diff options
Diffstat (limited to 'v4.0/src/CMD/PRINT/PRIDEFS.ASM')
| -rw-r--r-- | v4.0/src/CMD/PRINT/PRIDEFS.ASM | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/v4.0/src/CMD/PRINT/PRIDEFS.ASM b/v4.0/src/CMD/PRINT/PRIDEFS.ASM new file mode 100644 index 0000000..a2e0458 --- /dev/null +++ b/v4.0/src/CMD/PRINT/PRIDEFS.ASM | |||
| @@ -0,0 +1,210 @@ | |||
| 1 | ; SCCSID = @(#)pridefs.asm 4.4 85/07/17 | ||
| 2 | title DOS Print Utility | ||
| 3 | |||
| 4 | ;MS-DOS PSPRINT/PRINT program for background printing of text files | ||
| 5 | ; to the list device. | ||
| 6 | ; | ||
| 7 | ; IBM SERVER VERSION | ||
| 8 | ; | ||
| 9 | ; INT 28H is a software interrupt generated by the DOS | ||
| 10 | ; in its I/O wait loops. This spooler can be assembled for | ||
| 11 | ; operation using only this interrupt which is portable from | ||
| 12 | ; system to system. It may also be assembled to use a hardware | ||
| 13 | ; timer interrupt in addition to the software INT 28H. The | ||
| 14 | ; purpose of using hardware interrupts is to allow printing to | ||
| 15 | ; continue during programs which do not enter the system and | ||
| 16 | ; therefore causes the INT 28H to go away. A timer interrupt is | ||
| 17 | ; chosen in preference to a "printer buffer empty" interrupt | ||
| 18 | ; because PRINT in the timer form is generic. It can be given | ||
| 19 | ; the name of any currently installed character device as the | ||
| 20 | ; "printer", this makes it portable to devices which are | ||
| 21 | ; installed by the user even in the hardware case. It could be | ||
| 22 | ; Revised to use a buffer empty interrupt (no code is given for | ||
| 23 | ; this case), if this is done the PROMPT and BADMES messages and | ||
| 24 | ; their associated code should be removed as PRINT will then be | ||
| 25 | ; device specific. | ||
| 26 | ; | ||
| 27 | ; V1.00 07/03/82 | ||
| 28 | ; V2.00 07/05/83 A.R. | ||
| 29 | ; New INT 2FH interface, Pathnames, context switch. | ||
| 30 | ; V2.50 09/14/83 M.A.U | ||
| 31 | ; Turned it back to a print | ||
| 32 | ; 11/21/83 M.A.U | ||
| 33 | ; Repaired bug in file cancel code | ||
| 34 | ; 11/28/83 M.A.U | ||
| 35 | ; Added int 23 and 24 handlers to transient. | ||
| 36 | ; 01/27/84 M.A.U | ||
| 37 | ; Allways checks for valid drive. | ||
| 38 | ; V3.00 02/03/84 M.A.U | ||
| 39 | ; Partitioned so as to assemble on a PC | ||
| 40 | ; By the by, it is V3.00 now. | ||
| 41 | ; 05/23/85 K.G.S | ||
| 42 | ; Chains into INT19 (bootstrap) to unhook | ||
| 43 | ; INT_1C (timer) and INT_15 (AT's Wait On Event) | ||
| 44 | ; | ||
| 45 | |||
| 46 | |||
| 47 | ; Aaron's rambling: | ||
| 48 | ; | ||
| 49 | ; BEWARE ALL YEE WHO ENTER HERE. | ||
| 50 | ; PRINT is an amazingly complex program. MS-DOS versions below 3.00 are | ||
| 51 | ; NOT re-entrant, this means that this utility is basically not a | ||
| 52 | ; possibility. It gets by on the fact that it is written by the same | ||
| 53 | ; person who wrote the OS. Since you are not that person, you must be very | ||
| 54 | ; careful about making any modification to this utility. There are a | ||
| 55 | ; number of things which may seem to be unnecessary on first examination. | ||
| 56 | ; BEWARE, almost every line of code is there for a very good reason. The | ||
| 57 | ; order of things is very carefully chosen. PRINT is full of potential | ||
| 58 | ; windows, make sure that you do not open one by careless modification. Do | ||
| 59 | ; not look for a lot of help from the comments, a complete explanation | ||
| 60 | ; would probably fill a book. A succesful modifier will have an in-depth | ||
| 61 | ; knowledge of the internal function of MS-DOS, and of the PRINT utility | ||
| 62 | ; itself through in depth study of the comments AND the code. | ||
| 63 | |||
| 64 | |||
| 65 | subttl General Definition | ||
| 66 | page | ||
| 67 | |||
| 68 | |||
| 69 | FALSE EQU 0 | ||
| 70 | TRUE EQU NOT FALSE | ||
| 71 | |||
| 72 | IBM EQU IBMVER | ||
| 73 | ;IBMVER EQU IBM | ||
| 74 | ;MSVER EQU FALSE | ||
| 75 | |||
| 76 | IF MSVER | ||
| 77 | HARDINT EQU FALSE ;No hardware ints | ||
| 78 | AINT EQU FALSE ;No need to do interrupt acknowledge | ||
| 79 | ENDIF | ||
| 80 | |||
| 81 | IF IBM | ||
| 82 | HARDINT EQU TRUE | ||
| 83 | INTLOC EQU 1CH ;Hardware interrupt location (Timer) | ||
| 84 | REBOOT EQU 19H ;ROM BIOS "Bootstrap" | ||
| 85 | AINT EQU TRUE ;Acknowledge interrupts | ||
| 86 | EOI EQU 20H ;End Of Interrupt "instruction" | ||
| 87 | AKPORT EQU 20H ;Interrupt Acknowledge port | ||
| 88 | ENDIF | ||
| 89 | |||
| 90 | ; The following values have to do with the ERRCNT variable and the CNTMES | ||
| 91 | ; message. The values define levels at wich it is assumed an off-line error | ||
| 92 | ; exists. ERRCNT1 defines the value of ERRCNT above which the CNTMES message | ||
| 93 | ; is printed by the transient. ERRCNT2 defines the value of ERRCNT above | ||
| 94 | ; which the resident will give up trying to print messages on the printer, it | ||
| 95 | ; is much greater than ERRCNT1 because a much tighter loop is involved. The | ||
| 96 | ; bounding event which determines the correct value is the time required to | ||
| 97 | ; do a form feed. | ||
| 98 | |||
| 99 | IF IBM | ||
| 100 | ERRCNT1 EQU 1500 | ||
| 101 | ERRCNT2 EQU 20000 | ||
| 102 | ELSE | ||
| 103 | ERRCNT1 EQU 1500 | ||
| 104 | ERRCNT2 EQU 20000 | ||
| 105 | ENDIF | ||
| 106 | |||
| 107 | |||
| 108 | ;WARNING DANGER WARNING: | ||
| 109 | ; PRINT is a systems utility. It is clearly understood that it may have | ||
| 110 | ; to be entirely re-written for future versions of MS-DOS. The following | ||
| 111 | ; TWO vectors are version specific, they may not exist at all in future | ||
| 112 | ; versions. If they do exist, they may function differently. | ||
| 113 | ; ANY PROGRAM WHICH IMITATES PRINTS USE OF THESE VECTORS IS ALSO A SYSTEMS | ||
| 114 | ; UTILITY AND IS THEREFORE NOT VERSION PORTABLE IN ANY WAY SHAPE OR FORM. | ||
| 115 | ; YOU HAVE BEEN WARNED, "I DID IT THE SAME WAY PRINT DID" IS NOT AN REASON | ||
| 116 | ; TO EXPECT A PROGRAM TO WORK ON FUTURE VERSIONS OF MS-DOS. | ||
| 117 | |||
| 118 | SOFTINT EQU 28H ;Software interrupt generated by DOS | ||
| 119 | ComInt EQU 2FH ;Communications interrupt used by PSPRINT | ||
| 120 | ; Multiplex number 0 and 1 | ||
| 121 | |||
| 122 | ;----- Default (and Minimal) Print queue length | ||
| 123 | DefQueueLen equ 10 ; 10 files worth | ||
| 124 | MinQueueLen equ 4 ; 4 files worth min | ||
| 125 | MaxQueueLen equ 32 ; 32 files worth max. | ||
| 126 | |||
| 127 | ;----- Maximum length of a file name (incl nul) | ||
| 128 | MaxFileLen equ 64 | ||
| 129 | |||
| 130 | ; **************** Bogosity Warning ***************** | ||
| 131 | ; Below is the equate that MaxFile SHOULD be. Since the 3.0/3.1 documentation | ||
| 132 | ; documents each queue entry as being 64 chars long. Yes it is known that | ||
| 133 | ; that causes Print to misbehave on files deep in trees. But for | ||
| 134 | ; compatibilities sake, IBM insisted that we change the code back to the | ||
| 135 | ; way it was. | ||
| 136 | ;MaxFileLen equ 63 + 2 + 12 ; 63 characters as Command.com's | ||
| 137 | ; max. path length | ||
| 138 | ; 2 character for the Drive ext. | ||
| 139 | ; 12 characters for the max. valid | ||
| 140 | ; DOS filename | ||
| 141 | |||
| 142 | |||
| 143 | .xlist | ||
| 144 | .xcref | ||
| 145 | BREAK MACRO subtitle | ||
| 146 | SUBTTL subtitle | ||
| 147 | PAGE | ||
| 148 | ENDM | ||
| 149 | |||
| 150 | stdin EQU 0 | ||
| 151 | stdout EQU 1 | ||
| 152 | stderr EQU 2 | ||
| 153 | stdaux EQU 3 | ||
| 154 | stdprn EQU 4 | ||
| 155 | |||
| 156 | INCLUDE DEVSYM.INC | ||
| 157 | INCLUDE SYSCALL.INC | ||
| 158 | INCLUDE ERROR.INC | ||
| 159 | INCLUDE SYSVAR.INC | ||
| 160 | INCLUDE FIND.INC | ||
| 161 | include dpl.asm | ||
| 162 | INCLUDE PDB.INC | ||
| 163 | INCLUDE SYSCALL.INC | ||
| 164 | INCLUDE MI.INC | ||
| 165 | include versiona.inc | ||
| 166 | .list | ||
| 167 | .cref | ||
| 168 | |||
| 169 | |||
| 170 | error_busy EQU 9 | ||
| 171 | error_queue_full EQU 8 | ||
| 172 | error_name_too_long EQU 12 | ||
| 173 | |||
| 174 | IF1 | ||
| 175 | IF IBM | ||
| 176 | ; %out IBM VERSION | ||
| 177 | ELSE | ||
| 178 | %out MS-DOS VERSION | ||
| 179 | ENDIF | ||
| 180 | ENDIF | ||
| 181 | |||
| 182 | BREAK <Segment Definitions> | ||
| 183 | |||
| 184 | |||
| 185 | CodeR Segment public para | ||
| 186 | CodeR EndS | ||
| 187 | |||
| 188 | Code Segment public para | ||
| 189 | Code EndS | ||
| 190 | |||
| 191 | Data Segment public byte | ||
| 192 | Data EndS | ||
| 193 | |||
| 194 | Stack Segment Stack | ||
| 195 | Stack Ends | ||
| 196 | |||
| 197 | DG group Code,Data,Stack | ||
| 198 | |||
| 199 | SaveReg MACRO reglist ;; push those registers | ||
| 200 | IRP reg,<reglist> | ||
| 201 | PUSH reg | ||
| 202 | ENDM | ||
| 203 | ENDM | ||
| 204 | .xcref SaveReg | ||
| 205 | |||
| 206 | RestoreReg MACRO reglist ;; pop those registers | ||
| 207 | IRP reg,<reglist> | ||
| 208 | POP reg | ||
| 209 | ENDM | ||
| 210 | ENDM | ||