But a NOP would cause possible errors when trying to list the REM statements from what I gleaned above...and the HALT doesn't seem to impact the game since running in FAST doesn't work when that issue is fixed. But the little BASIC program to find the address worked pretty well in any case.
If NOPs replace the two $76 bytes at the start of a REM then they won't necessarily cause problems. The code for a NOP instruction is 0. The character displayed for a code of 0 is a space. So you'll simply end up with two spaces. But it will mean all the machine code after them will become visible and that could cause a lock up if the line is listed.
The approach you are taking of finding and correcting the call address is the best solution.
I tried to start this compiler once and the impressive thing maybe is, that it runs in BASIC (!)Fruitcake wrote: ↑Mon Mar 21, 2022 11:04 pm Aside from the original MCODER I, I'm also aware of another compiler for the ZX81. It was made by Silversoft but I don't have any direct experience of it so don't know how it compares. It's available online but sadly no instructions sheet for it:
I suspect MCODER II is superior, but perhaps someone else has used it and can comment on how it compares.
But sadly i never got to compile a program with it. Even a simple PRINT "HELLO WORLD" did not really work .. Maybe we should start a new thread trying to get it to run or finding someone, who actually has the Manual (?) also there is the Z99-Compiler, which i would like to try but there are literally no resources...
Back to MCODER II, i wrote my game especially in mind to run under MCODER II and after you understand the internals it works flawlessly (except this one crazy bug with printing chars rather than numbers fixed by Siggi). A simple tip of mine: If you want an Intro for your game, just compile the game itself and then deleting the basic code, to then append your intro in BASIC. Also some really neat idea is to simulate DATA READ and RESTORE by either using a complicated String method or to use REM Statements (but you need to know where this statement would lie in BASIC and even worse, you can't delete the BASIC Code).
So it was very possible back then to use MCODER II to create compiled code bigger than a few K and it actually was pretty straightforward. I was even more impressed with how it handled itself in multi-step compiles. A really well thought out program. Maybe one of the best on that platform IMHO.
I also briefly outline how to do it if you have 48K of memory (just highlighting what Fruitkake had shared with me). That mechanism is a whole lot simpler, obviously, but my goal was to see how it would have gone had I owned MCODER II myself as a kid and wanted to compile some of my own BASIC code. It definitely is very capable to do it in multiple steps.
One of the things I tried was compiling like half a dozen small modules in sequence (not in this video), and integrating them into one program (that was one attempt at a compiled Elite) and that also worked really well. So I could really see someone creating small routines in BASIC, compiling them, and then using them in other parts of the main program. All you had to do is organize yourself a bit at the start so you planned which module you'd compile first. I think that's what I really liked about the 1980's, you had to think about what you were doing when programming, even in BASIC. Today you can just try and see if it works and throw it out with little invested time. Obviously with emulators you can just max out the RAM and do it in a single compile, but not many folks likely had more than 16K of RAM back in the day.