diff options
Diffstat (limited to 'src/proc.asm')
| -rw-r--r-- | src/proc.asm | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/proc.asm b/src/proc.asm index ab1c807..cd79160 100644 --- a/src/proc.asm +++ b/src/proc.asm @@ -224,7 +224,9 @@ ProcCreate:: ld [hl+], a ; PROC_EXIT ld a, STD_CONSOLE ld [hl+], a ; PROC_STDIN = console - ld [hl], a ; PROC_STDOUT = console + ld [hl+], a ; PROC_STDOUT = console + ld a, $FF + ld [hl], a ; PROC_PROG = none ; build the initial stack frame in the task's RAM bank ld a, [wTmpEntry] @@ -453,7 +455,10 @@ sys_fork:: ld [hl+], a ; child STDIN = parent STDIN inc de ld a, [de] - ld [hl], a ; child STDOUT = parent STDOUT + ld [hl+], a ; child STDOUT = parent STDOUT + inc de + ld a, [de] + ld [hl], a ; child PROC_PROG = parent PROC_PROG ; ---- return to the parent with child pid ---- ld a, [wForkUserSP] @@ -484,6 +489,15 @@ sys_fork:: ; our demo programs keep no pre-initialized RAM. ; ============================================================================= sys_exec:: + ; record the running program id in the PCB (for ps) + ld a, [wCurProc] + add PROC_PROG + ld l, a + ld a, [wCurProc+1] + adc 0 + ld h, a + ld a, b + ld [hl], a ; HL = &ProgramTable[B] = ProgramTable + B*4 ld hl, ProgramTable ld a, b |
