Illegal opcodes emulation in simple emulator written in C
Illegal opcodes emulation in simple emulator written in C
Hello. I have forked this nice tool: https://github.com/LTVA1/siddump. In cpu.c I tried to add some illegal opcodes support (search by word "Lunatico"), but when I try to use the program on Lunatico sid files I don't get any SID registers writes but they should happen. This means that the 4 opcodes I tried to implement are done wrong. So I need help since I know almost nothing about 6502 internals and how illegal opcodes work.
Re: Illegal opcodes emulation in simple emulator written in
Welcome!
A quick look suggests that you'd need
WRITE(ABSOLUTE());
in some appropriate place(s).
A quick look suggests that you'd need
WRITE(ABSOLUTE());
in some appropriate place(s).
Re: Illegal opcodes emulation in simple emulator written in
BigEd wrote:
Welcome!
A quick look suggests that you'd need
WRITE(ABSOLUTE());
in some appropriate place(s).
A quick look suggests that you'd need
WRITE(ABSOLUTE());
in some appropriate place(s).
Re: Illegal opcodes emulation in simple emulator written in
Well, it does break. Maybe it won't be an easy fix, although I haven't found any C emulator with all illegal opcodes.
Re: Illegal opcodes emulation in simple emulator written in
Ok so I corrected program counter increments and now Lunatico sids actually write some data to SID registers, but it seems like the program is being stuck in short loop since after some time it starts to output repeating portions of nonsensical data (e.g. C-0 notes over and over again which isn't what the sid should play, obviously).
I updated code on github, and it's late now, so for today I won't do any further work on this.
P.S. Funny thing with this emulator is that is what actually writes to some memory location, while just does nothing.
The whole issue is basically because LFT made his custom sid player to fit in like ~15 rasterlines which is apparently implying some self-modifying code (?) and clever illegal opcodes hacks.
I updated code on github, and it's late now, so for today I won't do any further work on this.
P.S. Funny thing with this emulator is that
Code: Select all
MEM(ABSOLUTE()) = x;Code: Select all
WRITE(ABSOLUTE());The whole issue is basically because LFT made his custom sid player to fit in like ~15 rasterlines which is apparently implying some self-modifying code (?) and clever illegal opcodes hacks.
-
MicroCoreLabs
- Posts: 62
- Joined: 05 Oct 2017
Re: Illegal opcodes emulation in simple emulator written in
LTVA wrote:
Well, it does break. Maybe it won't be an easy fix, although I haven't found any C emulator with all illegal opcodes.
https://github.com/MicroCoreLabs/Projec ... /MCL64.ino
Re: Illegal opcodes emulation in simple emulator written in
I would probably check to see how good the emulation is of the instructions with https://github.com/Klaus2m5/6502_65C02_functional_tests and my cycle timing checker which includes undocumented instructions : https://github.com/dp111/6502Timing
Re: Illegal opcodes emulation in simple emulator written in
MicroCoreLabs wrote:
LTVA wrote:
Well, it does break. Maybe it won't be an easy fix, although I haven't found any C emulator with all illegal opcodes.
https://github.com/MicroCoreLabs/Projec ... /MCL64.ino
Re: Illegal opcodes emulation in simple emulator written in
dp11 wrote:
I would probably check to see how good the emulation is of the instructions with https://github.com/Klaus2m5/6502_65C02_functional_tests and my cycle timing checker which includes undocumented instructions : https://github.com/dp111/6502Timing
-
MicroCoreLabs
- Posts: 62
- Joined: 05 Oct 2017
Re: Illegal opcodes emulation in simple emulator written in
LTVA wrote:
MicroCoreLabs wrote:
LTVA wrote:
Well, it does break. Maybe it won't be an easy fix, although I haven't found any C emulator with all illegal opcodes.
https://github.com/MicroCoreLabs/Projec ... /MCL64.ino
Re: Illegal opcodes emulation in simple emulator written in
MicroCoreLabs wrote:
LTVA wrote:
MicroCoreLabs wrote:
LTVA wrote:
Well, it does break. Maybe it won't be an easy fix, although I haven't found any C emulator with all illegal opcodes.
https://github.com/MicroCoreLabs/Projec ... /MCL64.ino
Re: Illegal opcodes emulation in simple emulator written in
okay so... I could not adapt it, it just hangs on some instruction forever!
https://github.com/LTVA1/siddump/tree/broken
https://github.com/LTVA1/siddump/tree/broken
Re: Illegal opcodes emulation in simple emulator written in
MicroCoreLabs wrote:
LTVA wrote:
MicroCoreLabs wrote:
LTVA wrote:
Well, it does break. Maybe it won't be an easy fix, although I haven't found any C emulator with all illegal opcodes.
https://github.com/MicroCoreLabs/Projec ... /MCL64.ino