Z80 Routines:Memory:RAM Access

From WikiTI
(Redirected from Routines:Memory:RAM Access)
Jump to: navigation, search


RAM page Access

This is a routine to easily access those RAM pages generally inaccessable.

;=======READ/WRITE DATA FROM/TO RAM PAGE=======
;inputs: hl=offset of where to start reading data
;           (ranges from 4000h-7FFFh for READING the 'Unused' RAM page)
;               or (from 8000h-BFFFh for WRITING to the 'Unused' RAM page)
;        bc=number of bytes to copy
;        de=where to save the data
;           (ranges from 4000h-7FFFh for WRITING to the 'Unused' RAM page)
;               or (from 8000h-BFFFh for writing to the 'standard' RAM page)
;        RAMPAGE=new page to read/write

in a,(06h)
push af
ld a,RAMPAGE
out (06h),a       ;a=any valid RAM page number (83h-87h are unused by the OS 
                  ;see [[83Plus:OS:Ram Pages]] for more info on RAM pages
ldir
pop af
out (06h),a
ret

This routine is a modified version of the routine I use in my programs, and is untested, but seems like it would work. If there is anything I have forgotten PLEASE add it and tell me if possible.

--Nyquist562--