A82: Semi-Newbie HELP! I'm stumped.....


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

A82: Semi-Newbie HELP! I'm stumped.....



Hi there I'm stumped, looking at this block of code for an hour, and still
not knowing why it don't work makes me want to break my 82 in half. So
anyone know why this don't work (score always shows up as 00002!):

thescore = TEXT_MEM + 40  ; next var is 42... so it's a word

init:
        ld bc, 1
        ld (thescore), bc

[other stuff...]

makenewscore:
        push bc
        push hl

        ld bc, 0
        ld bc, (thescore)         ; I think the problem may be here, but
WHY????!!!??? 
        inc bc
        inc bc
        ld (thescore),bc
        ld hl, 0
        ld hl, (thescore)

;**************
; THANX Anders for the base of the next routine...
;******************                 

dnsc:                                         
 LD DE,$802C           ; -> OP1 (temp storage)
 LD B,5                ; maimum number of digits
dnsc_loop:
 CALL UNPACK_HL        ; Unpack one digit of HL into A
 ADD A,$30             ; make it ASCII
 LD (DE),A             ; Save in buffer
 DEC DE
 dec b
 ld a,b                ; point to next digit

 jr NZ,dnsc_loop
 LD A,0
 LD ($802D),A          ; nullterminate it
 INC DE                ; point to first digit
 ex de,hl
  ld de, $2044
  ld ($8215), de
 ROM_CALL(D_ZM_STR)    ; print it
      
  pop hl
  pop bc

  push bc

someotherroutine:

pop bc

[goes back to top for some other stuff....]