diff options
| author | 2024-04-25 21:24:10 +0100 | |
|---|---|---|
| committer | 2024-04-25 22:32:27 +0000 | |
| commit | 2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch) | |
| tree | 80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/DOS/RENAME.ASM | |
| parent | Merge pull request #430 from jpbaltazar/typoptbr (diff) | |
| download | ms-dos-main.tar.gz ms-dos-main.tar.xz ms-dos-main.zip | |
Diffstat (limited to 'v4.0/src/DOS/RENAME.ASM')
| -rw-r--r-- | v4.0/src/DOS/RENAME.ASM | 434 |
1 files changed, 434 insertions, 0 deletions
diff --git a/v4.0/src/DOS/RENAME.ASM b/v4.0/src/DOS/RENAME.ASM new file mode 100644 index 0000000..c7d6caf --- /dev/null +++ b/v4.0/src/DOS/RENAME.ASM | |||
| @@ -0,0 +1,434 @@ | |||
| 1 | ; SCCSID = @(#)rename.asm 1.1 85/04/10 | ||
| 2 | TITLE DOS_RENAME - Internal RENAME call for MS-DOS | ||
| 3 | NAME DOS_RENAME | ||
| 4 | ; Low level routine for renaming files | ||
| 5 | ; | ||
| 6 | ; DOS_RENAME | ||
| 7 | ; | ||
| 8 | ; Modification history: | ||
| 9 | ; | ||
| 10 | ; Created: ARR 30 March 1983 | ||
| 11 | ; | ||
| 12 | |||
| 13 | ; | ||
| 14 | ; get the appropriate segment definitions | ||
| 15 | ; | ||
| 16 | .xlist | ||
| 17 | include dosseg.asm | ||
| 18 | |||
| 19 | CODE SEGMENT BYTE PUBLIC 'CODE' | ||
| 20 | ASSUME SS:DOSGROUP,CS:DOSGROUP | ||
| 21 | |||
| 22 | .xcref | ||
| 23 | INCLUDE DOSSYM.INC | ||
| 24 | INCLUDE DEVSYM.INC | ||
| 25 | .cref | ||
| 26 | .list | ||
| 27 | |||
| 28 | Installed = TRUE | ||
| 29 | |||
| 30 | i_need RENAMEDMA,BYTE | ||
| 31 | i_need AUXSTACK,BYTE | ||
| 32 | i_need DESTSTART,WORD | ||
| 33 | i_need DIRSTART,WORD | ||
| 34 | i_need CURBUF,DWORD | ||
| 35 | I_need NAME1,BYTE | ||
| 36 | i_need NAME2,BYTE | ||
| 37 | i_need WFP_START,WORD | ||
| 38 | i_need REN_WFP,WORD | ||
| 39 | i_need CURR_DIR_END,WORD | ||
| 40 | i_need DMAADD,DWORD | ||
| 41 | i_need THISCDS,DWORD | ||
| 42 | i_need THISDPB,DWORD | ||
| 43 | i_need THISSFT,DWORD | ||
| 44 | i_need CREATING,BYTE | ||
| 45 | i_need THISDRV,BYTE | ||
| 46 | i_need ATTRIB,BYTE | ||
| 47 | i_need FOUND_DEV,BYTE | ||
| 48 | i_need FAILERR,BYTE | ||
| 49 | i_need EXTERR_LOCUS,BYTE | ||
| 50 | i_need SAVE_BX,WORD | ||
| 51 | |||
| 52 | ; Inputs: | ||
| 53 | ; [WFP_START] Points to SOURCE WFP string ("d:/" must be first 3 | ||
| 54 | ; chars, NUL terminated) | ||
| 55 | ; [CURR_DIR_END] Points to end of Current dir part of string [SOURCE] | ||
| 56 | ; ( = -1 if current dir not involved, else | ||
| 57 | ; Points to first char after last "/" of current dir part) | ||
| 58 | ; [REN_WFP] Points to DEST WFP string ("d:/" must be first 3 | ||
| 59 | ; chars, NUL terminated) | ||
| 60 | ; [THISCDS] Points to CDS being used | ||
| 61 | ; (Low word = -1 if NUL CDS (Net direct request)) | ||
| 62 | ; [SATTRIB] Is attribute of search, determines what files can be found | ||
| 63 | ; Function: | ||
| 64 | ; Rename the specified file(s) | ||
| 65 | ; NOTE: This routine uses most of AUXSTACK as a temp buffer. | ||
| 66 | ; Outputs: | ||
| 67 | ; CARRY CLEAR | ||
| 68 | ; OK | ||
| 69 | ; CARRY SET | ||
| 70 | ; AX is error code | ||
| 71 | ; error_file_not_found | ||
| 72 | ; No match for source, or dest path invalid | ||
| 73 | ; error_not_same_device | ||
| 74 | ; Source and dest are on different devices | ||
| 75 | ; error_access_denied | ||
| 76 | ; Directory specified (not simple rename), | ||
| 77 | ; Device name given, Destination exists. | ||
| 78 | ; NOTE: In third case some renames may have | ||
| 79 | ; been done if metas. | ||
| 80 | ; error_path_not_found | ||
| 81 | ; Bad path (not in curr dir part if present) | ||
| 82 | ; SOURCE ONLY | ||
| 83 | ; error_bad_curr_dir | ||
| 84 | ; Bad path in current directory part of path | ||
| 85 | ; SOURCE ONLY | ||
| 86 | ; error_sharing_violation | ||
| 87 | ; Deny both access required, generates an INT 24. | ||
| 88 | ; DS preserved, others destroyed | ||
| 89 | |||
| 90 | procedure DOS_RENAME,NEAR | ||
| 91 | DOSAssume CS,<DS>,"DOS_Rename" | ||
| 92 | ASSUME ES:NOTHING | ||
| 93 | |||
| 94 | Invoke TestNet | ||
| 95 | JNC LOCAL_RENAME | ||
| 96 | ; invoke OWN_SHARE2 ;IFS. IFS owns share ? ;AN000; | ||
| 97 | ; JZ ifsshare ;IFS. yes ;AN000; | ||
| 98 | ; PUSH WORD PTR [DMAADD+2] ;IFS. save DMAADD ;AN000; | ||
| 99 | ; PUSH WORD PTR [DMAADD] ;IFS. ;AN000; | ||
| 100 | ; | ||
| 101 | ; invoke IFS_SEARCH_FIRST ;IFS. search source name ;AN000; | ||
| 102 | ; JC nofiles ;IFS. not found ;AN000; | ||
| 103 | rename_next_file: | ||
| 104 | ; invoke IFS_REN_DEL_CHECK ;IFS. do share check ;AN000; | ||
| 105 | ; JNC share_okok ;IFS. share ok ;AN000; | ||
| 106 | ; MOV AX,error_sharing_violation ;IFS. share error ;AN000; | ||
| 107 | ; JMP SHORT nofiles ;IFS. ;AN000; | ||
| 108 | share_okok: | ||
| 109 | ; PUSH CS ;IFS. ;AN000; | ||
| 110 | ; POP ES ;IFS. ;AN000; | ||
| 111 | ; MOV SI,[REN_WFP] ;IFS. ds:si -> destination name ;AN000; | ||
| 112 | ; MOV BX,SI ;IFS. ;AN000; | ||
| 113 | fndnxt: ;IFS. ;AN000; | ||
| 114 | ; LODSB ;IFS. ;AN000; | ||
| 115 | ; CMP AL,0 ;IFS. ;AN000; | ||
| 116 | ; JNZ fndnxt ;IFS. ;AN000; | ||
| 117 | ; MOV DI,SI ;IFS. es:di -> end of destinatio ;AN000; | ||
| 118 | ; ADD BX,2 ;IFS. ;AN000; | ||
| 119 | ; invoke SkipBack ;IFS. ;AN000; | ||
| 120 | ; INC DI ;IFS. es:di -> last component of ;AN000; | ||
| 121 | ; MOV SI,DI ;IFS. dstination ;AN000; | ||
| 122 | ; MOV BX,[SAVE_BX] ;IFS. ds:bx -> last component of ;AN000; | ||
| 123 | ; CALL NEW_RENAME ;IFS. source ;AN000; | ||
| 124 | ; MOV AX,(multNET SHL 8) OR 17 ;IFS. replace ? chars with ;AN000; | ||
| 125 | ; INT 2FH ;IFS. source and issue RENAME ;AN000; | ||
| 126 | ; JC nofiles ;IFS. error ;AN000; | ||
| 127 | ; invoke DOS_SEARCH_NEXT ;IFS. serch next source ;AN000; | ||
| 128 | ; JNC rename_next_file ;IFS. rename next ;AN000; | ||
| 129 | ; CLC ;IFS. no more files ;AN000; | ||
| 130 | nofiles: | ||
| 131 | ; POP WORD PTR [DMAADD] ;IFS. restore DMAADD ;AN000; | ||
| 132 | ; POP WORD PTR [DMAADD+2] ;IFS. ;AN000; | ||
| 133 | ; ret ;IFS. return ;AN000; | ||
| 134 | ifsshare: | ||
| 135 | |||
| 136 | IF NOT Installed | ||
| 137 | transfer NET_RENAME | ||
| 138 | ELSE | ||
| 139 | MOV AX,(multNET SHL 8) OR 17 | ||
| 140 | INT 2FH | ||
| 141 | return | ||
| 142 | ENDIF | ||
| 143 | |||
| 144 | LOCAL_RENAME: | ||
| 145 | MOV [EXTERR_LOCUS],errLOC_Disk | ||
| 146 | MOV SI,[WFP_START] | ||
| 147 | MOV DI,[REN_WFP] | ||
| 148 | MOV AL,BYTE PTR [SI] | ||
| 149 | MOV AH,BYTE PTR [DI] | ||
| 150 | OR AX,2020H ; Lower case | ||
| 151 | CMP AL,AH | ||
| 152 | JZ SAMEDRV | ||
| 153 | MOV AX,error_not_same_device | ||
| 154 | STC | ||
| 155 | return | ||
| 156 | |||
| 157 | SAMEDRV: | ||
| 158 | PUSH WORD PTR [DMAADD+2] | ||
| 159 | PUSH WORD PTR [DMAADD] | ||
| 160 | MOV WORD PTR [DMAADD+2],DS | ||
| 161 | MOV WORD PTR [DMAADD],OFFSET DOSGROUP:RENAMEDMA | ||
| 162 | MOV [Found_dev],0 ; Rename fails on DEVS, assume not a dev | ||
| 163 | EnterCrit critDisk | ||
| 164 | invoke DOS_SEARCH_FIRST ; Sets [NoSetDir] to 1, [CURBUF+2]:BX | ||
| 165 | ; points to entry | ||
| 166 | JNC Check_Dev | ||
| 167 | CMP AX,error_no_more_files | ||
| 168 | JNZ GOTERR | ||
| 169 | MOV AX,error_file_not_found | ||
| 170 | GOTERR: | ||
| 171 | STC | ||
| 172 | RENAME_POP: | ||
| 173 | POP WORD PTR [DMAADD] | ||
| 174 | POP WORD PTR [DMAADD+2] | ||
| 175 | LeaveCrit critDisk | ||
| 176 | return | ||
| 177 | |||
| 178 | Check_dev: | ||
| 179 | MOV AX,error_access_denied ; Assume error | ||
| 180 | |||
| 181 | PUSH DS ;PTM. ;AN000; | ||
| 182 | LDS SI,[DMAADD] ;PTM. chek if source a dir ;AN000; | ||
| 183 | ADD SI,find_buf_attr ;PTM. ;AN000; | ||
| 184 | TEST [SI.dir_attr],attr_directory ;PTM. ;AN000; | ||
| 185 | JZ notdir ;PTM. ;AN000; | ||
| 186 | MOV SI,[REN_WFP] ;PTM. if yes, make sure path ;AN000; | ||
| 187 | invoke Check_Pathlen2 ;PTM. length < 67 ;AN000; | ||
| 188 | notdir: | ||
| 189 | POP DS ;PTM. ;AN000; | ||
| 190 | JA GOTERR ;PTM. ;AN000; | ||
| 191 | |||
| 192 | CMP [Found_dev],0 | ||
| 193 | JNZ GOTERR | ||
| 194 | ; At this point a source has been found. There is search continuation info (a | ||
| 195 | ; la DOS_SEARCH_NEXT) for the source at RENAMEDMA, together with the first | ||
| 196 | ; directory entry found. | ||
| 197 | ; [THISCDS], [THISDPB], and [THISDRV] are set and will remain correct | ||
| 198 | ; throughout the RENAME since it is known at this point that the source and | ||
| 199 | ; destination are both on the same device. | ||
| 200 | ; [SATTRIB] is also set. | ||
| 201 | MOV SI,BX | ||
| 202 | ADD SI,dir_first | ||
| 203 | invoke REN_DEL_Check | ||
| 204 | JNC REN_OK1 | ||
| 205 | MOV AX,error_sharing_violation | ||
| 206 | JMP RENAME_POP | ||
| 207 | |||
| 208 | REN_OK1: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 209 | invoke FastOpen_Delete ; delete dir info in fastopen DOS 3.3 | ||
| 210 | MOV SI,[REN_WFP] ; Swap source and destination | ||
| 211 | MOV [WFP_START],SI | ||
| 212 | MOV [CURR_DIR_END],-1 ; No current dir on dest | ||
| 213 | MOV WORD PTR [CREATING],0E5FFH ; Creating, not DEL *.* | ||
| 214 | ; A rename is like a CREATE_NEW as far | ||
| 215 | ; as the destination is concerned. | ||
| 216 | invoke GetPathNoSet | ||
| 217 | ; If this Getpath fails due to file not found, we know all renames will work | ||
| 218 | ; since no files match the destination name. If it fails for any other | ||
| 219 | ; reason, the rename fails on a path not found, or whatever (also fails if | ||
| 220 | ; we find a device or directory). If the Getpath succeeds, we aren't sure | ||
| 221 | ; if the rename should fail because we haven't built an explicit name by | ||
| 222 | ; substituting for the meta chars in it. In this case the destination file | ||
| 223 | ; spec with metas is in [NAME1] and the explicit source name is at RENAMEDMA | ||
| 224 | ; in the directory entry part. | ||
| 225 | JC NODEST | ||
| 226 | ;; JZ BAD_ACC ; Dest string is a directory ;AC000; | ||
| 227 | OR AH,AH ; Device? | ||
| 228 | JNS SAVEDEST ; No, continue | ||
| 229 | BAD_ACC: | ||
| 230 | MOV AX,error_access_denied | ||
| 231 | STC | ||
| 232 | RENAME_CLEAN: | ||
| 233 | PUSHF ; Save carry state | ||
| 234 | PUSH AX ; and error code (if carry set) | ||
| 235 | MOV AL,[THISDRV] | ||
| 236 | invoke FLUSHBUF | ||
| 237 | POP AX | ||
| 238 | CMP [FAILERR],0 | ||
| 239 | JNZ BAD_ERR ; User FAILed to I 24 | ||
| 240 | POPF | ||
| 241 | JMP RENAME_POP | ||
| 242 | |||
| 243 | BAD_ERR: | ||
| 244 | POP AX ; Saved flags | ||
| 245 | MOV AX,error_path_not_found | ||
| 246 | JMP GOTERR | ||
| 247 | |||
| 248 | NODEST: | ||
| 249 | JNZ BAD_PATH | ||
| 250 | CMP [FAILERR],0 | ||
| 251 | JNZ BAD_PATH ; Search for dest failed because user FAILed on | ||
| 252 | ; I 24 | ||
| 253 | OR CL,CL | ||
| 254 | JNZ SAVEDEST | ||
| 255 | BAD_PATH: | ||
| 256 | MOV AX,error_path_not_found | ||
| 257 | STC | ||
| 258 | JMP RENAME_POP | ||
| 259 | |||
| 260 | SAVEDEST: | ||
| 261 | Context ES | ||
| 262 | MOV DI,OFFSET DOSGROUP:NAME2 | ||
| 263 | MOV SI,OFFSET DOSGROUP:NAME1 | ||
| 264 | MOV CX,11 | ||
| 265 | REP MOVSB ; Save dest with metas at NAME2 | ||
| 266 | MOV AX,[DIRSTART] | ||
| 267 | MOV [DESTSTART],AX | ||
| 268 | BUILDDEST: | ||
| 269 | Context ES ; needed due to JMP BUILDDEST below | ||
| 270 | MOV BX,OFFSET DOSGROUP:RENAMEDMA + 21 ; Source of replace chars | ||
| 271 | MOV DI,OFFSET DOSGROUP:NAME1 ; Real dest name goes here | ||
| 272 | MOV SI,OFFSET DOSGROUP:NAME2 ; Raw dest | ||
| 273 | MOV CX,11 | ||
| 274 | CALL NEW_RENAME ;IFS. replace ? chars ;AN000; | ||
| 275 | |||
| 276 | MOV [ATTRIB],attr_all ; Stop duplicates with any attributes | ||
| 277 | MOV [CREATING],0FFH | ||
| 278 | invoke DEVNAME ; Check if we built a device name | ||
| 279 | ASSUME ES:NOTHING | ||
| 280 | JNC BAD_ACC | ||
| 281 | MOV BX,[DESTSTART] | ||
| 282 | LES BP,[THISDPB] | ||
| 283 | invoke SetDirSrch ; Reset search to start of dir | ||
| 284 | JC BAD_ACC ; Screw up | ||
| 285 | invoke FINDENTRY ; See if new name already exists | ||
| 286 | JNC BAD_ACC ; Error if found | ||
| 287 | CMP [FAILERR],0 | ||
| 288 | JNZ BAD_ACCJ ; Find failed because user FAILed to I 24 | ||
| 289 | MOV AX,[DESTSTART] ; DIRSTART of dest | ||
| 290 | CMP AX,WORD PTR [RENAMEDMA + 15] ; DIRSTART of source | ||
| 291 | JZ SIMPLE_RENAME ; If =, just give new name | ||
| 292 | |||
| 293 | MOV AL,[RENAMEDMA + 21 + dir_attr] | ||
| 294 | TEST AL,attr_directory | ||
| 295 | JNZ BAD_ACCJ ; Can only do a simple rename on dirs, | ||
| 296 | ; otherwise the . and .. entries get | ||
| 297 | ; wiped. | ||
| 298 | MOV [ATTRIB],AL | ||
| 299 | MOV WORD PTR [THISSFT+2],DS | ||
| 300 | MOV SI,OFFSET DOSGROUP:AUXSTACK - SIZE SF_ENTRY | ||
| 301 | MOV WORD PTR [THISSFT],SI | ||
| 302 | MOV [SI].sf_mode,sharing_compat+open_for_both | ||
| 303 | XOR CX,CX ; Set "device ID" for call into makenode | ||
| 304 | invoke RENAME_MAKE ; This is in mknode | ||
| 305 | JNC GOT_DEST | ||
| 306 | BAD_ACCJ: | ||
| 307 | JMP BAD_ACC | ||
| 308 | |||
| 309 | GOT_DEST: | ||
| 310 | SaveReg <BX> | ||
| 311 | LES DI,ThisSFT ; Rename_make entered this into sharing | ||
| 312 | Invoke ShareEnd ; we need to remove it. | ||
| 313 | RestoreReg <BX> | ||
| 314 | ; A zero length entry with the correct new name has now been made at | ||
| 315 | ; [CURBUF+2]:BX. | ||
| 316 | LES DI,[CURBUF] | ||
| 317 | Assert ISBUF,<ES,DI>,"Got_Dest" | ||
| 318 | |||
| 319 | TEST ES:[DI.buf_flags],buf_dirty ;LB. if already dirty ;AN000; | ||
| 320 | JNZ yesdirty ;LB. don't increment dirty count ;AN000; | ||
| 321 | invoke INC_DIRTY_COUNT ;LB. ;AN000; | ||
| 322 | OR ES:[DI.buf_flags],buf_dirty | ||
| 323 | yesdirty: | ||
| 324 | MOV DI,BX | ||
| 325 | ADD DI,dir_attr ; Skip name | ||
| 326 | MOV SI,OFFSET DOSGROUP:RENAMEDMA + 21 + dir_attr | ||
| 327 | MOV CX,(SIZE dir_entry) - dir_attr | ||
| 328 | REP MOVSB | ||
| 329 | CALL GET_SOURCE | ||
| 330 | JC RENAME_OVER | ||
| 331 | MOV DI,BX | ||
| 332 | MOV ES,WORD PTR [CURBUF+2] | ||
| 333 | MOV AL,0E5H | ||
| 334 | STOSB ; "free" the source | ||
| 335 | JMP SHORT DIRTY_IT | ||
| 336 | |||
| 337 | SIMPLE_RENAME: | ||
| 338 | CALL GET_SOURCE ; Get the source back | ||
| 339 | JC RENAME_OVER | ||
| 340 | MOV DI,BX | ||
| 341 | MOV ES,WORD PTR [CURBUF+2] | ||
| 342 | MOV SI,OFFSET DOSGROUP:NAME1 ; New Name | ||
| 343 | MOV CX,11 | ||
| 344 | REP MOVSB | ||
| 345 | DIRTY_IT: | ||
| 346 | MOV DI,WORD PTR [CURBUF] | ||
| 347 | |||
| 348 | TEST ES:[DI.buf_flags],buf_dirty ;LB. if already dirty ;AN000; | ||
| 349 | JNZ yesdirty2 ;LB. don't increment dirty count ;AN000; | ||
| 350 | invoke INC_DIRTY_COUNT ;LB. ;AN000; | ||
| 351 | OR ES:[DI.buf_flags],buf_dirty | ||
| 352 | yesdirty2: | ||
| 353 | Assert ISBUF,<ES,DI>,"Dirty_it" | ||
| 354 | NEXT_SOURCE: | ||
| 355 | MOV SI,OFFSET DOSGROUP:RENAMEDMA + 1 ;Name | ||
| 356 | ; | ||
| 357 | ; WARNING! Rename_Next leaves the disk critical section *ALWAYS*. We need | ||
| 358 | ; to enter it before going to RENAME_Next. | ||
| 359 | ; | ||
| 360 | EnterCrit critDisk | ||
| 361 | MOV [CREATING],0 ; Correct setting for search (we changed it | ||
| 362 | ; to FF when we made the prev new file). | ||
| 363 | invoke RENAME_NEXT | ||
| 364 | ; | ||
| 365 | ; Note, now, that we have exited the previous ENTER and so are back to where | ||
| 366 | ; we were before. | ||
| 367 | ; | ||
| 368 | JC RENAME_OVER | ||
| 369 | LEA SI,[BX].dir_First | ||
| 370 | invoke REN_DEL_Check | ||
| 371 | JNC REN_OK2 | ||
| 372 | MOV AX,error_sharing_violation | ||
| 373 | JMP RENAME_CLEAN | ||
| 374 | |||
| 375 | REN_OK2: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 376 | invoke FastOpen_Delete ; delete dir info in fastopen DOS 3.3 | ||
| 377 | JMP BUILDDEST | ||
| 378 | |||
| 379 | RENAME_OVER: | ||
| 380 | CLC | ||
| 381 | JMP RENAME_CLEAN | ||
| 382 | |||
| 383 | ; Inputs: | ||
| 384 | ; RENAMEDMA has source info | ||
| 385 | ; Function: | ||
| 386 | ; Re-find the source | ||
| 387 | ; Output: | ||
| 388 | ; [CURBUF] set | ||
| 389 | ; [CURBUF+2]:BX points to entry | ||
| 390 | ; Carry set if error (currently user FAILed to I 24) | ||
| 391 | ; DS preserved, others destroyed | ||
| 392 | |||
| 393 | GET_SOURCE: | ||
| 394 | DOSAssume CS,<DS>,"Get_Source" | ||
| 395 | ASSUME ES:NOTHING | ||
| 396 | |||
| 397 | MOV BX,WORD PTR [RENAMEDMA + 15] ; DirStart | ||
| 398 | LES BP,ThisDPB | ||
| 399 | invoke SetDirSrch | ||
| 400 | retc | ||
| 401 | invoke StartSrch | ||
| 402 | MOV AX,WORD PTR [RENAMEDMA + 13] ; Lastent | ||
| 403 | invoke GetEnt | ||
| 404 | return | ||
| 405 | |||
| 406 | EndProc DOS_RENAME | ||
| 407 | |||
| 408 | ;Input: DS:SI -> raw string with ? | ||
| 409 | ; ES:DI -> destination string | ||
| 410 | ; DS:BX -> source string | ||
| 411 | ;Function: replace ? chars of raw string with chars in source string and | ||
| 412 | ; put in destination string | ||
| 413 | ;Output: ES:DI-> new string | ||
| 414 | |||
| 415 | |||
| 416 | |||
| 417 | procedure NEW_RENAME,NEAR | ||
| 418 | DOSAssume CS,<DS>,"DOS_Rename" | ||
| 419 | ASSUME ES:NOTHING | ||
| 420 | NEWNAM: | ||
| 421 | LODSB | ||
| 422 | CMP AL,"?" | ||
| 423 | JNZ NOCHG | ||
| 424 | MOV AL,[BX] ; Get replace char | ||
| 425 | NOCHG: | ||
| 426 | STOSB | ||
| 427 | INC BX ; Next replace char | ||
| 428 | LOOP NEWNAM | ||
| 429 | return | ||
| 430 | |||
| 431 | EndProc NEW_RENAME | ||
| 432 | |||
| 433 | CODE ENDS | ||
| 434 | END | ||