There are a couple of things you should keep in mind when making your A500 demos to make them run on other Amigas. Off the top of my head:
1. Chipset state: The AGA chipset contains a number of control registers which change the behavior of existing OCS/ECS features. Since the OS uses these new features (unless you select on older chip set in the boot menu), some of these registers could be in a "bad" state when your intro starts.
You are usually home free if you include these three commands in your copper list (in addition to the setup for all OCS registers):
dc.l $01060000 ; Color register bank, black border, sprite resolution
dc.l $010c0011 ; Color remapping, sprite palette
dc.l $01fc0000 ; Fetch mode, bitplane/sprite scandoubling
2. CPU caches: If you use any kind of self-modifying code (writing code to memory, then executing it), you need to either:
- Flush caches between the write and the execute. CacheClearU (offset -636 in Exec, only present on KS 2.04+) does the trick.
- Disable caches. This in more involved. CacheControl is the Exec function to look up.
- Write the code to chip memory. Chip memory is always uncacheable. This does not have any performance impact on A500, but it might make your code run slower on faster Amigas than it does on A500.
Note that decrunching counts as writing code to memory. If you need to crunch your executable, use a cruncher which properly flushes the cache. Crunchmania is known not to do this. I of course recommend
my own cruncher - it compresses better than all the others, but decompresses very slowly. :)
3. Vectorbase. If you install your own interrupt by writing its address to the interrupt vector, you need to take into account that the interrupt vector might not be placed starting from address 0. The address is in the VBR register, which can be read using the privileged movec instruction. So, for example, to install a VBlank interrupt:
lea GetVBR(pc),a5
jsr -30(a6) ; Supervisor
lea OldInterrupt(pc),a0
lea Interrupt(pc),a1
move.l $6c(a2),(a0)
move.l a1,$6c(a2)
...
GetVBR:
movec vbr,a2
rte
OldInterrupt:
dc.l 0
Interrupt:
; Interrupt code here
rte
Keep in mind that the VBR register is only present on 68010+, so the above code needs to be guarded by a CPU check.
4. Interrupt request bits: At the end of an interrupt, you need to clear the corresponding interrupt request bit. On some A4000s, the actual disabling of the interrupt lines to the processor happens so slowly that the CPU sometimes manages to fully return from the interrupt beforehand, which means the interrupt gets triggered again. The solution is to clear the interrupt request bits twice:
move.w #$0020,$dff09c
move.w #$0020,$dff09c
rte
For an example of some of these things in practice, take a look at
my startup code. :)