From cac1e511f7324a58d3feb57ac1e3d894b7275392 Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Tue, 6 Aug 2024 13:56:44 +0100 Subject: [PATCH] Implemented int 21h/AH=41 --- build/chimaera.img | Bin 368640 -> 368640 bytes build/chimaera.vhd | Bin 34120704 -> 34120704 bytes src/apps/hello/hello.asm | 7 +- src/apps/pcomm/Makefile.unix | 2 +- src/apps/pcomm/Makefile.w32 | 2 +- src/apps/pcomm/del.asm | 222 +++++++++++++++++++++++++++ src/apps/pcomm/pcomm.asm | 5 + src/kernel/int21.asm | 281 ++++++++++++++++++++++++++++++++++- 8 files changed, 513 insertions(+), 6 deletions(-) create mode 100644 src/apps/pcomm/del.asm diff --git a/build/chimaera.img b/build/chimaera.img index d52add0355fc3a6b7e03549ba94739d682f4b10f..f77702e5bbb893147a8f231df71b79af0ebca794 100644 GIT binary patch delta 5778 zcma)A30PCtw%+GtVg?Zz0%Sl5gY}SuBL+c5!4U&dMiG524jmN&s8zrltArqJ-Cyl@ zd+R{aXB)vs3EI$DiKU7iuwHE~)oQENcBg487A}HNcgT`KV?v>o4OxQyP7Q z2U3?kE|uq4_MfFbX>U?;%3ti|qau)7$7_-aS^5HlUDDp9r!uD6v@#cu^^rAJ^Blxp zBC8_t#GGJyP9$EC^SxhFtnL%OeT<~~pEcjA_ayhK$)Q-R%8eLX$_?n+=!Nzl4avPV zRuVtSRGd4DqKztiVY?V#Sm{>&TC5?NPqJbgXA&8ZG+7!;dFDW7$~p6H9(%$q#I`m3VQiD=fLpl8Y?qV5={Z0Tx(o zEU~iWBbI!~!Y(?iklg0j<@GFik0t-jk~-icZp|AHfd2+d_Oj$vmQ=I)E?5JszpN<*&-g z&NcH;e_N)8+>jN9kiFq})7nJ(n_%3ucDGAv@Ty}>El8QOE|T7;Fg>^KExtlGN%sk@ z>!S^)#qzEEypC}x=fmt$+QdC zC(?)UC8X6et&m%EKe&(FyXWPRW%~VR6bZ z)%LLXmEp4n6$#-Hi4!Ac`$x{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F3k4L>w4k$;I6RI~#iRy!L zM!BF|QEn)Alm|+M@QGY|dg?bzHcho}E zf1wtk3Q&cp#i(~sMW`jHcTw-5mZFxSjHuTA?C)OJ)gY6t2YR1K;YwG*`qRfpP*`W97>YCxG#dr*5(ji`O7{ip+|Ce%UHA=F{i zcc>$%X4FyCG1PI?3Dil{Db)9<)2K73v#4{Z^Qa4`i>OPe%cv`;tEeAPKcap@{fxSX zx{mql z@-Y1gaKNJklniBqvPH>J3ZVg}Kf&Q+`0_6jKHoqDFJVvnIv+R)ayDPdNYKATbVEg3 R?~u^Z>F)F3e_prn{|z<3XDt8# diff --git a/src/apps/hello/hello.asm b/src/apps/hello/hello.asm index 07f1f9f..4aac207 100644 --- a/src/apps/hello/hello.asm +++ b/src/apps/hello/hello.asm @@ -19,10 +19,15 @@ _main: mov bx, offset _msg_hello call _writestr + mov ah, HEX (3C) + mov cx, HEX (20) + mov dx, offset _new_file + int HEX (21) + jc .exit + ; mov ah, HEX (3C) ; mov cx, HEX (20) ; mov dx, offset _existing_file -; mov dx, offset _new_file ; int HEX (21) ; jc .exit ; diff --git a/src/apps/pcomm/Makefile.unix b/src/apps/pcomm/Makefile.unix index b39d307..b256c62 100644 --- a/src/apps/pcomm/Makefile.unix +++ b/src/apps/pcomm/Makefile.unix @@ -46,7 +46,7 @@ genver: genver.c gcc -o $@ $^ endif -pcomm.com: ../../lib/crt/crt0.o cbreak.o cd.o crlf.o date.o dir.o erase.o exit.o history.o mkdir.o pcomm.o time.o touch.o type.o vector.o writedec.o writehex.o writestr.o xmalloc.o xstrcpy.o ../../lib/crt/libc.a +pcomm.com: ../../lib/crt/crt0.o cbreak.o cd.o crlf.o date.o del.o dir.o erase.o exit.o history.o mkdir.o pcomm.o time.o touch.o type.o vector.o writedec.o writehex.o writestr.o xmalloc.o xstrcpy.o ../../lib/crt/libc.a ../../utils/binutils/slink --oformat msdos -o $@ $^ %.o: %.asm diff --git a/src/apps/pcomm/Makefile.w32 b/src/apps/pcomm/Makefile.w32 index e56edd9..ddfdcfc 100644 --- a/src/apps/pcomm/Makefile.w32 +++ b/src/apps/pcomm/Makefile.w32 @@ -30,7 +30,7 @@ genhash.exe: genhash.c genver.exe: genver.c gcc -o $@ $^ -pcomm.com: ../../lib/crt/crt0.o cbreak.o cd.o crlf.o date.o dir.o erase.o exit.o history.o mkdir.o pcomm.o time.o touch.o type.o vector.o writedec.o writehex.o writestr.o xmalloc.o xstrcpy.o ../../lib/crt/libc.a +pcomm.com: ../../lib/crt/crt0.o cbreak.o cd.o crlf.o date.o del.o dir.o erase.o exit.o history.o mkdir.o pcomm.o time.o touch.o type.o vector.o writedec.o writehex.o writestr.o xmalloc.o xstrcpy.o ../../lib/crt/libc.a ../../utils/binutils/slink --oformat msdos -o $@ $^ %.o: %.asm diff --git a/src/apps/pcomm/del.asm b/src/apps/pcomm/del.asm new file mode 100644 index 0000000..154872a --- /dev/null +++ b/src/apps/pcomm/del.asm @@ -0,0 +1,222 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; @file type.asm +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +%ifndef HEX +% define HEX(y) 0x##y +%endif + +;****************************************************************************** +; @function _handler_del +;****************************************************************************** +global _handler_del +_handler_del: + + push bp + + mov bp, sp + sub sp, 4 + + push ax + push bx + push cx + push dx + push si + push di + push es + push ds + + mov word ptr [bp - 4], 0 + mov word ptr [bp - 2], 0 + + cmp byte ptr [bx], 0 + jne _handler_del.ok + + mov bx, offset _err_invalid + call _writestr + + jmp _handler_del.done + +_handler_del.ok: + + push bx + + call _strlen + add sp, 2 + + mov di, offset _cmdline + mov si, bx + + mov cx, ax + rep movsb + + xor al, al + stosb + + mov bx, offset _cmdline + +_handler_del.store_arg: + + cmp byte ptr [bx], 0 + je _handler_del.next + + mov si, bx + push si + + mov ax, offset _vec_files + push ax + + call _vec_push + add sp, 4 + +_handler_del.check: + + mov ax, ' ' + push ax + + mov si, bx + push si + + call _strchr + add sp, 4 + + and ax, ax + jz _handler_del.next + + mov bx, ax + mov byte ptr [bx], 0 + + inc bx + +_handler_del.skip: + + cmp byte ptr [bx], 0 + je _handler_del.next + + cmp byte ptr [bx], ' ' + ja _handler_del.store_arg + + inc bx + jmp _handler_del.skip + +_handler_del.next: + + mov ax, word ptr [bp - 4] + inc ax + + cmp ax, cs:[_vec_files + 4] + ja _handler_del.cleanup + + mov word ptr [bp - 4], ax + dec ax + + xor dx, dx + + mov cx, 2 + mul cx + + mov bx, ax + push es + + mov ax, cs:[_vec_files + 0] + mov es, ax + + mov ax, es:[bx] + mov bx, ax + + pop es + +_handler_del.delete: + + push bx + + mov ah, HEX (41) + mov dx, bx + int HEX (21) + jnc _handler_del.deleted + + cmp ax, 2 + jne _handler_del.check3 + + mov bx, offset _err_no_file + jmp _handler_del.error + +_handler_del.check3: + + cmp ax, 3 + jne _handler_del.unhandled + + mov bx, offset _err_no_dir + jmp _handler_del.error + +_handler_del.unhandled: + + pop bx + mov bx, offset _err_unhandled + +_handler_del.error: + + call _writestr + + cmp ax, 3 + ja _handler_del.next + + cmp ax, 2 + jb _handler_del.next + + pop bx + + call _writestr + call _crlf + + jmp _handler_del.cleanup + +_handler_del.deleted: + + pop bx + jmp _handler_del.next + +_handler_del.cleanup: + + mov ax, cs:[_vec_files + 0] + push ax + + call _free + add sp, 2 + + mov ax, cs + mov es, ax + + mov di, offset _vec_files + xor al, al + + mov cx, 6 + rep stosb + +_handler_del.done: + + pop ds + pop es + pop di + pop si + pop dx + pop cx + pop bx + pop ax + + add sp, 4 + pop bp + + ret + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Data area. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +_vec_files: db 6 dup (0) +_cmdline: db 256 dup (0) + +_err_invalid: db "Invalid number of parameters", HEX (0D), HEX (0A), HEX (00) + +_err_no_dir: db "Path not found: ", HEX (00) +_err_no_file: db "File not found: ", HEX (00) + +_err_unhandled: db "Unhandled error code", HEX (0D), HEX (0A), HEX (00) diff --git a/src/apps/pcomm/pcomm.asm b/src/apps/pcomm/pcomm.asm index f06e924..755fc5f 100644 --- a/src/apps/pcomm/pcomm.asm +++ b/src/apps/pcomm/pcomm.asm @@ -1070,6 +1070,7 @@ _handler_help.msg: db "CD Change the current directory to the specified path.", HEX (0D), HEX (0A) db "CLS Clears the screen.", HEX (0D), HEX (0A) db "DATE Displays the system date.", HEX (0D), HEX (0A) + db "DEL Delete the specified files.", HEX (0D), HEX (0A) db "DIR Displays a list of files and subdirectories in a directory.", HEX (0D), HEX (0A) db "ECHO Specifies the text to display to the screen.", HEX (0D), HEX (0A) db "EXIT Exit the current shell if it's not the last instance.", HEX (0D), HEX (0A) @@ -1278,6 +1279,10 @@ _cmd_table: dw 0 dw _handler_date + dw hash_del + dw 0 + dw _handler_del + dw hash_dir dw 0 dw _handler_dir diff --git a/src/kernel/int21.asm b/src/kernel/int21.asm index a6f0a11..6f189c3 100644 --- a/src/kernel/int21.asm +++ b/src/kernel/int21.asm @@ -869,10 +869,9 @@ _int21_dispatch.list: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Delete/Unlink File. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;db HEX (41) - ;dw _int21_41 + db HEX (41) + dw _int21_41 - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Move File Pointer Using Handle. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -3116,6 +3115,282 @@ _int21_40.done: jmp iretc +;****************************************************************************** +; @function _int21_41 +; @brief Delete/Unlink File +; +; @in DS:DX -> Pointer to ASCIIZ filename. +; @out AX -> Error code if CF is set. +;****************************************************************************** +_int21_41: + + push bp + + mov bp, sp + sub sp, 6 + + push bx + push cx + push dx + push si + push di + push es + push ds + + xor bh, bh + mov bl, al + + mov si, dx + + call _get_disk_info + jc _int21_41.path_error + + mov di, si + +_int21_41.open: + + call _open_file + jc _int21_41.error + + mov word ptr [bp - 6], ax + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; First thing we need to do is get the index into the file info vector. + ;; + ;; Note: We should need to do a compare here as _open_file should + ;; give us a value of at least 3. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xor dx, dx + sub ax, 3 + + mov cx, 2 + mul cx + + mov bx, ax + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Okay, we should have the correct index into the file info vector + ;; so get the + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov ax, cs:[_vec_files + 0] + mov es, ax + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; If the vector entry is zero then the file handle is invalid. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + cmp word ptr es:[bx], 0 + je _int21_41.denied + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Re-initialize the extra segment but this time with the address + ;; of the vector entry. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov ax, es:[bx] + mov es, ax + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; We'll use si register as the index into the info. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xor si, si + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Get the file size. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov ax, es:[si + 66] + mov dx, es:[si + 68] + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; If we don't have a file size then we can got straight to done. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov bx, ax + or bx, dx + + and bx, bx + jz _int21_41.update + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Convert the size into the amount of cluster. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov cx, es:[si + 50] + div cx + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Move the value into the cx register. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov cx, ax + inc cx + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Get the starting cluster. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov ax, es:[si + 58] + mov dx, es:[si + 60] + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Save the value in cx. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + push cx + +_int21_41.clear: + + and cx, cx + jz _int21_41.update + + push ax + push dx + + call cs:[_next_cluster] + + mov word ptr [bp - 8], ax + mov word ptr [bp - 10], dx + + pop dx + pop ax + + push cx + push bx + + xor bx, bx + xor cx, cx + call cs:[_update_cluster] + + pop bx + pop cx + + mov ax, word ptr [bp - 8] + mov dx, word ptr [bp - 10] + + dec cx + jnz _int21_41.clear + +_int21_41.update: + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Update the entry on disk. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov ax, es:[si + 74] + mov dx, es:[si + 76] + + mov cx, es:[si + 78] + mov di, es:[si + 80] + + push es + push bx + push ax + push dx + push cx + + mov bx, cs:[_disk_scratch] + mov es, bx + + xor bx, bx + call _read_sectors + + mov byte ptr es:[di + 0], HEX (E5) + pop cx + pop dx + pop ax + + xor bx, bx + call _write_sectors + + pop bx + pop es + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Restore the value in the cx register. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop si + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Check if we have an info sector. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov ax, cs:[_info_sector] + + and ax, ax + jz _int21_41.no_info + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Update the free clusters. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xor dx, dx + + add ax, cs:[_hidden_sectors] + adc dx, cs:[_hidden_sectors + 2] + + mov bx, cs:[_disk_scratch] + mov es, bx + xor bx, bx + + mov cx, 1 + call _read_sectors + + mov di, HEX (01E0) + + mov ax, es:[di + 8] + mov dx, es:[di + 10] + + add ax, si + adc dx, 0 + + mov es:[di + 8], ax + mov es:[di + 10], dx + + mov ax, cs:[_info_sector] + xor dx, dx + + add ax, cs:[_hidden_sectors] + adc dx, cs:[_hidden_sectors + 2] + + mov cx, 1 + call _write_sectors + +_int21_41.no_info: + + mov ax, word ptr [bp - 6] + jmp _int21_41.done + +_int21_41.denied: + + mov ax, 5 + jmp _int21_41.error + +_int21_41.path_error: + + mov ax, 3 + +_int21_41.error: + + pop ds + pop es + pop di + pop si + pop dx + pop cx + pop bx + + add sp, 6 + stc + + pop bp + jmp iretc + +_int21_41.done: + + pop ds + pop es + pop di + pop si + pop dx + pop cx + pop bx + + add sp, 6 + clc + + pop bp + jmp iretc + ;****************************************************************************** ; @function _int21_42 ; @brief Move File Pointer Using Handle -- 2.34.1