DOSBox-X
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 2 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * This program is distributed in the hope that it will be useful, 00008 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 * GNU General Public License for more details. 00011 * 00012 * You should have received a copy of the GNU General Public License along 00013 * with this program; if not, write to the Free Software Foundation, Inc., 00014 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00015 */ 00016 00017 00018 #include "dosbox.h" 00019 00020 #if C_PRINTER 00021 00022 #include "parport.h" 00023 //#include "callback.h" 00024 #include "printer_redir.h" 00025 00026 // Purpose of this is to pass LPT register access to the virtual printer 00027 00028 CPrinterRedir::CPrinterRedir(Bitu nr, Bit8u initIrq, CommandLine* cmd) 00029 :CParallel (cmd, nr, initIrq) { 00030 InstallationSuccessful = PRINTER_isInited(); 00031 } 00032 00033 CPrinterRedir::~CPrinterRedir () { 00034 // close file 00035 } 00036 00037 bool CPrinterRedir::Putchar(Bit8u val) 00038 { 00039 Write_CON(0xD4); 00040 // strobe data out 00041 Write_PR(val); 00042 Write_CON(0xD5); // strobe pulse 00043 Write_CON(0xD4); // strobe off 00044 Read_SR(); // clear ack 00045 00046 #if PARALLEL_DEBUG 00047 log_par(dbg_putchar,"putchar 0x%2x",val); 00048 if(dbg_plainputchar) fprintf(debugfp,"%c",val); 00049 #endif 00050 00051 return true; 00052 } 00053 Bitu CPrinterRedir::Read_PR() { 00054 return PRINTER_readdata(0,1); 00055 } 00056 Bitu CPrinterRedir::Read_COM() { 00057 return PRINTER_readcontrol(0,1); 00058 } 00059 Bitu CPrinterRedir::Read_SR() { 00060 return PRINTER_readstatus(0,1); 00061 } 00062 void CPrinterRedir::Write_PR(Bitu val) { 00063 PRINTER_writedata(0,val,1); 00064 } 00065 void CPrinterRedir::Write_CON(Bitu val) { 00066 PRINTER_writecontrol(0,val,1); 00067 } 00068 void CPrinterRedir::Write_IOSEL(Bitu val) { 00069 (void)val; // UNUSED 00070 // nothing 00071 } 00072 void CPrinterRedir::handleUpperEvent(Bit16u type) { 00073 (void)type; // UNUSED 00074 } 00075 #endif // C_PRINTER