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/
Diff: VirtualRAM.h
- Revision:
- 1:e74530ad6b9e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VirtualRAM.h Wed May 13 18:39:01 2015 +0900 @@ -0,0 +1,37 @@ +// VirtualRAM.h 2015/4/29 +#pragma once +#define PAGE_CHUNK_SIZE 1024 +class VirtualRAM { +public: + int used_size; + VirtualRAM(): used_size(0) { + memset(mem_ptr, 0x00, sizeof(mem_ptr)); // NULL + } + uint8_t peek(uint16_t a) { + uint8_t* mem = ptr(a); + if (mem == NULL) { + return 0x00; + } + return mem[a % PAGE_CHUNK_SIZE]; + } + void poke(uint16_t a, uint8_t b) { + uint8_t* mem = ptr(a); + if (mem == NULL) { + mem = reinterpret_cast<uint8_t*>(malloc(PAGE_CHUNK_SIZE)); + MBED_ASSERT(mem != NULL); + mem_ptr[idx(a)] = mem; + used_size += PAGE_CHUNK_SIZE; + } + mem[a % PAGE_CHUNK_SIZE] = b; + } + +private: + uint8_t* ptr(uint16_t addr) { + return mem_ptr[idx(addr)]; + } + int idx(uint16_t addr) { + return addr / PAGE_CHUNK_SIZE; + } + uint8_t* mem_ptr[65536 / PAGE_CHUNK_SIZE]; +}; +