Преглед на файлове

Command 'xex' added, going to be the command for executing a program from a file

master
Jørn Guldberg преди 5 години
родител
ревизия
c47b2fb780
променени са 3 файла, в които са добавени 100 реда и са изтрити 5 реда
  1. +4
    -3
      CLI/CLI.nasm
  2. +2
    -2
      kernel.nasm
  3. +94
    -0
      lib/xex.nasm

+ 4
- 3
CLI/CLI.nasm Целия файл

@ -158,9 +158,9 @@ CLI_EXECUTE:
ret
.tmp dw 0
.Num_Commands dw 10
.Command_Name_List dw .CMD1, .CMD2, .CMD3, .CMD4, .CMD5, .CMD6, .CMD7, .CMD8, .CMD9, .CMDa
.Command_Function_Pointers dw dumpmem_hardcoded_args, keyprint, svim, lsfs_list_files_command, lsfs_create_file, lsfs_format_disk, lsfs_get_fs_info, os_clear_screen, print_help_message, Go32Bit
.Num_Commands dw 11
.Command_Name_List dw .CMD1, .CMD2, .CMD3, .CMD4, .CMD5, .CMD6, .CMD7, .CMD8, .CMD9, .CMDa, .CMDb
.Command_Function_Pointers dw dumpmem_hardcoded_args, keyprint, svim, lsfs_list_files_command, lsfs_create_file, lsfs_format_disk, lsfs_get_fs_info, os_clear_screen, print_help_message, Go32Bit, xex
.CMD1 db 'dumpmem', 0
.CMD2 db 'keyprint', 0
.CMD3 db 'svim', 0
@ -171,5 +171,6 @@ CLI_EXECUTE:
.CMD8 db 'clear', 0
.CMD9 db 'help', 0
.CMDa db 'go32', 0
.CMDb db 'xex', 0

+ 2
- 2
kernel.nasm Целия файл

@ -13,6 +13,7 @@ jmp sing_loaded
%include "lib/debug_tools.nasm"
%include "lib/std_power.nasm"
%include "lib/svim.nasm"
%include "lib/xex.nasm"
%include "filesystems/lsfs/lsfs.nasm" ; old filesystem was ;%include "vsfs/vsfs.nasm"
%include "CLI/CLI.nasm"
@ -272,7 +273,6 @@ wait_for_key:
jmp .no_str
;
global_vars:
global_lsfs_master_record dw 2064 ; this is the index of the start of the master table for the filesystem
; This should maby contain more information.
@ -287,7 +287,7 @@ global_vars:
; this is the bios ID
data:
welcome db "###############################################################################", 13, 10, "# Welcome to SingOS - VERSION 0.0.5.1 #", 13, 10, "# #", 13, 10, "###############################################################################", 13, 10, 'Press ESC to halt.', 13, 10, 13, 10, 0
welcome db "###############################################################################", 13, 10, "# Welcome to SingOS - VERSION 0.0.5.2 #", 13, 10, "# #", 13, 10, "###############################################################################", 13, 10, 'Press ESC to halt.', 13, 10, 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

+ 94
- 0
lib/xex.nasm Целия файл

@ -0,0 +1,94 @@
; This is the "program" to execute a program
xex:
pusha ; save state before program
call os_clear_screen
call lsfs_list_files_command
; move cursor to the bootom
xor ax, ax
xor bx, bx
mov ah, 0x02
mov bh, 0x00 ; page number 0
mov dh, 0x17 ; row zero
mov dl, 0x00 ; coloumn zero
int 0x10
mov si, .welcome_xex_enter_fileindex
call print
.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
cmp ax, 0x0e08 ; backspace
jne .no_enter_fileindex
cmp cx, 0
je .loop_no_push
pop cx
sub cx, 1
mov bx, [.program_executable_buffer]
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
int 0x10 ; print char
pop cx
mov bx, [.program_executable_buffer]
add bx, cx
mov [bx], al
add cx, 1
; fileindex must only be 120 chars
cmp cx, 120
jae .fileindex_done
jmp .enter_fileindex_loop
.fileindex_done:
pop cx ; Cleanup, and now contain filename size
mov ax, cx
add ax, [.program_executable_buffer]
mov bx, ax
mov BYTE [bx], 0
mov si, [.program_executable_buffer]
call zstring_to_integer ; ax now contain the interger index for the file
mov [.fileindex_for_open_file], ax ; save the file index
;mov ax, [.fileindex_for_open_file]
;mov bx, [.program_executable_buffer]
;call lsfs_read_file
;mov [.program_executable_buffer], ax
; I guess we should have something like
; call ax ; here. We want to execute the file that we just have benn loaded in memory
; The executable should make use of the global systemcall table.
; That is what we are trying to get to work here.
popa ; retore
ret
.welcome_xex_enter_fileindex db 'Enter program index to execute: ', 0
.program_executable_buffer db 0
.fileindex_for_open_file dw 0

Зареждане…
Отказ
Запис