DMG CPU B (z80-pretender in gameboys)

Feel like posting Off Topic? Do it here.

Moderator: MaxCoderz Staff

Post Reply
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

DMG CPU B (z80-pretender in gameboys)

Post by King Harold »

This might be useful to those who program for it:

There are some operations that I might like on my TI 84p, but I don't really like the missing registers.. This also shows why I/O is memory mapped..

Code: Select all

* The "shadow" set of registers [BC',DE',HL',AF'] and the index registers
  [IX,IY] are missing and, consequently, there are no DD and FD opcode
tables.

* The I/O ports are gone and so are all IN/OUT opcodes.

* HALT is interrupted even when interrupts are disabled.

* Following Z80 opcodes are changed:
---------------------------------------------------------------------------
Code       Z80 operation  GameBoy operation
---------------------------------------------------------------------------
08 xx xx   EX AF,AF'      LD (word),SP     Save SP at given address
10 xx      DJNZ offset    STOP             Meaning unknown
22         LD (word),HL   LD (HLI),A       Save A at (HL) and increment HL
2A         LD HL,(word)   LD A,(HLI)       Load A from (HL) and increment HL
32         LD (word),A    LD (HLD),A       Save A at (HL) and decrement HL
3A         LD A,(word)    LD A,(HLD)       Load A from (HL) and decrement HL
D3         OUTA (byte)    No operation
D9         EXX            RETI             Enable interrupts and return
DB         INA (byte)     No operation
DD         Prefix DD      No operation
E0 xx      RET PO         LD (byte),A      Save A at (FF00+byte)
E2         JP PO,word     LD (C),A         Save A at (FF00+C)
E3         EX HL,(SP)     No operation
E4         CALL PO,word   No operation
E8 xx      RET PE         ADD SP,offset    Add signed offset to SP
EA xx xx   JP PE,word     LD (word),A      Save A at given address
EB         EX DE,HL       No operation
EC         CALL PE,word   No operation
F0 xx      RET P          LD A,(byte)      Load A from (FF00+byte)
F2         JP P,word      No operation
F4         CALL P,word    No operation
F8 xx      RET M          LDHL SP,offset   Load HL with SP + signed offset
FA xx xx   JP M,word      LD A,(word)      Load A from given address
FC         CALL M,word    No operation
FD         Prefix FD      No operation

Conclusions: the Sign and P/V flags are not used, they are instead weird loads. You can not load HL to memory location (not from one), and you cannot EX DE,HL it either, but you can use HL to load to/from memory anyway (using normal block loads and the new load-and-inc/dec instructions). You can on this processor pretend to load to/from a 8bit location, this sortof partly replaces the use of IX and IY since it is actually an offset added to FF00h.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

I'm still not sure why it's referred to as a Z80. The Z80 added the shadow registers and index registers to the 8080 - so to me it looks like it should be called an 8080 clone, not a Z80 clone. Maybe it's just riding on the popularity of the Z80.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

Probably, I'm just repeating what other ppl say lol :)
I have a tiny little problem though: how can I get anything on those gameboy storage things? there's got to be something for it that you can connect your computer..
Ben probably has something for it, don't you Ben?
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

I don't, I only have a Game Gear one (from ToToTEK - they don't seem to do a Game Boy one).

They do seem to exist, but I can't recommend any nor any sites. It might be a good idea to find a GB developer's forum and ask the members there.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

You mean a flash cart? Well i did a tiny bit of googling and found some info:

http://www.reinerziegler.de/readplus.htm#Bung carts
http://www.devrs.com/gb/hardware.php
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

Wow thanx, I didn't even know what to look for
Post Reply