Q40 - Making ROM images into LRESPR binaries
Posted: Tue Oct 31, 2023 10:03 pm
Hi guys,
I'm new to this forum and a complete noob at QL/SMS, so please bare with me.
I bought my Q40 about 20 something years ago, with a view to using it as a development machine for a software development system I was writing.
The project, despite getting to a demonstrable state and even having a meeting with Sir Clive himself, I failed to capture the interest of anyone willing to support me.
Just recently, I have decided to revive the project, this time targetting the growing microcontroller / robotics education sector. Though my intended goals include ESP32, RP2040 and RISC-V boards, I thought it might be fun (I must be mad) / useful to also include my Q40. The software system is being written to run on RTOS, so my first challenge is to get RTOS working on the bare metal of the Q40 hardware.
In order to do this, I need to create 68000 ROM images (which I have achieved). The next challenge is to create images that can be tested without having to burn EPROMS.
I know that new ROMs can be loaded into RAM and switched to LOWRAM mode, and that these images are loaded using the LRESPR function from BASIC.
From what I understand, LRESPR loads the file and then just calls the address at which is was loaded.
So, how does this work with ROM images that start with a vector table? There must be some additional code that:
1. turns off interrupts
2. copies the ROM image into the shadow RAM
3. switched the machine into LOWRAM mode
4. and finally calls a soft reset.
My question is: can I get this code anywhere? I have tried disassembling other SMS ROM images (most of which start with invalid op codes... how does that work), looking for a header block that I can strip off and attach to my ROM images.
Many thanks, Nick
Oh.... and many thanks to Derek, who has already helped me a great deal via e-mail and pointed me to this forum.
I'm new to this forum and a complete noob at QL/SMS, so please bare with me.
I bought my Q40 about 20 something years ago, with a view to using it as a development machine for a software development system I was writing.
The project, despite getting to a demonstrable state and even having a meeting with Sir Clive himself, I failed to capture the interest of anyone willing to support me.
Just recently, I have decided to revive the project, this time targetting the growing microcontroller / robotics education sector. Though my intended goals include ESP32, RP2040 and RISC-V boards, I thought it might be fun (I must be mad) / useful to also include my Q40. The software system is being written to run on RTOS, so my first challenge is to get RTOS working on the bare metal of the Q40 hardware.
In order to do this, I need to create 68000 ROM images (which I have achieved). The next challenge is to create images that can be tested without having to burn EPROMS.
I know that new ROMs can be loaded into RAM and switched to LOWRAM mode, and that these images are loaded using the LRESPR function from BASIC.
From what I understand, LRESPR loads the file and then just calls the address at which is was loaded.
So, how does this work with ROM images that start with a vector table? There must be some additional code that:
1. turns off interrupts
2. copies the ROM image into the shadow RAM
3. switched the machine into LOWRAM mode
4. and finally calls a soft reset.
My question is: can I get this code anywhere? I have tried disassembling other SMS ROM images (most of which start with invalid op codes... how does that work), looking for a header block that I can strip off and attach to my ROM images.
Many thanks, Nick
Oh.... and many thanks to Derek, who has already helped me a great deal via e-mail and pointed me to this forum.