3 changed files with 100 additions and 5 deletions
@ -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 |
Loading…
Reference in new issue