A85: Question


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

A85: Question




Something in the following section of code is corrupting the value of HL.
 When it starts it is a value depending on where the program is in
memory.  The second time HL is displayed, it is ALWAYS 32,768 (2^15). 
The display and pause routines are only in the code temporarily so that I
can find whatever bug is causing HL to be messed up.  I cannot figure it
out and would really like some help.  Also, if anyone could tell me the
differnece between TR_CHARPUT and TX_CHARPUT I would be grateful.

; B = $CF
; DE = (x -1, y) for displaying arrow

        ...
        pop    hl                  ; HL = Game_Speed + 1
        call   &D_HL       ; Look at current value of HL
        call   &PAUSE         ; Pause to read it before moving ahead

Menu:

        inc    d                   ; X is now correct value
        ld     ($800C), de         ; Save coords for displaying left
arrow
        ld     a, b                ; Load left arrow character into A
        call   TX_CHARPUT          ; Display left arrow
        inc    d                   ; Move over two characters
        inc    d
        ld     ($800C), de         ; Save coords for displaying right
arrow
        ld     a, c                ; Load right arrow character into A
        call   TX_CHARPUT          ; Display right arrow
        dec    d                   ; Restore original coordinates

Menu_Loop:

        call   &D_HL       ; Look at current value of HL
        ...

D_HL:

        push   de       ; Save coordinates
        ld     de, $0000      ; Display at (0,0)
        ld     ($800C), de       ; Save new coordinates
        call   D_HL_DECI        ;Display HL
        pop    de          ; Restore HL
        ret

PAUSE:

        call   GET_KEY
        or     a
        jr     z, PAUSE         ; Loop until a key is pressed
        ret

___________________________________________________________________
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/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]