forked from PoliEcho-holding-org/kern
Tried adding file saving/loading
This commit is contained in:
+1
-1
@@ -17,6 +17,6 @@ filetable:
|
|||||||
db 'filetable',0, 'txt',0,2,1 ; filetable.txt - start: 2, size: 1
|
db 'filetable',0, 'txt',0,2,1 ; filetable.txt - start: 2, size: 1
|
||||||
db 'kernel',0,0,0,0, 'bin',0,3,4 ; kernel.bin - start: 3, size: 4
|
db 'kernel',0,0,0,0, 'bin',0,3,4 ; kernel.bin - start: 3, size: 4
|
||||||
db 'calc',0,0,0,0,0,0, 'bin',0,7,1 ; calc.bin - start: 7, size: 1
|
db 'calc',0,0,0,0,0,0, 'bin',0,7,1 ; calc.bin - start: 7, size: 1
|
||||||
db 'edit',0,0,0,0,0,0, 'bin',0,8,3 ; edit.bin - start: 8, size: 2
|
db 'edit',0,0,0,0,0,0, 'bin',0,8,4 ; edit.bin - start: 8, size: 2
|
||||||
|
|
||||||
times 512-($-$$) db 0
|
times 512-($-$$) db 0
|
||||||
|
|||||||
+175
-22
@@ -1,11 +1,14 @@
|
|||||||
[bits 16]
|
[bits 16]
|
||||||
|
|
||||||
launch:
|
start:
|
||||||
|
mov byte [driveNum], dl
|
||||||
|
|
||||||
|
hexEditor:
|
||||||
pusha
|
pusha
|
||||||
call clearText
|
call clearText
|
||||||
|
|
||||||
mov di, 0x0e60 ; Offset in vidmem (2nd to last line)
|
mov di, 0x0e60 ; Offset in vidmem (2nd to last line)
|
||||||
mov si, statusBarMsg
|
mov si, hexModeMsg
|
||||||
call drawString
|
call drawString
|
||||||
mov di, 0x0f00 ; Last line
|
mov di, 0x0f00 ; Last line
|
||||||
mov si, controlsMsg
|
mov si, controlsMsg
|
||||||
@@ -16,10 +19,14 @@ launch:
|
|||||||
getHexCh:
|
getHexCh:
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
int 0x16
|
int 0x16
|
||||||
cmp al, '$' ; Check for end of input (Denoted by a "$")
|
cmp al, RUN_CODE
|
||||||
je .runInput
|
je .runInput
|
||||||
cmp al, '!' ; End editor, Exit back to kernel
|
cmp al, QUIT_EDIT
|
||||||
je return
|
je return
|
||||||
|
cmp al, SAVE_FILE
|
||||||
|
je save
|
||||||
|
cmp al, OPEN_FILE
|
||||||
|
je open
|
||||||
cmp al, 0x08 ; Backspace
|
cmp al, 0x08 ; Backspace
|
||||||
je .backspace
|
je .backspace
|
||||||
|
|
||||||
@@ -57,7 +64,7 @@ getHexCh:
|
|||||||
je getHexCh ; If not, ignore
|
je getHexCh ; If not, ignore
|
||||||
mov byte [di], 0
|
mov byte [di], 0
|
||||||
dec di
|
dec di
|
||||||
mov si, backChars
|
mov si, hexBackspace
|
||||||
call print
|
call print
|
||||||
jmp getHexCh
|
jmp getHexCh
|
||||||
.runInput:
|
.runInput:
|
||||||
@@ -72,16 +79,7 @@ getHexCh:
|
|||||||
call print
|
call print
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
int 0x16
|
int 0x16
|
||||||
jmp launch
|
jmp hexEditor
|
||||||
|
|
||||||
; Expects al to contain an ASCII character, will set bx to it's hex equivalent
|
|
||||||
asciiToHex:
|
|
||||||
cmp al, '9'
|
|
||||||
jle .getHex
|
|
||||||
sub al, 7
|
|
||||||
.getHex:
|
|
||||||
sub al, '0'
|
|
||||||
ret
|
|
||||||
|
|
||||||
return:
|
return:
|
||||||
mov cx, 256
|
mov cx, 256
|
||||||
@@ -104,24 +102,179 @@ return:
|
|||||||
mov gs, ax
|
mov gs, ax
|
||||||
jmp 0x2000:0x0000
|
jmp 0x2000:0x0000
|
||||||
|
|
||||||
|
; Saves a file
|
||||||
|
save:
|
||||||
|
mov dl, 9
|
||||||
|
mov si, saveFileMsg
|
||||||
|
call getFilename
|
||||||
|
mov byte al, [filename]
|
||||||
|
cmp byte al, 0
|
||||||
|
je getHexCh
|
||||||
|
|
||||||
|
; Call saveFile
|
||||||
|
mov byte dl, [driveNum]
|
||||||
|
push word filename
|
||||||
|
; TODO: More filetypes other than .bin
|
||||||
|
push word binFile
|
||||||
|
push word 1 ; TODO: Dynamic filesize
|
||||||
|
push word 0x8000 ; Program location (this segment)
|
||||||
|
push word hexCode
|
||||||
|
call saveFile ; Returns exit code in al
|
||||||
|
add sp, 8 ; Stack bs
|
||||||
|
|
||||||
|
cmp al, 0 ; Won't be 1 (File not found) so must be disk error
|
||||||
|
jne .error
|
||||||
|
|
||||||
|
jmp getHexCh
|
||||||
|
.error:
|
||||||
|
mov si, diskErrMsg
|
||||||
|
mov di, 0x0f00 ; Last line
|
||||||
|
call drawString
|
||||||
|
jmp getHexCh
|
||||||
|
|
||||||
|
; Opens a file
|
||||||
|
open:
|
||||||
|
mov dl, 11
|
||||||
|
mov si, openFileMsg
|
||||||
|
call getFilename
|
||||||
|
mov byte al, [filename]
|
||||||
|
cmp byte al, 0
|
||||||
|
je getHexCh
|
||||||
|
|
||||||
|
; Call loadFile
|
||||||
|
; TODO: The same stuff as in save
|
||||||
|
mov byte dl, [driveNum]
|
||||||
|
push word filename
|
||||||
|
push word 0x8000
|
||||||
|
push word hexCode
|
||||||
|
call loadFile
|
||||||
|
|
||||||
|
add sp, 6 ; Stack bs
|
||||||
|
|
||||||
|
cmp al, 1
|
||||||
|
je .notFound
|
||||||
|
cmp al, 2
|
||||||
|
je .diskErr
|
||||||
|
|
||||||
|
jmp getHexCh
|
||||||
|
.notFound:
|
||||||
|
mov si, notFoundMsg
|
||||||
|
jmp .error
|
||||||
|
.diskErr:
|
||||||
|
mov si, diskErrMsg
|
||||||
|
.error:
|
||||||
|
mov di, 0x0f00
|
||||||
|
call drawString
|
||||||
|
jmp getHexCh
|
||||||
|
|
||||||
|
;
|
||||||
|
; Gets a filename (10 chars, If less, padded with Nulls)
|
||||||
|
; Outputs the filename in the filename buffer
|
||||||
|
; si - Prompt string (Null terminated)
|
||||||
|
; dl - String offset
|
||||||
|
;
|
||||||
|
getFilename:
|
||||||
|
pusha
|
||||||
|
|
||||||
|
mov di, 0x0f00 ; Last line
|
||||||
|
call drawString ; si should contain the string
|
||||||
|
|
||||||
|
mov ah, 2 ; Move cursor to input position
|
||||||
|
mov dh, 24 ; Last line
|
||||||
|
int 0x10
|
||||||
|
|
||||||
|
mov di, filename
|
||||||
|
xor cx, cx ; Entered filename length
|
||||||
|
.loop:
|
||||||
|
xor ax, ax
|
||||||
|
int 0x16
|
||||||
|
|
||||||
|
cmp al, 0xD ; User pressed enter
|
||||||
|
je .done
|
||||||
|
cmp al, 8 ; Backspace
|
||||||
|
je .backspace
|
||||||
|
cmp al, 27 ; Escape
|
||||||
|
je .escape
|
||||||
|
cmp cx, 10 ; Filename too long
|
||||||
|
je .loop
|
||||||
|
|
||||||
|
mov ah, 0x0e
|
||||||
|
int 0x10
|
||||||
|
mov [di], al
|
||||||
|
inc di
|
||||||
|
inc cx
|
||||||
|
jmp .loop
|
||||||
|
.backspace:
|
||||||
|
cmp cx, 0
|
||||||
|
je .loop
|
||||||
|
dec cx
|
||||||
|
dec di
|
||||||
|
mov si, textBackspace
|
||||||
|
call print
|
||||||
|
jmp .loop
|
||||||
|
.escape:
|
||||||
|
xor cx, cx
|
||||||
|
mov si, filename
|
||||||
|
.done:
|
||||||
|
cmp cx, 10
|
||||||
|
je .after
|
||||||
|
mov byte [di], 0
|
||||||
|
inc cx
|
||||||
|
inc di
|
||||||
|
.after:
|
||||||
|
mov ah, 2 ; Move cursor
|
||||||
|
xor dx, dx ; 0,0
|
||||||
|
int 0x10
|
||||||
|
|
||||||
|
popa
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Expects al to contain an ASCII character, will set bx to it's hex equivalent
|
||||||
|
asciiToHex:
|
||||||
|
cmp al, '9'
|
||||||
|
jle .getHex
|
||||||
|
sub al, 7
|
||||||
|
.getHex:
|
||||||
|
sub al, '0'
|
||||||
|
ret
|
||||||
|
|
||||||
;; Includes
|
;; Includes
|
||||||
%include "./src/lib/print.asm"
|
%include "./src/lib/print.asm"
|
||||||
%include "./src/lib/disk.asm"
|
%include "./src/lib/disk.asm"
|
||||||
|
|
||||||
;; Variables
|
;; Variables
|
||||||
statusBarMsg: db " -- HEX -- ", 0
|
hexModeMsg: db " -- HEX -- ", 0
|
||||||
controlsMsg: db "'$' to execute code; '!' to quit; 's' to save", 0
|
textModeMsg: db " -- Text -- ", 0
|
||||||
fileChoiceMsg: db "'n' for new file; 'o' to open a file", 0
|
controlsMsg: db "'$' Execute; ^Q Quit; ^S Save; ^O Open", 0
|
||||||
chooseModeMsg: db "'x' for Hex mode; 't' for Text mode", 0
|
saveFileMsg: db "Save as: ", 0 ; Make sure to erase the controls
|
||||||
|
openFileMsg: db "Open file: ", 0
|
||||||
runMsg: db ENDL, ENDL, 0
|
runMsg: db ENDL, ENDL, 0
|
||||||
ranMsg: db ENDL, ENDL, " - Finished Execution - ", ENDL, 0
|
ranMsg: db ENDL, ENDL, " - Finished Execution - ", ENDL, 0
|
||||||
|
notFoundMsg: db "File not found! ", 0 ; Erase the user input
|
||||||
|
diskErrMsg: db "Disk Error! ", 0
|
||||||
|
|
||||||
backChars: db 8,8,8,' ',8,8,0
|
; Filetypes
|
||||||
|
binFile: db "bin"
|
||||||
|
txtFile: db "txt"
|
||||||
|
|
||||||
|
hexBackspace: db 8,8,8,' ',8,8,0
|
||||||
|
textBackspace: db 8,' ',8,0
|
||||||
|
|
||||||
|
driveNum: db 0
|
||||||
hexByte: db 0
|
hexByte: db 0
|
||||||
|
|
||||||
|
filenameLen: db 0
|
||||||
|
filename: times 10 db 0
|
||||||
codeLen: db 0
|
codeLen: db 0
|
||||||
hexCode: times 256 db 0 ; Code buffer
|
|
||||||
ret
|
;; Constants
|
||||||
|
RUN_CODE equ '$'
|
||||||
|
QUIT_EDIT equ 'q'
|
||||||
|
NEW_FILE equ 'n'
|
||||||
|
SAVE_FILE equ 's'
|
||||||
|
OPEN_FILE equ 'o'
|
||||||
|
|
||||||
times 3*512-($-$$) db 0
|
times 3*512-($-$$) db 0
|
||||||
|
|
||||||
|
hexCode: times 511 db 0 ; Code buffer
|
||||||
|
ret
|
||||||
|
|||||||
+6
-4
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
start:
|
start:
|
||||||
; Save the drive number from stack
|
; Save the drive number from stack
|
||||||
mov byte [driveNumber], dl
|
mov byte [driveNum], dl
|
||||||
|
|
||||||
mov bx, 0x2000
|
mov bx, 0x2000
|
||||||
mov es, bx
|
mov es, bx
|
||||||
@@ -170,7 +170,7 @@ foundProgram:
|
|||||||
push ax ; Save file size
|
push ax ; Save file size
|
||||||
|
|
||||||
mov ah, 0 ; Reset disk system
|
mov ah, 0 ; Reset disk system
|
||||||
mov dl, byte [driveNumber]
|
mov dl, byte [driveNum]
|
||||||
int 0x13
|
int 0x13
|
||||||
|
|
||||||
mov bx, PROGRAM_LOC
|
mov bx, PROGRAM_LOC
|
||||||
@@ -178,7 +178,7 @@ foundProgram:
|
|||||||
xor bx, bx ; [es:bx] - Place to load out program
|
xor bx, bx ; [es:bx] - Place to load out program
|
||||||
|
|
||||||
mov ah, 2 ; Read sectors into memory
|
mov ah, 2 ; Read sectors into memory
|
||||||
mov dl, byte [driveNumber]
|
mov dl, byte [driveNum]
|
||||||
mov ch, 0 ; Cylinder
|
mov ch, 0 ; Cylinder
|
||||||
mov dh, 0 ; Head
|
mov dh, 0 ; Head
|
||||||
int 0x13
|
int 0x13
|
||||||
@@ -200,6 +200,8 @@ foundProgram:
|
|||||||
repe cmpsb
|
repe cmpsb
|
||||||
jne .printText ; TODO: Check for more file extensions
|
jne .printText ; TODO: Check for more file extensions
|
||||||
|
|
||||||
|
mov dl, [driveNum]
|
||||||
|
|
||||||
mov ax, PROGRAM_LOC
|
mov ax, PROGRAM_LOC
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
@@ -407,7 +409,7 @@ reboot: jmp 0xffff:0x0000
|
|||||||
%include "./src/lib/screen.asm"
|
%include "./src/lib/screen.asm"
|
||||||
|
|
||||||
;; Variables
|
;; Variables
|
||||||
driveNumber: db 0
|
driveNum: db 0
|
||||||
|
|
||||||
startMsg: db "kern.", ENDL, ENDL, 0 ; The bootup message
|
startMsg: db "kern.", ENDL, ENDL, 0 ; The bootup message
|
||||||
prompt: db "> ", 0 ; Prompt for input
|
prompt: db "> ", 0 ; Prompt for input
|
||||||
|
|||||||
+31
-31
@@ -1,11 +1,10 @@
|
|||||||
;
|
;
|
||||||
; Loads a file from the filetable into a memory location
|
; Loads a file from the filetable into a memory location
|
||||||
; dl - Disk number
|
|
||||||
; Params:
|
; Params:
|
||||||
|
; dl - Disk number
|
||||||
; Filename (Null terminated)
|
; Filename (Null terminated)
|
||||||
; Destination location segment
|
; Destination location segment
|
||||||
; Destination location offset
|
; Destination location offset
|
||||||
; Disk number
|
|
||||||
;
|
;
|
||||||
; Returns:
|
; Returns:
|
||||||
; al - Exit code : 0 - Success; 1 - File not found; 2 - Disk error
|
; al - Exit code : 0 - Success; 1 - File not found; 2 - Disk error
|
||||||
@@ -16,13 +15,13 @@ loadFile:
|
|||||||
mov bp, sp
|
mov bp, sp
|
||||||
pusha
|
pusha
|
||||||
|
|
||||||
mov byte [driveNum], dl
|
mov byte [diskNum], dl
|
||||||
mov bx, [bp+4] ; dest Offset
|
mov bx, [bp+4] ; dest Offset
|
||||||
mov fs, [bp+6] ; dest Segment
|
mov fs, [bp+6] ; dest Segment
|
||||||
mov si, [bp+8] ; Filename
|
mov si, [bp+8] ; Filename
|
||||||
|
|
||||||
mov cx, 10
|
mov cx, 10
|
||||||
mov di, filename
|
mov di, fileName
|
||||||
.getFilename:
|
.getFilename:
|
||||||
lodsb ; mov byte al, [si]; inc si
|
lodsb ; mov byte al, [si]; inc si
|
||||||
cmp al, 0 ; End of filename
|
cmp al, 0 ; End of filename
|
||||||
@@ -33,8 +32,8 @@ loadFile:
|
|||||||
mov ax, FILETAB_LOC
|
mov ax, FILETAB_LOC
|
||||||
mov es, ax
|
mov es, ax
|
||||||
xor di, di ; es:di - Filetable location
|
xor di, di ; es:di - Filetable location
|
||||||
mov si, filename
|
mov si, fileName
|
||||||
.filenameCheck:
|
.fileNameCheck:
|
||||||
mov al, [di]
|
mov al, [di]
|
||||||
cmp al, 0 ; End of filetable
|
cmp al, 0 ; End of filetable
|
||||||
je .notFound
|
je .notFound
|
||||||
@@ -43,7 +42,7 @@ loadFile:
|
|||||||
je .beginCmp
|
je .beginCmp
|
||||||
|
|
||||||
add di, 16
|
add di, 16
|
||||||
jmp .filenameCheck
|
jmp .fileNameCheck
|
||||||
.beginCmp:
|
.beginCmp:
|
||||||
push di
|
push di
|
||||||
mov cl, 10
|
mov cl, 10
|
||||||
@@ -58,10 +57,10 @@ loadFile:
|
|||||||
inc si
|
inc si
|
||||||
jmp .cmpLoop
|
jmp .cmpLoop
|
||||||
.redoCheck:
|
.redoCheck:
|
||||||
mov si, filename
|
mov si, fileName
|
||||||
pop di
|
pop di
|
||||||
inc di
|
inc di
|
||||||
jmp .filenameCheck
|
jmp .fileNameCheck
|
||||||
.notFound:
|
.notFound:
|
||||||
mov byte [exitCode], NOT_FOUND
|
mov byte [exitCode], NOT_FOUND
|
||||||
jmp .done
|
jmp .done
|
||||||
@@ -75,7 +74,7 @@ loadFile:
|
|||||||
inc di ; Skip Number of entries
|
inc di ; Skip Number of entries
|
||||||
|
|
||||||
xor ax, ax ; Reset disk
|
xor ax, ax ; Reset disk
|
||||||
mov dl, [driveNum]
|
mov dl, [diskNum]
|
||||||
int 0x13
|
int 0x13
|
||||||
|
|
||||||
push fs
|
push fs
|
||||||
@@ -96,6 +95,7 @@ loadFile:
|
|||||||
popa
|
popa
|
||||||
mov sp, bp
|
mov sp, bp
|
||||||
pop bp
|
pop bp
|
||||||
|
mov byte al, [exitCode]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;
|
;
|
||||||
@@ -117,11 +117,11 @@ saveFile:
|
|||||||
mov bp, sp
|
mov bp, sp
|
||||||
pusha
|
pusha
|
||||||
|
|
||||||
mov byte [driveNum], dl
|
mov byte [diskNum], dl
|
||||||
pop bx ; src Offset
|
mov bx, [bp+4] ; src Offset
|
||||||
pop fs ; src Segment
|
mov fs, [bp+6] ; src Segment
|
||||||
pop cx ; Filesize
|
mov cx, [bp+8] ; Filesize
|
||||||
pop ax ; Filetype
|
mov ax, [bp+10] ; Filetype
|
||||||
|
|
||||||
push bx
|
push bx
|
||||||
|
|
||||||
@@ -131,17 +131,17 @@ saveFile:
|
|||||||
mov cx, 3
|
mov cx, 3
|
||||||
.filetype:
|
.filetype:
|
||||||
lodsb
|
lodsb
|
||||||
cmp al, 0 ; End of filename
|
cmp al, 0 ; End of fileName
|
||||||
dec si ; Fill the rest with Null
|
dec si ; Fill the rest with Null
|
||||||
stosb
|
stosb
|
||||||
loop .getFilename
|
loop .getFilename
|
||||||
|
|
||||||
pop si ; Filename
|
mov si, [bp+12] ; Filename
|
||||||
mov cx, 10
|
mov cx, 10
|
||||||
mov di, filename
|
mov di, fileName
|
||||||
.getFilename:
|
.getFilename:
|
||||||
lodsb ; mov byte al, [si]; inc si
|
lodsb ; mov byte al, [si]; inc si
|
||||||
cmp al, 0 ; End of filename
|
cmp al, 0 ; End of fileName
|
||||||
dec si ; Fill the rest with Null
|
dec si ; Fill the rest with Null
|
||||||
stosb
|
stosb
|
||||||
loop .getFilename
|
loop .getFilename
|
||||||
@@ -149,8 +149,8 @@ saveFile:
|
|||||||
mov ax, FILETAB_LOC
|
mov ax, FILETAB_LOC
|
||||||
mov es, ax
|
mov es, ax
|
||||||
xor di, di ; es:di - Filetable location
|
xor di, di ; es:di - Filetable location
|
||||||
mov si, filename
|
mov si, fileName
|
||||||
.filenameCheck:
|
.fileNameCheck:
|
||||||
mov byte al, [es:di+14]
|
mov byte al, [es:di+14]
|
||||||
mov byte [availableSector], al
|
mov byte [availableSector], al
|
||||||
mov byte al, [es:di+15]
|
mov byte al, [es:di+15]
|
||||||
@@ -164,7 +164,7 @@ saveFile:
|
|||||||
je .beginCmp
|
je .beginCmp
|
||||||
|
|
||||||
add di, 16
|
add di, 16
|
||||||
jmp .filenameCheck
|
jmp .fileNameCheck
|
||||||
.beginCmp:
|
.beginCmp:
|
||||||
push di
|
push di
|
||||||
mov cl, 10
|
mov cl, 10
|
||||||
@@ -179,10 +179,10 @@ saveFile:
|
|||||||
inc si
|
inc si
|
||||||
jmp .cmpLoop
|
jmp .cmpLoop
|
||||||
.redoCheck:
|
.redoCheck:
|
||||||
mov si, filename
|
mov si, fileName
|
||||||
pop di
|
pop di
|
||||||
add di, 16
|
add di, 16
|
||||||
jmp .filenameCheck
|
jmp .fileNameCheck
|
||||||
.found: ; File already exists (override)
|
.found: ; File already exists (override)
|
||||||
; TODO: Ask user if they want to override file
|
; TODO: Ask user if they want to override file
|
||||||
mov al, [es:di]
|
mov al, [es:di]
|
||||||
@@ -194,7 +194,7 @@ saveFile:
|
|||||||
inc di ; Skip Number of entries
|
inc di ; Skip Number of entries
|
||||||
|
|
||||||
xor ax, ax ; Reset disk
|
xor ax, ax ; Reset disk
|
||||||
mov dl, [driveNum]
|
mov dl, [diskNum]
|
||||||
int 0x13
|
int 0x13
|
||||||
|
|
||||||
; TODO: Override current file
|
; TODO: Override current file
|
||||||
@@ -215,8 +215,8 @@ saveFile:
|
|||||||
|
|
||||||
createFile: ; Appends a file to the filetable.
|
createFile: ; Appends a file to the filetable.
|
||||||
mov cx, 10
|
mov cx, 10
|
||||||
mov si, filename
|
mov si, fileName
|
||||||
rep movsb ; Append the filename
|
rep movsb ; Append the fileName
|
||||||
mov cx, 3
|
mov cx, 3
|
||||||
mov si, filetype
|
mov si, filetype
|
||||||
rep movsb ; Append the extension
|
rep movsb ; Append the extension
|
||||||
@@ -229,7 +229,7 @@ createFile: ; Appends a file to the filetable.
|
|||||||
; Write changed filetable to disk
|
; Write changed filetable to disk
|
||||||
;! If filetable size changes, this will have to change (probably)
|
;! If filetable size changes, this will have to change (probably)
|
||||||
xor bx, bx ; es:bx - Filetable location
|
xor bx, bx ; es:bx - Filetable location
|
||||||
mov dl, [driveNum]
|
mov dl, [diskNum]
|
||||||
mov ah, 3 ; Write to disk
|
mov ah, 3 ; Write to disk
|
||||||
mov al, 1 ; Write 1 sector
|
mov al, 1 ; Write 1 sector
|
||||||
mov ch, 0 ; Cylinder
|
mov ch, 0 ; Cylinder
|
||||||
@@ -248,7 +248,7 @@ writeFileData: ; Writes file data to the disk
|
|||||||
pop bx ; es:bx - Source
|
pop bx ; es:bx - Source
|
||||||
mov ah, 3 ; Write to disk
|
mov ah, 3 ; Write to disk
|
||||||
mov byte al, [filesize]
|
mov byte al, [filesize]
|
||||||
mov dl, [driveNum]
|
mov dl, [diskNum]
|
||||||
mov ch, 0 ; Cylinder
|
mov ch, 0 ; Cylinder
|
||||||
mov dh, 0 ; Head
|
mov dh, 0 ; Head
|
||||||
mov byte cl, [availableSector]
|
mov byte cl, [availableSector]
|
||||||
@@ -270,10 +270,10 @@ returnToCaller:
|
|||||||
availableSector: db 0
|
availableSector: db 0
|
||||||
exitCode: db 0
|
exitCode: db 0
|
||||||
|
|
||||||
driveNum: db 0
|
diskNum: db 0
|
||||||
filesize: db 0
|
filesize: db 0
|
||||||
filetype: times 3 db 0
|
filetype: times 3 db 0
|
||||||
filename: times 10 db 0
|
fileName: times 10 db 0
|
||||||
|
|
||||||
;; Constants
|
;; Constants
|
||||||
FILETAB_LOC equ 0x1000
|
FILETAB_LOC equ 0x1000
|
||||||
|
|||||||
Reference in New Issue
Block a user