Re: A86: Problem with variables


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

Re: A86: Problem with variables




> This bit of code dosen't work and I can't figure out why.  Can anybody
> help?  The calc freezes in place when the variable exists, and turns off
> then freezes when it dosent.
> 
> #include "asm86.h"
> #include "ti86asm.inc"
> #include "ti86math.inc"
> #include "ti86ops.inc"
> #include "ti86abs.inc"
> 
> org _asm_exec_ram
> 
> _delvar                 equ     475Fh
> _FINDSYM        equ     46CBh
> 
> main:
        >         call    _OP1SET0        ; OP1 = 0
        >         ld      hl,progname     ; Source = progname
        >         ld      de,_OP1+1       ; Dest = OP1+1
        >         ld      b,6             ; copy 6 bytes
        >         ldir                    ; copy
        >         call    _FINDSYM        ; carry flag set if var 
        > dosen't exist, registers

There's a simpler way.. Just do this instead of what I indented:

   ld hl,progname ;point hl to progname
   rst 20h  ;copies (hl) to OP1 but shorter than what you did
   call    _FINDSYM


Everything else looks fine..  Also, I tried a similar thing like this 
but for some reason you had to call _delvar twice for it to work. 
Anyway, try that

>                                 ; set correctly for _delvar
>         jr      c,dosentexist   ; if so, quit without doing
> anything
>         call    _delvar         ; if not, delete it
> 
> dosentexist:
>         ret                     ; return to system
> 
> progname:
>         .db             05h,"ABCDE"
> 
> end
 


References: