Browse Source

1 year

special_first_anniversary_edition v0.0.3
Rhodez-x 5 years ago
parent
commit
7c11b527a1
2 changed files with 23 additions and 7 deletions
  1. +1
    -1
      CLI/CLI.nasm
  2. +22
    -6
      lib/svim.nasm

+ 1
- 1
CLI/CLI.nasm View File

@ -104,7 +104,7 @@ print_help_message:
db " createfile: Name a file, in the file system", 13, 10
db " fsinfo: Displays info about the file system", 13, 10
db " ls: Lists the named files", 13, 10
db " svim: Is SingOS' text editor", 13, 10, 0
db " svim: SingOS' text editor", 13, 10, 0
; Executes the command.
CLI_EXECUTE:

+ 22
- 6
lib/svim.nasm View File

@ -145,14 +145,14 @@ svim:
mov bx, .buffer_for_svim
xor ax, ax
mov ah, 0x02 ;Read sectors from drive
mov al, 0x01 ;Number of sectors to read (8 * 512 = 4096 bytes)
mov al, 0x04 ;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, [global_disk_identifier] ;Drive number
int 0x13
mov bx, .buffer_for_svim
add bx, 510
add bx, 2046
mov ax, [bx]
mov [.buffer_counter_svim], ax
; print buffer
@ -168,7 +168,23 @@ svim:
int 0x16
cmp ax, 0x1c0d ; enter key
jne .no_enter
call printCRLF
mov bx, .buffer_for_svim
add bx, [.buffer_counter_svim]
mov BYTE [bx], 13 ; put char in the buffer
mov BYTE [bx + 1], 10 ; put char in the buffer
mov bx, [.buffer_counter_svim]
add bx, 0x02
mov [.buffer_counter_svim], bx
xor bx, bx
xor cx, cx
xor dx, dx
mov ax, 0x0e0d
int 0x10
mov ax, 0x0e0a
int 0x10
jmp .svim_loop
.no_enter:
@ -201,7 +217,7 @@ svim:
;ES:BX Buffer Address Pointer
mov ax, [.buffer_counter_svim]
mov bx, .buffer_for_svim
add bx, 510
add bx, 2046
mov [bx], ax
mov bx, ds
@ -212,7 +228,7 @@ svim:
mov ch, al ; move the fileindex in the ch
mov ah, 0x03 ;Write sectors to drive
mov al, 0x01 ;Number of sectors to write (8 * 512 = 4096 bytes)
mov al, 0x04 ;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, [global_disk_identifier] ;Drive number
@ -270,5 +286,5 @@ svim:
.welcome_svim_enter_fileindex db 'Enter fileindex: ', 0
.seperate_line db '________________________________________________________________________________', 0
.fileindex_for_open_file dw 0
.buffer_for_svim times 512 dw 0 ; db 'this is the buffer', 0, times 32 db 0
.buffer_for_svim times 2048 db 0 ; db 'this is the buffer', 0, times 32 db 0
.buffer_counter_svim dw 0

Loading…
Cancel
Save