Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undocumented Opcode Build Option #133

Open
wants to merge 10 commits into
base: v2.1
Choose a base branch
from

Conversation

lfantoniosi
Copy link

@lfantoniosi lfantoniosi commented Nov 5, 2023

Allow to build nextor and drives without undocumented op-codes to allow it to run in Z180 machines like Victor HC-95.

  • some code had to be conditionally relocated (DRV.MAC) due to the extra instructions causing code overlap
  • a JR had to be changed to JP
  • START label conflicting with macros.inc

Related discussion: https://www.msx.org/forum/msx-talk/development/i-made-an-undoc-op-free-nextor-build

Tang driver for WonderTANG cartridge: https://github.com/lfantoniosi/WonderTANG

@Konamiman
Copy link
Owner

Hi @lfantoniosi, thanks for your contribution. I'd like to request some changes, please:

  1. Move the addition of the WonderTANG cartridge driver to a separate pull request, to keep this one focused in the undocumented-opcode-free-build feature exclusively.
  2. Create a separate macro for each instruction, make the macro names lowercase, and remove the comment indicating the replaced instruction. This will increase the number of macros but will also make the code more readable. So e.g. instead of LD_N_IYH a ;ld a,iyh it would be simply ld_a_iyh, and the same for the other register combinations.
  3. The code that is relocated in drv.mac can't go into 7BD0h, since as the comment in the preceding line says, "Here goes the 1K free area at the end of banks 0 and 3". An alternative could be the following (I haven't tested these changes so please double check):

3.1. Move the IS_EMU routine to immediately before the ALIGN 7850h line, and use HL instead of IY to make the code shorter:

IS_EMU:
	push	hl
	ld	hl,(DVB_TABLE##)
	bit	7,(hl)
	pop	hl
	scf
	ret	nz
	ccf
	ret

3.2. Change the usage of the two macros that replace ld a,iyh - or iyl to the following (saves four consecutive ex (sp) instructions), you can do this too in other places where there are two consecutive undocumented instructions:

	ifdef DISABLE_UNDOCUMENTED_OPCODES

ex (sp),iy
ex (sp),hl
	ld a,h
	or l
ex (sp),hl
ex (sp),iy

	else

	ld a,iyh
	or iyl

	endif
  1. The "How to build Nextor" section of the README.md file should mention the new opcode-free build option. I can add this myself if you want.

Please ping me once you have addresses these changes.

@Konamiman
Copy link
Owner

Hi @lfantoniosi, another thing I just noticed: your pull request includes changes in the MAPDRV tool too, thus the modification in the Makefile to accept the ASSEMBLE_SYMBOLS variable should be implemented in the source/tools/Makefile file as well.

@lfantoniosi
Copy link
Author

lfantoniosi commented Nov 20, 2023 via email

@lfantoniosi
Copy link
Author

Hi @lfantoniosi, another thing I just noticed: your pull request includes changes in the MAPDRV tool too, thus the modification in the Makefile to accept the ASSEMBLE_SYMBOLS variable should be implemented in the source/tools/Makefile file as well.

Check my last commit: 26782a9 thxs

@Konamiman
Copy link
Owner

hi, but there are few
ld iyl,1
how the macro should be in this case ?

In that particular case, yes, a ld_iyl_n macro is fine. But for loading registers, one dedicated macro per register is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants