Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ParseStringLoop: ;take in a string and check each character. If the character is an A, call aDetected. Same with B. If the end of the string is reached, end.
- ld a,(hl)
- push bc ; we are pushing BC and HL to the stack
- push hl ; so that they are preserved when we call aDetected and bDetected
- cp 97
- call z, aDetected
- cp 98
- call z, bDetected
- pop hl ; now we pop them off in reverse order
- pop bc ; because that's how the stack works
- inc hl
- dec bc
- ld a,b
- or c
- jr nz, ParseStringLoop
- ret
- aDetected: ;put draw a_tile into the graphics buffer.
- ld hl,a_tile
- ld bc,(8*256)+8 ; If you want B=8 and C=8 this gets the job done because... hexadecimal (I don't know how to explain this, ask geekboy or Kerm)
- call drawSprite8bpp
- xor a ; This sets A=0 so that we don't accidentally trigger any of the other routines
- ret
- bDetected: ;draw b_tile into the graphics buffer.
- ld hl,b_tile
- ld bc,(30*256)+30
- call drawSprite8bpp
- xor a
- ret
Advertisement
Add Comment
Please, Sign In to add comment