my code doesn't seem to respond to key presses but it keeps redrawing the frog which it should only do after a key press. any help you can provide would be great


Code:
.nolist
#include "ion.inc"
#include "tokens.inc"
#include "keyval.inc"
_runindicoff .equ 4570h
_runindicon   .equ 456Dh
xcoord .equ saferam2
ycoord .equ saferam2 + 1
skDown .equ   01h
skLeft .equ 02h
skRight .equ 03h
skUp .equ 04h
skClear .equ 0Fh
.list

   .org progstart-2
   .db $BB,6D
   ret
   jp nc,start
   .db "Frog",0
start:
   bcall(_runindicoff)
   ld a,$20
   ld (xcoord),a
   ld a,$10
   ld (ycoord),a
   bcall(_clrlcdf)
    call loop
    bcall(_clrlcdf)
    ret
   
loop:
    ld b,32
    ld c,4
    ld hl,(xcoord)
    ld a,l
    ld l,h
    ld ix,frog
    call ionLargeSprite
    call ionFastCopy
   bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   jp nz,loop
   ret
   
right:
   ld hl,(xcoord)
   ld a,$41
   inc l
   cp l
   jp c,incx
   jp loop

incx:
   ld hl,(xcoord)
   inc l
   ld (xcoord),hl
   jp clrsprite

left:
   ld hl,(xcoord)
   ld a,$01
   dec l
   cp l
   jp nc,decx
   jp loop

decx:
   ld hl,(xcoord)
   dec l
   ld (xcoord),hl
   jp clrsprite
   
up:
   ld hl,(xcoord)
   ld a,$01
   dec h
   cp h
   jp nc,decy
   jp loop
   
decy:
   ld hl,(xcoord)
   dec h
   ld (xcoord),hl
   jp clrsprite
   
down:
   ld hl,(xcoord)
   ld a,$21
   inc h
   cp h
   jp c,incy
   jp loop

incy:
   ld hl,(xcoord)
   inc h
   ld (xcoord),hl
   jp clrsprite
   
clrsprite:
   ld b,32
    ld c,4
    ld hl,(xcoord)
    ld a,l
    ld l,h
    ld ix,blnksprt
    call ionLargeSprite
    call ionFastCopy
    jp loop
   
frog:
 .db $D0,$01,$80,$0A,$A8,$03,$C0,$15,$A8,$06,$60,$15,$50,$0C,$30,$0A
 .db $50,$1E,$78,$0E,$68,$16,$64,$1A,$38,$39,$04,$14,$28,$34,$04,$1C
 .db $35,$F8,$03,$B4,$1F,$EA,$03,$E8,$16,$70,$02,$F8,$1D,$EC,$03,$28
 .db $0B,$78,$12,$D0,$0C,$6A,$12,$30,$00,$78,$12,$00,$00,$6C,$22,$00
 .db $00,$74,$22,$00,$00,$6C,$22,$00,$00,$74,$02,$00,$00,$38,$1C,$00
 .db $00,$F8,$1F,$00,$03,$D0,$03,$C0,$1F,$20,$00,$F8,$7C,$88,$10,$3E
 .db $EA,$04,$2A,$87,$D7,$FE,$7F,$F1,$CF,$F1,$8F,$E1,$70,$F8,$3F,$4E
 .db $0F,$0C,$72,$F0,$06,$E4,$67,$60,$18,$54,$75,$18,$0F,$F8,$3F,$F0
 
blnksprt:
 ;Tile 0
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
   
.end
.end
To fix the redraw, do this:


Code:
loop:
    ld b,32
    ld c,4
    ld hl,(xcoord)
    ld a,l
    ld l,h
    ld ix,frog
    call ionLargeSprite
    call ionFastCopy
loop2:
   bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   jp nz,loop2
   ret


Not sure about the keys not registering though...
I think the problem is here:


Code:
   cp skClear
   jp nz,loop

If the user didn't press the key, then it would jump back to the loop. See if this would help: Instead of:

Code:
   bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   jp nz,loop

Do:

Code:

keyloop:
bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   ret z
   jp keyloop

/me hopes I was any help with Asm. Very Happy
well, now it responds to keypresses, first one clears the sprite, second one redraws it. no change in coordinates.

new code:


Code:
.nolist
#include "ion.inc"
#include "tokens.inc"
#include "keyval.inc"
_runindicoff .equ 4570h
_runindicon   .equ 456Dh
xcoord .equ saferam2
ycoord .equ saferam2 + 1
skDown .equ   01h
skLeft .equ 02h
skRight .equ 03h
skUp .equ 04h
skClear .equ 0Fh
.list


