Prev: A49C Up: Map Next: A560
A533: rebuild BASIC line chaining
Used by the routines at A49C and E195.
A533 A5 2B LDA $2B get start of memory low byte
A535 A4 2C LDY $2C get start of memory high byte
A537 85 22 STA $22 set line start pointer low byte
A539 84 23 STY $23 set line start pointer high byte
A53B 18 CLC clear carry for add
A53C A0 01 LDY #$01 set index to pointer to next line high byte
A53E B1 22 LDA ($22),Y get pointer to next line high byte
A540 F0 1D BEQ $A55F exit if null, [EOT]
A542 A0 04 LDY #$04 point to first code byte of line
there is always 1 byte + [EOL] as null entries are deleted
A544 C8 INY next code byte
A545 B1 22 LDA ($22),Y get byte
A547 D0 FB BNE $A544 loop if not [EOL]
A549 C8 INY point to byte past [EOL], start of next line
A54A 98 TYA copy it
A54B 65 22 ADC $22 add line start pointer low byte
A54D AA TAX copy to X
A54E A0 00 LDY #$00 clear index, point to this line's next line pointer
A550 91 22 STA ($22),Y set next line pointer low byte
A552 A5 23 LDA $23 get line start pointer high byte
A554 69 00 ADC #$00 add any overflow
A556 C8 INY increment index to high byte
A557 91 22 STA ($22),Y set next line pointer high byte
A559 86 22 STX $22 set line start pointer low byte
A55B 85 23 STA $23 set line start pointer high byte
A55D 90 DD BCC $A53C go do next line, branch always
A55F 60 RTS
Prev: A49C Up: Map Next: A560