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

  1. ;=========================================================================+
  2. ;                                      |
  3. ; TITLE:  GENERIC1.ASM --    GENERIC1.DOC --> .ASM Version          |
  4. ;                          with "KEYBOARD SELECT"  |
  5. ;                            ~~~~~~~~ ~~~~~~      |
  6. ; AUTHOR:  Richard Altman    DATE:  10/15/91       v1.0              |
  7. ;                                      |
  8. ; See    KEYBRD:  and  KEYBD1:  toward the middle of this file.          |
  9. ;    ~~~~~~        ~~~~~~                          |
  10. ; See    XXXMSG:  and  YYYMSG:  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        ; HL=old stack
  36.     SHLD    STACK        ; Save it
  37.     LXI    SP,STACK    ; Get new stack
  38.     XRA    A
  39.     STA    CLRFLG        ; Clear file found flag
  40.     MVI    C,12        ; Get and save the CP/M version #
  41.     CALL    BDOS
  42.     MOV    A,L
  43.     STA    VERFLG
  44.     CPI    20H        ; Set carry if CP/M 1.4
  45.     JC    VERBAD        ; Exit on earlier than 2.0
  46.     LXI    D,XXXMSG    ; Clear Screen and display XXXMSG
  47.     CALL    PRINT
  48.     CALL    KEYBRD
  49.     LXI    D,DSHMSG
  50.     CALL    PRINT
  51.     LXI    D,YYYMSG
  52.     CALL    PRINT
  53. EXIT:    LHLD    STACK        ; Get old stack pointer
  54.     SPHL            ; Move back to old stack
  55.     RET            ; And return to CCP
  56. ;
  57. KEYBRD:    MVI    C,CONIN
  58.     CALL    BDOS        ; Get one character
  59.     CPI    'X'
  60.     JZ    KEYBD1        ; Jump to KEYBD1 if X,x
  61.     CPI    'x'
  62.     JZ    KEYBD1        ;
  63.     LXI    D,KEYMSG    ;  else return
  64.     CALL    PRINT        ;    and print YYYMSG.
  65.     RET
  66. KEYBD1:    LXI    D,KEYMSG
  67.     CALL    PRINT
  68.     LXI    D,DSHMSG
  69.     CALL    PRINT
  70.     LXI    D,ZZZMSG
  71.     CALL    PRINT
  72.     JMP    EXIT
  73. ;
  74. PRINT:    LDAX    D
  75.     ORA    A
  76.     RZ            ; If zero, finished
  77.     CALL    PRINTA        ; Display on CRT
  78.     INX    D
  79.     JMP    PRINT
  80. ;
  81. PRINTA:    PUSH    B
  82.     PUSH    D
  83.     PUSH    H
  84.     PUSH    PSW        ; Save the character to output
  85.     CALL    PRINTB        ; Send it to console
  86.     POP    PSW        ; Restore the output character
  87.     POP    H
  88.     POP    D
  89.     POP    B
  90.     RET
  91. ;
  92. PRINTB:    MOV    E,A        ; Get character into BDOS entry register
  93.     MVI    C,WRTCHR
  94.     JMP    BDOS        ; Call CONOUT via the BDOS
  95. ;
  96. VERBAD:    LXI    D,VERMSG    ; Abort, bad CP/M version
  97.     CALL    PRINT
  98.     JMP    EXIT
  99. ;
  100. ;=============================================================================
  101. ;
  102. ;     NOTE:    As long as you enclose your message in single quotes,
  103. ;        you can print virtually anything you want on the screen.
  104. ;
  105. ;        Use DB at the beginning of each message line in this file.
  106. ;
  107. ;        Use CR,LF at the end of each line to be displayed on screen.
  108. ;
  109. ;        Always END the message with a ZERO (0).
  110. ;
  111.  
  112. XXXMSG: DB    CLS,CR,LF,TAB,TAB,'This is a GENERIC MESSAGE.',CR,LF,LF,LF
  113.     DB    TAB,'Use  ASM ________.AAZ  and  LOAD ________  to produce'
  114.     DB    CR,LF,LF,TAB,'a new Assembly Version of a .DOC file.',CR,LF
  115.     DB    LF,LF,TAB,'This is Line #1 of a general message .......',CR,LF
  116.     DB    TAB,'This is Line #2 of a general message .......',CR,LF
  117.     DB    TAB,'This is Line #3 of a general message .......',CR,LF
  118.     DB    TAB,'This is Line #4 of a general message .......',CR,LF
  119.     DB    TAB,TAB,'etc.   etc.   etc.',CR,LF
  120.     DB    LF,LF,TAB,'    >>>>>  Press <ANY KEY> to continue.',CR,LF,LF
  121.     DB    TAB,'    >>>>>  Press  <  X  >  to stop.',CR,LF,BEL,0
  122. DSHMSG:    DB    CR,LF,LF,'=================================================='
  123.     DB    '=====================',CR,LF,LF,0
  124. YYYMSG:    DB    TAB,'"ANY KEY" was pressed;'
  125.     DB    '   therefore, this is simply a ',CR,LF,LF,TAB,'continuation '
  126.     DB    'of the (above) GENERIC MESSAGE.',CR,LF,LF,BEL,0
  127. ZZZMSG:    DB    TAB,'" X " was pressed;   '
  128.     DB    'the GENERIC MESSAGE is now ENDED.',CR,LF,LF,LF,BEL,0
  129. KEYMSG:    DB    CTRLK,CTRLK,CTRLK,CTRLK,CTRLK,CLX,0
  130. VERMSG:    DB    '>>>>>   Needs CP/M 2.0 or newer to RUN',CR,LF,0
  131. ;
  132. CLRFLG:    DB    0    ; File found flag
  133. VERFLG:    DB    0    ; CP/M version number (0= not CP/M 2.0 or newer)
  134. ;
  135.     DS    100    ; Stack area
  136. STACK:    DS    2    ; Save old stack pointer here
  137. ;
  138. ORDER    EQU    $    ; Order table starts here
  139. ;
  140.     END
  141.  
  142.