Skip to content

Commit

Permalink
Partially fix CEdit not loading existing files
Browse files Browse the repository at this point in the history
  • Loading branch information
beckadamtheinventor committed Oct 18, 2024
1 parent d7c6913 commit 1d934c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions src/sys/ExecuteFile.asm
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,6 @@ sys_ExecuteFile:
jr .restore_colors
.runnothreading_actually:
call .actuallyrunprogram_nothread
ld (LastExitCode),hl
ld a,e
ld (LastExitCode+3),a
.restore_colors:
call ti.PopOP3
ld iy,ti.OP3
Expand Down Expand Up @@ -305,8 +302,11 @@ sys_ExecuteFile:
ld hl,(fsOP6+9) ; argc
push hl
call .jptoprogram
pop bc,bc
ret
ld (LastExitCode),hl ; save exit code
ld a,e
ld (LastExitCode+3),a
pop bc,hl ; argc, argv
jp sys_Free.entryhl ; free argv


.actuallyrunprogram_thread:
Expand Down Expand Up @@ -377,6 +377,18 @@ sys_jphl := $
; output hl -> argv
; output bc -> argc
.load_argc_argv_loop:
ld bc,(running_process_id)
push bc
ld a,1 ; make sure to malloc as PID 1 so it doesn't get freed until the program exits
ld (running_process_id),a
call .load_argc_argv_loop_entry
ex (sp),hl
ld a,l
ld (running_process_id),a
pop hl
ret

.load_argc_argv_loop_entry:
ex hl,de
push hl
inc sp
Expand Down
2 changes: 1 addition & 1 deletion src/util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
include 'util/BackupRegisters.asm'
include 'util/NumToString.asm'
include 'util/RestoreRegisters.asm'
include 'util/VoidPtr.asm'
; include 'util/VoidPtr.asm'
include 'util/Zx7Compress.asm'
include 'util/Zx7Decompress.asm'
include 'util/Zx7DecompressToFlash.asm'
Expand Down

0 comments on commit 1d934c8

Please sign in to comment.