Submitted by Steve Fewell
Routine:apack
Name: Pack FWA to Floating-Point Variable
Starting Address: &A519
Entry criteria: &4A and &4B (the argp) point to the first byte of the address
that should be used to store the packed 5-byte Floating-Point variable.
Exit: The FWA value has been converted to 5-byte variable format
and copied to the address specified.
Description:
The 1st byte of the variable is set to the FWA exponent.
The 2nd byte of the variable is set to the FWA Sign byte EORed with the FWA Mantissa byte 1.
(this sets the top bit to 1 (if positive number [sign=0]) or 0 (if negative number [sign not 0])
the value is now ANDed with #&80 to clear all bits except for the top bit (which we want to preserve).
the value is lastly EORed with the Mantissa byte 1 to replace bits 0 to 6 with the Mantissa byte 1 (preserving the top bit).
The 3rd byte of the variable is set to the FWA Mantissa byte 2.
The 4th byte of the variable is set to the FWA Mantissa byte 3.
The 5th byte of the variable is set to the FWA Mantissa byte 4.
A519 | 0 | 165 048 | A5 30 | LDA &30 |
A51B | J | 146 074 | 92 4A | STA (&4A) |
A51D | 160 001 | A0 01 | LDY#&01 | |
A51F | . | 165 046 | A5 2E | LDA &2E |
A521 | E1 | 069 049 | 45 31 | EOR &31 |
A523 | ) | 041 128 | 29 80 | AND#&80 |
A525 | E1 | 069 049 | 45 31 | EOR &31 |
A527 | J | 145 074 | 91 4A | STA (&4A),Y |
A529 | 2 | 165 050 | A5 32 | LDA &32 |
A52B | 200 | C8 | INY | |
A52C | J | 145 074 | 91 4A | STA (&4A),Y |
A52E | 3 | 165 051 | A5 33 | LDA &33 |
A530 | 200 | C8 | INY | |
A531 | J | 145 074 | 91 4A | STA (&4A),Y |
A533 | 4 | 165 052 | A5 34 | LDA &34 |
A535 | 200 | C8 | INY | |
A536 | J | 145 074 | 91 4A | STA (&4A),Y |
A538 | ` | 096 | 60 | RTS |