diff -Naur bochs-2.1.1.orig/bios/rombios.c bochs-2.1.1/bios/rombios.c --- bochs-2.1.1.orig/bios/rombios.c 2004-02-11 23:28:50.000000000 +0100 +++ bochs-2.1.1/bios/rombios.c 2004-06-17 23:10:33.000000000 +0200 @@ -23,7 +23,10 @@ // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - +/* + Modificado em 4/Ago/2000 por Rildo Pragana + para adicionar driver de porta paralela. +*/ // ROM BIOS for use with Bochs/Plex x86 emulation environment @@ -7581,6 +7584,94 @@ pop bp iret +;---------------------- +;- INT17h (relocated) - +;---------------------- +int17_relocated: + push ds + push bx + push cx + push dx + mov bx,#0x40 + mov ds,bx + mov bx,dx + shl bx,#1 + mov dx,8[bx] + or dx,dx + jz lp_01 + or ah,ah + jz lp_02 ; print function + dec ah + jz lp_ini ; init function + dec ah + jz lp_sts ; status function +lp_01: + pop dx + pop cx + pop bx + pop ds + iret +lp_02: + out dx,al + inc dx +; +; mov bh,0x78[bx] +; mov ah,al +; +;Bitfields for printer status: +; 7 not busy = 1 +; 6 acknowledge = 0 +; 5 out of paper = 0 +; 4 selected = 1 +; 3 I/O error = 0 +; 2-1 unused = 0 +; 0 timeout = 0 + mov al,#0x90 + mov ah,al +lp_05: + xor cx,cx +lp_pol: +; in al,dx +; or al,al +; js lp_don +; loop lp_pol +; dec bh +; jnz lp_05 +; or al,#0x01 +; and al,#0xf9 +; jmp lp_tog +lp_don: + inc dx + mov al,#0x0d + out dx,al +lp_str: + mov al,#0x0c + out dx,al + dec dx + jmp lp_st1 +lp_sts: + mov ah,al + inc dx +lp_st1: +; in al,dx +; and al,#0xf8 + + mov al,#0x90 +lp_tog: +; xor al,#0x48 + xchg al,ah + jmp lp_01 +lp_ini: + mov ah,al + inc dx + inc dx + mov al,#0x08 + out dx,al + mov cx,#0x5dc +lp_dly: + loop lp_dly + jmp lp_str + ;---------------------- ;- INT13h (relocated) - @@ -8842,8 +8933,8 @@ in al, 0x71 mov 0x0410, ax - - ;; Parallel setup +// Disable bochs Parallel support +/* ;; Parallel setup SET_INT_VECTOR(0x0F, #0xF000, #dummy_iret_handler) xor ax, ax mov ds, ax @@ -8857,7 +8948,7 @@ mov ax, 0x410 ; Equipment word bits 14..15 determing # parallel ports and ax, #0x3fff or ax, bx ; set number of parallel ports - mov 0x410, ax + mov 0x410, ax*/ ;; Serial setup SET_INT_VECTOR(0x0C, #0xF000, #dummy_iret_handler) @@ -8874,6 +8965,10 @@ or ax, bx ; set number of serial port mov 0x410, ax + ;; Modification to indicate that a parallel port is present + mov ax,#0x378 + mov 0x408, AX ; Parallel I/O address, port 1 + ;; CMOS RTC SET_INT_VECTOR(0x1A, #0xF000, #int1a_handler) SET_INT_VECTOR(0x4A, #0xF000, #dummy_iret_handler) @@ -9383,14 +9478,16 @@ ;---------------------------------------- .org 0xefd2 int17_handler: - push ds +;; Remove Bochs parallel support , and use Pragana support +/* push ds pusha mov ax, #0x0000 mov ds, ax call _int17_function popa pop ds - iret + iret*/ + jmp int17_relocated .org 0xf045 ; INT 10 Functions 0-Fh Entry Point HALT(__LINE__) diff -Naur bochs-2.1.1.orig/cpu/exception.cc bochs-2.1.1/cpu/exception.cc --- bochs-2.1.1.orig/cpu/exception.cc 2003-08-28 02:10:40.000000000 +0200 +++ bochs-2.1.1/cpu/exception.cc 2004-06-17 23:11:59.000000000 +0200 @@ -151,7 +151,7 @@ // else #GP(vector * 8 + 2 + EXT) if (is_INT && (gate_descriptor.dpl < CPL)) { /* ??? */ - BX_DEBUG(("interrupt(): is_INT && (dpl < CPL)")); + //BX_DEBUG(("interrupt(): is_INT && (dpl < CPL)")); exception(BX_GP_EXCEPTION, vector*8 + 2, 0); return; } diff -Naur bochs-2.1.1.orig/gui/x.cc bochs-2.1.1/gui/x.cc --- bochs-2.1.1.orig/gui/x.cc 2004-02-11 23:28:52.000000000 +0100 +++ bochs-2.1.1/gui/x.cc 2004-06-17 23:14:10.000000000 +0200 @@ -143,7 +143,7 @@ static void headerbar_click(int x, int y); static void send_keyboard_mouse_status(void); - +extern int io_habilitado; Bit32u ascii_to_key_event[0x5f] = { @@ -913,12 +913,20 @@ } else switch (keysym) { case XK_KP_1: + /* Rildo Pragana: patch for enabling i/o processing */ + io_habilitado = 0; + fprintf(stderr,"io_habilitado: %d\n",io_habilitado); + break; #ifdef XK_KP_End case XK_KP_End: #endif key_event = BX_KEY_KP_END; break; case XK_KP_2: + /* Rildo Pragana: patch for enabling i/o processing */ + io_habilitado = 1; + fprintf(stderr,"io_habilitado: %d\n",io_habilitado); + break; #ifdef XK_KP_Down case XK_KP_Down: #endif diff -Naur bochs-2.1.1.orig/iodev/devices.cc bochs-2.1.1/iodev/devices.cc --- bochs-2.1.1.orig/iodev/devices.cc 2004-02-11 23:28:53.000000000 +0100 +++ bochs-2.1.1/iodev/devices.cc 2004-06-23 00:18:00.965432590 +0200 @@ -24,6 +24,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#include #include "bochs.h" #define LOG_THIS bx_devices. @@ -92,6 +93,9 @@ void bx_devices_c::init(BX_MEM_C *newmem) { + // (Rildo Pragana) allow access to parallel port address + ioperm(0x378,3,1); + unsigned i; BX_DEBUG(("Init $Id: devices.cc,v 1.58 2003/12/26 13:53:39 vruppert Exp $")); @@ -606,12 +610,27 @@ * Read a byte of data from the IO memory address space */ +int io_habilitado=0; +int io_count=1; +int out378_found=0; + Bit32u BX_CPP_AttrRegparmN(2) bx_devices_c::inp(Bit16u addr, unsigned io_len) { Bit8u handle; Bit32u ret; + // rildo pragana patches for printer io debugging + if ((addr <= 0x37a) && (addr >= 0x378)) { + if (io_habilitado) { + ret = inb(addr); + + //fprintf(impr_log,"I%x(%x) 0x%x\n",(addr-0x378),ret,EIP); //Pragana original + BX_ERROR(("// : I%x(%x)",(addr-0x378),ret)); //Boichat + } + return ret; + } + BX_INSTR_INP(addr, io_len); handle = read_handler_id[addr]; @@ -641,6 +660,21 @@ bx_devices_c::outp(Bit16u addr, Bit32u value, unsigned io_len) { Bit8u handle; + Bit8u st379; + + if ((addr <= 0x37a) && (addr >= 0x378)) { + if (io_habilitado) { + outb(value, addr); + + st379 = inb(0x379); + + /*fprintf(impr_log,"O%x,%x i1(%x) 0x%x\n", + (addr-0x378),value,st379,EIP); //Pragana original*/ + BX_ERROR(("// : O%x,%x i1(%x)\n", (addr-0x378),value,st379)); //Boichat + } + return; + } + BX_INSTR_OUTP(addr, io_len); BX_INSTR_OUTP2(addr, io_len, value); diff -Naur bochs-2.1.1.orig/iodev/parallel.cc bochs-2.1.1/iodev/parallel.cc --- bochs-2.1.1.orig/iodev/parallel.cc 2004-02-11 23:28:53.000000000 +0100 +++ bochs-2.1.1/iodev/parallel.cc 2004-06-17 23:44:01.000000000 +0200 @@ -35,6 +35,7 @@ #define BX_PLUGGABLE #include "bochs.h" +#include #define LOG_THIS theParallelDevice-> bx_parallel_c *theParallelDevice = NULL; @@ -71,6 +72,7 @@ { BX_DEBUG(("Init $Id: parallel.cc,v 1.24 2003/10/29 17:29:26 vruppert Exp $")); +#if 0 if (bx_options.par[0].Oenabled->get ()) { /* PARALLEL PORT 1 */ @@ -105,6 +107,7 @@ bx_options.par[0].Ooutfile->getptr ())); } } +#endif } void @@ -150,6 +153,12 @@ #else UNUSED(this_ptr); #endif // !BX_USE_PAR_SMF + UNUSED(address); + UNUSED(io_len); + + BX_ERROR(("read: Bochs parallel support disabled")); + + return(0); //Disable Bochs parallel support Bit32u retval; @@ -224,6 +233,13 @@ #else UNUSED(this_ptr); #endif // !BX_USE_PAR_SMF + UNUSED(address); + UNUSED(value); + UNUSED(io_len); + + BX_ERROR(("write: Bochs parallel support disabled")); + + return; //Disable Bochs parallel support switch (address) { /* PARALLEL PORT 1 */ diff -Naur bochs-2.1.1.orig/iodev/unmapped.cc bochs-2.1.1/iodev/unmapped.cc --- bochs-2.1.1.orig/iodev/unmapped.cc 2003-08-10 19:19:49.000000000 +0200 +++ bochs-2.1.1/iodev/unmapped.cc 2004-06-17 23:20:46.000000000 +0200 @@ -249,8 +249,8 @@ case 0x3eb: case 0x3ec: case 0x3ed: - // BX_DEBUG(("unsupported IO write to port %04x of %02x", - // address, value)); + BX_DEBUG(("unsupported IO write to port %04x of %02x", + address, value)); break; case 0x8900: // Shutdown port, could be moved in a PM device diff -Naur bochs-2.1.1.orig/main.cc bochs-2.1.1/main.cc --- bochs-2.1.1.orig/main.cc 2004-02-11 23:28:41.000000000 +0100 +++ bochs-2.1.1/main.cc 2004-06-23 00:11:41.772080547 +0200 @@ -27,6 +27,7 @@ #include "bochs.h" #include #include "state_file.h" +#include #ifdef HAVE_LOCALE_H #include @@ -2284,6 +2285,9 @@ int bx_begin_simulation (int argc, char *argv[]) { + // (Rildo Pragana) allow access to parallel port address + ioperm(0x378,3,1); + // deal with gui selection if (!load_and_init_display_lib ()) { BX_PANIC (("no gui module was loaded"));