/RESET wrote:
Great!
Now as hardware wise things got aligned and clarified, let's check the toolchain.
Example Assembly:
Code:
================ test.asm ==================
!cpu 65816
!to "test.o", plain
* = $800
.start LDA #'W' ; write "WDC" under ROM 00:E000
STA $01e000
LDA #'D'
STA $01e001
LDA #'C'
STA $01e002
RTS
That's not what you want to do.
Instead, what you want to do is store 'WDC' at 00:0800. Then, at 00:0804, you have code to start things up. The monitor looks for WDC at 00:8000 and 00:0800, then jump to **04 (as appropriate) if it finds it.
A simple example, is you could have a large program/dataset that consumes all (most) 64K of RAM. (it doesn't have to be large, just have segment that go to where the ROM is.)
You then load that via the monitor using S28 records, in to Bank 01. This lets you load all of it (notably the stuff that lives behind the ROM). The minor trick here is convincing your assembler/linker to let you build the code as if it's in Bank 0, but create the memory image (and thus the S28 records) as if it's in Bank 1.
Now, part of you start up code will be setting the proper control registers to disable the ROM, then you can jump in to that behind the ROM code and show that it works.
The other alternative, is to convince the MCU that the internal ROM doesn't exist at all. But out of the box, on the QXB, I don't think you can do that. Your BE line is tied high on the board, whereas on the SXB board, BE is tied high AND it is run out to an expansion header, and you could tie in to that there. It seems, though, if you had two buttons -- one for RESB and one for BE, if you held them both "down", driving them both low, if you let up the RESB button first, and then the BE button, it will boot to the external ROM. If you just press the RESB button, it'll boot to the internal ROM. There doesn't seem to be any time requirement between when RESB goes high and BE goes high. Just that they both need to go high for the system to reset. If RESB goes high after BE, it uses the internal bits. If RESB goes hight before BE, it boots externally. Obviously for a permanent project, you'd need the reset circuit to handle the timings of the two signals.
But, anyway, loading stuff in to Bank 1, and leveraging the WDC signatures at 00:8000 or 00:0800 will let you blame with swapping the ROM in and out.
You can do a simple test to have a simple program behind the ROM that lights up the LEDs, that way you won't have to figure out how to bootstrap the services that the monitor provides.
The two button trick makes testing a ROM pretty easy, I think. If the your "ROM" works, it works! If not, just hit RESB and you're back to the monitor ready to try again. In contrast, if your WDC code fails, you have to make sure you lose the signature in memory somehow to restart the machine back to the monitor. This may mean keeping the machine powered down for several seconds for the RAM to lose it's contents.