blm.s 421 B

123456789101112131415161718192021222324252627282930313233343536
  1. .define .blm
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! Block move
  8. ! Expects in de-reg: size of block
  9. ! Expects on stack: destination address
  10. ! source address
  11. .blm: pop h
  12. shld .retadr
  13. mov h,b
  14. mov l,c
  15. shld .bcreg
  16. pop h ! hl = destination address
  17. pop b ! bc = source address
  18. 1: ldax b
  19. mov m,a
  20. inx b
  21. inx h
  22. dcx d
  23. mov a,d
  24. ora e
  25. jnz 1b
  26. lhld .bcreg
  27. mov b,h
  28. mov c,l
  29. lhld .retadr
  30. pchl