windres -i $< -o $@
#---- depend file ----
-driver_hongkongfc.o: driver_hongkongfc.c type.h hard_hongkongfc.h \
- giveio.h
-driver_onajimi.o: driver_onajimi.c type.h hard_onajimi.h driver_onajimi.h
+driver_hongkongfc.o: driver_hongkongfc.c type.h paralellport.h \
+ hard_hongkongfc.h giveio.h
+driver_onajimi.o: driver_onajimi.c type.h paralellport.h hard_onajimi.h \
+ driver_onajimi.h
file.o: file.c file.h type.h
giveio.o: giveio.c giveio.h
header.o: header.c type.h file.h header.h
header.h script.h
textutil.o: textutil.c type.h textutil.h
unagi.o: unagi.c type.h driver_onajimi.h giveio.h file.h script.h
-
#include "type.h"
+#include "paralellport.h"
#include "hard_hongkongfc.h"
//#include "hongkongfc.h"
enum{
- PORT_DATA = 0x0378,
- PORT_BUSY,
- PORT_CONTROL
-};
-enum{
- ADDRESS_MASK_A0toA12 = 0x1fff,
- ADDRESS_MASK_A0toA14 = 0x7fff,
- ADDRESS_MASK_A15 = 0x8000
-};
-enum{
PORT_CONTROL_MASK_XOR = 0x03, //bit01 invert
PORT_CONTROL_READ = 0,
PORT_CONTROL_WRITE
todo:
* Ê̤Υϡ¼¥É¥¦¥§¥¢¤ËÂбþ¤·¤¿¾ì¹ç¤Ï PORT_DATA ¤«¤é wait ¤Þ¤Ç¤ò¥Ø¥Ã¥À¤Ë¤Þ¤È¤á¤ë
-memo:
-* -O0 ¤Ê¤é inline asm ¤Ç¤âÈ¿±þ¤Ç¤¤ë¤¬¡¢-O2 ¤À¤ÈÆ°¤«¤Ê¤¤
- * ͽÁÛ¤ËÈ¿¤·¤Æ out ¤ÏÆ°¤¯¤¬¡¢ in ¤Ë wait ¤¬É¬Íפߤ¿¤¤
-* gcc ¤Î¥¢¥»¥ó¥Ö¥é¤Ï x86 ¤Ç¤¢¤í¤¦¤È src,dst ¤Î½ç¤Çȿž¤·¤Æ¤¤¤ë
-* http://download.intel.com/jp/developer/jpdoc/IA32_Arh_Dev_Man_Vol2A_i.pdf
- * out,in ¤Î¥¢¥É¥ì¥¹¤Ë dx ¤ò»È¤ï¤Ê¤¤¤È 8bit ¥¢¥É¥ì¥¹¤Ë¤Ê¤ë
- * out,in ¤Î¥Ç¡¼¥¿¤Ï¥ì¥¸¥¹¥¿¤Ç¥Ç¡¼¥¿Éý¤¬ÊѤï¤ë al:8bit, ax:16bit, eax:32bit
*/
-//#include <dos.h> ?
-//#include <windows.h>
#include "type.h"
+#include "paralellport.h"
#include "hard_onajimi.h"
#include "driver_onajimi.h"
-#define ASM_ENABLE (0)
-enum{
- PORT_DATA = 0x0378,
- PORT_STATUS,
- PORT_CONTROL
-};
-enum{
- ADDRESS_MASK_A0toA14 = 0x7fff,
- ADDRESS_MASK_A15 = 0x8000
-};
-#if ASM_ENABLE==0
-void _outp(int, int);
-int _inp(int);
-#endif
-
-static inline int bit_set(int data, const int bit)
-{
- data |= 1 << bit;
- return data;
-}
-
-static inline int bit_clear(int data, const int bit)
-{
- data &= ~(1 << bit);
- return data;
-}
-
-static inline void wait(void)
-{
- //const long waittime = 100000;
- //SleepEx(20,TRUE);
-}
-
static inline void bus_control(int data)
{
#if ASM_ENABLE==0
" movl %1,%%edx\n"
" in %%dx,%%al\n"
" movl %%eax,%0"
- :"=q"(data) : "i"(PORT_STATUS) :"%edx", "%eax"
+ :"=q"(data) : "i"(PORT_BUSY) :"%edx", "%eax"
);
#else
- int data = _inp(PORT_STATUS);
+ int data = _inp(PORT_BUSY);
#endif
data >>= 7;
data &= 0x01;