all repos — xyw @ 91c5bb20892f4ce23273e1f8b729b7d49e105d1e

A minimal virtual machine and assembler for terminals.

devices/terminal.c

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
#include <stdio.h>
#include "../xyw.h"

/* terminal device */
#define terminal_INPUT 0x0
#define terminal_OUTPUT 0x1

void terminal_output(xyw_byte *data, xyw_byte addr, xyw_byte *error)
{
    (void)error;
    switch (addr)
    {
    case terminal_OUTPUT:
        fputc(data[addr], stdout);
        fflush(stdout);
        break;
    }
}