print.s 603 B

123456789101112131415161718192021222324252627
  1. .define Mprint
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine prints a zero terminated ascii string.
  8. ! The registerpair AX contains the start of the string.
  9. ! The subroutine WRCH is a special routine on the BBC microcomputer
  10. ! which prints the character in A to the screen.
  11. ! The subroutine WRCH is a special one provided by the BBC
  12. ! microcomputer.
  13. Mprint:
  14. stx ADDR ! start address of string (lowbyte)
  15. sta ADDR+1 ! start address of string (highbyte)
  16. ldy #0
  17. 1: lda (ADDR),y ! get ascii character
  18. beq 2f
  19. jsr WRCH ! put it on the screen
  20. iny
  21. bne 1b
  22. 2: rts