diff --git a/projects/examples/blank.tal b/projects/examples/blank.tal index cd34a4d..5ea79c8 100644 --- a/projects/examples/blank.tal +++ b/projects/examples/blank.tal @@ -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 ] diff --git a/projects/examples/devices/console.echo.tal b/projects/examples/devices/console.echo.tal index 8d35833..0f43476 100644 --- a/projects/examples/devices/console.echo.tal +++ b/projects/examples/devices/console.echo.tal @@ -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 diff --git a/src/uxncli.c b/src/uxncli.c index 549599f..1c2b157 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -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 diff --git a/src/uxnemu.c b/src/uxnemu.c index f28f1c5..0946ed7 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -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