8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly

Page Last Altered:

IWA = 8-bit or 16-bit Integer

Submitted by Steve Fewell

Routine: i16-bit
Name: IWA = 8-bit or 16-bit Integer
Starting Address: &AE1A for 16-bit value [or AE18 for 8-bit]
Entry criteria: A contains the least significant byte of the 16-bit number, Y contains the most significant byte of the 16-bit number.
[Y is always set to 0 when called from AE18, so only need to supply A].
Exit: IWA contains the 8-bit or 16-bit number [(256 * Y)  + A].

Stores an 8-bit [if called from AE18] or 16-bit [if called from AE1A] number (The 16-bit value is represented by 2 individual bytes) into the IWA and sets the 2 most significant bytes (or in the case or an 8-bit value, the 3 most significant bytes) of the IWA to zero.

Disassembly for the IWA = 8-bit or 16-bit Integer routine

AE18   160 000 A0 00 LDY#&00
AE1A * 133 042 85 2A STA &2A
AE1C + 132 043 84 2B STY &2B
AE1E d, 100 044 64 2C STZ &2C
AE20 d- 100 045 64 2D STZ &2D
AE22 @ 169 064 A9 40 LDA#&40
AE24 ` 096 60 RTS


 Back to 8BS