[Feature Request] Add special eReader Z80 Mode
- Dominant language
- C++
- Stars
- 1.6k
- Forks
- 193
- Avg merge
- 20h 32m
- Merged PRs (30d)
- 29
Description
I know this is a lot of effort listed below but mainly I'm curious if its something that would even be considered. I thought about just making my own assembler but its such a daunting task when something already exists that's 98% of the way there. Feel free to just close this if it doesn't make sense.
rgbds is surprisingly useful for developing and reverse engineering eReader Z80 applications but there are a few hurdles that must be hacked around. The addition of a flag like `-ereader` along with the following changes would be a huge boost to productivity and code cleanliness.
## Opcodes supported by eReader but missing from gb
https://github.com/FexCollects/pokecarde/blob/master/macros.asm#L4
* Load Indirect HL: `ld [nn], hl`
* Load HL Indirect: `ld hl, [nn]`
* Load Indirect HL A: `ld [hl], a`
* Load Indirect HL B: `ld [hl], b`
* Load Indirect HL C: `ld [hl], c`
* Load A Indirect: `ld a, [nn]`
* Load A Indirect DE: `ld a, [de]`
* Load Indirect A: `ld [nn], a`
* Load A Indirect HL: `ld a, [hl]`
* Load B Indirect HL: `ld b, [hl]`
* Load C Indirect HL: `ld c, [hl]`
* Load D Indirect HL: `ld d, [hl]`
* Load E Indirect HL: `ld e, [hl]`
* Load L Indirect HL: `ld l, [hl]`
* Add A Indirect HL: `add a, [hl]`
* Exchange DE HL: `ex de, hl`
## Opcdoes not supported by eReader but present in gb (should be an error)
* https://ereader.miraheze.org/wiki/Z80_Emulator_Limitations
* https://problemkaputt.de/gbatek-gba-cart-e-reader-program-code.htm (Under `Z80/8080 Format`)
## Nice way to extract just the machine code
While the first two items are significantly more important, it would be really nice if there was a way to dump just the assembled machine code. Right now a lot of effort is put into stripping out all the gbc stuff added.
Contributor guide
Research direction
Start by reviewing the linked eReader opcode references and the existing `gb` instruction handling; the issue does not name specific source files or tests. Clarify the scope of `-ereader`, including accepted and rejected opcodes and the machine-code dump, then define tests that demonstrate each requested behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100