#ifdef TI83P
   .org progstart-2
   .db $BB,6D
#else
   .org progstart
#endif   
   ret
   jr nc,start
   .db "Frog",0
start:
   bcall(_runindicoff)
   ld a,$20
   ld (xcoord),a
   ld a,$10
   ld (ycoord),a
   bcall(_clrlcdf)
    call loop
    bcall(_clrlcdf)
    ret
   
loop:
    ld b,32
    ld c,4
    ld hl,(xcoord)
    ld a,l
    ld l,h
    ld ix,frog
    call ionLargeSprite
    call ionFastCopy
loop2:
   bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   ret z
   jp loop2
   
right:
   ld hl,(xcoord)
   ld a,$41
   inc l
   cp l
   jp c,incx
   jp loop

incx:
   ld hl,(xcoord)
   inc l
   ld (xcoord),hl
   jp clrsprite

left:
   ld hl,(xcoord)
   ld a,$01
   dec l
   cp l
   jp nc,decx
   jp loop

decx:
   ld hl,(xcoord)
   dec l
   ld (xcoord),hl
   jp clrsprite
   
up:
   ld hl,(xcoord)
   ld a,$01
   dec h
   cp h
   jp nc,decy
   jp loop
   
decy:
   ld hl,(xcoord)
   dec h
   ld (xcoord),hl
   jp clrsprite
   
down:
   ld hl,(xcoord)
   ld a,$21
   inc h
   cp h
   jp c,incy
   jp loop

incy:
   ld hl,(xcoord)
   inc h
   ld (xcoord),hl
   jp clrsprite
   
clrsprite:
   ld b,32
    ld c,4
    ld hl,(xcoord)
    ld a,l
    ld l,h
    ld ix,blnksprt
    call ionLargeSprite
    jp loop
   
frog:
 .db $D0,$01,$80,$0A,$A8,$03,$C0,$15,$A8,$06,$60,$15,$50,$0C,$30,$0A
 .db $50,$1E,$78,$0E,$68,$16,$64,$1A,$38,$39,$04,$14,$28,$34,$04,$1C
 .db $35,$F8,$03,$B4,$1F,$EA,$03,$E8,$16,$70,$02,$F8,$1D,$EC,$03,$28
 .db $0B,$78,$12,$D0,$0C,$6A,$12,$30,$00,$78,$12,$00,$00,$6C,$22,$00
 .db $00,$74,$22,$00,$00,$6C,$22,$00,$00,$74,$02,$00,$00,$38,$1C,$00
 .db $00,$F8,$1F,$00,$03,$D0,$03,$C0,$1F,$20,$00,$F8,$7C,$88,$10,$3E
 .db $EA,$04,$2A,$87,$D7,$FE,$7F,$F1,$CF,$F1,$8F,$E1,$70,$F8,$3F,$4E
 .db $0F,$0C,$72,$F0,$06,$E4,$67,$60,$18,$54,$75,$18,$0F,$F8,$3F,$F0
 
blnksprt:
 ;Tile 0
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
   
.end
.end
I noticed the program only modifies xcoord not ycoord. Also, I read in Ion Guru that LargeSprite XORs the sprite to the screen, so maybe just output the same frog sprite to the same place instead of using a blank sprite. Either that or clear the graph buffer.
hmmm.

Well, notice where XCoord and YCoord are located and remember how many bytes HL is.

plus that still doesn't explain why it isn't moving. Neutral



Code:
.nolist
#include "ion.inc"
#include "tokens.inc"
#include "keyval.inc"
_runindicoff .equ 4570h
_runindicon   .equ 456Dh
xcoord .equ saferam2
ycoord .equ saferam2 + 1
skDown .equ   01h
skLeft .equ 02h
skRight .equ 03h
skUp .equ 04h
skClear .equ 0Fh
.list


#ifdef TI83P
   .org progstart-2
   .db $BB,6D
#else
   .org progstart
#endif   
   ret
   jr nc,start
   .db "Frog",0
start:
   bcall(_runindicoff)
   ld a,$20
   ld (xcoord),a
   ld a,$10
   ld (ycoord),a
   bcall(_clrlcdf)
    call loop
    bcall(_clrlcdf)
    ret
   
loop:
    ld b,32
    ld c,4
    ld hl,(xcoord)
    ld a,l
    ld l,h
    ld ix,frog
    call ionLargeSprite
    call ionFastCopy
loop2:
   bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   ret z
   jp loop2
   
right:
   ld hl,(xcoord)
   ld a,$41
   inc l
   cp l
   jp c,incx
   jp loop

