home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / misc / generic.lbr / GNRC522.AZM / GNRC522.ASM
Encoding:
Assembly Source File  |  1993-10-25  |  4.0 KB  |  173 lines

  1. ;==================================================+
  2. ;                           |
  3. ; TITLE:  GENERIC2.ASM --               |
  4. ;      GENERIC2.DOC --> .ASM Version    (52 COLUMNS)
  5. ;               with "KEYBOARD SELECT"  |
  6. ;                    ~~~~~~~~ ~~~~~~   |
  7. ; AUTHOR:  Richard Altman    DATE:  10/15/91       |
  8. ;                           |
  9. ; See  KEYBRD: KEYBD1: KEYBD2: near middle of file.|
  10. ;      ~~~~~~  ~~~~~~  ~~~~~~               |
  11. ; See  XXXMSG: MSSG1:  MSSG2: toward end of file.  |
  12. ;      ~~~~~~  ~~~~~   ~~~~~               |
  13. ;==================================================+
  14. ;
  15. BEL    EQU    07H
  16. CTRLK    EQU    0BH
  17. TAB    EQU    09H
  18. CR    EQU    0DH
  19. LF    EQU    0AH
  20. CLS    EQU    1AH
  21. CLX    EQU    17H
  22. ESC    EQU    1BH
  23. APOS    EQU    27H    ; Apostrophe
  24. ;
  25. ;  BDOS equates
  26. ;
  27. BDOS    EQU    0005H
  28. CONIN    EQU    1    ; Get char from keyboard
  29. WRTCHR    EQU    2    ; Write char to console
  30.     ORG    0100H
  31. ;
  32. ;================================================
  33. ;
  34.  
  35. START:    LXI    H,0
  36.     DAD    SP        ; HL=old stack
  37.     SHLD    STACK        ; Save it
  38.     LXI    SP,STACK    ; Get new stack
  39.     XRA    A
  40.     STA    CLRFLG
  41.     MVI    C,12
  42.     CALL    BDOS
  43.     MOV    A,L
  44.     STA    VERFLG
  45.     CPI    20H
  46.     JC    VERBAD
  47.     LXI    D,XXXMSG    ; Display XXXMSG
  48.     CALL    PRINT
  49.     CALL    KEYBRD
  50.     LXI    D,DSHMSG
  51.     CALL    PRINT
  52.     LXI    D,ENDMSG
  53.     CALL    PRINT
  54. EXIT:    LHLD    STACK    ; Get old stack pointer
  55.     SPHL        ; Move back to old stack
  56.     RET        ; And return to CCP
  57. ;
  58. KEYBRD:    MVI    C,CONIN
  59.     CALL    BDOS        ; Get one char
  60.     CPI    '1'
  61.     JZ    KEYBD1        ; Jump to KEYBD1
  62.     CPI    '2'        ;   if "1"
  63.     JZ    KEYBD2        ; Jump to KEYBD2
  64.     LXI    D,KEYMSG    ;   if "2"
  65.     CALL    PRINT
  66.     RET            ; else RETURN
  67. ;                ;   & print ENDMSG
  68. ;
  69. KEYBD1:    LXI    D,DSHMSG
  70.     CALL    PRINT
  71.     LXI    D,MSSG1
  72.     CALL    PRINT
  73.     JMP    EXIT
  74. ;
  75. KEYBD2:    LXI    D,DSHMSG
  76.     CALL    PRINT
  77.     LXI    D,MSSG2
  78.     CALL    PRINT
  79.     JMP    EXIT
  80. ;
  81. PRINT:    LDAX    D
  82.     ORA    A
  83.     RZ            ; If zero, finished
  84.     CALL    PRINTA        ; Display on CRT
  85.     INX    D
  86.     JMP    PRINT
  87. ;
  88. PRINTA:    PUSH    B
  89.     PUSH    D
  90.     PUSH    H
  91.     PUSH    PSW
  92.     CALL    PRINTB
  93.     POP    PSW
  94.     POP    H
  95.     POP    D
  96.     POP    B
  97.     RET
  98. ;
  99. PRINTB:    MOV    E,A        ; Get char into BDOS
  100.     MVI    C,WRTCHR    ;   entry register
  101.     JMP    BDOS        ; Call CONOUT via BDOS
  102. ;
  103. VERBAD:    LXI    D,VERMSG    ; Abort,
  104.     CALL    PRINT        ;   bad CP/M version
  105.     JMP    EXIT
  106. ;
  107. ;=================================================
  108. ;
  109. ;     NOTE:   As long as you enclose your message
  110. ;    in single quotes, you can print virtually
  111. ;    anything you want on the screen.
  112. ;
  113. ;    Use DB at the beginning of each message
  114. ;    line in this file.
  115. ;
  116. ;    Use CR,LF at the end of each line to be
  117. ;    displayed on screen.
  118. ;
  119. ;    Always END the message with a ZERO (0).
  120. ;
  121.  
  122. XXXMSG: DB    CLS,CR,LF,TAB,'This is a GENERIC '
  123.     DB    'MESSAGE.',CR,LF,LF,LF
  124.     DB    'Use  ASM ________.AAZ  and  '
  125.     DB    'LOAD ________  to produce',CR,LF
  126.     DB    LF,'     a new Assembly Version '
  127.     DB    'of a .DOC file.',CR,LF,LF,LF
  128.     DB    'This is Line #1 of a general '
  129.     DB    'message .......',CR,LF
  130.     DB    'This is Line #2 of a general '
  131.     DB    'message .......',CR,LF
  132.     DB    'This is Line #3 of a general '
  133.     DB    'message .......',CR,LF
  134.     DB    'This is Line #4 of a general '
  135.     DB    'message .......',CR,LF
  136.     DB    'This is Line #5 of a general '
  137.     DB    'message .......',CR,LF
  138.     DB    LF,TAB,'etc.   etc.   etc.',CR,LF
  139.     DB    LF,LF,'>>>>>  Press <1> or <2> '
  140.     DB    'to continue.',CR,LF,LF
  141.     DB    '>>>>>  Press  <ANY KEY>  to stop.'
  142.     DB    CR,LF,LF,BEL,0
  143. DSHMSG:    DB    CLS,CR,LF,LF,LF,'================'
  144.     DB    '================================'
  145.     DB    '====',CR,LF,LF,LF,0
  146. ENDMSG:    DB    '    A key other than "1" or '
  147.     DB    '"2" was pressed.',CR,LF,LF,LF
  148.     DB    '    Therefore, this is simply the '
  149.     DB    'ENDING of the',CR,LF,LF
  150.     DB    '           (previous) GENERIC '
  151.     DB    'MESSAGE.',CR,LF,LF,LF,BEL,0
  152. MSSG1:    DB    '    "1" was '
  153.     DB    'pressed;',CR,LF,LF
  154.     DB    '    the GENERIC MESSAGE (PART A) '
  155.     DB    'was printed.',CR,LF,LF,LF,BEL,0
  156. MSSG2:    DB    '    "2" was '
  157.     DB    'pressed;',CR,LF,LF
  158.     DB    '    the GENERIC MESSAGE (PART B) '
  159.     DB    'was printed.',CR,LF,LF,LF,BEL,0
  160. KEYMSG:    DB    CTRLK,CLX,0
  161. VERMSG:    DB    '>>>>>   Needs CP/M 2.0 or newer '
  162.     DB    'to RUN',CR,LF,0
  163. ;
  164. CLRFLG:    DB    0    ; File found flag
  165. VERFLG:    DB    0    ; CP/M version number
  166. ;
  167.     DS    100    ; Stack area
  168. STACK:    DS    2    ; Save old stack pointer here
  169. ;
  170. ORDER    EQU    $    ; Order table starts here
  171. ;
  172.     END
  173.