Explorar el Código

fix #6, isseu found elsewhere. Improved 'xex' command, and print return value from the program

master
Jørn Guldberg hace 5 años
padre
commit
30d6cf9f44
Se han modificado 1 ficheros con 14 adiciones y 12 borrados
  1. +14
    -12
      lib/xex.nasm

+ 14
- 12
lib/xex.nasm Ver fichero

@ -2,8 +2,8 @@
; This is the "program" to execute a program
xex:
pusha ; save state before program
;sub sp, 2048
;mov [.program_executable_buffer], sp
sub sp, 512
mov [.program_executable_buffer], sp
;mov [.program_executable_buffer], sp
@ -22,6 +22,10 @@ xex:
mov si, .welcome_xex_enter_fileindex
call print
; Ask the user for the filename
xor bx, bx
xor cx, cx ; are going to be the counter
xor dx, dx
.enter_fileindex_loop:
push cx
.loop_no_push:
@ -75,18 +79,11 @@ xex:
mov BYTE [bx], 0
mov si, [.program_executable_buffer]
call zstring_to_integer ; ax now contain the interger index for the file
mov ax, 3
call dumpax
mov [.fileindex_for_open_file], ax ; save the file index
mov ax, [.fileindex_for_open_file]
mov bx, [.program_executable_buffer]
.xex_lsfs_read_file:
; INPUT ax = file index
@ -98,7 +95,6 @@ xex:
mov dx, 24 ; LSFS_magic_start_sector
add ax, dx ; senctor number, into the master Table.
call dumpax
mov WORD [XEXPACK.db_addr_offset], xex_lsfs_loading_buffer
mov WORD [XEXPACK.lba_addr_dw_low], ax
mov WORD [XEXPACK.blkcnt], 0x1 ; Read to sectors, that is what the space is for the buffer in svim
@ -113,7 +109,6 @@ xex:
; Save the buffer addr
mov bx, [xex_lsfs_loading_buffer + 288] ; this is the first data pointer
mov ax, bx
call dumpax
mov WORD [XEXPACK.lba_addr_dw_low], bx
mov WORD [XEXPACK.blkcnt], 0x4 ; Read to sectors, that is what the space is for the buffer in svim
mov WORD [XEXPACK.db_addr_segment], 0x2000
@ -138,17 +133,24 @@ xex:
retf
.this_place:
push ax
call printCRLF
mov si, .program_output_text
call print
pop ax
call dumpax
;mov bx, ss
;call bx: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.
;add sp, 2048
add sp, 512
popa ; retore
ret
.welcome_xex_enter_fileindex db 'Enter program index to execute: ', 0
.program_output_text db 'Program has terminated with return value: ', 0
.fileindex_for_open_file dw 0
.program_executable_buffer dw 0

Cargando…
Cancelar
Guardar