Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;--------------------------------------------------------------------------
  2. ;- Programmer: Zach Bunce, Kaioli Bessert, and Garrett Maxon
  3. ;- Date: 2/17/17
  4. ;-
  5. ;- Creates a firmware-based stack originating from 0xD0
  6. ;- Includes Push and Pop subroutines to allow for stack manipulation
  7. ;--------------------------------------------------------------------------
  8.  
  9. ;--------------------------------------------------------------------------
  10. ;- Register Constants
  11. ;--------------------------------------------------------------------------
  12. .DEF DATA = R30         ;Registers named to be easier to follow.
  13. .DEF SP   = R31
  14.  
  15. ;--------------------------------------------------------------------------
  16. ;-- .ORG used in code segment
  17. ;--------------------------------------------------------------------------
  18. .CSEG
  19. .ORG    0x10
  20.  
  21. ;--------------------------------------------------------------------------
  22. ;-- Code Segment
  23. ;--------------------------------------------------------------------------
  24. INIT:       MOV     SP, 0xD1    ;Sets the stack pointer register to 0xD1
  25.  
  26.  
  27. S_PUSH: SUB SP, 0x01    ;Decrements the stack pointer
  28.         ST  DATA, (R31) ;Pushes the data onto the stack
  29.  
  30. S_POP:      LD  DATA, (R31) ;Pops the data off the stack
  31.         ADD SP, 0x01    ;Increments the stack pointer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement