[Coco] 64K ROM to RAM programs - where did this one come from?

Allen Huffman alsplace at pobox.com
Tue Dec 14 22:12:21 EST 2021


On Dec 14, 2021, at 7:57 PM, Alex Evans <varmfskii at gmail.com> wrote:
> 
> allram:
> ;;  check if already in all RAM mode
> lda $8000
> tfr a,b
> com $8000
> eora $8000
> beq rom
> stb $8000
> rts
> 
> ;; copy ROMs to RAM
> rom:
> pshs cc
> orcc #$50 ; disable interrupts
> sts $fe
> lds #$8000
> loop@:
> clr RAMROM
> puls a,b,x,y,u
> clr RAMRAM
> pshs u,y,x,a,b
> leas 8,s
> cmps #$ff00
> ble loop@
> lds $fe
> puls cc,pc
> 
> Copies eight bytes at a time by temporarily using the stack.

This is very nice. The first time I heard of using the stack like this was Alan DeKok, I think, talking about it being used in the NitrOS9 screen stuff. That looks pretty straight forward, now that I understand how it works.

I like your test at the start to avoid copying if it’s already in RAM mode. Someone could jump to the actual routine to "restore" the RAM copy (overwrite) if needed.

Why do some of you push CC at the start?


More information about the Coco mailing list