A85: #$%#$^ Code!


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

A85: #$%#$^ Code!



Can someone debug this code?!  It compiles fine, but in Usgard its description
shows up as a bunch of crap and it doesn't run.  All it is supposed to do is
move a cursor around, then exit when you press enter.

-Gray
;Rubik's Infinity, 9/26/98 Patrick Gray
;set 3,(iy+5)
;Right=3 Left=2 Enter=9 2nd=54

#include "usgard.h"

.org 0
.db "Rubik's Infinity",0

CUR_POS = TEXT_MEM

 call CLEARLCD
 ld a,1
 ld (CUR_POS),a
DrawBoard:
 ld a,7
 ld (CURSOR_ROW),a
 ld a,2
 ld (CURSOR_COL),a
 ld hl,&Numbers
 call D_ZT_STR
 ld a,7
 ld (CURSOR_ROW),a
 ld a,2
 ld (CURSOR_COL),a
 ld hl,&One
 set 3,(iy+5)
 call D_ZT_STR
 res 3,(iy+5)
GetKey:
 call GET_KEY
 jr z,GetKey
 cp 3
 jr z,Right
 cp 2
 jr z,Left
 cp 9
 jp z,&Enter
 cp 54
 jp z,&Enter
Right:
 ld a,(CUR_POS)
 cp 4
 jr z,GetKey
 sub 1
 call &UpdateCursor
 jr GetKey
Left:
 ld a,(CUR_POS)
 cp 1
 jr z,GetKey
 sub 1
 call &UpdateCursor
 jr GetKey
UpdateCursor:
 push af
 ld a,7
 ld (CURSOR_ROW),a
 ld a,2
 ld (CURSOR_COL),a
 ld hl,&Numbers
 call D_ZT_STR
 ld a,(CUR_POS)
 cp 1
 jp z,&Won
 cp 2
 jp z,&Tew
 cp 3
 jp z,&Threee
 cp 4
 jp z,&Fowr
 pop af
 ret
Won:
 ld a,7
 ld (CURSOR_ROW),a
 ld a,2
 ld (CURSOR_COL),a
 ld hl,&One
 set 3,(iy+5)
 call D_ZT_STR
 res 3,(iy+5)
 ret
Tew:
 ld a,7
 ld (CURSOR_ROW),a
 ld a,6
 ld (CURSOR_COL),a
 ld hl,&Two
 set 3,(iy+5)
 call D_ZT_STR
 res 3,(iy+5)
 ret
Threee:
 ld a,7
 ld (CURSOR_ROW),a
 ld a,10
 ld (CURSOR_COL),a
 ld hl,&Three
 set 3,(iy+5)
 call D_ZT_STR
 res 3,(iy+5)
 ret
Fowr:
 ld a,7
 ld (CURSOR_ROW),a
 ld a,14
 ld (CURSOR_COL),a
 ld hl,&Four
 set 3,(iy+5)
 call D_ZT_STR
 res 3,(iy+5)
 ret
Enter:
 call OTH_EXIT

Numbers:
 .db "1    2    3    4",0

One:
 .db "1",0

Two:
 .db "2",0

Three:
 .db "3",0

Four:
 .db "4",0

.end










Follow-Ups: