diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/openbios/arch/x86/xbox | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/openbios/arch/x86/xbox')
-rw-r--r-- | roms/openbios/arch/x86/xbox/console.c | 23 | ||||
-rw-r--r-- | roms/openbios/arch/x86/xbox/methods.c | 102 |
2 files changed, 125 insertions, 0 deletions
diff --git a/roms/openbios/arch/x86/xbox/console.c b/roms/openbios/arch/x86/xbox/console.c new file mode 100644 index 000000000..78576c449 --- /dev/null +++ b/roms/openbios/arch/x86/xbox/console.c @@ -0,0 +1,23 @@ +/* + * Xbox framebuffer - Video + Console + * + * Copyright (C) 2005 Ed Schouten <ed@fxq.nl>, + * Stefan Reinauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation + */ + + +#include "config.h" +#include "libopenbios/bindings.h" +#include "libc/diskio.h" + +typedef struct osi_fb_info { + unsigned long mphys; + int rb, w, h, depth; +} osi_fb_info_t; + +#include "../../../packages/video.c" +#include "../../../libopenbios/console_common.c" diff --git a/roms/openbios/arch/x86/xbox/methods.c b/roms/openbios/arch/x86/xbox/methods.c new file mode 100644 index 000000000..741d15c08 --- /dev/null +++ b/roms/openbios/arch/x86/xbox/methods.c @@ -0,0 +1,102 @@ +/* + * Creation Date: <2004/08/28 18:38:22 greg> + * Time-stamp: <2004/08/28 18:38:22 greg> + * + * <methods.c> + * + * Misc device node methods + * + * Copyright (C) 2004 Greg Watson + * + * Based on MOL specific code which is + * + * Copyright (C) 2003, 2004 Samuel Rydh (samuel@ibrium.se) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 + * + */ + +#include "config.h" +#include "libopenbios/bindings.h" +#include "libc/string.h" +// #include "libopenbios/ofmem.h" + +/************************************************************************/ +/* stdout */ +/************************************************************************/ + +DECLARE_NODE( video_stdout, INSTALL_OPEN, 0, "Tdisplay" ); + +/* ( addr len -- actual ) */ +static void +stdout_write( void ) +{ + int len = POP(); + char *addr = (char*)POP(); + + printk( "%s", s ); + //vfd_draw_str( s ); + console_draw_fstr(addr, len); + + PUSH( len ); +} + +NODE_METHODS( video_stdout ) = { + { "write", stdout_write }, +}; + + +/************************************************************************/ +/* tty */ +/************************************************************************/ + +DECLARE_NODE( tty, INSTALL_OPEN, 0, "/packages/terminal-emulator" ); + +/* ( addr len -- actual ) */ +static void +tty_read( void ) +{ + int ch, len = POP(); + char *p = (char*)POP(); + int ret=0; + + if( len > 0 ) { + ret = 1; + ch = getchar(); + if( ch >= 0 ) { + *p = ch; + } else { + ret = 0; + } + } + PUSH( ret ); +} + +/* ( addr len -- actual ) */ +static void +tty_write( void ) +{ + int i, len = POP(); + char *p = (char*)POP(); + for( i=0; i<len; i++ ) + putchar( *p++ ); + RET( len ); +} + +NODE_METHODS( tty ) = { + { "read", tty_read }, + { "write", tty_write }, +}; + +/************************************************************************/ +/* init */ +/************************************************************************/ + +void +node_methods_init( void ) +{ + REGISTER_NODE( video_stdout ); + REGISTER_NODE( tty ); +} |