| Currah μSpeech | Routines |
| Prev: 01AB | Up: Map | Next: 021F |
|
Walk the BASIC variable area looking for the name code in A.
|
||||||||||||||
| FindVariable | 01CD | LD B,A | Keep the name code in B. | |||||||||||
| 01CE | LD A,($5C3B) | Fetch *FLAGS. | ||||||||||||
| 01D1 | RLA | Jump to FindVariable_Miss if bit 7 is not set. | ||||||||||||
| 01D2 | JR NC,FindVariable_Miss | |||||||||||||
| 01D4 | LD A,($5CB6) | Fetch *CHINFO. | ||||||||||||
| 01D7 | CP $F4 | Jump to FindVariable_Start if it is F4. | ||||||||||||
| 01D9 | JR Z,FindVariable_Start | |||||||||||||
| 01DB | OR A | Jump to FindVariable_Miss if it is not 00. | ||||||||||||
| 01DC | JR NZ,FindVariable_Miss | |||||||||||||
|
Walk *VARS for the requested name.
|
||||||||||||||
| FindVariable_Start | 01DE | LD HL,($5C4B) | Start at *VARS. | |||||||||||
| FindVariable_Loop | 01E1 | LD A,(HL) | Return if this is the requested variable. | |||||||||||
| 01E2 | CP B | |||||||||||||
| 01E3 | RET Z | |||||||||||||
| 01E4 | CP $80 | Jump to FindVariable_Miss if this is the end of *VARS. | ||||||||||||
| 01E6 | JR Z,FindVariable_Miss | |||||||||||||
| 01E8 | AND %11100000 | Keep only bits 5-7 (the variable type). | ||||||||||||
| 01EA | CP $60 | Jump to FindVariable_SkipNumeric if the type is 60. | ||||||||||||
| 01EC | JR Z,FindVariable_SkipNumeric | |||||||||||||
| 01EE | CP $A0 | Jump to FindVariable_SkipName if the type is A0. | ||||||||||||
| 01F0 | JR Z,FindVariable_SkipName | |||||||||||||
| 01F2 | CP $E0 | Jump to FindVariable_SkipArray if the type is E0. | ||||||||||||
| 01F4 | JR Z,FindVariable_SkipArray | |||||||||||||
| 01F6 | CP $C0 | Jump to FindVariable_SkipWord if the type is C0. | ||||||||||||
| 01F8 | JR Z,FindVariable_SkipWord | |||||||||||||
| 01FA | CP $80 | Jump to FindVariable_SkipWord if the type is 80. | ||||||||||||
| 01FC | JR Z,FindVariable_SkipWord | |||||||||||||
| 01FE | CP $40 | Return if the type is not a simple numeric. | ||||||||||||
| 0200 | RET NZ | |||||||||||||
| FindVariable_SkipWord | 0201 | INC HL | Skip the following length word and jump to FindVariable_Loop. | |||||||||||
| 0202 | LD E,(HL) | |||||||||||||
| 0203 | INC HL | |||||||||||||
| 0204 | LD D,(HL) | |||||||||||||
| 0205 | INC HL | |||||||||||||
| 0206 | ADD HL,DE | |||||||||||||
| 0207 | JR FindVariable_Loop | |||||||||||||
| FindVariable_Miss | 0209 | LD A,$80 | Clear the Z flag. | |||||||||||
| 020B | AND A | |||||||||||||
| 020C | RET | Return. | ||||||||||||
| FindVariable_SkipArray | 020D | LD DE,$000D | Skip the array header. | |||||||||||
| 0210 | ADD HL,DE | |||||||||||||
| FindVariable_SkipNumeric | 0211 | LD DE,$0006 | Skip the numeric value and jump to FindVariable_Loop. | |||||||||||
| 0214 | ADD HL,DE | |||||||||||||
| 0215 | JR FindVariable_Loop | |||||||||||||
| FindVariable_SkipName | 0217 | INC HL | Move to the next letter of the long name. | |||||||||||
| 0218 | LD A,(HL) | Jump to FindVariable_SkipName if the name has not ended. | ||||||||||||
| 0219 | SLA A | |||||||||||||
| 021B | JR NC,FindVariable_SkipName | |||||||||||||
| 021D | JR FindVariable_SkipNumeric | Jump to FindVariable_SkipNumeric. | ||||||||||||
| Prev: 01AB | Up: Map | Next: 021F |