Some of you might recognize this name from my CC18 thread, and that would be correct. I wanted to continue to make this game. Here is the link to that thread. Now I have fixed my code up a lot, and even incorporated some assembly code. My newest and latest problem is the error the compiler gives.
Code:
That's the error.
Code:
That is the code that I believe this error comes from. Also, if you see any optimizations, please post them.
Code:
Fatal Error (040412) No label found in span-dependant instruction.
Code:
.assume ADL=1
_missed:
db 0
_correct:
dw 0
db 0
_number:
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,51,54,57,0,0,0,0,21,56,0,0,0,1,52,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;void game_Addition()
_game_Addition:
ld hl, -12
call __frameset
ld (ix - 1), 5 ;increment = 5
ld hl, 0 ;hl = 0
ld (ix - 4), hl ;Possible Number = 0
ld hl, 5 ;hl = 5
ld (ix - 12), hl ;num
loopA: ;while{} loop
call _os_GetCSC ;a = pressed key
ld (_key), a ;_key = pressed key
ld bc, $BE ;bc = 190 rgba(189,215,247,255)
push bc
call _gfx_FillScreen
pop bc
call _rand ;hl = random integer
ld bc, $FF ;bc = 255
call _irems ;hl %= bc
ld de, hl ;de = hl
push de ;save de
call _rand ;hl = random integer
pop de
ld bc, hl ;bc = 2nd random integer
ld hl, de ;hl = 1st random integer
call _imuls ;hl *= bc
push hl
call _srand ;store seed for rand function
call _rand ;hl = random integer
ld bc, 310 ;bc = 310
call _irems ;hl %= 310
ld bc, 5 ;bc = 5
add hl, bc ;hl += bc
ld (ix - 5), h
ld (ix - 6), l ;sx variable
ld bc, 1
push bc
ld bc, 0
push bc
ld.is bc, (ix - 6) ;2 bytes are taken from sx
push bc
call _draw_Snow ;void draw_Snow(sx, 0, 1)
pop bc
pop bc
pop bc
push iy
ld hl, (_snowflakeXY + 6) ;hl = snowflakeXY[0].number
ld iy, _snowflakeXY ;iy = *snowflakeXY
ld bc, (iy + 15) ;bc = snowflakeXY[1].number
add hl, bc ;hl += bc
ld (ix - 9), hl ;Correct Number
pop iy
ld a, (_key)
or a, a
jp z, _graphics ;if no key was pressed, skip to graphics
switch: ;if (key == ###), then...
cp 54
jp z, check ;if (key == sk_2nd),then go to check
cp 56
jp z, backspace ;if (key == sk_Del),then go to backspace
cp 15
jp z, clear ;if (key == sk_Clear),then go to clear
jp default ;otherwise, go to default
check:
ld hl, (ix - 9) ;hl = correct number
ld bc, (ix - 4) ;bc = possible number
or a, a
sbc hl, bc
jp nz, incorrect ;if (possible number != correct number),then go to incorrect
call _move ;delete first two snowflakes, move the rest down
ld hl, (_correct)
inc hl
ld (_correct), hl
jp levelw
incorrect:
ld a, (_missed)
inc a
ld (_missed), a
jp levelw
backspace:
ld hl, (ix - 4) ;hl = possible number
ld bc, 10 ;bc = 10
call _idivs ;(int)(hl /= bc)
ld (ix - 4), hl ;possible number = hl
jp levelw
clear:
ld hl, 0 ;hl = 0
ld (ix - 4), hl ;possible number = hl
jp levelw
default:
or a, a
sbc hl, hl
ld l, a ;a = key, l = a
ld bc, _number ;bc = *number
add hl, bc ;hl += bc
ld a, (hl) ;a = *hl
or a, a
ex de, hl ;de = *number + key, hl = garbage
jp nz, dand ;Goto dand if key offset > 0
ld a, (_key) ;a = key
cp a, 33 ;a - 0x21
jp nz, levelw ;if previous isn't 0, then goto levelw. 0x21 is the key 0
dand:
ld hl,0 ;hl = 0
ld bc, (ix - 4) ;bc = possible number
or a, a
sbc hl, bc ;hl -= bc
jp z, true ;if (hl == 0), which means possible number has a length of 1, then goto true
false:
ld bc, (ix - 4) ;bc = possible number
call _length
jp m, levelw ;see _length outputs
jp z, levelw
true:
ld hl, (ix - 4) ;hl = possible number
ld bc, hl
add hl, hl
add hl, hl
add hl, bc
add hl, hl ;hl *= 10
ld bc, hl
ld a, (_key) ;a = key
or a, a
sbc hl, hl ;hl = 0
ld l, a
ld de, _number
add hl, de
ld a, (hl) ;a = key number
or a, a
sbc hl, hl
ld l, a
add hl, bc ;possible number * 10 + key number
ld (ix - 4), hl
levelw:
ld hl, (ix - 12) ;hl = num
ld bc, (ix - 1) ;bc = increment
add hl, bc ;hl = num + increment
push bc
ld bc, (_correct) ;bc = correct
or a, a
sbc hl, bc
jp nz, _graphics ;if (correct != hl), then goto graphics
add hl, bc
ld (ix - 12), hl ;num = hl
pop bc
inc bc ;increment++
ex de, hl
ld hl, 50 ;hl = 50 50 is the max number increment can be
or a, a
sbc hl, bc ;50 - increment
jr z, 5 ;if (increment == 50),then skip 5 bytes
ld (ix - 1), bc
ld a, (_level) ;a = level
inc a ;level++
jp z, _graphics ;replace with automatic high score test
ld (_level), a
_graphics:
ld bc, 255
push bc
call _gfx_SetColor
pop bc
ld bc, 220
push bc
ld bc, 320
push bc
or a, a
sbc hl, hl
ld a, (_missed)
ld l, a
ld bc, hl
add hl, hl
add hl, hl
add hl, bc
add hl, hl
add hl, bc
add hl, hl ;missed *= 22
ld de, 220
ex de, hl
or a, a
sbc hl, de
push hl
ld bc, 0
push bc
call _gfx_FillRectangle
pop bc
pop bc
pop bc
pop bc
ld bc, 0
push bc
call _gfx_SetColor
pop bc
ld bc, 220
push bc
ld bc, 320
push bc
ld bc, 220
push bc
ld bc, 0
push bc
call _gfx_Line
pop bc
pop bc
pop bc
ld bc, 160
push bc
ld bc, 0
push bc
ld bc, 160
push bc
call _gfx_Line
pop bc
pop bc
pop bc
pop bc
ld bc, 2
push bc
ld bc, 1
push bc
call _gfx_SetTextScale
pop bc
pop bc
ld bc, 225
push bc
ld bc, 5
push bc
call _gfx_SetTextXY
pop bc
pop bc
ld bc, (ix - 4)
push bc
call _length
pop de
push bc
push de
call _gfx_PrintInt
pop bc
pop bc
ld bc, 220
push bc
ld bc, _LevelT
push bc
call _gfx_GetStringWidth
pop bc
ld bc, hl
ld hl, 278
or a, a
sbc hl, bc
push hl
ld bc, _LevelT
push bc
call _gfx_PrintStringXY
pop bc
pop bc
pop bc
ld bc, 225
push bc
ld bc, 283
push bc
call _gfx_SetTextXY
pop bc
pop bc
ld bc, 4
push bc
ld bc, (_level)
push bc
call _gfx_PrintUInt
pop bc
pop bc
ld bc, 1
push bc
push bc
call _gfx_SetTextScale
pop bc
pop bc
call _gfx_SwapDraw
ld a, (_missed)
cp a, 10
jp nz, loopA
ld a, 0
ld (_missed), a
ld hl, 0
ld (_count), hl
call _blank
ret
_LevelT:
db "Level:", 0
_length:
;Inputs
; BC = variable number
;Outputs
; flags:
; sign: set if length is greater than 6
; zero: set if length is 6
; BC = length of number
;Destroyed
; A,HL,BC,DE
call __itol ;int to long output in bc
call __ltof ;long to float output in bc
ld de, bc ;de = bc
ld c, a ;c = a
ld b, 0 ;b = 0
push bc
push de
call _fabs
pop bc
pop bc
ld c, e
ld b, 0
push bc
push hl
call _log10
pop bc
pop bc
ld a, e
ld bc, hl
ld hl, 8388608
ld e, 63
call __fadd
call __ftol
or a, a
ld hl, 6
sbc hl, bc
ret
.ref _key
.ref _snowflakeXY
.ref _count
.ref _level
.ref _draw_Snow
.ref _move
.ref _blank
.def _game_Addition
.def _game_Subtraction
.def _game_Multiplication
.def _game_Division
.def _length
.def _number
.def _correct
.def _missed