Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;--------------------------------------------------------------------------
- ;- Programmer: Zach Bunce, Kaioli Bessert, and Garrett Maxon
- ;- Date: 2/17/17
- ;-
- ;- Creates a firmware-based stack originating from 0xD0
- ;- Includes Push and Pop subroutines to allow for stack manipulation
- ;--------------------------------------------------------------------------
- ;--------------------------------------------------------------------------
- ;- Register Constants
- ;--------------------------------------------------------------------------
- .DEF DATA = R30 ;Registers named to be easier to follow.
- .DEF SP = R31
- ;--------------------------------------------------------------------------
- ;-- .ORG used in code segment
- ;--------------------------------------------------------------------------
- .CSEG
- .ORG 0x10
- ;--------------------------------------------------------------------------
- ;-- Code Segment
- ;--------------------------------------------------------------------------
- INIT: MOV SP, 0xD1 ;Sets the stack pointer register to 0xD1
- S_PUSH: SUB SP, 0x01 ;Decrements the stack pointer
- ST DATA, (R31) ;Pushes the data onto the stack
- S_POP: LD DATA, (R31) ;Pops the data off the stack
- ADD SP, 0x01 ;Increments the stack pointer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement