Advertisement
Zeda

sendByte

Aug 22nd, 2016
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. axe=1
  2. #define bcall(x) rst 28h \ .dw x
  3. .db $BB,$6D
  4. .org $9D95
  5.     bcall(4AD7h)
  6.     bcall(4AEFh)
  7.     di
  8.     xor a
  9.     out (8),a
  10.     ld a,e
  11. ;    call sendb
  12. ;    ld a,d
  13.     jp sendb
  14. sendb:
  15. ;;sends A, preserves regs except flags: returns c if good, nc if fail
  16.     push bc
  17.     ld c,0
  18.     ld b,a
  19.     ld a,$FD
  20.     out (1),a
  21.     cpl
  22.     out (0),a            ;Indicate we are ready to send
  23. _:
  24.     in a,(1)
  25.     and 40h
  26.     jr z,__SendByteDone
  27.     in a,(c)            ;Loop is 58cc min before next write
  28.     jp pe,-_            ;Keep looping till we get it
  29.     out (0),a
  30.     ld c,55h
  31. _:
  32.     rrc b
  33.     ccf
  34.     rla
  35.     sla c
  36.     ccf
  37.     rla
  38.     out (0),a
  39.     ex (sp),hl
  40.     ex (sp),hl
  41.     ld a,c
  42.     jr nz,-_
  43. ;need 33cc
  44.     push hl
  45.     add hl,hl
  46.     pop hl
  47.     scf
  48. __SendByteDone
  49.     out (0),a
  50.     ld a,b
  51.     pop bc
  52.     ret
  53. .echo "Size:",$-9D95h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement