8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly


Page Last Altered:

B1A0 Load Variable

Submitted by Steve Fewell

Routine:loadvar
Name: Load Variable
Starting Address: &B1C2
Entry criteria: &2A and &2B point to the address of the variable's value.
&2C contains the Type of the value to load.
Exit: The value has been loaded into the appropriate storage location (IWA, FWA or SWA).
The address in (&2A and &2B) could be destroyed.

Description:

If &2C is negative (probable &80 or &81) then we are loading a string value, so jump
to routine &B1F7.
If &2C is zero then we are loading a 1-byte Integer value, so jump to routine &B1C2.
If &2C is &05 then we are loading a Floating-Point value, so jump to routine &B1C7.
Otherwise, &2C must be &04, so we are loading an Integer value, so continue with routine &B1AA.


Disassembly for the Load Variable routine

B1A0 , 164 044 A4 2C LDY &2C
B1A2 0S 048 083 30 53 BMI 83 --> &B1F7 Load SWA with String Value
B1A4   240 028 F0 1C BEQ 28 --> &B1C2 Load IWA with 1-byte Integer value
B1A6   192 005 C0 05 CPY#&05
B1A8   240 029 F0 1D BEQ 29 --> &B1C7 Load FWA with Floating-Point Value (ain)
B1AA   ...Load IWA with Integer Value

 


 Back to 8BS
Or