printhex.s 458 B

1234567891011121314151617181920212223242526272829303132
  1. .define Printhex
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine print the contents of register A to the screen
  8. ! in hexadecimal form.
  9. ! The subroutine WRCH is a special one provided by the BBC
  10. ! microcomputer.
  11. Printhex:
  12. pha ! save A
  13. lsr a
  14. lsr a
  15. lsr a
  16. lsr a ! get four high bits
  17. jsr 1f
  18. pla ! restore A
  19. and #0x0F ! get four low bits
  20. jsr 1f
  21. rts
  22. 1: sed ! print in hex
  23. clc
  24. adc #0x90
  25. adc #0x40
  26. cld
  27. jmp WRCH