![]() |
Routines |
| Prev: 43355 | Up: Map | Next: 43445 |
|
||||||||||||||||
| RotateAndExtractCharacterCode | 43408 | PUSH DE | Stash DE on the stack. | |||||||||||||
|
Read two bytes from the bit-packed data.
|
||||||||||||||||
| 43409 | LD D,(HL) | Load two bytes from the bit-packed data into DE. | ||||||||||||||
| 43410 | INC HL | |||||||||||||||
| 43411 | LD E,(HL) | |||||||||||||||
| 43412 | DEC HL | Decrease HL by one (restore the pointer). | ||||||||||||||
| 43413 | LD A,C | Jump to RotateAndExtractCharacterCode_UpdateRotation if no rotation is needed. | ||||||||||||||
| 43414 | AND A | |||||||||||||||
| 43415 | JR Z,RotateAndExtractCharacterCode_UpdateRotation | |||||||||||||||
|
Rotate the two bytes left by the rotation count.
|
||||||||||||||||
| RotateAndExtractCharacterCode_RotateLoop | 43417 | SLA E | Shift E left (with carry) (move bit from high byte to carry). | |||||||||||||
| 43419 | RL D | Rotate D left (move carry bit into low byte). | ||||||||||||||
| 43421 | DEC A | Decrease A (the rotation counter) by one. | ||||||||||||||
| 43422 | JR NZ,RotateAndExtractCharacterCode_RotateLoop | Jump to RotateAndExtractCharacterCode_RotateLoop if more rotations are needed. | ||||||||||||||
|
Update the rotation count for the next character extraction.
|
||||||||||||||||
| RotateAndExtractCharacterCode_UpdateRotation | 43424 | LD A,C | A=C (load the current rotation count). | |||||||||||||
| 43425 | ADD A,5 | A+=5 (add 5 bits for the character we're extracting). | ||||||||||||||
| 43427 | CP 8 | Jump to RotateAndExtractCharacterCode_Extract if we haven't crossed a byte boundary (A is less than 8). | ||||||||||||||
| 43429 | JR C,RotateAndExtractCharacterCode_Extract | |||||||||||||||
| 43431 | SUB 8 | A-=8 (wrap around within the byte). | ||||||||||||||
| 43433 | INC HL | Increment HL by one (move to the next byte for the next character). | ||||||||||||||
| RotateAndExtractCharacterCode_Extract | 43434 | LD C,A | C=A (store the updated rotation count). | |||||||||||||
| 43435 | LD A,D | A=D (load the rotated low byte). | ||||||||||||||
| 43436 | POP DE | Restore DE from the stack. | ||||||||||||||
|
Extract the 5-bit character code from the rotated byte.
|
||||||||||||||||
| 43437 | RRCA | RRCA three times (shift right by 3 bits to align the 5-bit code). | ||||||||||||||
| 43438 | RRCA | |||||||||||||||
| 43439 | RRCA | |||||||||||||||
| 43440 | AND %00011111 | Keep only bits 0-4 (extract the 5-bit character code). | ||||||||||||||
| 43442 | ADD A,96 | A+=96 (convert to ASCII character code range 96-127). | ||||||||||||||
| 43444 | RET | Return. | ||||||||||||||
| Prev: 43355 | Up: Map | Next: 43445 |