:UK => Emulators => Topic started by: Prodatron on 2014.December.18. 18:31:34
Title: Stackpointer-Bug in EP128EMU?
Post by: Prodatron on 2014.December.18. 18:31:34
I have a strange behaviour in EP128Emu. When I unlock the interrupts with EI after there is already an IRQ the following happens: - the next command after EI will be executed; this is correct - new #38 is called, which is correct, too - BUT: instead of having the address of the next command on the stack I have this address increased by 1
Example:
#1000: EI #1001: LD BC,#1006 #1004: PUSH BC #1005: JP (HL) #1006: ... The IRQ happens between LD BC,#1234 and PUSH BC. The return address in the Stack should be #1004 now. But it is #1005. PUSH BC is just skipped, when the IRQ returns :eek: When I add a NOP after the LD BC,#1006 it works...
Title: Re: Stackpointer-Bug in EP128EMU?
Post by: IstvanV on 2014.December.18. 21:05:21
Can you post a snapshot that reproduces this issue ?
Title: Re: Stackpointer-Bug in EP128EMU?
Post by: IstvanV on 2014.December.21. 12:06:26
I tried to reproduce the problem with this code entered in the monitor while IS-BASIC was running:
Code: ZiLOG Z80 Assembler
A 0FF0 F3 DI
A 0FF1 31 F0 0F LDSP, 0FF0
A 0FF4 21 00 00 LDHL, 0000
A 0FF7 2B DECHL
A 0FF8 7D LDA, L
A 0FF9 B4 ORH
A 0FFA C2 F7 0F JP NZ, 0FF7
A 0FFD 21 F0 0F LDHL, 0FF0
A 1000 FB EI
A 1001 01 06 10 LDBC, 1006
A 1004 C5 PUSHBC
A 1005 E9 JP(HL)
However, after setting a 0038x breakpoint and starting the code with G FF0, the return address on the stack was always 1004h. I do not know exactly what conditions could trigger the bug, but it cannot be common, because something basic like this being broken would otherwise cause a lot of crashes.
Title: Re: Stackpointer-Bug in EP128EMU?
Post by: Prodatron on 2014.December.21. 16:43:43
Absolutely strange, now it doesn't happen anymore. Now I could remove the NOP command and it doesn't crash, it works again as it should. You are right, if there would be a general bug it would crash much more often. Next time (if there is a next time at all...) I will make a snapshot at once. Anyway thanks a lot for your investigation! (and for this great emulator, I really love it!)