sposn.asm 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ; Printing positioning library.
  2. ;- PROC
  3. ;- LOCAL ECHO_E
  4. __LOAD_S_POSN: ; Loads into DE current ROW, COL print position from S_POSN mem var.
  5. lda S_POSN ;- ld de,(S_POSN)
  6. sta z80_e
  7. lda S_POSN+1
  8. sta z80_d
  9. lda MAXX ;- ld hl,(MAXX)
  10. sta z80_l
  11. lda MAXX+1
  12. sta z80_h
  13. ora z80_a ;- or a
  14. lda z80_l ;- sbc hl,de
  15. sbc z80_e
  16. sta z80_l
  17. lda z80_h
  18. sbc z80_d
  19. sta z80_h
  20. lda z80_e ;- ex de,hl
  21. ldx z80_l
  22. stx z80_e
  23. sta z80_l
  24. lda z80_d
  25. ldx z80_h
  26. stx z80_d
  27. sta z80_h
  28. rts ;- ret
  29. __SAVE_S_POSN: ; Saves ROW, COL from DE into S_POSN mem var.
  30. lda MAXX ;- ld hl,(MAXX)
  31. sta z80_l
  32. lda MAXX+1
  33. sta z80_h
  34. ora z80_a ;- or a
  35. lda z80_l ;- sbc hl,de
  36. sbc z80_e
  37. sta z80_l
  38. lda z80_h
  39. sbc z80_d
  40. sta z80_h
  41. ;- ld (S_POSN), hl ; saves it again
  42. rts ;- ret
  43. ECHO_E EQU 23682
  44. MAXX EQU ECHO_E ; Max X position + 1
  45. MAXY EQU MAXX + 1 ; Max Y position + 1
  46. S_POSN EQU 23688
  47. POSX EQU S_POSN ; Current POS X
  48. POSY EQU S_POSN + 1 ; Current POS Y
  49. ENDP