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

  1. ;=========================================================================+
  2. ;                                      |
  3. ; TITLE:  GENERIC.ASM --    GENERIC.DOC --> .ASM Version          |
  4. ;                                      |
  5. ; AUTHOR:  Richard Altman    DATE:  10/15/91       v1.0              |
  6. ;                                      |
  7. ; See    XXXMSG:  toward the end of this file.                  |
  8. ;    ~~~~~~                                  |
  9. ;=========================================================================+
  10. ;
  11. BEL    EQU    07H
  12. TAB    EQU    09H
  13. CR    EQU    0DH
  14. LF    EQU    0AH
  15. CLS    EQU    1AH
  16. CLX    EQU    17H
  17. ESC    EQU    1BH
  18. APOS    EQU    27H    ; Apostrophe
  19. ;
  20. ;  BDOS equates
  21. ;
  22. BDOS    EQU    0005H
  23. WRTCHR    EQU    2        ; Write character to console
  24.     ORG    0100H
  25. ;
  26. ;===========================================================================
  27. ;
  28.  
  29. START:    LXI    H,0
  30.     DAD    SP        ; HL=old stack
  31.     SHLD    STACK        ; Save it
  32.     LXI    SP,STACK    ; Get new stack
  33.     XRA    A
  34.     STA    CLRFLG        ; Clear file found flag
  35.     MVI    C,12        ; Get and save the CP/M version #
  36.     CALL    BDOS
  37.     MOV    A,L
  38.     STA    VERFLG
  39.     CPI    20H        ; Set carry if CP/M 1.4
  40.     JC    VERBAD        ; Exit on earlier than 2.0
  41.     LXI    D,XXXMSG    ; Clear Screen and display XXXMSG
  42.     CALL    PRINT
  43. EXIT:    LHLD    STACK        ; Get old stack pointer
  44.     SPHL            ; Move back to old stack
  45.     RET            ; And return to CCP
  46. ;
  47. PRINT:    LDAX    D
  48.     ORA    A
  49.     RZ            ; If zero, finished
  50.     CALL    PRINTA        ; Display on CRT
  51.     INX    D
  52.     JMP    PRINT
  53. ;
  54. PRINTA:    PUSH    B
  55.     PUSH    D
  56.     PUSH    H
  57.     PUSH    PSW        ; Save the character to output
  58.     CALL    PRINTB        ; Send it to console
  59.     POP    PSW        ; Restore the output character
  60.     POP    H
  61.     POP    D
  62.     POP    B
  63.     RET
  64. ;
  65. PRINTB:    MOV    E,A        ; Get character into BDOS entry register
  66.     MVI    C,WRTCHR
  67.     JMP    BDOS        ; Call CONOUT via the BDOS
  68. ;
  69. VERBAD:    LXI    D,VERMSG    ; Abort, bad CP/M version
  70.     CALL    PRINT
  71.     JMP    EXIT
  72. ;
  73. ;=============================================================================
  74. ;
  75. ;     NOTE:    As long as you enclose your message in single quotes,
  76. ;        you can print virtually anything you want on the screen.
  77. ;
  78. ;        Use DB at the beginning of each message line in this file.
  79. ;
  80. ;        Use CR,LF at the end of each line to be displayed on screen.
  81. ;
  82. ;        Always END the message with a ZERO (0).
  83. ;
  84.  
  85. XXXMSG: DB    CLS,CR,LF,TAB,TAB,'This is a GENERIC MESSAGE.',CR,LF,LF,LF
  86.     DB    TAB,'Use  ASM ________.AAZ  and  LOAD ________  to produce'
  87.     DB    CR,LF,LF,TAB,'a new Assembly Version of a .DOC file.',CR,LF
  88.     DB    LF,LF,TAB,'This is Line #1 of a general message .......',CR,LF
  89.     DB    TAB,'This is Line #2 of a general message .......',CR,LF
  90.     DB    TAB,'This is Line #3 of a general message .......',CR,LF
  91.     DB    TAB,'This is Line #4 of a general message .......',CR,LF
  92.     DB    TAB,'This is Line #5 of a general message .......',CR,LF,LF
  93.     DB    TAB,TAB,'etc.   etc.   etc.',CR,LF,LF,LF,BEL,0
  94. VERMSG:    DB    '>>>>>   Needs CP/M 2.0 or newer to RUN',CR,LF,0
  95. ;
  96. CLRFLG:    DB    0    ; File found flag
  97. VERFLG:    DB    0    ; CP/M version number (0= not CP/M 2.0 or newer)
  98. ;
  99.     DS    100    ; Stack area
  100. STACK:    DS    2    ; Save old stack pointer here
  101. ;
  102. ORDER    EQU    $    ; Order table starts here
  103. ;
  104.     END
  105.