Re: A86: Saving Variables


[Prev][Next][Index][Thread]

Re: A86: Saving Variables




At 17:22 1998-01-01 -0500, you wrote:
>
>Hello Everyone,
>	Well, we all know Nagel made it easy to save variables after you exit
>w/AShell 1.1... but can anyone give me a SIMPLE routine to save more than
>one variable... some being 16 bit, some being 8... for example, lets say I
>have 4 variables... 2 are 16bit, 2 are 8 bit... how do I save them?  Any
>help would be appreciated.

Here's a template code:

AHL_TO_ASIC  = $46C3
INC_AHL      = $4637

 ld hl,progName-1  ; The first byte in OP1 is not important
 rst 20h     ; Copy HL to OP1
 rst 10h     ; Looks up variable, BDE = ABS addr to program
 ld a,b
 ld hl,StartSaveHere-_asm_exec_ram+4 ; 4 header bytes
 add hl,de
 adc a,0     ; AHL = ABS address to where to write
 ld de,StartSaveHere
 ld b,10     ; Number of bytes to save
RepCopy:
 push af
 push hl
 call AHL_TO_ASIC
 ld a,(de)   ; Read from temporary program memory
 ld (hl),a   ; Store in the real variable
 pop hl
 pop af
 call INC_AHL ; Point to next byte in 'real' variable
 inc de       ; Point to next byte in temp program
 djnz RepCopy

progName:
 .db 8,"progname"

StartSaveHere:  ; Data to be saved
 .db 0,0,0,0,0,0,0,0,0,0

--
Real name: Jimmy Mårdell                 
IRC......: Yarin                         
Email....: mailto:yarin@acc.umu.se      <-- NEW E-MAIL ADDRESS!!!!
Homepage.: http://www.algonet.se/~mja/


References: