aboutsummaryrefslogtreecommitdiffstats
path: root/src/proc.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/proc.asm')
-rw-r--r--src/proc.asm19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/proc.asm b/src/proc.asm
index a2b1368..ab1c807 100644
--- a/src/proc.asm
+++ b/src/proc.asm
@@ -221,7 +221,10 @@ ProcCreate::
ld [hl+], a ; PROC_WRAMB
xor a
ld [hl+], a ; PROC_PARENT
- ld [hl], a ; PROC_EXIT
+ ld [hl+], a ; PROC_EXIT
+ ld a, STD_CONSOLE
+ ld [hl+], a ; PROC_STDIN = console
+ ld [hl], a ; PROC_STDOUT = console
; build the initial stack frame in the task's RAM bank
ld a, [wTmpEntry]
@@ -438,7 +441,19 @@ sys_fork::
ld [hl+], a
; PROC_EXIT = 0
xor a
- ld [hl], a
+ ld [hl+], a
+ ; PROC_STDIN / PROC_STDOUT = inherit from parent
+ ld a, [wCurProc]
+ add PROC_STDIN
+ ld e, a
+ ld a, [wCurProc+1]
+ adc 0
+ ld d, a
+ ld a, [de]
+ ld [hl+], a ; child STDIN = parent STDIN
+ inc de
+ ld a, [de]
+ ld [hl], a ; child STDOUT = parent STDOUT
; ---- return to the parent with child pid ----
ld a, [wForkUserSP]