A86: Re: Date: Wed, 16 Jun 1999 16:13:27 PDT


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

A86: Re: Date: Wed, 16 Jun 1999 16:13:27 PDT




This is a pretty typical write-back routine.  Any data between SettingData
and SettingDataEnd will be the same everytime the program is run.  Just
remember that it does, of course, take up space in your program.  It's too
bad there isn't a flag to set that would write back the program.

Sorry about the code, the comments make it a little messy :)

SaveSettings:
 ld hl,ProgName            ; point to program name
 rst 20h                   ; load into OP1 with _MOV10TOOP1
 rst 10h                   ; find it with _FINDSYM
 ex de,hl                  ; point to start of variable
 ld a,b                    ; get top of absolute pointer
 ld de,SettingData-$d748+4 ; relative offset - 4
 add hl,de                 ; form pointer to var
 adc a,0                   ; add carry
 ld de,SettingData         ; point to data in _asm_exec_ram
 ld b,SettingDataEnd-SettingData ; copy entire length of SettingData
SaveSettingsL:
 call _getb_ahl            ; convert abs pointer
 ld a,(de)                 ; read value
 ld (hl),a                 ; save new value to variable
 call _inc_ptr_ahl         ; move to next destination byte
 djnz SaveSettingsL        ; loop for all bytes

ProgName:
 .db $12,7,"program"

SettingData:
 .db "This will be written back.",0
SettingDataEnd:

> How do you store a name loaded into hl (inputed by
> the user, kind of a high score thing, but with just a name) so it shows
even
> after you exit the program. I have it so it stays while i am in the
> program, but after I exit the program, the name I entered dissapears.
> If anyone has a routine to use, it would be apprecieated.




References: