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

  1. ;echo.asm
  2. ;========================
  3. ; Command:  echo on/off
  4. ;           echo string
  5. ;========================
  6.                                   
  7. int04       = $1704               
  8. int05       = $1705               
  9. int0e       = $170e               
  10. echo        = $1beb               ;echo status (BMI=on)
  11. primm       = $ff7d               
  12. chrout      = $ffd2               
  13.                                   
  14. star        = $0b00               
  15.             .wor star             
  16.             * = star
  17.  
  18.             jmp Echo
  19.             dw  Date
  20.                                   
  21. Echo        ldx #1                ;get parameter 1
  22.             jsr int04             ;is it there?
  23.             bcc e0                ;ok. do it
  24.             jsr primm             ;otherwise print echo status
  25.             .asc "echo is ",0
  26.             bit echo              
  27.             bpl eoff              ;its off
  28.             jsr primm             
  29.             .asc "on",13,0
  30.             lda #1                ;return echo status as the errorlevel
  31.             jmp int0e             
  32.                                   
  33. eoff        jsr primm             
  34.             .asc "off",13,0
  35. ex0         lda #0                
  36.             jmp int0e             
  37.                                   
  38. e0          cmp #"o"              ;on or off?
  39.             beq eo                ;ok. toggle echo
  40. e1          cmp #34               ;otherwise just echo whats there...but ignore quotes
  41.             beq e2                
  42.             jsr chrout            
  43. e2          jsr int05             
  44.             cmp #0                
  45.             bne e1                
  46.             lda #13               
  47.             jsr chrout            
  48. e11         jmp ex0               
  49.                                   
  50. e00         pha                   
  51.             lda #"o"              
  52.             jsr chrout            
  53.             pla                   
  54.             jmp e1                
  55.                                   
  56. eo          jsr int05             ;check for on or off
  57.             cmp #0                
  58.             bne eoeo              
  59.             lda #"o"              
  60.             jsr chrout            
  61.             jmp e11               
  62. eoeo        cmp #"n"              
  63.             beq mbon              ;possibly echo on
  64.             cmp #"f"              
  65.             bne e00               ;neither
  66.             jsr int05             
  67.             cmp #"f"              
  68.             beq mboff             
  69.             pha                   
  70.             jsr primm             
  71.             .asc "of", 0          
  72. eoo         pla                   
  73.             jmp e1                
  74.                                   
  75. mboff       jsr int05             
  76.             cmp #0                
  77.             beq setoff            
  78.             pha                   
  79.             jsr primm             
  80.             .asc "off", 0         
  81.             jmp eoo               
  82.                                   
  83. mbon        jsr int05             
  84.             cmp #0                
  85.             beq seton             
  86.             pha                   
  87.             jsr primm             
  88.             .asc "on", 0          
  89.             jmp eoo               
  90.                                   
  91. seton       lda #$ff              
  92.             .byt $2c              
  93. setoff      lda #0                
  94.             sta echo              
  95.             jmp ex0               
  96.                                   
  97.             .end                  
  98.