|
|
|
@ -4,14 +4,14 @@ svim:
|
|
|
|
|
;mov si, .os_clear_screen_str |
|
|
|
|
;call print |
|
|
|
|
xor bx, bx |
|
|
|
|
mov [.buffer_counter_svim], bx |
|
|
|
|
xor cx, cx ; Upper and left coordinate |
|
|
|
|
mov bh, 0x0a ; color for new screen 0 = black a = light green |
|
|
|
|
mov dh, 0xff ; Select all screen |
|
|
|
|
mov dl, 0xff ; Select all screen |
|
|
|
|
mov ah, 0x07 ; scrool down |
|
|
|
|
mov al, 0x00 ; scrool 0 lines (means blank screen ) |
|
|
|
|
int 0x10 |
|
|
|
|
call os_clear_screen |
|
|
|
|
;xor cx, cx ; Upper and left coordinate |
|
|
|
|
;mov bh, 0x0a ; color for new screen 0 = black a = light green |
|
|
|
|
;mov dh, 0xff ; Select all screen |
|
|
|
|
;mov dl, 0xff ; Select all screen |
|
|
|
|
;mov ah, 0x07 ; scrool down |
|
|
|
|
;mov al, 0x00 ; scrool 0 lines (means blank screen ) |
|
|
|
|
;int 0x10 |
|
|
|
|
|
|
|
|
|
mov ah, 0x02 |
|
|
|
|
mov bh, 0x00 ; page number 0 |
|
|
|
@ -44,11 +44,34 @@ svim:
|
|
|
|
|
xor dx, dx |
|
|
|
|
.enter_fileindex_loop: |
|
|
|
|
push cx |
|
|
|
|
.loop_no_push: |
|
|
|
|
mov ax, 0x10 ; BIOS call to wait for key |
|
|
|
|
int 0x16 |
|
|
|
|
cmp ax, 0x1c0d ; enter key |
|
|
|
|
je .fileindex_done |
|
|
|
|
.no_enter: |
|
|
|
|
cmp ax, 0x0e08 ; backspace |
|
|
|
|
jne .no_enter_fileindex |
|
|
|
|
cmp cx, 0 |
|
|
|
|
je .loop_no_push |
|
|
|
|
pop cx |
|
|
|
|
sub cx, 1 |
|
|
|
|
mov bx, .buffer_for_svim |
|
|
|
|
add bx, cx |
|
|
|
|
mov BYTE [bx], 0 |
|
|
|
|
; Go back one space |
|
|
|
|
mov ax, 0x0e08 ; ah=0x0e means teletype output. al=0x08 means backspace character. |
|
|
|
|
int 0x10 |
|
|
|
|
|
|
|
|
|
; Place a NULL |
|
|
|
|
mov al, 0x0 ; NULL |
|
|
|
|
int 0x10 |
|
|
|
|
|
|
|
|
|
; Go back one space again as the above print of NULL pushes the cursor forward again. |
|
|
|
|
mov ax, 0x0e08 |
|
|
|
|
int 0x10 |
|
|
|
|
jmp .enter_fileindex_loop |
|
|
|
|
|
|
|
|
|
.no_enter_fileindex: |
|
|
|
|
mov bh, 0x00 |
|
|
|
|
mov bl, 0x02 |
|
|
|
|
mov ah, 0x0E |
|
|
|
@ -66,28 +89,15 @@ svim:
|
|
|
|
|
|
|
|
|
|
.fileindex_done: |
|
|
|
|
pop cx ; Cleanup, and now contain filename size |
|
|
|
|
add cx, .buffer_for_svim |
|
|
|
|
mov bx, cx |
|
|
|
|
mov ax, cx |
|
|
|
|
add ax, .buffer_for_svim |
|
|
|
|
mov bx, ax |
|
|
|
|
mov BYTE [bx], 0 |
|
|
|
|
mov si, .buffer_for_svim |
|
|
|
|
call zstring_to_integer ; ax now contain the interger index for the file |
|
|
|
|
mov [.fileindex_for_open_file], ax ; save the file index |
|
|
|
|
|
|
|
|
|
xor bx, bx |
|
|
|
|
xor cx, cx ; Upper and left coordinate |
|
|
|
|
mov bh, 0x0a ; color for new screen 0 = black a = light green |
|
|
|
|
mov dh, 0xff ; Select all screen |
|
|
|
|
mov dl, 0xff ; Select all screen |
|
|
|
|
mov ah, 0x07 ; scrool down |
|
|
|
|
mov al, 0x00 ; scrool 0 lines (means blank screen ) |
|
|
|
|
int 0x10 |
|
|
|
|
|
|
|
|
|
; move cursor back up to the top |
|
|
|
|
mov ah, 0x02 |
|
|
|
|
mov bh, 0x00 ; page number 0 |
|
|
|
|
mov dh, 0x00 ; row zero |
|
|
|
|
mov dl, 0x00 ; coloumn zero |
|
|
|
|
int 0x10 |
|
|
|
|
call os_clear_screen |
|
|
|
|
|
|
|
|
|
; Load from disk and, enter it, into the buffer |
|
|
|
|
|
|
|
|
@ -103,9 +113,13 @@ svim:
|
|
|
|
|
mov al, 0x01 ;Number of sectors to read (8 * 512 = 4096 bytes) |
|
|
|
|
mov cl, 0x01 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7) |
|
|
|
|
mov dh, 0x00 ;Head number |
|
|
|
|
mov dl, 0x00 ;Drive number |
|
|
|
|
mov dl, [global_disk_identifier] ;Drive number |
|
|
|
|
int 0x13 |
|
|
|
|
|
|
|
|
|
mov bx, .fileindex_for_open_file |
|
|
|
|
add bx, 510 |
|
|
|
|
mov ax, [bx] |
|
|
|
|
mov [.buffer_counter_svim], ax |
|
|
|
|
; print buffer |
|
|
|
|
mov si, .buffer_for_svim |
|
|
|
|
mov es, si |
|
|
|
@ -115,14 +129,17 @@ svim:
|
|
|
|
|
mov ax, 0x1000 ; BIOS call to wait for key |
|
|
|
|
int 0x16 |
|
|
|
|
cmp ax, 0x1c0d ; enter key |
|
|
|
|
jne .no_enter_fileindex |
|
|
|
|
jne .no_enter |
|
|
|
|
call printCRLF |
|
|
|
|
jmp .svim_loop |
|
|
|
|
.no_enter_fileindex: |
|
|
|
|
|
|
|
|
|
.no_enter: |
|
|
|
|
cmp ax, 0x11b ; ESC key |
|
|
|
|
je .end_svim |
|
|
|
|
cmp ax, 0x3c00 ; f2 key |
|
|
|
|
je .f_key_pushed |
|
|
|
|
cmp ax, 0x0e08 ; backspace |
|
|
|
|
je .backspace_pushed |
|
|
|
|
mov bx, ax |
|
|
|
|
mov ax, 0xe20 |
|
|
|
|
mov al, bl |
|
|
|
@ -144,6 +161,11 @@ svim:
|
|
|
|
|
;DH Head |
|
|
|
|
;DL Drive |
|
|
|
|
;ES:BX Buffer Address Pointer |
|
|
|
|
mov ax, [.buffer_counter_svim] |
|
|
|
|
mov bx, .fileindex_for_open_file |
|
|
|
|
add bx, 510 |
|
|
|
|
mov [bx], ax |
|
|
|
|
|
|
|
|
|
mov bx, ds |
|
|
|
|
mov es, bx |
|
|
|
|
mov bx, .buffer_for_svim |
|
|
|
@ -155,26 +177,47 @@ svim:
|
|
|
|
|
mov al, 0x01 ;Number of sectors to write (8 * 512 = 4096 bytes) |
|
|
|
|
mov cl, 0x01 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7) |
|
|
|
|
mov dh, 0x00 ;Head number |
|
|
|
|
mov dl, 0x0 ;Drive number |
|
|
|
|
mov dl, [global_disk_identifier] ;Drive number |
|
|
|
|
int 0x13 ;Low level disk services |
|
|
|
|
|
|
|
|
|
; clean up swim |
|
|
|
|
xor bx, bx |
|
|
|
|
xor cx, cx ; Upper and left coordinate |
|
|
|
|
mov bh, 0x0f ; color for new screen 0 = black f = white |
|
|
|
|
mov dh, 0xff ; Select all screen |
|
|
|
|
mov dl, 0xff ; Select all screen |
|
|
|
|
mov ah, 0x07 ; scrool down |
|
|
|
|
mov al, 0x00 ; scrool 0 lines (means blank screen ) |
|
|
|
|
;xor bx, bx |
|
|
|
|
;xor cx, cx ; Upper and left coordinate |
|
|
|
|
;mov bh, 0x0f ; color for new screen 0 = black f = white |
|
|
|
|
;mov dh, 0xff ; Select all screen |
|
|
|
|
;mov dl, 0xff ; Select all screen |
|
|
|
|
;mov ah, 0x07 ; scrool down |
|
|
|
|
;mov al, 0x00 ; scrool 0 lines (means blank screen ) |
|
|
|
|
;int 0x10 |
|
|
|
|
call os_clear_screen |
|
|
|
|
popa |
|
|
|
|
ret |
|
|
|
|
|
|
|
|
|
.backspace_pushed: |
|
|
|
|
pusha |
|
|
|
|
mov bx, [.buffer_counter_svim] |
|
|
|
|
cmp bx, 0 |
|
|
|
|
je .svim_loop |
|
|
|
|
mov cx, bx |
|
|
|
|
sub cx, 1 |
|
|
|
|
mov bx, .buffer_for_svim |
|
|
|
|
add bx, cx |
|
|
|
|
mov BYTE [bx], 0 |
|
|
|
|
mov [.buffer_counter_svim], cx |
|
|
|
|
; Go back one space |
|
|
|
|
mov ax, 0x0e08 ; ah=0x0e means teletype output. al=0x08 means backspace character. |
|
|
|
|
int 0x10 |
|
|
|
|
; Move curser back to the top of the screen |
|
|
|
|
mov ah, 0x02 |
|
|
|
|
mov bh, 0x00 ; page number 0 |
|
|
|
|
mov dh, 0x00 ; row zero |
|
|
|
|
mov dl, 0x00 ; coloumn zero |
|
|
|
|
|
|
|
|
|
; Place a NULL |
|
|
|
|
mov al, 0x0 ; NULL |
|
|
|
|
int 0x10 |
|
|
|
|
|
|
|
|
|
; Go back one space again as the above print of NULL pushes the cursor forward again. |
|
|
|
|
mov ax, 0x0e08 |
|
|
|
|
int 0x10 |
|
|
|
|
popa |
|
|
|
|
ret |
|
|
|
|
jmp .svim_loop |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.f_key_pushed: |
|
|
|
|
mov al, 0x01 ;arg: index 1 |
|
|
|
|