incx:
   call clrsprite
   ld hl,(xcoord)
   inc l
   ld (xcoord),hl
   jp loop

left:
   ld hl,(xcoord)
   ld a,$01
   dec l
   cp l
   jp nc,decx
   jp loop

decx:
   call clrsprite
   ld hl,(xcoord)
   dec l
   ld (xcoord),hl
   jp loop
   
up:
   ld hl,(xcoord)
   ld a,$01
   dec h
   cp h
   jp nc,decy
   jp loop
   
decy:
   call clrsprite
   ld hl,(xcoord)
   dec h
   ld (xcoord),hl
   jp loop
   
down:
   ld hl,(xcoord)
   ld a,$21
   inc h
   cp h
   jp c,incy
   jp loop

incy:
   call clrsprite
   ld hl,(xcoord)
   inc h
   ld (xcoord),hl
   jp loop
   
clrsprite:
   ld b,32
    ld c,4
    ld hl,(xcoord)
    ld a,l
    ld l,h
    ld ix,frog
    call ionLargeSprite
    ret
   
frog:
 .db $D0,$01,$80,$0A,$A8,$03,$C0,$15,$A8,$06,$60,$15,$50,$0C,$30,$0A
 .db $50,$1E,$78,$0E,$68,$16,$64,$1A,$38,$39,$04,$14,$28,$34,$04,$1C
 .db $35,$F8,$03,$B4,$1F,$EA,$03,$E8,$16,$70,$02,$F8,$1D,$EC,$03,$28
 .db $0B,$78,$12,$D0,$0C,$6A,$12,$30,$00,$78,$12,$00,$00,$6C,$22,$00
 .db $00,$74,$22,$00,$00,$6C,$22,$00,$00,$74,$02,$00,$00,$38,$1C,$00
 .db $00,$F8,$1F,$00,$03,$D0,$03,$C0,$1F,$20,$00,$F8,$7C,$88,$10,$3E
 .db $EA,$04,$2A,$87,$D7,$FE,$7F,$F1,$CF,$F1,$8F,$E1,$70,$F8,$3F,$4E
 .db $0F,$0C,$72,$F0,$06,$E4,$67,$60,$18,$54,$75,$18,$0F,$F8,$3F,$F0
 
blnksprt:
 ;Tile 0
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
   
.end
.end
Here's how XOR works: in essence, drawing it one time makes it, and drawing the exact same thing in the same place erases it again. You must call the iLargeSprite routine AFTER you know a key has been pressed but BEFORE you change coordinates to erase it.
yeah. I know how XOR works.

also, digi's been helping out with some optimizations, but Im still getting that effect.


Code:
.nolist
#include "ion.inc"
#include "tokens.inc"
#include "keyval.inc"
_runindicoff .equ 4570h
_runindicon   .equ 456Dh
xcoord .equ saferam2
ycoord .equ saferam2 + 1
skDown .equ   01h
skLeft .equ 02h
skRight .equ 03h
skUp .equ 04h
skClear .equ 0Fh
.list


#ifdef TI83P
   .org progstart-2
   .db $BB,6D
#else
   .org progstart
#endif   
   ret
   jr nc,start
   .db "Frog",0
start:
   bcall(_runindicoff)
   ld a,$20
   ld (xcoord),a
   ld a,$10
   ld (ycoord),a
   bcall(_clrlcdf)
    call loop
    bcall(_clrlcdf)
    ret
   
loop:
    ld b,32
    ld c,4
    ld hl,(xcoord)
    ld a,l
    ld l,h
    ld ix,frog
    call ionLargeSprite
    call ionFastCopy
loop2:
   bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   ret z
   jp loop2
   
right:
   ld hl,(xcoord)
   ld a,$41
   inc l
   cp l
   jr c,update_coord
   jp loop

update_coord:
   call clrsprite
   ld (xcoord),hl
   jp loop

left:
   ld hl,(xcoord)
   ld a,$01
   dec l
   cp l
   jr nc,update_coord
   jp loop

up:
   ld hl,(xcoord)
   ld a,$01
   dec h
   cp h
   jr nc,update_coord
   jp loop

down:
   ld hl,(xcoord)
   ld a,$21
   inc h
   cp h
   jr c,update_coord
   jp loop
   
clrsprite:
  push hl
  ld b,32
  ld c,4
;   ld hl,(xcoord)
  ld a,l
  ld l,h
  ld ix,blnksprt
  call ionLargeSprite
  pop hl
  ret
   
