C64 ROM | Routines |
Prev: A483 | Up: Map | Next: A533 |
Used by the routine at A483.
|
||||
A49C | 20 6B A9 | JSR $A96B | get fixed-point number into temporary integer | |
A49F | 20 79 A5 | JSR $A579 | crunch keywords into BASIC tokens | |
A4A2 | 84 0B | STY $0B | save index pointer to end of crunched line | |
A4A4 | 20 13 A6 | JSR $A613 | search BASIC for temporary integer line number | |
A4A7 | 90 44 | BCC $A4ED | if not found skip the line delete | |
line # already exists so delete it
|
||||
A4A9 | A0 01 | LDY #$01 | set index to next line pointer high byte | |
A4AB | B1 5F | LDA ($5F),Y | get next line pointer high byte | |
A4AD | 85 23 | STA $23 | save it | |
A4AF | A5 2D | LDA $2D | get start of variables low byte | |
A4B1 | 85 22 | STA $22 | save it | |
A4B3 | A5 60 | LDA $60 | get found line pointer high byte | |
A4B5 | 85 25 | STA $25 | save it | |
A4B7 | A5 5F | LDA $5F | get found line pointer low byte | |
A4B9 | 88 | DEY | decrement index | |
A4BA | F1 5F | SBC ($5F),Y | subtract next line pointer low byte | |
A4BC | 18 | CLC | clear carry for add | |
A4BD | 65 2D | ADC $2D | add start of variables low byte | |
A4BF | 85 2D | STA $2D | set start of variables low byte | |
A4C1 | 85 24 | STA $24 | save destination pointer low byte | |
A4C3 | A5 2E | LDA $2E | get start of variables high byte | |
A4C5 | 69 FF | ADC #$FF | -1 + carry | |
A4C7 | 85 2E | STA $2E | set start of variables high byte | |
A4C9 | E5 60 | SBC $60 | subtract found line pointer high byte | |
A4CB | AA | TAX | copy to block count | |
A4CC | 38 | SEC | set carry for subtract | |
A4CD | A5 5F | LDA $5F | get found line pointer low byte | |
A4CF | E5 2D | SBC $2D | subtract start of variables low byte | |
A4D1 | A8 | TAY | copy to bytes in first block count | |
A4D2 | B0 03 | BCS $A4D7 | branch if no underflow | |
A4D4 | E8 | INX | increment block count, correct for = 0 loop exit | |
A4D5 | C6 25 | DEC $25 | decrement destination high byte | |
A4D7 | 18 | CLC | clear carry for add | |
A4D8 | 65 22 | ADC $22 | add source pointer low byte | |
A4DA | 90 03 | BCC $A4DF | branch if no overflow | |
A4DC | C6 23 | DEC $23 | else decrement source pointer high byte | |
A4DE | 18 | CLC | clear carry | |
close up memory to delete old line
|
||||
A4DF | B1 22 | LDA ($22),Y | get byte from source | |
A4E1 | 91 24 | STA ($24),Y | copy to destination | |
A4E3 | C8 | INY | increment index | |
A4E4 | D0 F9 | BNE $A4DF | while <> 0 do this block | |
A4E6 | E6 23 | INC $23 | increment source pointer high byte | |
A4E8 | E6 25 | INC $25 | increment destination pointer high byte | |
A4EA | CA | DEX | decrement block count | |
A4EB | D0 F2 | BNE $A4DF | loop until all done | |
got new line in buffer and no existing same #
|
||||
A4ED | 20 59 A6 | JSR $A659 | reset execution to start, clear variables, flush stack and return | |
A4F0 | 20 33 A5 | JSR $A533 | rebuild BASIC line chaining | |
A4F3 | AD 00 02 | LDA $0200 | get first byte from buffer | |
A4F6 | F0 88 | BEQ $A480 | if no line go do BASIC warm start | |
else insert line into memory
|
||||
A4F8 | 18 | CLC | clear carry for add | |
A4F9 | A5 2D | LDA $2D | get start of variables low byte | |
A4FB | 85 5A | STA $5A | save as source end pointer low byte | |
A4FD | 65 0B | ADC $0B | add index pointer to end of crunched line | |
A4FF | 85 58 | STA $58 | save as destination end pointer low byte | |
A501 | A4 2E | LDY $2E | get start of variables high byte | |
A503 | 84 5B | STY $5B | save as source end pointer high byte | |
A505 | 90 01 | BCC $A508 | branch if no carry to high byte | |
A507 | C8 | INY | else increment high byte | |
A508 | 84 59 | STY $59 | save as destination end pointer high byte | |
A50A | 20 B8 A3 | JSR $A3B8 | open up space in memory | |
most of what remains to do is copy the crunched line into the space opened up in memory, however, before the crunched line comes the next line pointer and the line number. the line number is retrieved from the temporary integer and stored in memory, this overwrites the bottom two bytes on the stack. next the line is copied and the next line pointer is filled with whatever was in two bytes above the line number in the stack. this is ok because the line pointer gets fixed in the line chain re-build.
|
||||
A50D | A5 14 | LDA $14 | get line number low byte | |
A50F | A4 15 | LDY $15 | get line number high byte | |
A511 | 8D FE 01 | STA $01FE | save line number low byte before crunched line | |
A514 | 8C FF 01 | STY $01FF | save line number high byte before crunched line | |
A517 | A5 31 | LDA $31 | get end of arrays low byte | |
A519 | A4 32 | LDY $32 | get end of arrays high byte | |
A51B | 85 2D | STA $2D | set start of variables low byte | |
A51D | 84 2E | STY $2E | set start of variables high byte | |
A51F | A4 0B | LDY $0B | get index to end of crunched line | |
A521 | 88 | DEY | -1 | |
A522 | B9 FC 01 | LDA $01FC,Y | get byte from crunched line | |
A525 | 91 5F | STA ($5F),Y | save byte to memory | |
A527 | 88 | DEY | decrement index | |
A528 | 10 F8 | BPL $A522 | loop while more to do | |
This entry point is used by the routine at E195.
reset execution, clear variables, flush stack, rebuild BASIC chain and do warm start
|
||||
A52A | 20 59 A6 | JSR $A659 | reset execution to start, clear variables and flush stack | |
A52D | 20 33 A5 | JSR $A533 | rebuild BASIC line chaining | |
A530 | 4C 80 A4 | JMP $A480 | go do BASIC warm start |
Prev: A483 | Up: Map | Next: A533 |