Submitted by Steve Fewell
Routine: izpin
Name: Load IWA with Integer from Zero Page Address
Starting Address: &AA80
Entry criteria: X is the Zero page address of the Least Significant
(first) byte of a 32-bit Integer variable
Exit: IWA contains the Integer number
pointed to by X (That is the 32-bit Integer stored in locations 00,X to 03,X).
Description:
Loads the IWA with the 32-bit Integer pointed to
by the X register (The number is stored least significant byte first, one byte
is copied at a time), and sets A to #&40 to
show that an Integer number is being processed.
There is another routine which loads the IWA from any address, but we need this zero page routine due to it executing a lot faster than the one which allows longer addresses.
Disassembly for the Load Integer from Zero Page Address routine
AA80 | 181 000 | B5 00 | LDA &00,X | |
AA82 | * | 133 042 | 85 2A | STA &2A |
AA84 | 181 001 | B5 01 | LDA &01,X | |
AA86 | + | 133 043 | 85 2B | STA &2B |
AA88 | 181 002 | B5 02 | LDA &02,X | |
AA8A | , | 133 044 | 85 2C | STA &2C |
AA8C | 181 003 | B5 03 | LDA &03,X | |
AA8E | - | 133 045 | 85 2D | STA &2D |
AA90 | @ | 169 064 | A9 40 | LDA#&40 |
AA92 | ` | 096 | 60 | RTS |