Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ParseString:
- ld hl,Picture ;the memory address at the start of our thingy
- ld bc,1200 ;the number of bytes we are going to read
- ld de,0 ;we can do a 16-bit compare
- ParseStringLoop: ;the loop body
- ld a,(hl) ;put the byte currently being tested in accumulator for testing
- cp 97 ;is it the ASCII value for 'a'?
- call z, aDetected ;if it is, call this routine here
- cp 98 ;is it the ASCII value for 'b'?
- call z, bDetected ;if it is, call this routine here
- inc hl ;we're done with the current byte so we go to the next
- dec bc ;since we're done with the byte, we decrement the counter
- ld a,b ;we are going to use a for a 16-bit compare, we can use a because we are done with the previous byte
- or c ;a contains the bits in b. We now add the bits in c to the bits in a. if bc is 0, they will all remain 0. else, not zero
- cp 0 ;are they all zero? if so, bc is 0
- jp nz, ParseStringLoop ;if bc is not zero, then we are not done reading/processing bytes, and we go back to the loop body
- ret ;otherwise, we are done, and go back home.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement