×   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

Save Integer to Zero Page Address

Submitted by Steve Fewell

Routine: izpout
Name: Save Integer to Zero Page Address
Starting Address: &BDC6
Entry criteria: X is the Zero page address of the first of 4 sequential bytes of memory in which to store a 32-bit Integer variable.
Exit: The zero page locations pointed to by X (That is locations 00,X to 03,X) now contain the 32-bit Integer from the IWA.

Description:
The contents of the IWA are copied to the zero page memory locations pointed to by the X register (The number is stored least significant byte first, one byte is copied at a time). The routine sets A to #&40 to indicate that an Integer number is being processed before exiting.

There is another routine which saves the IWA to any address, but we need this zero page routine because it executing a lot faster than the one which allows longer addresses.

Disassembly for the Save Integer to Zero Page Address routine

BDC6 * 165 042 A5 2A LDA &2A
BDC8   149 000 95 00 STA &00,X
BDCA + 165 043 A5 2B LDA &2B
BDCC   149 001 95 01 STA &01,X
BDCE , 165 044 A5 2C LDA &2C
BDD0   149 002 95 02 STA &02,X
BDD2 - 165 045 A5 2D LDA &2D
BDD4   149 003 95 03 STA &03,X
BDD6 ` 096 60 RTS

 


 Back to 8BS
Or