BASIC IV ROM Routines
Page Last Altered:
Submitted by Steve Fewell
Routine: pushi
Name: Push Integer to BASIC Stack
Starting Address: &BC26
Entry criteria: The IWA contains the
32-bit Integer to store on the BASIC Stack.
Exit: A copy of the IWA has been pushed to the Stack or a "No
Room" error occurs if insufficient memory.
Description:
Subtract the required number of bytes (that is 4, as we are about to push an
Integer number) from the Stack Pointer Low Byte.
Leaving the result in A, call the routine to Check
for Stack clash with Heap (which will decrement the high byte of the Stack
Pointer, if a page boundary is crossed). Store the IWA
on the Stack.
Disassembly for the Push Integer to BASIC Stack routine
BC26 | 165 004 | A5 04 | LDA &04 | |
BC28 | 8 | 056 | 38 | SEC |
BC29 | 233 004 | E9 04 | SBC#&04 | |
BC2B | 032 030 189 | 20 1E BD | JSR &BD1E Check Stack clash with Heap | |
BC2E | 160 003 | A0 03 | LDY#&03 | |
BC30 | - | 165 045 | A5 2D | LDA &2D |
BC32 | 145 004 | 91 04 | STA (&04),Y | |
BC34 | 136 | 88 | DEY | |
BC35 | , | 165 044 | A5 2C | LDA &2C |
BC37 | 145 004 | 91 04 | STA (&04),Y | |
BC39 | 136 | 88 | DEY | |
BC3A | + | 165 043 | A5 2B | LDA &2B |
BC3C | 145 004 | 91 04 | STA (&04),Y | |
BC3E | * | 165 042 | A5 2A | LDA &2A |
BC40 | 146 004 | 92 04 | STA (&04) | |
BC42 | ` | 096 | 60 | RTS |