Guest User

Hmm... it's fixed!

a guest
Dec 21st, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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.
  2.  ld a,(hl)
  3.  push bc ; we are pushing BC and HL to the stack
  4.  push hl ; so that they are preserved when we call aDetected and bDetected
  5.  cp 97
  6.  call z, aDetected
  7.  cp 98
  8.  call z, bDetected
  9.  pop hl ; now we pop them off in reverse order
  10.  pop bc ; because that's how the stack works
  11.  inc hl
  12.  dec bc
  13.  ld a,b
  14.  or c        
  15.  jr nz, ParseStringLoop
  16.  ret
  17. aDetected: ;put draw a_tile into the graphics buffer.
  18.  ld hl,a_tile
  19.  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)
  20.  call drawSprite8bpp
  21.  xor a ; This sets A=0 so that we don't accidentally trigger any of the other routines
  22.  ret
  23. bDetected: ;draw b_tile into the graphics buffer.
  24.  ld hl,b_tile
  25.  ld bc,(30*256)+30
  26.  call drawSprite8bpp
  27.  xor a
  28.  ret
Advertisement
Add Comment
Please, Sign In to add comment