diff options
Diffstat (limited to 'v4.0/src/CMD/FORMAT/FORLABEL.ASM')
| -rw-r--r-- | v4.0/src/CMD/FORMAT/FORLABEL.ASM | 771 |
1 files changed, 771 insertions, 0 deletions
diff --git a/v4.0/src/CMD/FORMAT/FORLABEL.ASM b/v4.0/src/CMD/FORMAT/FORLABEL.ASM new file mode 100644 index 0000000..a7d46a1 --- /dev/null +++ b/v4.0/src/CMD/FORMAT/FORLABEL.ASM | |||
| @@ -0,0 +1,771 @@ | |||
| 1 | |||
| 2 | ; | ||
| 3 | ;***************************************************************************** | ||
| 4 | ;***************************************************************************** | ||
| 5 | ; | ||
| 6 | ;UTILITY NAME: FORMAT.COM | ||
| 7 | ; | ||
| 8 | ;MODULE NAME: FORLABEL.SAL | ||
| 9 | ; | ||
| 10 | ; Interpret_Parse | ||
| 11 | ; | | ||
| 12 | ;* | | ||
| 13 | ;³ÚÄÄÄÄÄ¿ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿|ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 14 | ;À´VolIDôGet_New_LabelÃÄ´Get_11_CharactersôChange_Blanks³ | ||
| 15 | ; ÀÄÄÄÄÄÙÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 16 | ; ³ÚÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 17 | ; ôSkip_Blanks³ | ||
| 18 | ; ³ÀÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 19 | ; ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 20 | ; ôCheck_DBCS_OverrunôCheck_DBCS_Character³ | ||
| 21 | ; ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 22 | ; ³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 23 | ; À´Copy_FCB_String³ | ||
| 24 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 25 | ;***************************************************************************** | ||
| 26 | ;***************************************************************************** | ||
| 27 | |||
| 28 | data segment public para 'DATA' | ||
| 29 | data ends | ||
| 30 | |||
| 31 | code segment public para 'CODE' | ||
| 32 | assume cs:code,ds:data | ||
| 33 | code ends | ||
| 34 | |||
| 35 | .xlist | ||
| 36 | INCLUDE FORCHNG.INC | ||
| 37 | INCLUDE FORMACRO.INC | ||
| 38 | INCLUDE SYSCALL.INC | ||
| 39 | INCLUDE FOREQU.INC | ||
| 40 | INCLUDE FORSWTCH.INC | ||
| 41 | .list | ||
| 42 | |||
| 43 | ; | ||
| 44 | ;***************************************************************************** | ||
| 45 | ; Equates | ||
| 46 | ;***************************************************************************** | ||
| 47 | ; | ||
| 48 | |||
| 49 | None equ 0 | ||
| 50 | StdIn equ 0 | ||
| 51 | StdOut equ 1 | ||
| 52 | StdErr equ 2 | ||
| 53 | Tab equ 09h | ||
| 54 | Label_Buffer_length equ 80h | ||
| 55 | Create_Worked equ 0 ;an024; | ||
| 56 | |||
| 57 | |||
| 58 | ; | ||
| 59 | ;***************************************************************************** | ||
| 60 | ; External Data Declarations | ||
| 61 | ;***************************************************************************** | ||
| 62 | ; | ||
| 63 | |||
| 64 | Extrn SwitchMap:Word | ||
| 65 | Extrn Switch_String_Buffer:Byte | ||
| 66 | Extrn VolFCB:Byte | ||
| 67 | Extrn MsgBadCharacters:Byte | ||
| 68 | Extrn MsgLabelPrompt:Byte | ||
| 69 | Extrn MsgBadVolumeID:Byte | ||
| 70 | Extrn MsgCRLF:Byte | ||
| 71 | Extrn VolNam:Byte | ||
| 72 | Extrn Vol_Label_Count:Byte | ||
| 73 | Extrn VolDrive:Byte | ||
| 74 | Extrn Drive:Byte | ||
| 75 | Extrn Command_Line:Byte | ||
| 76 | Extrn Vol_Label_Buffer:Byte | ||
| 77 | Extrn DelDrive:Byte | ||
| 78 | Extrn DelFCB:Byte | ||
| 79 | |||
| 80 | code segment public para 'CODE' | ||
| 81 | |||
| 82 | ;************************************************************************************************ | ||
| 83 | ;Routine name Volid | ||
| 84 | ;************************************************************************************************ | ||
| 85 | ; | ||
| 86 | ;Description: Get volume id from command line /V:xxxxxxx if it is there, or | ||
| 87 | ; else prompt user for volume label, parse the input. At this | ||
| 88 | ; point setup the FCB and create the volume label. If failure, | ||
| 89 | ; prompt user that they entered bad input, and try again. | ||
| 90 | ; | ||
| 91 | ; Note: This routine in 3.30 and prior used to check for /V | ||
| 92 | ; switch. Volume labels are always required now, so /V | ||
| 93 | ; is ignored, except to get volume label on command line. | ||
| 94 | ; | ||
| 95 | ;Called Procedures: Message (macro) | ||
| 96 | ; Get_New_Label | ||
| 97 | ; | ||
| 98 | ;Change History: Created 5/1/87 MT | ||
| 99 | ; | ||
| 100 | ;Input: Switch_V | ||
| 101 | ; Command_Line = YES/NO | ||
| 102 | ; | ||
| 103 | ;Output: None | ||
| 104 | ; | ||
| 105 | ;Psuedocode | ||
| 106 | ;---------- | ||
| 107 | ; | ||
| 108 | ; Save registers | ||
| 109 | ; IF /V switch entered | ||
| 110 | ; IF /v:xxxxx form not entered | ||
| 111 | ; CALL Get_New_Label ;Return string in Volume_Label | ||
| 112 | ; ENDIF | ||
| 113 | ; ELSE | ||
| 114 | ; CALL Get_New_Label ;Return string in Volume_Label | ||
| 115 | ; ENDIF | ||
| 116 | ; DO | ||
| 117 | ; Create volume label | ||
| 118 | ; LEAVE Create Ok | ||
| 119 | ; Display Bad Character message | ||
| 120 | ; CALL Get_New_Label ;Return string in Volume_Label | ||
| 121 | ; ENDDO | ||
| 122 | ; Restore registers | ||
| 123 | ; ret | ||
| 124 | ;***************************************************************************** | ||
| 125 | |||
| 126 | Procedure Volid ; ;AN000; | ||
| 127 | |||
| 128 | push ds ;Save registers ;AN000; | ||
| 129 | push si ; " " " " ;AN000; | ||
| 130 | test SwitchMap,Switch_V ;Was /V entered ;AN000; | ||
| 131 | ; $IF NZ ;Yes, see if label entered also ;AN000; | ||
| 132 | JZ $$IF1 | ||
| 133 | cmp Command_Line,YES ;Is there a string there? ;AN000; | ||
| 134 | ; $IF NE ;Nope ;AN000; | ||
| 135 | JE $$IF2 | ||
| 136 | call Get_New_Label ;Go get volume label from user ;AN000; | ||
| 137 | ; $ENDIF ; ;AN000; | ||
| 138 | $$IF2: | ||
| 139 | ; $ELSE ;Label not entered on cmd line ;AN000; | ||
| 140 | JMP SHORT $$EN1 | ||
| 141 | $$IF1: | ||
| 142 | call Get_New_Label ;Go get label from user ;AN000; | ||
| 143 | ; $ENDIF ; ;AN000; | ||
| 144 | $$EN1: | ||
| 145 | mov dl,drive ;Get drive number A=0 ;AN000; | ||
| 146 | inc dl ;Make it 1 based ;AN000; | ||
| 147 | mov DelDrive,dl ;Put into FCBs ;AN000; | ||
| 148 | mov VolDrive,dl ; ;AN000; | ||
| 149 | mov dx,offset DelFCB ;Point at FCB to delete label ;AN000; | ||
| 150 | DOS_Call FCB_Delete ;Do the delete ;AN000; | ||
| 151 | mov dx,offset VolFCB ;Point at FCB for create ;AN000; | ||
| 152 | DOS_CALL FCB_Create ;Go create it ;AN000; | ||
| 153 | cmp dl,Create_Worked ;See if the create worked ;an024; | ||
| 154 | ; $IF E ;an024; | ||
| 155 | JNE $$IF6 | ||
| 156 | mov dx,offset VolFCB ;Point to the FCB created ;an022; dms; | ||
| 157 | DOS_Call FCB_Close ;Close the newly created FCB ;an022; dms; | ||
| 158 | ; $ENDIF ;an024; | ||
| 159 | $$IF6: | ||
| 160 | |||
| 161 | pop si ;Restore registers ;AN000; | ||
| 162 | pop ds ; " " " " ;AN000; | ||
| 163 | ret ; ;AN000; | ||
| 164 | |||
| 165 | Volid endp ; ;AN000; | ||
| 166 | |||
| 167 | ;***************************************************************************** | ||
| 168 | ;Routine name: Get_New_Label | ||
| 169 | ;***************************************************************************** | ||
| 170 | ; | ||
| 171 | ;Description: Prompts, inputs and verifies a volume label string. Continues | ||
| 172 | ; to prompt until valid vol label is input | ||
| 173 | ; | ||
| 174 | ;Called Procedures: Message (macro) | ||
| 175 | ; Build_String | ||
| 176 | ; Get_11_Characters | ||
| 177 | ; | ||
| 178 | ;Change History: Created 3/18/87 MT | ||
| 179 | ; | ||
| 180 | ;Input: None | ||
| 181 | ; | ||
| 182 | ;Output: Volume_Label holds | ||
| 183 | ; | ||
| 184 | ;Psuedocode | ||
| 185 | ;---------- | ||
| 186 | ; | ||
| 187 | ; DO | ||
| 188 | ; Display new volume label prompt | ||
| 189 | ; Input vol label | ||
| 190 | ; IF No error (NC) | ||
| 191 | ; Build Asciiz string with label, pointer DS:SI (CALL Build_String) | ||
| 192 | ; Call Get_11_Characters (Error returned CY) | ||
| 193 | ; ENDIF | ||
| 194 | ; LEAVE no error (NC) | ||
| 195 | ; Display label error | ||
| 196 | ; ENDDO | ||
| 197 | ; ret | ||
| 198 | ;***************************************************************************** | ||
| 199 | |||
| 200 | Procedure Get_New_Label ; ;AN000; | ||
| 201 | |||
| 202 | ; $DO ;Loop until we get good one ;AN000; | ||
| 203 | $$DO8: | ||
| 204 | Message msgLabelPrompt ;Prompt to input Vol label ;AN000; | ||
| 205 | mov ax,(Std_Con_Input_Flush shl 8) + 0 ;an000; dms;clean out input | ||
| 206 | int 21h ;an000; dms; | ||
| 207 | mov dx,offset Vol_Label_Count ;an000; dms;beginning of buffer | ||
| 208 | mov ah,Std_Con_String_Input ;an000; dms;get input | ||
| 209 | int 21h ;an000; dms; | ||
| 210 | mov ax,(Std_Con_Input_Flush shl 8) + 0 ;an000; dms; clean out input | ||
| 211 | int 21h ;an000; dms; | ||
| 212 | ; $IF NC ;Read ok if NC, Bad sets CY ;AN000; | ||
| 213 | JC $$IF9 | ||
| 214 | mov si,offset Vol_Label_Buffer ;Get pointer to string ;AN000; | ||
| 215 | call Get_11_Characters ;Handle DBCS stuff on input ;AN000; | ||
| 216 | ; $ENDIF ;Ret CY if error ;AN000; | ||
| 217 | $$IF9: | ||
| 218 | ; $LEAVE NC ;Done if NC ;AN000; | ||
| 219 | JNC $$EN8 | ||
| 220 | Message MsgCRLF ;next line ;an020; dms; | ||
| 221 | Message msgBadVolumeID ;Tell user error ;AN000; | ||
| 222 | ; $ENDDO ;Try again ;AN000; | ||
| 223 | JMP SHORT $$DO8 | ||
| 224 | $$EN8: | ||
| 225 | Message MsgCRLF ;an000; dms;next line | ||
| 226 | ret ; ;AN000; | ||
| 227 | |||
| 228 | Get_New_Label endp ; ;AN000; | ||
| 229 | |||
| 230 | ;***************************************************************************** | ||
| 231 | ;Routine name: Get_11_Characters | ||
| 232 | ;***************************************************************************** | ||
| 233 | ; | ||
| 234 | ;Description: Handle DBCS considerations, and build FCB to create vol label | ||
| 235 | ; | ||
| 236 | ; | ||
| 237 | ;Called Procedures: Change_Blanks | ||
| 238 | ; Skip_Blanks | ||
| 239 | ; Check_DBCS_Overrun | ||
| 240 | ; Copy_FCB_String | ||
| 241 | ; | ||
| 242 | ;Change History: Created 5/12/87 MT | ||
| 243 | ; | ||
| 244 | ;Input: DS:SI = Asciiz string containing volume label input | ||
| 245 | ; Command_Line = YES/NO | ||
| 246 | ; | ||
| 247 | ;Output: Volname will contain an 8.3 volume label in FCB | ||
| 248 | ; CY set on invalid label | ||
| 249 | ; | ||
| 250 | ;Psuedocode | ||
| 251 | ;---------- | ||
| 252 | ; Save regs used | ||
| 253 | ; Scan line replacing all DBCS blanks with SBCS (CALL_Change_Blanks) | ||
| 254 | ; Skip over leading blanks (Call Skip_Blanks) | ||
| 255 | ; IF leading blanks ,AND | ||
| 256 | ; IF Command line | ||
| 257 | ; Indicate invalid label (STC) | ||
| 258 | ; ELSE | ||
| 259 | ; See if DBCS character at 11th byte (CALL Check_DBCS_Overrun) | ||
| 260 | ; IF DBCS character at 11th byte | ||
| 261 | ; Indicate invalid label (STC) | ||
| 262 | ; ELSE | ||
| 263 | ; Put string into FCB (CALL Copy_FCB_STRING) | ||
| 264 | ; CLC | ||
| 265 | ; ENDIF | ||
| 266 | ; ENDIF | ||
| 267 | ; Restore regs | ||
| 268 | ; ret | ||
| 269 | ;***************************************************************************** | ||
| 270 | |||
| 271 | Procedure Get_11_Characters ; ;AN000; | ||
| 272 | |||
| 273 | call Change_Blanks ;Change DBCS blanks to SBCS ;AN000; | ||
| 274 | call Skip_Blanks ;Skip over leading blanks ;AN000; | ||
| 275 | ; $IF C,AND ;Find leading blanks? ;AN000; | ||
| 276 | JNC $$IF13 | ||
| 277 | cmp Command_Line,YES ;Is this command line input? ;AN000; | ||
| 278 | ; $IF E ;Yes ;AN000; | ||
| 279 | JNE $$IF13 | ||
| 280 | stc ;Indicate error (CY set) ;AN000; | ||
| 281 | ; $ELSE ;Leading blanks ok ;AN000; | ||
| 282 | JMP SHORT $$EN13 | ||
| 283 | $$IF13: | ||
| 284 | call Check_DBCS_Overrun ;Is DBCS char at 11th byte? ;AN000; | ||
| 285 | ; $IF C ;Yes ;AN000; | ||
| 286 | JNC $$IF15 | ||
| 287 | stc ;Indicate invalid label ;AN000; | ||
| 288 | ; $ELSE ;No, good characters ;AN000; | ||
| 289 | JMP SHORT $$EN15 | ||
| 290 | $$IF15: | ||
| 291 | call Copy_FCB_String ;Put string into FCB ;AN000; | ||
| 292 | clc ;Indicate everything A-OK! ;AN000; | ||
| 293 | ; $ENDIF ; ;AN000; | ||
| 294 | $$EN15: | ||
| 295 | ; $ENDIF ; ;AN000; | ||
| 296 | $$EN13: | ||
| 297 | ret ; ;AN000; | ||
| 298 | |||
| 299 | Get_11_Characters endp ; ;AN000; | ||
| 300 | |||
| 301 | ;***************************************************************************** | ||
| 302 | ;Routine name: Change_Blanks | ||
| 303 | ;***************************************************************************** | ||
| 304 | ; | ||
| 305 | ;Description: Replace all DBCS blanks with SBCS blanks, end string with | ||
| 306 | ; Asciiz character if one doesn't already exist | ||
| 307 | ; | ||
| 308 | ;Called Procedures: Check_DBCS_Character | ||
| 309 | ; | ||
| 310 | ;Change History: Created 6/12/87 MT | ||
| 311 | ; | ||
| 312 | ;Input: DS:SI = String containing volume label input | ||
| 313 | ; | ||
| 314 | ;Output: DS:SI = ASCIIZ string with all DBCS blanks replaced with 2 SBCS blanks | ||
| 315 | ; | ||
| 316 | ; | ||
| 317 | ;Psuedocode | ||
| 318 | ;---------- | ||
| 319 | ; | ||
| 320 | ; Save pointer to string | ||
| 321 | ; DO | ||
| 322 | ; LEAVE End of string (0) | ||
| 323 | ; See if DBCS character (Check_DBCS_Character) | ||
| 324 | ; IF CY (DBCS char found) | ||
| 325 | ; IF first byte DBCS blank, AND | ||
| 326 | ; IF second byte DBCS blank | ||
| 327 | ; Convert to SBCS blanks | ||
| 328 | ; ENDIF | ||
| 329 | ; Point to next byte to compensate for DBCS character | ||
| 330 | ; ENDIF | ||
| 331 | ; ENDDO | ||
| 332 | ; Tack on ASCIIZ character to string | ||
| 333 | ; Restore pointer to string | ||
| 334 | ; | ||
| 335 | ;***************************************************************************** | ||
| 336 | |||
| 337 | Procedure Change_Blanks ; ;AN000; | ||
| 338 | |||
| 339 | push si ;Save pointer to string ;AN000; | ||
| 340 | push cx ; ;AN000; | ||
| 341 | push ax ; ;AN000; | ||
| 342 | xor cx,cx ; ;AN000; | ||
| 343 | ; $DO ;Do while not CR ;AN000; | ||
| 344 | $$DO19: | ||
| 345 | cmp byte ptr [si],Asciiz_End ;Is it end of string? ;AN000; | ||
| 346 | ; $LEAVE E,OR ;All done if so ;AN000; | ||
| 347 | JE $$EN19 | ||
| 348 | cmp byte ptr [si],CR ;Is it CR? ;AN000; | ||
| 349 | ; $LEAVE E,OR ;Exit if yes,end of label ;AN000; | ||
| 350 | JE $$EN19 | ||
| 351 | inc cx ;Count the character ;AN000; | ||
| 352 | cmp cx,Label_Buffer_Length ;Reached max chars? (80h) ;AN000; | ||
| 353 | ; $LEAVE E ;Exit if so ;AN000; | ||
| 354 | JE $$EN19 | ||
| 355 | mov al,byte ptr [si] ;Get char to test for DBCS ;AN000; | ||
| 356 | call Check_DBCS_Character ;Test for dbcs lead byte ;AN000; | ||
| 357 | ; $IF C ;We have a lead byte ;AN000; | ||
| 358 | JNC $$IF21 | ||
| 359 | cmp byte ptr [si],DBCS ;Is it a lead blank? ;AN000; | ||
| 360 | ; $IF E,AND ;If a dbcs char ;AN000; | ||
| 361 | JNE $$IF22 | ||
| 362 | cmp byte ptr [si+1],DBCS_Blank ;Is it an Asian blank? ;AN000; | ||
| 363 | ; $IF E ;If an Asian blank ;AN000; | ||
| 364 | JNE $$IF22 | ||
| 365 | mov byte ptr [si+1],Blank ;set up moves ;AN000; | ||
| 366 | mov byte ptr [si],Blank ; to replace ;AN000; | ||
| 367 | ; $ENDIF ; ;AN000; | ||
| 368 | $$IF22: | ||
| 369 | inc si ;Point to dbcs char ;AN000; | ||
| 370 | ; $ENDIF ;End lead byte test ;AN000; | ||
| 371 | $$IF21: | ||
| 372 | inc si ;Point to si+1 ;AN000; | ||
| 373 | ; $ENDDO ;End do while ;AN000; | ||
| 374 | JMP SHORT $$DO19 | ||
| 375 | $$EN19: | ||
| 376 | mov byte ptr [si],Asciiz_End ;Mark end of string ;AN000; | ||
| 377 | pop ax ;Restore regs ;AN000; | ||
| 378 | pop cx ; ;AN000; | ||
| 379 | pop si ; ;AN000; | ||
| 380 | ret ;return to caller ;AN000; | ||
| 381 | |||
| 382 | Change_Blanks endp ; ;AN000; | ||
| 383 | |||
| 384 | ;***************************************************************************** | ||
| 385 | ;Routine name: Skip_Blanks | ||
| 386 | ;***************************************************************************** | ||
| 387 | ; | ||
| 388 | ;Description: Scan ASCIIZ string for leading blanks, return pointer to first | ||
| 389 | ; non-blank character. Set CY if blanks found | ||
| 390 | ; | ||
| 391 | ;Called Procedures: None | ||
| 392 | ; | ||
| 393 | ;Change History: Created 6/12/87 MT | ||
| 394 | ; | ||
| 395 | ;Input: DS:SI = ASCIIZ string containing volume label input | ||
| 396 | ; | ||
| 397 | ;Output: DS:SI = Input string starting at first non-blank character | ||
| 398 | ; CY set if blanks found | ||
| 399 | ; | ||
| 400 | ; | ||
| 401 | ; | ||
| 402 | ;Psuedocode | ||
| 403 | ;---------- | ||
| 404 | ; | ||
| 405 | ; Save original pointer, DI register | ||
| 406 | ; DO | ||
| 407 | ; Look at character from string | ||
| 408 | ; LEAVE End of string (0) | ||
| 409 | ; IF character is blank,OR | ||
| 410 | ; IF character is tab | ||
| 411 | ; INC pointer (SI) | ||
| 412 | ; Indicate blank | ||
| 413 | ; ELSE | ||
| 414 | ; Indicate non-blank | ||
| 415 | ; ENDIF | ||
| 416 | ; ENDDO non-blank | ||
| 417 | ; Get back pointer | ||
| 418 | ; Cmp string pointer to original pointer | ||
| 419 | ; IF NE | ||
| 420 | ; STC | ||
| 421 | ; ELSE | ||
| 422 | ; CLC | ||
| 423 | ; ENDIF | ||
| 424 | ; ret | ||
| 425 | ;***************************************************************************** | ||
| 426 | |||
| 427 | Procedure Skip_Blanks ; ;AN000; | ||
| 428 | |||
| 429 | push di ;Preserve DI, just in case ;AN000; | ||
| 430 | push si ;Save pointer to string ;AN000; | ||
| 431 | ; $DO ;Look at entire ASCIIZ string ;AN000; | ||
| 432 | $$DO26: | ||
| 433 | cmp byte ptr [si],ASCIIZ_End ;End of string? ;AN000; | ||
| 434 | ; $LEAVE E ;Yep, exit loop ;AN000; | ||
| 435 | JE $$EN26 | ||
| 436 | cmp byte ptr [si],Blank ;Find a blank? ;AN000; | ||
| 437 | ; $IF E,OR ;Yes ;AN000; | ||
| 438 | JE $$LL28 | ||
| 439 | cmp byte ptr [si],TAB ;Is it tab? ;AN000; | ||
| 440 | ; $IF E ;Yes ;AN000; | ||
| 441 | JNE $$IF28 | ||
| 442 | $$LL28: | ||
| 443 | inc si ;Bump pointer to next character ;AN000; | ||
| 444 | clc ;Indicate found blank ;AN000; | ||
| 445 | ; $ELSE ;Not blank or tab ;AN000; | ||
| 446 | JMP SHORT $$EN28 | ||
| 447 | $$IF28: | ||
| 448 | stc ;Force exit ;AN000; | ||
| 449 | ; $ENDIF ; ;AN000; | ||
| 450 | $$EN28: | ||
| 451 | ; $ENDDO C ;Go look at next character ;AN000; | ||
| 452 | JNC $$DO26 | ||
| 453 | $$EN26: | ||
| 454 | pop di ;Get back original pointer ;AN000; | ||
| 455 | cmp di,si ;Are they the same? ;AN000; | ||
| 456 | ; $IF NE ;If not equal blanks were found ;AN000; | ||
| 457 | JE $$IF32 | ||
| 458 | stc ;Set CY ;AN000; | ||
| 459 | ; $ELSE ;No leading blanks found ;AN000; | ||
| 460 | JMP SHORT $$EN32 | ||
| 461 | $$IF32: | ||
| 462 | clc ;Clear CY ;AN000; | ||
| 463 | ; $ENDIF ; ;AN000; | ||
| 464 | $$EN32: | ||
| 465 | pop di ;Restore DI ;AN000; | ||
| 466 | ret ; ;AN000; | ||
| 467 | |||
| 468 | Skip_Blanks endp ; ;AN000; | ||
| 469 | |||
| 470 | |||
| 471 | ;***************************************************************************** | ||
| 472 | ;Routine name: Copy_FCB_String | ||
| 473 | ;***************************************************************************** | ||
| 474 | ; | ||
| 475 | ;Description: Build an 11 character string in the FCB from ASCIIZ string | ||
| 476 | ; If nothing entered, than terminated with 0. Also add drive | ||
| 477 | ; number in FCB | ||
| 478 | ; | ||
| 479 | ;Called Procedures: None | ||
| 480 | ; | ||
| 481 | ;Change History: Created 6/12/87 MT | ||
| 482 | ; | ||
| 483 | ;Input: DS:SI = String containing volume label input | ||
| 484 | ; | ||
| 485 | ;Output: VOLNAM is filled in with Volume label string | ||
| 486 | ; | ||
| 487 | ; | ||
| 488 | ; | ||
| 489 | ;Psuedocode | ||
| 490 | ;---------- | ||
| 491 | ; | ||
| 492 | ; Save regs | ||
| 493 | ; Init VolNam to blanks | ||
| 494 | ; DO | ||
| 495 | ; LEAVE if character is end of ASCIIZ string | ||
| 496 | ; Mov character to FCB | ||
| 497 | ; Inc counter | ||
| 498 | ; ENDDO all 11 chars done | ||
| 499 | ; Restore regs | ||
| 500 | ;***************************************************************************** | ||
| 501 | |||
| 502 | Procedure Copy_FCB_String ; ;AN000; | ||
| 503 | |||
| 504 | push di ; ;AN000; | ||
| 505 | push cx ; ;AN000; | ||
| 506 | push si ;Save pointer to string ;AN000; | ||
| 507 | cld ;Set string direction to up ;AN000; | ||
| 508 | mov di,offset Volnam ;Init FCB field to blanks ;AN000; | ||
| 509 | mov al,Blank ; " " " " ;AN000; | ||
| 510 | mov cx,Label_Length ; " " " " ;AN000; | ||
| 511 | rep stosb ; " " " " ;AN000; | ||
| 512 | pop si ;Get back pointer to string ;AN000; | ||
| 513 | mov di,offset VolNam ;Point at FCB field ;AN000; | ||
| 514 | xor cx,cx ;Init counter ;AN000; | ||
| 515 | ; $DO ;Copy characters over ;AN000; | ||
| 516 | $$DO35: | ||
| 517 | cmp byte ptr [si],ASCIIZ_End ;End of String? ;AN000; | ||
| 518 | ; $LEAVE E ;Yes, don't copy - leave blanks ;AN000; | ||
| 519 | JE $$EN35 | ||
| 520 | movsb ;Nope, copy character ;AN000; | ||
| 521 | inc cx ;Bump up count ;AN000; | ||
| 522 | cmp cx,Label_Length ;Have we moved 11? ;AN000; | ||
| 523 | ; $ENDDO E ;Quit if so ;AN000; | ||
| 524 | JNE $$DO35 | ||
| 525 | $$EN35: | ||
| 526 | pop cx ; ;AN000; | ||
| 527 | pop di ; ;AN000; | ||
| 528 | ret ; ;AN000; | ||
| 529 | |||
| 530 | Copy_FCB_String endp ; ;AN000; | ||
| 531 | |||
| 532 | |||
| 533 | ;***************************************************************************** | ||
| 534 | ;Routine name: Check_DBCS_Overrun | ||
| 535 | ;***************************************************************************** | ||
| 536 | ; | ||
| 537 | ;Description: Check 11th byte, if the string is that long, to see | ||
| 538 | ; if it is a DBCS character that is split down the middle. Must | ||
| 539 | ; scan entire string to properly find DBCS characters, due to | ||
| 540 | ; the fact a second byte of a DBCS character can fall into | ||
| 541 | ; the range of the first byte environment vector, and thus look | ||
| 542 | ; like a DBCS char when it really isn't | ||
| 543 | ; | ||
| 544 | ;Called Procedures: Check_DBCS_Character | ||
| 545 | ; | ||
| 546 | ;Change History: Created 6/12/87 MT | ||
| 547 | ; | ||
| 548 | ;Input: DS:SI = String containing volume label input | ||
| 549 | ; | ||
| 550 | ;Output: CY set if DBCS character at bytes 11-12 in string | ||
| 551 | ; | ||
| 552 | ;***************************************************************************** | ||
| 553 | |||
| 554 | Procedure Check_DBCS_Overrun ; ;AN000; | ||
| 555 | |||
| 556 | push si ;Save pointer ;AN000; | ||
| 557 | push ax ;Save registers ;AN000; | ||
| 558 | push cx ; " " " " ;AN000; | ||
| 559 | mov cx,si ;Get start of string ;AN000; | ||
| 560 | add cx,Label_Length ;Find where to check for overrun;AN000; | ||
| 561 | |||
| 562 | Check_DBCS_OverRun_Cont: ;Scan string for DBCS chars ;AN000; | ||
| 563 | |||
| 564 | cmp byte ptr [si],ASCIIZ_End ;End of string? ;AN000; | ||
| 565 | je DBCS_Good_Exit ;Yep ;AN000; | ||
| 566 | |||
| 567 | mov al,[si] ;Get character for routine ;AN000; | ||
| 568 | call Check_DBCS_Character ;See if DBCS leading character ;AN000; | ||
| 569 | ; $if c ;DBCS if CY set ;AN000; | ||
| 570 | JNC $$IF38 | ||
| 571 | inc si ;Next byte to handle DBCS ;AN000; | ||
| 572 | cmp si,cx ;Is DBCS char spanning 11-12? ;AN000; | ||
| 573 | ; $if e ;truncate string | ||
| 574 | JNE $$IF39 | ||
| 575 | mov byte ptr [si-1],20h;blank it out | ||
| 576 | mov byte ptr [si],20h ;blank it out | ||
| 577 | jmp DBCS_Good_Exit ;exit | ||
| 578 | ; $endif ; | ||
| 579 | $$IF39: | ||
| 580 | ; $else ;Not DBCS character ;an000; dms; | ||
| 581 | JMP SHORT $$EN38 | ||
| 582 | $$IF38: | ||
| 583 | mov al,[si] ;Get character for routine ;an000; dms; | ||
| 584 | call Scan_For_Invalid_Char ;See if invalid vol ID char ;an000; dms; | ||
| 585 | jc DBCS_Bad_Exit ;Bad char entered - exit ;an000; dms; | ||
| 586 | ; $endif ; ;an000; dms; | ||
| 587 | $$EN38: | ||
| 588 | |||
| 589 | inc si ;Point to next character ;an000; dms; | ||
| 590 | jmp Check_DBCS_OverRun_Cont ;Continue looping ;an000; dms; | ||
| 591 | |||
| 592 | DBCS_Good_Exit: | ||
| 593 | ;an000; dms; | ||
| 594 | clc ;Signal no error ;an000; dms; | ||
| 595 | jmp DBCS_Exit ;Exit routine ;an000; dms; | ||
| 596 | |||
| 597 | DBCS_Bad_Exit: ;an000; dms; | ||
| 598 | |||
| 599 | stc ;Signal error ;an000; dms; | ||
| 600 | |||
| 601 | DBCS_Exit: ;an000; dms; | ||
| 602 | |||
| 603 | pop cx ;Restore registers ;AN000; | ||
| 604 | pop ax ; " " " " ;AN000; | ||
| 605 | pop si ;Restore string pointer ;AN000; | ||
| 606 | ret ; ;AN000; | ||
| 607 | |||
| 608 | Check_DBCS_Overrun endp ; ;AN000; | ||
| 609 | |||
| 610 | ;***************************************************************************** | ||
| 611 | ;Routine name: Check_DBCS_Character | ||
| 612 | ;***************************************************************************** | ||
| 613 | ; | ||
| 614 | ;Description: Check if specified byte is in ranges of DBCS vectors | ||
| 615 | ; | ||
| 616 | ;Called Procedures: None | ||
| 617 | ; | ||
| 618 | ;Change History: Created 6/12/87 MT | ||
| 619 | ; | ||
| 620 | ;Input: AL = Character to check for DBCS lead character | ||
| 621 | ; DBCS_Vector = YES/NO | ||
| 622 | ; | ||
| 623 | ;Output: CY set if DBCS character | ||
| 624 | ; DBCS_VECTOR = YES | ||
| 625 | ; | ||
| 626 | ; | ||
| 627 | ;Psuedocode | ||
| 628 | ;---------- | ||
| 629 | ; Save registers | ||
| 630 | ; IF DBCS vector not found | ||
| 631 | ; Get DBCS environmental vector (INT 21h | ||
| 632 | ; Point at first set of vectors | ||
| 633 | ; ENDIF | ||
| 634 | ; SEARCH | ||
| 635 | ; LEAVE End of DBCS vectors | ||
| 636 | ; EXITIF Character > X1,AND (X1,Y1) are environment vectors | ||
| 637 | ; EXITIF Character < Y1 | ||
| 638 | ; STC (DBCS character) | ||
| 639 | ; ORELSE | ||
| 640 | ; Inc pointer to next set of vectors | ||
| 641 | ; ENDLOOP | ||
| 642 | ; CLC (Not DBCS character) | ||
| 643 | ; ENDSRCH | ||
| 644 | ; Restore registers | ||
| 645 | ; ret | ||
| 646 | ;***************************************************************************** | ||
| 647 | |||
| 648 | Procedure Check_DBCS_Character ; ;AN000; | ||
| 649 | |||
| 650 | push ds ;Save registers ;AN000; | ||
| 651 | push si ; " " " " ;AN000; | ||
| 652 | push ax ; " " " " ;AN000; | ||
| 653 | push ds ; " " " " ;AN000; | ||
| 654 | pop es ;Establish addressability ;AN000; | ||
| 655 | cmp byte ptr es:DBCS_VECTOR,Yes ;Have we set this yet? ;AN000; | ||
| 656 | push ax ;Save input character ;AN000; | ||
| 657 | ; $IF NE ;Nope ;AN000; | ||
| 658 | JE $$IF43 | ||
| 659 | mov al,0 ;Get DBCS environment vectors ;AN000; | ||
| 660 | DOS_Call Hongeul ; " " " " ;AN000; | ||
| 661 | mov byte ptr es:DBCS_VECTOR,YES ;Indicate we've got vector ;AN000; | ||
| 662 | mov es:DBCS_Vector_Off,si ;Save the vector ;AN000; | ||
| 663 | mov ax,ds ; ;AN000; | ||
| 664 | mov es:DBCS_Vector_Seg,ax ; ;AN000; | ||
| 665 | ; $ENDIF ; for next time in ;AN000; | ||
| 666 | $$IF43: | ||
| 667 | pop ax ;Restore input character ;AN000; | ||
| 668 | mov si,es:DBCS_Vector_Seg ;Get saved vector pointer ;AN000; | ||
| 669 | mov ds,si ; ;AN000; | ||
| 670 | mov si,es:DBCS_Vector_Off ; ;AN000; | ||
| 671 | ; $SEARCH ;Check all the vectors ;AN000; | ||
| 672 | $$DO45: | ||
| 673 | cmp word ptr ds:[si],End_Of_Vector ;End of vector table? ;AN000; | ||
| 674 | ; $LEAVE E ;Yes, done ;AN000; | ||
| 675 | JE $$EN45 | ||
| 676 | cmp al,ds:[si] ;See if char is in vector ;AN000; | ||
| 677 | ; $EXITIF AE,AND ;If >= to lower, and ;AN000; | ||
| 678 | JNAE $$IF45 | ||
| 679 | cmp al,ds:[si+1] ; =< than higher range ;AN000; | ||
| 680 | ; $EXITIF BE ; then DBCS character ;AN000; | ||
| 681 | JNBE $$IF45 | ||
| 682 | stc ;Set CY to indicate DBCS ;AN000; | ||
| 683 | ; $ORELSE ;Not in range, check next ;AN000; | ||
| 684 | JMP SHORT $$SR45 | ||
| 685 | $$IF45: | ||
| 686 | add si,DBCS_Vector_Size ;Get next DBCS vector ;AN000; | ||
| 687 | ; $ENDLOOP ;We didn't find DBCS char ;AN000; | ||
| 688 | JMP SHORT $$DO45 | ||
| 689 | $$EN45: | ||
| 690 | clc ;Clear CY for exit ;AN000; | ||
| 691 | ; $ENDSRCH ; ;AN000; | ||
| 692 | $$SR45: | ||
| 693 | pop ax ;Restore registers ;AN000; | ||
| 694 | pop si ; " " " " ;AN000; | ||
| 695 | pop ds ;Restore data segment ;AN000; | ||
| 696 | ret ; ;AN000; | ||
| 697 | |||
| 698 | Check_DBCS_Character endp ; ;AN000; | ||
| 699 | |||
| 700 | ;========================================================================= | ||
| 701 | ; Scan_For_Invalid_Char : This routine scans the bad character table | ||
| 702 | ; to determine if the referenced character is | ||
| 703 | ; invalid. | ||
| 704 | ; | ||
| 705 | ; Inputs : Bad_Char_Table - Table of bad characters | ||
| 706 | ; Bad_Char_Table_Len - Length of table | ||
| 707 | ; AL - Character to be searched for | ||
| 708 | ; | ||
| 709 | ; Outputs : CY - Bad character | ||
| 710 | ; NC - Character good | ||
| 711 | ;========================================================================= | ||
| 712 | |||
| 713 | Procedure Scan_For_Invalid_Char ;an000; dms; | ||
| 714 | |||
| 715 | push ax ;an000; dms;save ax | ||
| 716 | push cx ;an000; dms;save cx | ||
| 717 | push di ;an000; dms;save di | ||
| 718 | |||
| 719 | lea di,Bad_Char_Table ;an000; dms;point to bad character table | ||
| 720 | mov cx,Bad_Char_Table_Len ;an000; dms;get its length | ||
| 721 | repnz scasb ;an000; dms;scan the table | ||
| 722 | cmp cx,0000h ;an000; dms;did we find the character | ||
| 723 | ; $if e ;an000; dms;no - a good character | ||
| 724 | JNE $$IF51 | ||
| 725 | clc ;an000; dms;flag a good character | ||
| 726 | ; $else ;an000; dms;yes - a bad character | ||
| 727 | JMP SHORT $$EN51 | ||
| 728 | $$IF51: | ||
| 729 | stc ;an000; dms;flag a bad character | ||
| 730 | ; $endif ;an000; dms; | ||
| 731 | $$EN51: | ||
| 732 | |||
| 733 | pop di ;an000; dms;restore di | ||
| 734 | pop cx ;an000; dms;restore cx | ||
| 735 | pop ax ;an000; dms;restore ax | ||
| 736 | |||
| 737 | ret ;an000; dms; | ||
| 738 | |||
| 739 | Scan_For_Invalid_Char endp ;an000; dms; | ||
| 740 | |||
| 741 | |||
| 742 | code ends | ||
| 743 | |||
| 744 | data segment public para 'DATA' | ||
| 745 | |||
| 746 | Bad_Char_Table label byte ;an000; dms;table of invalid vol ID chars | ||
| 747 | db "*" | ||
| 748 | db "?" | ||
| 749 | db "[" | ||
| 750 | db "]" | ||
| 751 | db ":" | ||
| 752 | db "<" | ||
| 753 | db "|" | ||
| 754 | db ">" | ||
| 755 | db "+" | ||
| 756 | db "=" | ||
| 757 | db ";" | ||
| 758 | db "," | ||
| 759 | db "/" | ||
| 760 | db "\" | ||
| 761 | db '.' | ||
| 762 | db '"' | ||
| 763 | db " " | ||
| 764 | Bad_Char_Table_Len equ $-Bad_Char_Table;an000; dms;length of table | ||
| 765 | |||
| 766 | DBCS_Vector_Off dw 0 ; | ||
| 767 | DBCS_Vector_Seg dw 0 ; | ||
| 768 | |||
| 769 | data ends | ||
| 770 | end | ||
| 771 | \ No newline at end of file | ||