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

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