Przeglądaj źródła

string to int -not wokr

special_first_anniversary_edition
Rhodez-x 5 lat temu
rodzic
commit
722306fe1c
7 zmienionych plików z 88 dodań i 9 usunięć
  1. BIN
      SingOS.img
  2. BIN
      bootloader.bin
  3. BIN
      kernel.bin
  4. +9
    -1
      kernel.nasm
  5. +32
    -0
      lib/string.nasm
  6. +7
    -7
      lib/svim.nasm
  7. +40
    -1
      vsfs/vsfs.nasm

BIN
SingOS.img Wyświetl plik


BIN
bootloader.bin Wyświetl plik


BIN
kernel.bin Wyświetl plik


+ 9
- 1
kernel.nasm Wyświetl plik

@ -2,6 +2,12 @@ BITS 16
start_sing_os:
mov si, welcome ; Put address of the null-terminated string to output into 'si'
call print_os ; Call our string-printing routine
mov si, number_one_zstring
call zstring_to_integer
call dumpax_os
mov si, command_line
call print_os
jmp terminal
@ -230,6 +236,8 @@ data_os:
welcome db 'This is SingOS! v0.0.3', 13, 10, 'Press ESC to halt.', 13, 10, 0
exit_message db 13, 10, 'Goodbye from SingOS',13,10,'The system has halted.', 0
command_line db 13, 10, 'groot@SingOS $ ', 0
number_one_zstring db '71', 0
%include "lib/os_lib.nasm"
%include "lib/string.nasm"
@ -238,7 +246,7 @@ data_os:
%include "lib/std_power.nasm"
%include "lib/svim.nasm"
%include "lib/ls.nasm"
%include "vsfs/vsfs.nasm"
;%include "vsfs/vsfs.nasm"
times 131072-($-$$) db 0 ; 256 sectos
GLOBAL_VSFS_START db 'VSFS v0.1' ; sector 257 reserved for file system information

+ 32
- 0
lib/string.nasm Wyświetl plik

@ -23,3 +23,35 @@ stringcompare:
pop bx
ret
zstring_to_integer:
;IN: si Pointer to string
;OUT: ax result in binary
push bx
push si
push cx
push dx
xor ax, ax
xor bx, bx
xor cx, cx
xor dx, dx
mov bx, 10
.loop:
mov cl, [si]
cmp cl, 0
je .end
sub cl,'0'
cmp cl, 9
ja .end ; next number is not a number, or its a zero, and then we are done
; multiply by 10, and add the new number.
mul bx
add ax, cx
inc si
jmp .loop
.end:
pop dx
pop cx
pop si
pop bx
ret

+ 7
- 7
lib/svim.nasm Wyświetl plik

@ -44,10 +44,10 @@ svim:
xor cx, cx
xor ax, ax
mov ah, 0x02 ;Read sectors from drive
mov al, 0x01 ;Number of sectors to read (8 * 512 = 4096 bytes)
mov ch, 0x02 ;Low 8 bits of cylinder
mov cl, 0x03 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7)
mov dh, 0x01 ;Head number
mov al, 0x02 ;Number of sectors to read (8 * 512 = 4096 bytes)
mov ch, 0x06 ;Low 8 bits of cylinder
mov cl, 0x02 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7)
mov dh, 0x00 ;Head number
mov dl, 0x00 ;Drive number
int 0x13
@ -97,9 +97,9 @@ svim:
xor ax, ax
mov ah, 0x03 ;Write sectors to drive
mov al, 0x01 ;Number of sectors to write (8 * 512 = 4096 bytes)
mov cl, 0x03 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7)
mov ch, 0x02
mov dh, 0x01 ;Head number
mov cl, 0x02 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7)
mov ch, 0x09
mov dh, 0x00 ;Head number
mov dl, 0x0 ;Drive number
int 0x13 ;Low level disk services

+ 40
- 1
vsfs/vsfs.nasm Wyświetl plik

@ -4,8 +4,8 @@ vsfs_read_file_index_in_ax:
pusha ; save all register state
call vsfs_convert_index_into_regs
mov bx, .buffer_for_svim
xor cx, cx
xor ax, ax
xor cx, cx
mov ah, 0x02 ;Read sectors from drive
mov al, 0x01 ;Number of sectors to read (8 * 512 = 4096 bytes)
mov ch, 0x02 ;Low 8 bits of cylinder
@ -50,12 +50,51 @@ vsfs_convert_index_into_regs:
; DH Head
; The rest of the parameters is set in the read and write function.
mov 00000000
mov ch, ah
mov dh, 0x01
ret
vfsf_write_file_system_information:
ret
vfsf_create_file:
; ax pointer to filename
; bx size
; cx fileIndex
.vfsf_create_file_type_filename db 'Enter filename: ', 0
.vfsf_create_file_type_filetype db 'Enter file index: ', 0
pusha ; save all register state
;AH 03h
;AL Sectors To Write Count
;CH Track
;CL Sector
;DH Head
;DL Drive
;ES:BX Buffer Address Pointer
mov bx, ds
mov es, bx
xor bx, bx
mov bx, .buffer_for_svim
xor cx, cx
xor ax, ax
mov ah, 0x03 ;Write sectors to drive
mov al, 0x01 ;Number of sectors to write (8 * 512 = 4096 bytes)
mov cl, 0x03 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7)
mov ch, 0x02
mov dh, 0x01 ;Head number
mov dl, 0x0 ;Drive number
int 0x13 ;Low level disk services
popa
ret
ret
vfsf_list_files_command:
; This function takes the adress of the first sector of the disk
; which the OS has to know

Ładowanie…
Anuluj
Zapisz