I have decided, once again, to start up another project... This time it is going to be a virtual processor on the calc. The reason I decided to start this was to give beginners a safe way to play with assembly, get accustomed to hexadecimal and syntax, and to get them used to low level stuff. For that reason, I wanted some input about what instructions should be supported. I am using BatLib extensively, so I have access to some resources (like for reading/writing bytes and the emulated LCD and whatnot). At the moment, I have this stuff finished:
-The memory map consists of 4 memory banks of 256 bytes each (1024 bytes, total)
-There are 16 pages in all making a total of 4096 bytes of memory
-There is a PC register (functioning)
-There is an SP register (not used yet)
-There are registers a,b,c,d,e,h,l,f as in Z80 assembly
-I have loads all of the loads working in the form of ld reg8,reg8 where reg8 can be a,b,c,d,e,h,l, or (hl)
-There is an emulated LCD port that is 32x32
-There are four emulated ports for memory mapping
The emulated LCD port cannot be written to, yet (there isn't an in/out instruction), but here is how it works:
-Load a byte into the port (port 0). This is an MSB
-Load another byte and this becomes the LSB. At this point, the LCD "refreshes" using the MSB and LSB as an address in memory for where the LCD data is.
Unfortunately, a 32x32 screen means that half of a page is used up (128 bytes), but at least you don't have to write every byte of an image to a port
So anyway, here is what I plan to add soon:
add / adc
sub / sbc
and / xor
or / compare (really I didn't want to type "cp")
jr / jp / call / ret
ld (address),reg8 / ld reg8,(address)
ld reg8,immediate / (in/out/bit/extended/ex de,hl/ex sp,hl /ex pc,hl
push / pop
port 5- key port: write is the same as the actual key port, read is the same. The value refreshes after the next instruction finishes.
So does anybody have any suggestions or ideas?!
Here is a screeny, too. When you notice that I use these commands:
dim(14,Str2,0,15
dim(14,Str2,1,1
dim(14,Str2,2,49
dim(14,Str2,3,255
...
Str2 has the name of the hacked string and I am writing to the first few bytes 0F0131FFFFFFFFF...
That translates to:
ld b,(hl)
ld a,b
ld l,a
So the first time it was run, hl was 0, so it read byte 0 (0F) and stored it to b. Then it loaded b into a and then it loaded a into l. The next time it was run, hl was 000Fh and byte 15 was FFh, so FF was loaded into b, b into a, and a into l. The next time it was run, hl=00FFh and byte 255 was 00h, so 0 was loaded into b, then a, then l and it all starts all over again.
As a note, I could have just done 37h and it would have done ld l,(hl), but I needed an example