This commit is contained in:
julianb0 2019-09-09 08:12:02 +02:00
parent c8d899db9e
commit 227150be08
No known key found for this signature in database
GPG Key ID: 9C7ACF0C053FB8A1
2 changed files with 24 additions and 16 deletions

View File

@ -11,21 +11,25 @@
blte zero, eax, .do_exec
; nope, append ".com" and try again
mov esi, argv0
sub ecx, argbuf.size, 5
scasb ax0, zero ; find null-term
mov b[ax0+0], '.' ; ".com"
mov b[ax0+1], 'c'
mov b[ax0+2], 'o'
mov b[ax0+3], 'm'
nul b[ax0+4]
scasb esi, zero ; find null-term
mov b[esi], '.' ; ".com"
mov b[esi+1], 'c'
mov b[esi+2], 'o'
mov b[esi+3], 'm'
nul b[esi+4]
; try again
mov eax, Sys.OpenFile
mov ax0, argv0
trap 0
; still no good?
bltz eax, .exec_not_found
; we good?
blte 0, eax, .do_exec
nul b[esi] ; erase ".com"
jmp .exec_not_found
.do_exec:
; load file into memory

View File

@ -1380,21 +1380,25 @@ main:
blte zero, eax, .do_exec
; nope, append ".com" and try again
mov esi, argv0
sub ecx, argbuf.size, 5
scasb ax0, zero ; find null-term
mov b[ax0+0], '.' ; ".com"
mov b[ax0+1], 'c'
mov b[ax0+2], 'o'
mov b[ax0+3], 'm'
nul b[ax0+4]
scasb esi, zero ; find null-term
mov b[esi], '.' ; ".com"
mov b[esi+1], 'c'
mov b[esi+2], 'o'
mov b[esi+3], 'm'
nul b[esi+4]
; try again
mov eax, Sys.OpenFile
mov ax0, argv0
trap 0
; still no good?
bltz eax, .exec_not_found
; we good?
blte 0, eax, .do_exec
nul b[esi] ; erase ".com"
jmp .exec_not_found
.do_exec:
; load file into memory