A86: NEED HELP ON DATA STRINGS!!!


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

A86: NEED HELP ON DATA STRINGS!!!




Below is my source to a sample program that I was trying to write to help
me better understand how to store permament variables with the 86.  The
code is all messed up.  I can't even get it to display a simple declared
byte!  What I wanted this to do was display the number 0 from the label
"score", then after a keypress I wanted the program to store te number
255 to the memory location "score".  Here it is.  I hope someone can help
me.  Thanks.

|===========================|
|  permmem.asm                                |
|===========================|

#include asm86.h              
#include ti86asm.inc
                               
.org $D748
                                
MAINLOOP:
 call _clrLCD                  ; clear screen
 call DISP_SCORE       ; write score to screen (data stored @ label
"score")
 call _getkey                   ; pause until keypress

 call DO_SCORE          ; save number 255 to permanent memory
 call DISP_SCORE       ; write score to screen (data stored @ label
"score")
 call _getkey                   ; pause until keypress
 ret                                    ; return to TI-OS or asm-shell

DISP_SCORE:
 ld hl, score                   ; get address of data
 xor a                              ; clear a register otherwise
D_HL_DECI won't work
 call D_HL_DECI        ; display  HL in in decimal format
 ret                                 ; return to MAINLOOP
  
DO_SCORE:
 ld hl,ProgName          ; name of program 
 rst 20h                          ; copy 10 bytes @ (hl) to OP1 
 rst 10h                          ; find program's abs address
 call $462F                    ; load the ram page and get asic addr in
hl
 ld de,score-$D748     ; DE = relative offset to stuff to store
 add hl,de                      ; add offset to program start location
 ld a, 255                       ; copy the number 255 into score memory

 ld (hl),a                         ; And save it in the real variable

 ld hl, score                   ; save it in temp variable too
 ld (hl), a                         ;

 ret                                 ; return to MAINLOOP

ProgName:                          ; name of program
 .db $12,8,"permmem"       ;

score:                                   ; score memory location
 .db 0,0

.end
END

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]


References: