Extended Console to write to FD 2-8 (most useful for 2, stderr)

This commit is contained in:
Andrew Alderwick 2021-07-11 17:51:11 +01:00
parent 78cd998177
commit 91fedff46d
4 changed files with 13 additions and 7 deletions

View File

@ -13,7 +13,7 @@
( devices )
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]

View File

@ -1,8 +1,12 @@
( dev/console )
(
Copies data from stdin to both stdout and stderr.
)
%RTN { JMP2r }
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
( init )
@ -14,7 +18,9 @@ BRK
@on-stdin ( -> )
.Console/read DEI .Console/write DEO
.Console/read DEI
DUP .Console/write DEO
.Console/error DEO
BRK

View File

@ -45,8 +45,8 @@ printstack(Stack *s)
static void
console_talk(Device *d, Uint8 b0, Uint8 w)
{
if(w && b0 == 0x8)
write(1, (char *)&d->dat[0x8], 1);
if(w && b0 > 0x7)
write(b0 - 0x7, (char *)&d->dat[b0], 1);
}
static void

View File

@ -238,8 +238,8 @@ system_talk(Device *d, Uint8 b0, Uint8 w)
static void
console_talk(Device *d, Uint8 b0, Uint8 w)
{
if(w && b0 == 0x8)
write(1, (char *)&d->dat[0x8], 1);
if(w && b0 > 0x7)
write(b0 - 0x7, (char *)&d->dat[b0], 1);
}
static void