pushf.asm 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ; Routine to push Float pointed by HL
  2. ; Into the stack. Notice that the hl points to the last
  3. ; byte of the FP number.
  4. ; Uses H'L' B'C' and D'E' to preserve ABCDEHL registers
  5. ;
  6. __FP_PUSH_REV:
  7. lda z80_l ;- push hl
  8. pha
  9. lda z80_h
  10. pha
  11. lda z80_c ;- exx
  12. ldx z80_cp
  13. stx z80_c
  14. sta z80_cp
  15. lda z80_b
  16. ldx z80_bp
  17. stx z80_b
  18. sta z80_bp
  19. lda z80_e
  20. ldx z80_ep
  21. stx z80_e
  22. sta z80_ep
  23. lda z80_d
  24. ldx z80_dp
  25. stx z80_d
  26. sta z80_dp
  27. lda z80_l
  28. ldx z80_lp
  29. stx z80_l
  30. sta z80_lp
  31. lda z80_h
  32. ldx z80_hp
  33. stx z80_h
  34. sta z80_hp
  35. pla ;- pop hl
  36. sta z80_h
  37. pla
  38. sta z80_l
  39. pla ;- pop bc ; Return Address
  40. sta z80_b
  41. pla
  42. sta z80_c
  43. ldy #$00 ;- ld d,(hl)
  44. lda (z80_hl),y
  45. sta z80_d
  46. lda z80_l ;- dec_hl
  47. bne dec_hl_no_dec_h
  48. dec z80_h
  49. dec_hl_no_dec_h:
  50. dec z80_l
  51. ldy #$00 ;- ld e,(hl)
  52. lda (z80_hl),y
  53. sta z80_e
  54. lda z80_l ;- dec_hl
  55. bne dec_hl_no_dec_h
  56. dec z80_h
  57. dec_hl_no_dec_h:
  58. dec z80_l
  59. lda z80_e ;- push de
  60. pha
  61. lda z80_d
  62. pha
  63. ldy #$00 ;- ld d,(hl)
  64. lda (z80_hl),y
  65. sta z80_d
  66. lda z80_l ;- dec_hl
  67. bne dec_hl_no_dec_h
  68. dec z80_h
  69. dec_hl_no_dec_h:
  70. dec z80_l
  71. ldy #$00 ;- ld e,(hl)
  72. lda (z80_hl),y
  73. sta z80_e
  74. lda z80_l ;- dec_hl
  75. bne dec_hl_no_dec_h
  76. dec z80_h
  77. dec_hl_no_dec_h:
  78. dec z80_l
  79. lda z80_e ;- push de
  80. pha
  81. lda z80_d
  82. pha
  83. ldy #$00 ;- ld d,(hl)
  84. lda (z80_hl),y
  85. sta z80_d
  86. lda z80_e ;- push de
  87. pha
  88. lda z80_d
  89. pha
  90. lda z80_c ;- push bc ; Return Address
  91. pha
  92. lda z80_b
  93. pha
  94. lda z80_c ;- exx
  95. ldx z80_cp
  96. stx z80_c
  97. sta z80_cp
  98. lda z80_b
  99. ldx z80_bp
  100. stx z80_b
  101. sta z80_bp
  102. lda z80_e
  103. ldx z80_ep
  104. stx z80_e
  105. sta z80_ep
  106. lda z80_d
  107. ldx z80_dp
  108. stx z80_d
  109. sta z80_dp
  110. lda z80_l
  111. ldx z80_lp
  112. stx z80_l
  113. sta z80_lp
  114. lda z80_h
  115. ldx z80_hp
  116. stx z80_h
  117. sta z80_hp
  118. rts ;- ret