A86: Re: equate problem


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

A86: Re: equate problem




Sure.  You store it in the program using a '.db' and write the program back.
If you just need one byte and aren't going to release it, you can be pretty
safe by throwing it in one of the _alt_ecec spaces.  I don't think anyone
has ever (or will ever) write an _alt_slink program.

So you could probably do a 'equate = _alt_slink_exec+199' and be safe.
They're 200 bytes each, so use space at the end.  But if everyone gets that
idea...

Writeback is much safer and the prefered method:

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"    ; 7 is the length of the name

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


>
> I was wondering if there was a place to store an equate where it cannot be
> changed by another program,
>
> >Example
> in the program it checks for certian conditions where the equate is
changed
> to  z,nz,or m. Then it uses the number in the equate to decide where the
> program will jump to  (shown here)
>
> equate         equ          $8534
>
> ld a,(equate)
> or a
> jp z,firstjump                 ;since the program is on its first run,
> jp nz,secondjump         ;it will jump to firstjump since the equate is 0
> jp m,lastjump                ;but later in the prog the user can change it
> to
>                                     ;a diffrent number,, changing the
route
> of the                                     ;program.
>
>
>
> But the problem is that certain programs change the equates to zero, and
the
> route set by the user is changed.   Does anyone have any idea on to solve
> this problem??
>
> Thanks
>
> -chris manning
>
>
> _______________________________________________________________
> Get Free Email and Do More On The Web. Visit http://www.msn.com
>
>



References: