@@ -49,36 +49,6 @@ bool isDBCSCP(), shiftjis_lead_byte(int c);
4949bool Network_IsNetworkResource (const char * filename), TTF_using(void );
5050bool CodePageGuestToHostUTF16 (uint16_t *d/* CROSS_LEN*/ ,const char *s/* CROSS_LEN*/ );
5151
52- struct ExtDeviceData {
53- uint16_t attribute;
54- uint16_t segment;
55- uint16_t strategy;
56- uint16_t interrupt;
57- };
58-
59- class DOS_ExtDevice : public DOS_Device {
60- public:
61- DOS_ExtDevice (const char *name, uint16_t seg, uint16_t off) {
62- SetName (name);
63- ext.attribute = real_readw (seg, off + 4 );
64- ext.segment = seg;
65- ext.strategy = real_readw (seg, off + 6 );
66- ext.interrupt = real_readw (seg, off + 8 );
67- }
68- virtual bool Read (uint8_t * data,uint16_t * size);
69- virtual bool Write (const uint8_t * data,uint16_t * size);
70- virtual bool Seek (uint32_t * pos,uint32_t type);
71- virtual bool Close ();
72- virtual uint16_t GetInformation (void );
73- virtual bool ReadFromControlChannel (PhysPt bufptr,uint16_t size,uint16_t * retcode);
74- virtual bool WriteToControlChannel (PhysPt bufptr,uint16_t size,uint16_t * retcode);
75- virtual uint8_t GetStatus (bool input_flag);
76- bool CheckSameDevice (uint16_t seg, uint16_t s_off, uint16_t i_off);
77- private:
78- struct ExtDeviceData ext;
79-
80- uint16_t CallDeviceFunction (uint8_t command, uint8_t length, PhysPt bufptr, uint16_t size);
81- };
8252
8353bool DOS_ExtDevice::CheckSameDevice (uint16_t seg, uint16_t s_off, uint16_t i_off) {
8454 if (seg == ext.segment && s_off == ext.strategy && i_off == ext.interrupt ) {
@@ -87,7 +57,7 @@ bool DOS_ExtDevice::CheckSameDevice(uint16_t seg, uint16_t s_off, uint16_t i_off
8757 return false ;
8858}
8959
90- uint16_t DOS_ExtDevice::CallDeviceFunction (uint8_t command, uint8_t length, PhysPt bufptr , uint16_t size) {
60+ uint16_t DOS_ExtDevice::CallDeviceFunction (uint8_t command, uint8_t length, uint16_t seg, uint16_t offset , uint16_t size) {
9161 uint16_t oldbx = reg_bx;
9262 uint16_t oldes = SegValue (es);
9363
@@ -98,8 +68,8 @@ uint16_t DOS_ExtDevice::CallDeviceFunction(uint8_t command, uint8_t length, Phys
9868 real_writed (dos.dcp , 5 , 0 );
9969 real_writed (dos.dcp , 9 , 0 );
10070 real_writeb (dos.dcp , 13 , 0 );
101- real_writew (dos.dcp , 14 , ( uint16_t )(bufptr & 0x000f ) );
102- real_writew (dos.dcp , 16 , ( uint16_t )(bufptr >> 4 ) );
71+ real_writew (dos.dcp , 14 , offset );
72+ real_writew (dos.dcp , 16 , seg );
10373 real_writew (dos.dcp , 18 , size);
10474
10575 reg_bx = 0 ;
@@ -115,7 +85,7 @@ uint16_t DOS_ExtDevice::CallDeviceFunction(uint8_t command, uint8_t length, Phys
11585bool DOS_ExtDevice::ReadFromControlChannel (PhysPt bufptr,uint16_t size,uint16_t * retcode) {
11686 if (ext.attribute & 0x4000 ) {
11787 // IOCTL INPUT
118- if ((CallDeviceFunction (3 , 26 , bufptr, size) & 0x8000 ) == 0 ) {
88+ if ((CallDeviceFunction (3 , 26 , ( uint16_t )( bufptr >> 4 ), ( uint16_t )(bufptr & 0x000f ) , size) & 0x8000 ) == 0 ) {
11989 *retcode = real_readw (dos.dcp , 18 );
12090 return true ;
12191 }
@@ -126,7 +96,7 @@ bool DOS_ExtDevice::ReadFromControlChannel(PhysPt bufptr,uint16_t size,uint16_t
12696bool DOS_ExtDevice::WriteToControlChannel (PhysPt bufptr,uint16_t size,uint16_t * retcode) {
12797 if (ext.attribute & 0x4000 ) {
12898 // IOCTL OUTPUT
129- if ((CallDeviceFunction (12 , 26 , bufptr, size) & 0x8000 ) == 0 ) {
99+ if ((CallDeviceFunction (12 , 26 , ( uint16_t )( bufptr >> 4 ), ( uint16_t )(bufptr & 0x000f ) , size) & 0x8000 ) == 0 ) {
130100 *retcode = real_readw (dos.dcp , 18 );
131101 return true ;
132102 }
@@ -138,7 +108,7 @@ bool DOS_ExtDevice::Read(uint8_t * data,uint16_t * size) {
138108 PhysPt bufptr = (dos.dcp << 4 ) | 32 ;
139109 for (uint16_t no = 0 ; no < *size ; no++) {
140110 // INPUT
141- if ((CallDeviceFunction (4 , 26 , bufptr , 1 ) & 0x8000 )) {
111+ if ((CallDeviceFunction (4 , 26 , dos. dcp + 2 , 0 , 1 ) & 0x8000 )) {
142112 return false ;
143113 } else {
144114 if (real_readw (dos.dcp , 18 ) != 1 ) {
@@ -155,7 +125,7 @@ bool DOS_ExtDevice::Write(const uint8_t * data,uint16_t * size) {
155125 for (uint16_t no = 0 ; no < *size ; no++) {
156126 mem_writeb (bufptr, *data);
157127 // OUTPUT
158- if ((CallDeviceFunction (8 , 26 , bufptr , 1 ) & 0x8000 )) {
128+ if ((CallDeviceFunction (8 , 26 , dos. dcp + 2 , 0 , 1 ) & 0x8000 )) {
159129 return false ;
160130 } else {
161131 if (real_readw (dos.dcp , 18 ) != 1 ) {
@@ -186,10 +156,10 @@ uint8_t DOS_ExtDevice::GetStatus(bool input_flag) {
186156 uint16_t status;
187157 if (input_flag) {
188158 // NON-DESTRUCTIVE INPUT NO WAIT
189- status = CallDeviceFunction (5 , 14 , 0 , 0 );
159+ status = CallDeviceFunction (5 , 14 , 0 , 0 , 0 );
190160 } else {
191161 // OUTPUT STATUS
192- status = CallDeviceFunction (10 , 13 , 0 , 0 );
162+ status = CallDeviceFunction (10 , 13 , 0 , 0 , 0 );
193163 }
194164 // check NO ERROR & BUSY
195165 if ((status & 0x8200 ) == 0 ) {
0 commit comments