printnum.asm 904 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include once <print.asm>
  2. #include once <attr.asm>
  3. ;
  4. __PRINTU_START:
  5. ;- PROC
  6. ;- LOCAL __PRINTU_CONT
  7. lda z80_b ;- ld a,b
  8. sta z80_a
  9. ora z80_a ;- or a
  10. jne __PRINTU_CONT ;- jp nz, __PRINTU_CONT
  11. lda #'0' ;- ld a,'0'
  12. jmp __PRINT_DIGIT ;- jp __PRINT_DIGIT
  13. __PRINTU_CONT:
  14. plp ;- pop af
  15. pha
  16. lda z80_c ;- push bc
  17. pha
  18. lda z80_b
  19. pha
  20. jsr __PRINT_DIGIT ;- call __PRINT_DIGIT
  21. pla ;- pop bc
  22. sta z80_b
  23. pla
  24. sta z80_c
  25. dec z80_b ;- djnz __PRINTU_CONT
  26. jne __PRINTU_CONT
  27. rts ;- ret
  28. ;- ENDP
  29. __PRINT_MINUS: ; PRINT the MINUS (-) sign. CALLER must preserve registers
  30. lda #'-' ;- ld a,'-'
  31. jmp __PRINT_DIGIT ;- jp __PRINT_DIGIT
  32. ;- __PRINT_DIGIT EQU __PRINTCHAR ; PRINTS the char in A register, and puts its attrs