×   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

Pop Integer from the BASIC Stack

Submitted by Steve Fewell

Routine: popi
Name: Pop Integer from the BASIC Stack
Starting Address: &BCE6
Entry criteria: None
Exit: IWA contains the value of the most recent Integer number on the BASIC Stack. The Basic Stack Pointer is moved up.

Description:
Loads the IWA with the 32-bit Integer pointed to by the BASIC Stack Pointer. Then move the Stack Pointer up 4 bytes so that is points to the previous item pushed onto the stack.

Disassembly for the Pop Integer from the BASIC Stack routine

BCE6   160 003 A0 03 LDY#&03
BCE8   177 004 B1 04 LDA (&04),Y
BCEA - 133 045 85 2D STA &2D
BCEC   136 88 DEY
BCED   177 004 B1 04 LDA (&04),Y
BCEF , 133 044 85 2C STA &2C
BCF1   136 88 DEY
BCF2   177 004 B1 04 LDA (&04),Y
BCF4 + 133 043 85 2B STA &2B
BCF6   178 004 B2 04 LDA (&04)
BCF8 * 133 042 85 2A STA &2A
BCFA   024 18 CLC
BCFB   169 004 A9 04 LDA#&04
BCFD e 101 004 65 04 ADC &04
BCFF   133 004 85 04 STA &04
BD01   144 002 90 02 BCC 2 --> &BD05
BD03   230 005 E6 05 INC &05
BD05 ` 096 60 RTS

 


 Back to 8BS
Or