2019-06-21 19:38:31 +02:00
|
|
|
// The OS/K Team licenses this file to you under the MIT license.
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
#include <in/instrs.h>
|
|
|
|
#include <pc/console.h>
|
|
|
|
|
|
|
|
IMPL_START_1(prn)
|
|
|
|
{
|
2019-07-10 22:37:59 +02:00
|
|
|
// Magic value? :)
|
|
|
|
if (__builtin_expect(v1 == 0xC15000AF, 0))
|
|
|
|
console_clear(ctx);
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p1->mlen > 1) {
|
|
|
|
trace("prn warning: large access size\n");
|
|
|
|
}
|
|
|
|
console_putc(ctx, (char)v1);
|
2019-06-21 19:38:31 +02:00
|
|
|
}
|
|
|
|
}
|
2019-06-23 20:56:04 +02:00
|
|
|
IMPL_END
|
2019-06-21 19:38:31 +02:00
|
|
|
|
2019-07-02 20:13:05 +02:00
|
|
|
IMPL_START_0(prns)
|
|
|
|
{
|
|
|
|
uchar ch = readmemzx(ctx, R(p1->reg), 1);
|
|
|
|
|
|
|
|
COMPARE(ch, 0);
|
|
|
|
|
2019-07-11 18:34:21 +02:00
|
|
|
if ((rfx & ZF) == 0)
|
2019-07-02 20:13:05 +02:00
|
|
|
{
|
|
|
|
console_putc(ctx, ch);
|
|
|
|
|
2019-07-11 18:34:21 +02:00
|
|
|
if (rfx & DF)
|
2019-07-02 20:13:05 +02:00
|
|
|
R(p1->reg)--;
|
|
|
|
else
|
|
|
|
R(p1->reg)++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IMPL_END
|
|
|
|
|
2019-06-21 19:38:31 +02:00
|
|
|
IMPL_START_1(scan)
|
|
|
|
{
|
|
|
|
v1 = console_scankeybuf(ctx);
|
|
|
|
}
|
|
|
|
IMPL_OUT;
|
|
|
|
|