.area _COMMONMEM
;
-; Size currently selected memory mapper
+; Size currently selected memory mapper (this should be done during bootstrap)
;
size_memory:
ld bc, #0x03FC ; make sure ram page 3 is selected
out (c), b
- ld hl, #8 ; good a target as any
+ ld hl, #3FFF ; careful, there is code in page 3
ld (hl), #0xAA ; we know there is a low page!
ld bc, #0x04FC ; continue with page 4
ramscan_2:
out (c), b
cp (hl) ; is it 0xAA
jr z, ramwrapped ; we've wrapped (hopefully)
- ld (hl), a
- cp (hl)
- jr nz, ramerror ; ermm.. help ???
inc b
jr nz, ramscan
jr ramerror ; not an error we *could* have 256 pages!