home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / enterprs / c128 / text / examples.arc / VAL.A < prev    next >
Text File  |  1989-12-01  |  3KB  |  81 lines

  1. ;val.asm
  2. ;-------------------------------------------------
  3. ; user installable command:  val number number ...
  4. ;-------------------------------------------------
  5.                                   
  6. poker       = $0016               
  7. pntr        = $00ec               
  8. int11       = $1711               
  9. int0e       = $170e               
  10. prtchr      = $c003               
  11. prtlin      = $8e32               
  12. hexa        = $b8c2               
  13. chrout      = $ffd2               
  14. clrchn      = $ffcc               
  15.                                   
  16. star        = $0b00               
  17.             .wor star             
  18.             * = star              
  19.             & = star              
  20.                                   
  21.             jmp val
  22.             dw  Date
  23.  
  24. val         lda #13               
  25.             jsr chrout            
  26.             ldx #1                ; start with %1 and work up
  27.             stx wchval            
  28. val2        ldx wchval            ; which parameter
  29.             jsr int11             ; evaluate constant
  30.             bcs valx              ; wasn't there
  31.             stx value             
  32.             sta value+1           
  33.             lda #"$"              ; do hex first
  34.             jsr chrout            
  35.             lda value+1           
  36.             jsr hexa              
  37.             lda value             
  38.             jsr hexa              
  39.             lda #" "              
  40.             jsr chrout            
  41.             lda value+1           
  42.             ldx value             
  43.             jsr prtlin            ; print as decimal
  44.             lda #12               
  45.             sta pntr              
  46.             lda #"%"              
  47.             jsr chrout            
  48.             ldy #16               
  49.             lda value             
  50.             sta poker             
  51.             lda value+1           
  52.             sta poker+1           
  53. val1        asl poker             
  54.             rol poker+1           
  55.             lda #"0"              
  56.             bcc val0              
  57.             lda #"1"              
  58. val0        jsr chrout            
  59.             dey                   
  60.             bne val1              
  61.             lda #" "              
  62.             jsr chrout            
  63.             lda value+1           
  64.             ldx $f1               
  65.             jsr prtchr            
  66.             inc pntr              
  67.             lda value             
  68.             ldx $f1               
  69.             jsr prtchr            
  70.             lda #13               
  71.             jsr chrout            
  72.             inc wchval            
  73.             jmp val2              
  74.                                   
  75. valx        jmp int0e             
  76.                                   
  77. wchval      .byt 0                
  78. value       .wor 0                
  79.                                   
  80.             .end                  
  81.