frog:
 .db $D0,$01,$80,$0A,$A8,$03,$C0,$15,$A8,$06,$60,$15,$50,$0C,$30,$0A
 .db $50,$1E,$78,$0E,$68,$16,$64,$1A,$38,$39,$04,$14,$28,$34,$04,$1C
 .db $35,$F8,$03,$B4,$1F,$EA,$03,$E8,$16,$70,$02,$F8,$1D,$EC,$03,$28
 .db $0B,$78,$12,$D0,$0C,$6A,$12,$30,$00,$78,$12,$00,$00,$6C,$22,$00
 .db $00,$74,$22,$00,$00,$6C,$22,$00,$00,$74,$02,$00,$00,$38,$1C,$00
 .db $00,$F8,$1F,$00,$03,$D0,$03,$C0,$1F,$20,$00,$F8,$7C,$88,$10,$3E
 .db $EA,$04,$2A,$87,$D7,$FE,$7F,$F1,$CF,$F1,$8F,$E1,$70,$F8,$3F,$4E
 .db $0F,$0C,$72,$F0,$06,$E4,$67,$60,$18,$54,$75,$18,$0F,$F8,$3F,$F0
 
blnksprt:
 ;Tile 0
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
   
.end
.end
Hmm, that code looks absolutely fine to me. Sad
Sad I thought so too.
Actually, wait. WTF is with the cp after the dec/inc? just do the jp no matter what.
in the keypressing?

Im attempting to see if it will draw offscreen and prevent that. let me see if that helps though.

[edit]
yeah it moves now

[edit2]
slaps self. i had the c's and nc's reversed Neutral

[edit3]

now just some issues with encountering the edge.


Code:
.nolist
#include "ion.inc"
#include "tokens.inc"
#include "keyval.inc"
_runindicoff .equ 4570h
_runindicon   .equ 456Dh
xcoord .equ saferam2
ycoord .equ saferam2 + 1
skDown .equ   01h
skLeft .equ 02h
skRight .equ 03h
skUp .equ 04h
skClear .equ 0Fh
.list


#ifdef TI83P
   .org progstart-2
   .db $BB,6D
#else
   .org progstart
#endif   
   ret
   jr nc,start
   .db "Frog",0
start:
   bcall(_runindicoff)
   ld a,$20
   ld (xcoord),a
   ld a,$10
   ld (ycoord),a
   bcall(_clrlcdf)
   call loop
   bcall(_clrlcdf)
   ret
      
loop:
   ld b,32
   ld c,4
   ld hl,(xcoord)
   ld a,l
   ld l,h
   ld ix,frog
   call ionLargeSprite
   call ionFastCopy
loop2:
   bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   ret z
   jp loop2
   
right:
   ld hl,(xcoord)
   ld a,$41
   inc l
   cp l
   jr nc,update_coord
   jp loop

update_coord:
   call clrsprite
   ld (xcoord),hl
   jp loop

left:
   ld hl,(xcoord)
   ld a,$01
   dec l
   cp l
   jr c,update_coord
   jp loop

up:
   ld hl,(xcoord)
   ld a,$01
   dec h
   cp h
   jr c,update_coord
   jp loop

down:
   ld hl,(xcoord)
   ld a,$21
   inc h
   cp h
   jr nc,update_coord
   jp loop
   
clrsprite:
   push hl
   ld b,32
   ld c,4
   ld hl,(xcoord)
   ld a,l
   ld l,h
   ld ix,frog
   call ionLargeSprite
   pop hl
   ret
      
frog:
 .db $D0,$01,$80,$0A,$A8,$03,$C0,$15,$A8,$06,$60,$15,$50,$0C,$30,$0A
 .db $50,$1E,$78,$0E,$68,$16,$64,$1A,$38,$39,$04,$14,$28,$34,$04,$1C
 .db $35,$F8,$03,$B4,$1F,$EA,$03,$E8,$16,$70,$02,$F8,$1D,$EC,$03,$28
 .db $0B,$78,$12,$D0,$0C,$6A,$12,$30,$00,$78,$12,$00,$00,$6C,$22,$00
 .db $00,$74,$22,$00,$00,$6C,$22,$00,$00,$74,$02,$00,$00,$38,$1C,$00
 .db $00,$F8,$1F,$00,$03,$D0,$03,$C0,$1F,$20,$00,$F8,$7C,$88,$10,$3E
 .db $EA,$04,$2A,$87,$D7,$FE,$7F,$F1,$CF,$F1,$8F,$E1,$70,$F8,$3F,$4E
 .db $0F,$0C,$72,$F0,$06,$E4,$67,$60,$18,$54,$75,$18,$0F,$F8,$3F,$F0
      
