lei32.asm 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #include once <lti8.asm>
  2. #include once <sub32.asm>
  3. :
  4. __LEI32: ; Test 32 bit values HLDE < Top of the stack
  5. lda z80_c ;- exx
  6. ldx z80_cp
  7. stx z80_c
  8. sta z80_cp
  9. lda z80_b
  10. ldx z80_bp
  11. stx z80_b
  12. sta z80_bp
  13. lda z80_e
  14. ldx z80_ep
  15. stx z80_e
  16. sta z80_ep
  17. lda z80_d
  18. ldx z80_dp
  19. stx z80_d
  20. sta z80_dp
  21. lda z80_l
  22. ldx z80_lp
  23. stx z80_l
  24. sta z80_lp
  25. lda z80_h
  26. ldx z80_hp
  27. stx z80_h
  28. sta z80_hp
  29. pla ;- pop de ; Preserves return address
  30. sta z80_d
  31. pla
  32. sta z80_e
  33. lda z80_c ;- exx
  34. ldx z80_cp
  35. stx z80_c
  36. sta z80_cp
  37. lda z80_b
  38. ldx z80_bp
  39. stx z80_b
  40. sta z80_bp
  41. lda z80_e
  42. ldx z80_ep
  43. stx z80_e
  44. sta z80_ep
  45. lda z80_d
  46. ldx z80_dp
  47. stx z80_d
  48. sta z80_dp
  49. lda z80_l
  50. ldx z80_lp
  51. stx z80_l
  52. sta z80_lp
  53. lda z80_h
  54. ldx z80_hp
  55. stx z80_h
  56. sta z80_hp
  57. jsr __SUB32 ;- call __SUB32
  58. lda z80_c ;- exx
  59. ldx z80_cp
  60. stx z80_c
  61. sta z80_cp
  62. lda z80_b
  63. ldx z80_bp
  64. stx z80_b
  65. sta z80_bp
  66. lda z80_e
  67. ldx z80_ep
  68. stx z80_e
  69. sta z80_ep
  70. lda z80_d
  71. ldx z80_dp
  72. stx z80_d
  73. sta z80_dp
  74. lda z80_l
  75. ldx z80_lp
  76. stx z80_l
  77. sta z80_lp
  78. lda z80_h
  79. ldx z80_hp
  80. stx z80_h
  81. sta z80_hp
  82. lda z80_e ;- push de ; Restores return address
  83. pha
  84. lda z80_d
  85. pha
  86. lda z80_c ;- exx
  87. ldx z80_cp
  88. stx z80_c
  89. sta z80_cp
  90. lda z80_b
  91. ldx z80_bp
  92. stx z80_b
  93. sta z80_bp
  94. lda z80_e
  95. ldx z80_ep
  96. stx z80_e
  97. sta z80_ep
  98. lda z80_d
  99. ldx z80_dp
  100. stx z80_d
  101. sta z80_dp
  102. lda z80_l
  103. ldx z80_lp
  104. stx z80_l
  105. sta z80_lp
  106. lda z80_h
  107. ldx z80_hp
  108. stx z80_h
  109. sta z80_hp
  110. lda #0 ;- ld a,0
  111. jne __LTI2 ;- jp nz, __LTI2 ; go for sign it Not Zero
  112. ; At this point, DE = 0. So, check HL
  113. ora z80_h ;- or h
  114. ora z80_l ;- or l
  115. ;- sub 1 ; If A = 0 => A = 0xFF & Carry
  116. ;- sbc a, a; If Carry, A = 0xFF else, 0
  117. rts ;- ret