commanderx16 / x16-rom

Other
153 stars 44 forks source link

Idea/wish: "ROM directory" #13

Open lgblgblgb opened 5 years ago

lgblgblgb commented 5 years ago

Just an idea ... As X16 seems to have more ROM pages in a 8K window, it can be expected that there can be custom ROM contents as well in the future, and also more and more stuffs in the "official ROM pack" as well.

Some 8 bit machines (I can mention the Z80 based Enterprise-128, but I guess Acorn systems as well - I am not sure about the second, but for example to stay with Commodore, the very rare Commodore LCD too ... though C-LCD has it as a menu, but this is not my point here for sure) there is way to list ROMs, also to use them easily, if there is an entry point for that.

My idea is to put some identifier string into ROMs which marks some kind of "ROM directory" with one or more entry points listed (a ROM can have multiple entries as well), with some short name to easy to refer them. So then, there can be even a BASIC token allocated to use a search+list routine to list those for the user without an argument, or with an argument, to give the control to that functionality.

In this way, some can have eg a menu based program loader, which can be quickly call that, without the need to first load it from disk. And maybe other usages as well, it would be nice.

The alternative of course, to know your system and use various SYS commands with the right parameter :) [I'm not sure if there is SYS btw, for paged ROM to also select which ROM "page" should be used to utilize the jump there - which would page out BASIC ...].

mist64 commented 5 years ago

Yes, every ROM page should have a common structure. I'm thinking a few bytes at the very end of the page.

lgblgblgb commented 5 years ago

Sounds cool, and btw, there can be (optional) init and startup points for each items, so KERNAL can even initialize each (by calling the startup init func), if ROMs provides entry point for "startup init" not only the "user call". I got this idea from my disassembling works on the Commodore LCD's kernal btw, and I like the approach since then :)

BruceMcF commented 5 years ago

After reviewing the PRG, it would appear that anywhere in $FFxx that is not used for interrupt handling by the processor is fair game for the Kernel jump table. So the simplest place to put a ROM signature is the top eight bytes of $FExx, $FFE8 to $FFEF. To allow using all eight for name, put a nul in trailing bytes of the name that are not used.

[Edit] Note, probably there should be a signature byte as part of this, so perhaps 7 bytes of name and $FFEF contains the signature byte. If you follow the instructions in the name of the CX16 ... that is, multiply "$C" times "$16" you get $108, and if you multiply $C times decimal 16, you get $C0, so perhaps $C8 for a signature byte.