band32.asm 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ; FASTCALL bitwise and 32 version.
  2. ; Performs 32bit and 32bit and returns the bitwise
  3. ; result in DE,HL
  4. ; First operand in DE,HL 2nd operand into the stack
  5. ;
  6. __BAND32:
  7. lda z80_h ;- ld b,h
  8. sta z80_b
  9. lda z80_l ;- ld c,l ; BC <- HL
  10. sta z80_c
  11. pla ;- pop hl ; Return address
  12. sta z80_h
  13. pla
  14. sta z80_l
  15. tsx ;- ex (sp),hl ; HL <- Lower part of 2nd Operand
  16. lda $0103,x
  17. ldy z80_h
  18. sta z80_h
  19. tya
  20. sta $0103,x
  21. lda $0104,x
  22. ldy z80_l
  23. sta z80_l
  24. tya
  25. sta $104,x
  26. lda z80_b ;- ld a,b
  27. sta z80_a
  28. and z80_h ;- and h
  29. lda z80_a ;- ld b,a
  30. sta z80_b
  31. lda z80_c ;- ld a,c
  32. sta z80_a
  33. and z80_l ;- and l
  34. lda z80_a ;- ld c,a ;- BC <- BC & HL
  35. sta z80_c
  36. pla ;- pop hl ; Return address
  37. sta z80_h
  38. pla
  39. sta z80_l
  40. tsx ;- ex (sp),hl ; HL <- High part of 2nd Operand
  41. lda $0103,x
  42. ldy z80_h
  43. sta z80_h
  44. tya
  45. sta $0103,x
  46. lda $0104,x
  47. ldy z80_l
  48. sta z80_l
  49. tya
  50. sta $104,x
  51. lda z80_d ;- ld a,d
  52. sta z80_a
  53. and z80_h ;- and h
  54. lda z80_a ;- ld d,a
  55. sta z80_d
  56. lda z80_e ;- ld a,e
  57. sta z80_a
  58. and z80_l ;- and l
  59. lda z80_a ;- ld e,a ; DE <- DE & HL
  60. sta z80_e
  61. lda z80_b ;- ld h,b
  62. sta z80_h
  63. lda z80_c ;- ld l,c ; HL <- BC ; Always return DE,HL pair regs
  64. sta z80_l
  65. rts ;- ret