Advertisement
sci4me

Relay CPU Software Stack

Oct 16th, 2016
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. .macro push 1
  2. st a ppm_save_a
  3. st b ppm_save_b
  4. st c ppm_save_c
  5. st d ppm_save_d
  6.  
  7. st %1 ppm_sp_high
  8.  
  9. ld b ppm_sp_low
  10. ldi c #-1
  11. add a
  12. st a ppm_sp_low
  13.  
  14. ld a ppm_save_a
  15. ld b ppm_save_b
  16. ld c ppm_save_c
  17. ld d ppm_save_d
  18. .endmacro
  19.  
  20. .macro pop 1
  21. st a ppm_save_a
  22. st b ppm_save_b
  23. st c ppm_save_c
  24. st d ppm_save_d
  25.  
  26. ld b ppm_sp_low
  27. ldi c #1
  28. add a
  29. st a ppm_sp_low
  30.  
  31. ld a ppm_sp_high
  32. st a ppm_load
  33.  
  34. ld a ppm_save_a
  35. ld b ppm_save_b
  36. ld c ppm_save_c
  37. ld d ppm_save_d
  38.  
  39. ld %1 ppm_load
  40. .endmacro
  41.  
  42. jmp start
  43.  
  44. .resb 256
  45.  
  46. ppm_save_a: .resb 1
  47. ppm_save_b: .resb 1
  48. ppm_save_c: .resb 1
  49. ppm_save_d: .resb 1
  50. ppm_load: .resb 1
  51. ppm_sp_high: .resb 1
  52. ppm_sp_low: .db -1
  53.  
  54. start: ldi a #1
  55. ldi b #2
  56. ldi c #3
  57. ldi d #4
  58.  
  59. push a
  60. push b
  61. push c
  62. push d
  63.  
  64. pop a
  65. pop b
  66. pop c
  67. pop d
  68.  
  69. hlt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement