home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol12n22.zip / NUMPRN.ZIP / BASES.SCR < prev    next >
Text File  |  1993-11-29  |  2KB  |  63 lines

  1. A100
  2. JMP 120        ; JMP begin
  3.      ;=======================================
  4.      ; begin number printing subroutine
  5.      ;=======================================
  6.                ; dploop:
  7. XOR DX,DX
  8. DIV CX
  9. PUSH DX
  10. CMP AX,0
  11. JE 10F         ; JE undo
  12. CALL 102       ; CALL dploop
  13.                ; undo:
  14. POP DX
  15.                ; pdig:
  16. ADD DL,30
  17. CMP DL,39
  18. JLE 11B        ; JLE pch
  19. ADD DL,7
  20.                ; pch:
  21. MOV AH,2
  22. INT 21
  23. RET
  24.      ;=============================================
  25.      ; end number-printing subroutines.
  26.      ;=============================================
  27.      ; Add code that will *use* the number printing
  28.      ; routine after this point.
  29.      ;=============================================
  30.      ;
  31.      ; the remaining code prints 65,535 in hex
  32.      ; and in every base from 10 down to 2
  33. MOV CX,10      ; set up base 16
  34. CALL 134       ; CALL printOneBase
  35. MOV CX,0A      ; start with base 10
  36.                ; loop:
  37. CALL 134       ; CALL printOneBase
  38. DEC CX         ; reduce base by 1
  39. CMP CX,1
  40. JA 129         ; JA loop:
  41. INT 20
  42.                ; printOneBase:
  43. MOV AX,CX      ; put current base in AX
  44. PUSH CX        ; save current base
  45. MOV CX,0A      ; set for base 10
  46. CALL 102       ; CALL dploop
  47. MOV DL,09      ; put a TAB in DL
  48. CALL 11B       ; CALL pch
  49. POP CX         ; restore current base
  50. MOV AX,FFFF
  51. CALL 102       ; CALL dploop
  52. MOV DL,0D      ; put carriage return in DL
  53. CALL 11B       ; CALL pch
  54. MOV DL,0A      ; put line feed in DL
  55. CALL 11B       ; CALL pch
  56. RET
  57.  
  58. RCX
  59. 54
  60. N BASES.COM
  61. W
  62. Q
  63.