aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs.asm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/fs.asm14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fs.asm b/src/fs.asm
index a4ad77e..1c6d299 100644
--- a/src/fs.asm
+++ b/src/fs.asm
@@ -761,6 +761,13 @@ sys_open::
; =============================================================================
sys_close::
ld a, b
+ call is_pipe_fd
+ jr c, .notpipe
+ call pipe_close
+ xor a
+ ret
+.notpipe
+ ld a, b
cp OF_MAX
jr nc, .done
ld [wFsSlot], a ; save fd
@@ -787,6 +794,9 @@ sys_close::
; =============================================================================
sys_getb::
ld a, b
+ call is_pipe_fd
+ jp nc, pipe_read ; A = pipe read fd
+ ld a, b
cp OF_MAX
jr nc, .eof
call OFPtr
@@ -868,6 +878,10 @@ sys_getb::
sys_putb::
ld a, e
ld [wFsByte], a
+ ld [wPipeByte], a
+ ld a, b
+ call is_pipe_fd
+ jp nc, pipe_write ; A = pipe write fd, byte in wPipeByte
ld a, b
cp OF_MAX
jr nc, .done