.end
.end
coolness. Why not do more conventional loading into a and then or a or cp 95 or cp 63?
look how it works. I never have to load the coordinates anywhere other than HL, (xcoord) and a brief stay in the stack while drawing.
Change all your c/nc's to z's. See how that works.
I already got it to move fine. I'll see if that helps with it getting one draw cycle off when it hits the edge though.
I just found my last bug.

In a keypress that was at the edge of the screen and therefore not moving the sprite I was jumping back to loop instead of loop2, thus XORing the sprite and throwing everything off a drawing cycle.

final code:


Code:
.nolist
#include "ion.inc"
#include "tokens.inc"
#include "keyval.inc"
_runindicoff .equ 4570h
_runindicon   .equ 456Dh
xcoord .equ saferam2
ycoord .equ saferam2 + 1
skDown .equ   01h
skLeft .equ 02h
skRight .equ 03h
skUp .equ 04h
skClear .equ 0Fh
.list


#ifdef TI83P
   .org progstart-2
   .db $BB,6D
#else
   .org progstart
#endif   
   ret
   jr nc,start
   .db "Frog",0
start:
   bcall(_runindicoff)
   ld a,$20
   ld (xcoord),a
   ld a,$10
   ld (ycoord),a
   bcall(_clrlcdf)
   call loop
   bcall(_clrlcdf)
   ret
      
loop:
   ld b,32
   ld c,4
   ld hl,(xcoord)
   ld a,l
   ld l,h
   ld ix,frog
   call ionLargeSprite
   call ionFastCopy
loop2:
   bcall(_getcsc)
   cp skLeft
   jp z,left
   cp skRight
   jp z,right
   cp skUp
   jp z,up
   cp skDown
   jp z,down
   cp skClear
   ret z
   jp loop2
   
right:
   ld hl,(xcoord)
   ld a,$40
   inc l
   cp l
   jr nz,update_coord
   jp loop2

update_coord:
   call clrsprite
   ld (xcoord),hl
   jp loop

left:
   ld hl,(xcoord)
   ld a,$00
   dec l
   cp l
   jr nz,update_coord
   jp loop2

up:
   ld hl,(xcoord)
   ld a,$00
   dec h
   cp h
   jr nz,update_coord
   jp loop2

down:
   ld hl,(xcoord)
   ld a,$20
   inc h
   cp h
   jr nz,update_coord
   jp loop2
   
clrsprite:
   push hl
   ld b,32
   ld c,4
   ld hl,(xcoord)
   ld a,l
   ld l,h
   ld ix,frog
   call ionLargeSprite
   pop hl
   ret
      
frog:
 .db $D0,$01,$80,$0A,$A8,$03,$C0,$15,$A8,$06,$60,$15,$50,$0C,$30,$0A
 .db $50,$1E,$78,$0E,$68,$16,$64,$1A,$38,$39,$04,$14,$28,$34,$04,$1C
 .db $35,$F8,$03,$B4,$1F,$EA,$03,$E8,$16,$70,$02,$F8,$1D,$EC,$03,$28
 .db $0B,$78,$12,$D0,$0C,$6A,$12,$30,$00,$78,$12,$00,$00,$6C,$22,$00
 .db $00,$74,$22,$00,$00,$6C,$22,$00,$00,$74,$02,$00,$00,$38,$1C,$00
 .db $00,$F8,$1F,$00,$03,$D0,$03,$C0,$1F,$20,$00,$F8,$7C,$88,$10,$3E
 .db $EA,$04,$2A,$87,$D7,$FE,$7F,$F1,$CF,$F1,$8F,$E1,$70,$F8,$3F,$4E
 .db $0F,$0C,$72,$F0,$06,$E4,$67,$60,$18,$54,$75,$18,$0F,$F8,$3F,$F0
      
.end
.end
Alright Elfprince, you're well on your way. Very Happy

My only regret is that I couldn't have been on here earlier to help. By the time I signed in, everything was pretty much fixed.

Glad to see you're becoming a member of the ASM club. Our only rule is that no n00bs are allowed (and that is only because if you can get asm working....you're not a n00b Smile).
thank you.

the debugging time on this was actually a lot shorter than the amount of time I spent on my first 400 byte Basic program...this comes in at around 300.
Cool Cool Do you have any plans for upcoming ASM programs? Have you had any ideas for programs that just weren't feasable in BASIC (due to speed, etc) that you will now bring to fruition?

Please don't take offense to my comments on BASIC, but there are somethings that are better left to faster languages (not that you can't make them in BASIC, as you have clearly shown time and time again).
  
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement