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

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