Prev: A94B Up: Map Next: A9A5
A96B: get fixed-point number into temporary integer
Used by the routines at A49C, A69C, A8A0 and A94B.
A96B A2 00 LDX #$00 clear X
A96D 86 14 STX $14 clear temporary integer low byte
A96F 86 15 STX $15 clear temporary integer high byte
A971 B0 F7 BCS $A96A return if carry set, end of scan, character was not 0-9
A973 E9 2F SBC #$2F subtract $30, $2F+carry, from byte
A975 85 07 STA $07 store #
A977 A5 15 LDA $15 get temporary integer high byte
A979 85 22 STA $22 save it for now
A97B C9 19 CMP #$19 compare with $19
A97D B0 D4 BCS $A953 branch if >=
this makes the maximum line number 63999 because the next bit does $1900 * $0A = $FA00 = 64000 decimal. the branch target is really the SYNTAX error at $A8E8 but that is too far so an intermediate compare and branch to that location is used. the problem with this is that line number that gives a partial result from $8900 to $89FF, 35072x to 35327x, will pass the new target compare and will try to execute the remainder of the ON n GOTO/GOSUB. a solution to this is to copy the byte in A before the branch to X and then branch to $A955 skipping the second compare
A97F A5 14 LDA $14 get temporary integer low byte
A981 0A ASL A *2 low byte
A982 26 22 ROL $22 *2 high byte
A984 0A ASL A *2 low byte
A985 26 22 ROL $22 *2 high byte (*4)
A987 65 14 ADC $14 + low byte (*5)
A989 85 14 STA $14 save it
A98B A5 22 LDA $22 get high byte temp
A98D 65 15 ADC $15 + high byte (*5)
A98F 85 15 STA $15 save it
A991 06 14 ASL $14 *2 low byte (*10d)
A993 26 15 ROL $15 *2 high byte (*10d)
A995 A5 14 LDA $14 get low byte
A997 65 07 ADC $07 add #
A999 85 14 STA $14 save low byte
A99B 90 02 BCC $A99F branch if no overflow to high byte
A99D E6 15 INC $15 else increment high byte
A99F 20 73 00 JSR $0073 increment and scan memory
A9A2 4C 71 A9 JMP $A971 loop for next character
Prev: A94B Up: Map Next: A9A5