[emulation] hardware emulation trouble?
Moderator: MaxCoderz Staff
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
[emulation] hardware emulation trouble?
Ok, so I wrote my own z80 core (everyone does that) and it seems to work alright, but the TI OS doesn't get very far which probably means that I'm emulating some hardware part incorrectly.. (it does not even turn the LCD on, the LCD works at least a bit though - tested with a custom rom, sometimes it makes some garbage, but TIOS leaves it disabled/off)
Could someone list some common pitfalls?
thanks
Could someone list some common pitfalls?
thanks
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
My biggest problems were getting the timer interrupts right (which I never did, the TIOS keeps locking up).
The first (and easiest) thing to check would be that your Z80 core works properly, before looking at more specific (and complicated) hardware issues.
SMS Power! have a version of ZEXALL (down at the bottom - ZEXALL is rather a misnomer, it's more like ZEXDOC as it only tests documented flags) that can output to an SDSC console. You can implement a very primitive SDSC console for testing, and simply emulate all memory as 64KB of RAM. I used this to develop my core, and it proved invaluable!
The first (and easiest) thing to check would be that your Z80 core works properly, before looking at more specific (and complicated) hardware issues.
SMS Power! have a version of ZEXALL (down at the bottom - ZEXALL is rather a misnomer, it's more like ZEXDOC as it only tests documented flags) that can output to an SDSC console. You can implement a very primitive SDSC console for testing, and simply emulate all memory as 64KB of RAM. I used this to develop my core, and it proved invaluable!
An accurate core was our last barrier I think. TIOS relies heavily on the bit operations on index registers, once those were fixed it wasn't a problem. It's never satisfying to code for index registers. I can't think of a way to handle index registers in a z80 core that doesn't feel like a hack.
The minimal set of hardware for TIOS is pretty small. IM 1 and related ports, memory controller, link port, and LCD. I might have forgot some.
http://svn.revsoft.org/wabbitemu/source ... re/83phw.c
(the tabs don't look too great in a browser)
The minimal set of hardware for TIOS is pretty small. IM 1 and related ports, memory controller, link port, and LCD. I might have forgot some.
http://svn.revsoft.org/wabbitemu/source ... re/83phw.c
(the tabs don't look too great in a browser)
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
My index-regs also feel like a hack.. I use HL's property to switch it to IX or IY when those flags are true.
So I guess I'll debug my bit operations on index registers
And the link port, since I forgot that/left it out, maybe that's why it keeps looping.... (it's also showing execution in the 0x6XXX range, is that normal?)
Thank you too Spencer
So I guess I'll debug my bit operations on index registers
And the link port, since I forgot that/left it out, maybe that's why it keeps looping.... (it's also showing execution in the 0x6XXX range, is that normal?)
Thank you too Spencer
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
- Jim e
- Calc King
- Posts: 2457
- Joined: Sun 26 Dec, 2004 5:27 am
- Location: SXIOPO = Infinite lives for both players
- Contact:
What are you emulating, 83, 83+, SEs?
For the 83+:
The link port can will work with a register that returns an inverted value of what was written.
The key port can get away with 0xFF
Status can read 0x3B.
Port 3 just needs to be a register as bare minimum. As long as interrupts occur at a steady rate.
Port 4 needs to handle boot mapping. Frequency and what triggered an interrupt not required for TI-OS. ON key being pressed must be emulated.
Port 6 & 7 need to handle memory mapping.
LCD is optional, but you kinda need it to see.
Thats all thats needed to get ti-os running. If I remember correctly, the last big bug we had before ti-os ran as expected was that we forgot to emulate "DI". Out of all the instructions thats the one that we missed.
For the 83+:
The link port can will work with a register that returns an inverted value of what was written.
The key port can get away with 0xFF
Status can read 0x3B.
Port 3 just needs to be a register as bare minimum. As long as interrupts occur at a steady rate.
Port 4 needs to handle boot mapping. Frequency and what triggered an interrupt not required for TI-OS. ON key being pressed must be emulated.
Port 6 & 7 need to handle memory mapping.
LCD is optional, but you kinda need it to see.
Thats all thats needed to get ti-os running. If I remember correctly, the last big bug we had before ti-os ran as expected was that we forgot to emulate "DI". Out of all the instructions thats the one that we missed.
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
My emulator had problems with ld bc,(nnnn) and ld (nnnn),bc having an incorrect address, and that made the TIOS (rightfully!) fail.
You may want to try the Bubble Bobble ROM to see if that works. (This is a TI83 OS, but the ports look like they should match up)
You may want to try the Bubble Bobble ROM to see if that works. (This is a TI83 OS, but the ports look like they should match up)
You know your hexadecimal output routine is broken when it displays the character 'G'.
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
Code: Select all
0092 005E ;clear memory
0093 005E 21 00 80 ld hl,$8000
0094 0061 11 01 80 ld de,$8001
0095 0064 36 00 ld (hl),0
0096 0066 01 FF 7F ld bc,$7FFF
0097 0069 ED B0 ldir
0098 006B ;copy appended program
0099 006B 11 27 93 ld de,$9327
0100 006E 21 BB 00 ld hl,end
0101 0071 01 00 6C ld bc,$6C00
0102 0074 ED B0 ldir
You know your hexadecimal output routine is broken when it displays the character 'G'.