IPS(Interpreter for Process Structures) for mbed
Dependencies: ConfigFile FATFileSystem mbed
IPS port from linux/unix version.
mbed_blinky.ips
0 VAR led1 " LED1 " DigitalOut led1 ! : main ANFANG 1 JA? 1 led1 @ write 200 wait_ms 0 led1 @ write 200 wait_ms DANN/NOCHMAL ; main
- ips-02.tgz - ips for linux/unix
- ipsdoc.zip - document
- https://bitbucket.org/va009039/ips/
BaseIPS.h@4:b62b40563944, 2015-05-24 (annotated)
- Committer:
- va009039
- Date:
- Sun May 24 21:29:48 2015 +0900
- Revision:
- 4:b62b40563944
- Parent:
- 2:908338b1151a
fix I2C
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 |
2:908338b1151a | 1 | // BaseIPS.h 2015/5/22 |
va009039 |
1:e74530ad6b9e | 2 | #pragma once |
va009039 |
1:e74530ad6b9e | 3 | |
va009039 |
1:e74530ad6b9e | 4 | /* data types */ |
va009039 |
1:e74530ad6b9e | 5 | typedef unsigned char u8; |
va009039 |
1:e74530ad6b9e | 6 | typedef unsigned short u16; |
va009039 |
1:e74530ad6b9e | 7 | typedef signed short s16; |
va009039 |
1:e74530ad6b9e | 8 | typedef unsigned long u32; |
va009039 |
1:e74530ad6b9e | 9 | typedef unsigned char byte; |
va009039 |
1:e74530ad6b9e | 10 | |
va009039 |
1:e74530ad6b9e | 11 | /* some variables of IPS also need to be accessed by the emulator; here are their addresses: */ |
va009039 |
1:e74530ad6b9e | 12 | #define READYFLAG 0x42e |
va009039 |
1:e74530ad6b9e | 13 | #define LOADFLAG 0x43b |
va009039 |
1:e74530ad6b9e | 14 | #define UHR 0x418 |
va009039 |
1:e74530ad6b9e | 15 | #define SU0 0x41e |
va009039 |
1:e74530ad6b9e | 16 | #define SU1 0x422 |
va009039 |
1:e74530ad6b9e | 17 | #define SU2 0x426 |
va009039 |
1:e74530ad6b9e | 18 | #define SU3 0x42a |
va009039 |
1:e74530ad6b9e | 19 | #define a_PE 0x42f |
va009039 |
1:e74530ad6b9e | 20 | #define a_PI 0x431 |
va009039 |
1:e74530ad6b9e | 21 | #define a_P1 0x433 |
va009039 |
1:e74530ad6b9e | 22 | #define a_P2 0x435 |
va009039 |
1:e74530ad6b9e | 23 | #define a_P3 0x437 |
va009039 |
1:e74530ad6b9e | 24 | #define a_NDptr 0x43e |
va009039 |
1:e74530ad6b9e | 25 | #define a_Os 0x43c |
va009039 |
1:e74530ad6b9e | 26 | |
va009039 |
1:e74530ad6b9e | 27 | #define TVE 1023 |
va009039 |
1:e74530ad6b9e | 28 | |
va009039 |
1:e74530ad6b9e | 29 | class BaseIPS { |
va009039 |
1:e74530ad6b9e | 30 | public: |
va009039 |
1:e74530ad6b9e | 31 | BaseIPS(); |
va009039 |
1:e74530ad6b9e | 32 | void emulator(); |
va009039 |
1:e74530ad6b9e | 33 | void load_image(const u8* image, int size); |
va009039 |
1:e74530ad6b9e | 34 | void command(const char* s); |
va009039 |
1:e74530ad6b9e | 35 | |
va009039 |
2:908338b1151a | 36 | void push_ps(u16 w); |
va009039 |
2:908338b1151a | 37 | u16 pull_ps(); |
va009039 |
2:908338b1151a | 38 | virtual uint8_t mem_peek(uint16_t a) = 0; |
va009039 |
2:908338b1151a | 39 | virtual void mem_poke(uint16_t a, uint8_t b) = 0; |
va009039 |
2:908338b1151a | 40 | |
va009039 |
2:908338b1151a | 41 | uint8_t peekB(u16 a) { return mem_peek(a); } |
va009039 |
2:908338b1151a | 42 | void pokeB(uint16_t a, uint8_t b) { mem_poke(a, b); } |
va009039 |
2:908338b1151a | 43 | |
va009039 |
1:e74530ad6b9e | 44 | protected: |
va009039 |
1:e74530ad6b9e | 45 | void poke(u16 a, u16 w); |
va009039 |
1:e74530ad6b9e | 46 | u16 peek(u16 a); |
va009039 |
1:e74530ad6b9e | 47 | virtual void do_io() = 0; |
va009039 |
1:e74530ad6b9e | 48 | virtual bool test_20ms() { return false; } |
va009039 |
1:e74530ad6b9e | 49 | virtual void* file_open(const char* filename, const char* mode = "rb") { return NULL; } |
va009039 |
1:e74530ad6b9e | 50 | virtual int file_getc(void* handle) { return -1; } |
va009039 |
1:e74530ad6b9e | 51 | virtual void file_putc(int c, void* handle) {} |
va009039 |
1:e74530ad6b9e | 52 | virtual bool file_close(void* handle) { return false; } |
va009039 |
1:e74530ad6b9e | 53 | virtual void trace(u32 cycle, u16 ppc, u16 hp, u16 cpc, u16 ps, u16 rs) {} |
va009039 |
2:908338b1151a | 54 | virtual void usercode(uint16_t cpc) = 0; |
va009039 |
1:e74530ad6b9e | 55 | int input_ptr; |
va009039 |
1:e74530ad6b9e | 56 | |
va009039 |
1:e74530ad6b9e | 57 | private: |
va009039 |
1:e74530ad6b9e | 58 | u32 peek32(u16 a); |
va009039 |
1:e74530ad6b9e | 59 | u16 PPC, HP, PS, RS; |
va009039 |
1:e74530ad6b9e | 60 | u32 cycle; |
va009039 |
1:e74530ad6b9e | 61 | int depth; |
va009039 |
1:e74530ad6b9e | 62 | int redraw; |
va009039 |
1:e74530ad6b9e | 63 | int idle; |
va009039 |
1:e74530ad6b9e | 64 | void push_rs(u16 w); |
va009039 |
1:e74530ad6b9e | 65 | u16 pull_rs(); |
va009039 |
1:e74530ad6b9e | 66 | void* inputfile; |
va009039 |
1:e74530ad6b9e | 67 | void do_20ms(); |
va009039 |
1:e74530ad6b9e | 68 | void read_inputfile(void); |
va009039 |
1:e74530ad6b9e | 69 | |
va009039 |
1:e74530ad6b9e | 70 | void c_rumpelstilzchen(void); // 0 |
va009039 |
1:e74530ad6b9e | 71 | void c_defex(void); // 1 |
va009039 |
1:e74530ad6b9e | 72 | void c_consex(void); // 2 |
va009039 |
1:e74530ad6b9e | 73 | void c_varex(void); // 3 |
va009039 |
1:e74530ad6b9e | 74 | void c_retex(void); // 4 |
va009039 |
1:e74530ad6b9e | 75 | void c_get(void); // 5 |
va009039 |
1:e74530ad6b9e | 76 | void c_getB(void); // 6 |
va009039 |
2:908338b1151a | 77 | void c_put(void); // 7 |
va009039 |
2:908338b1151a | 78 | void c_putB(void); // 8 |
va009039 |
1:e74530ad6b9e | 79 | void c_1bliteral(void); // 9 |
va009039 |
1:e74530ad6b9e | 80 | void c_2bliteral(void); // 10 |
va009039 |
1:e74530ad6b9e | 81 | void c_bronz(void); // 11 |
va009039 |
1:e74530ad6b9e | 82 | void c_jump(void); // 12 |
va009039 |
1:e74530ad6b9e | 83 | void c_weg(void); // 13 |
va009039 |
1:e74530ad6b9e | 84 | void c_pweg(void); // 14 |
va009039 |
1:e74530ad6b9e | 85 | void c_plus(void); // 15 |
va009039 |
1:e74530ad6b9e | 86 | void c_minus(void); // 16 |
va009039 |
1:e74530ad6b9e | 87 | void c_dup(void); // 17 |
va009039 |
1:e74530ad6b9e | 88 | void c_pdup(void); // 18 |
va009039 |
1:e74530ad6b9e | 89 | void c_vert(void); // 19 |
va009039 |
1:e74530ad6b9e | 90 | void c_zwo(void); // 20 |
va009039 |
1:e74530ad6b9e | 91 | void c_rdu(void); // 21 |
va009039 |
1:e74530ad6b9e | 92 | void c_rdo(void); // 22 |
va009039 |
1:e74530ad6b9e | 93 | void c_index(void); // 23 |
va009039 |
1:e74530ad6b9e | 94 | void c_s_to_r(void); // 24 |
va009039 |
1:e74530ad6b9e | 95 | void c_r_to_s(void); // 25 |
va009039 |
1:e74530ad6b9e | 96 | void c_eqz(void); // 26 |
va009039 |
1:e74530ad6b9e | 97 | void c_gz(void); // 27 |
va009039 |
1:e74530ad6b9e | 98 | void c_lz(void); // 28 |
va009039 |
1:e74530ad6b9e | 99 | void c_geu(void); // 29 |
va009039 |
1:e74530ad6b9e | 100 | void c_f_vergl(void); // 30 |
va009039 |
1:e74530ad6b9e | 101 | void c_nicht(void); // 31 |
va009039 |
1:e74530ad6b9e | 102 | void c_und(void); // 32 |
va009039 |
1:e74530ad6b9e | 103 | void c_oder(void); // 33 |
va009039 |
1:e74530ad6b9e | 104 | void c_exo(void); // 34 |
va009039 |
1:e74530ad6b9e | 105 | void c_bit(void); // 35 |
va009039 |
1:e74530ad6b9e | 106 | void c_cbit(void); // 36 |
va009039 |
1:e74530ad6b9e | 107 | void c_sbit(void); // 37 |
va009039 |
1:e74530ad6b9e | 108 | void c_tbit(void); // 38 |
va009039 |
1:e74530ad6b9e | 109 | void loop_sharedcode(int i); |
va009039 |
2:908338b1151a | 110 | void c_jeex(void); // 39 |
va009039 |
1:e74530ad6b9e | 111 | void c_loopex(void); // 40 |
va009039 |
1:e74530ad6b9e | 112 | void c_plusloopex(void); // 41 |
va009039 |
1:e74530ad6b9e | 113 | void c_fieldtrans(void); // 42 |
va009039 |
1:e74530ad6b9e | 114 | void c_pmul(void); // 43 |
va009039 |
1:e74530ad6b9e | 115 | void c_pdiv(void); // 44 |
va009039 |
1:e74530ad6b9e | 116 | void c_tue(void); // 45 |
va009039 |
1:e74530ad6b9e | 117 | void c_polyname(void); // 46 |
va009039 |
1:e74530ad6b9e | 118 | void c_scode(void); // 47 |
va009039 |
1:e74530ad6b9e | 119 | void c_cscan(void); // 48 |
va009039 |
1:e74530ad6b9e | 120 | void c_chs(void); // 49 |
va009039 |
1:e74530ad6b9e | 121 | void c_cyc2(void); // 50 |
va009039 |
1:e74530ad6b9e | 122 | void c_close(void); // 51 |
va009039 |
1:e74530ad6b9e | 123 | void c_open(void); // 52 |
va009039 |
2:908338b1151a | 124 | void c_oscli(void); // 53 |
va009039 |
1:e74530ad6b9e | 125 | void c_load(void); // 54 |
va009039 |
1:e74530ad6b9e | 126 | void c_save(void); // 55 |
va009039 |
1:e74530ad6b9e | 127 | void c_setkbptr(void); // 56 |
va009039 |
1:e74530ad6b9e | 128 | void c_getPS(void); // 57 |
va009039 |
1:e74530ad6b9e | 129 | void c_setPS(void); // 58 |
va009039 |
1:e74530ad6b9e | 130 | void c_rp_code(void); // 59 |
va009039 |
1:e74530ad6b9e | 131 | void c_tr_code(void); // 60 |
va009039 |
1:e74530ad6b9e | 132 | void c_swap3(void); // 61 |
va009039 |
1:e74530ad6b9e | 133 | void c_defchar(void); // 62 |
va009039 |
1:e74530ad6b9e | 134 | void c_pplus(void); // 63 |
va009039 |
1:e74530ad6b9e | 135 | void c_pminus(void); // 64 |
va009039 |
1:e74530ad6b9e | 136 | }; |
va009039 |
1:e74530ad6b9e | 137 | |
va009039 |
1:e74530ad6b9e | 138 | |
va009039 |
2:908338b1151a | 139 |