×   Main Menu ALL The 8BS News Manuals (New menu) Links Worth a Look Tools Disc and Basic Webring Site Map 8BS Guestbook Old Guest Book Me The Barnsley Rovers   
8-Bit Software

The BBC and Master Computer Public Domain Library

Load IWA with Integer from Address

Submitted by Steve Fewell

Routine: iin
Name: Load Integer from Address
Starting Address: &B1AA
Entry criteria: &2A and &2B (lo, hi) contain the address of the Least Significant (first) byte of a 32-bit Integer variable.
Exit: IWA contains the 32-bit Integer number pointed to by &2A, &2B.

Description:
Loads the IWA with the 32-bit Integer pointed to by the zero page locations &2A (low byte) and &2B (high byte). The bytes are copied most significant byte first. The 2nd byte (which should go into IWA location &2B) is temporally stored in X, as &2B is also being used as the address pointer, and we don't want to corrupt it before we've read the complete Integer variable!

The routine sets A to #&40 to indicate that an Integer number is being processed before exiting.

Disassembly for the Load IWA with Integer from Address routine

B1AA   160 003 A0 03 LDY#&03
B1AC * 177 042 B1 2A LDA (&2A),Y
B1AE - 133 045 85 2D STA &2D
B1B0   136 88 DEY
B1B1 * 177 042 B1 2A LDA (&2A),Y
B1B3 , 133 044 85 2C STA &2C
B1B5   136 88 DEY
B1B6 * 177 042 B1 2A LDA (&2A),Y
B1B8   170 AA TAX
B1B9 * 178 042 B2 2A LDA (&2A)
B1BB * 133 042 85 2A STA &2A
B1BD + 134 043 86 2B STX &2B
B1BF @ 169 064 A9 40 LDA#&40
B1C1 ` 096 60 RTS

 


 Back to 8BS
Or