OSDN Git Service

一部構造体のtypedef
authorhikarupsp <hikarupsp@users.sourceforge.jp>
Mon, 10 Mar 2014 12:00:26 +0000 (21:00 +0900)
committerhikarupsp <hikarupsp@users.sourceforge.jp>
Mon, 10 Mar 2014 12:00:26 +0000 (21:00 +0900)
function.c
jitc.c
main.c
osecpu.h
screen.c

index 489c696..c36b9c9 100644 (file)
@@ -4,6 +4,108 @@ static struct {
        unsigned stat[4], mat1, mat2, tmat;
 } randStat;
 
+static unsigned char fontdata[] = {
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,
+       0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x44, 0x44, 0x44, 0xfe, 0x44, 0x44, 0x44, 0x44, 0x44, 0xfe, 0x44, 0x44, 0x44, 0x00, 0x00,
+       0x10, 0x3a, 0x56, 0x92, 0x92, 0x90, 0x50, 0x38, 0x14, 0x12, 0x92, 0x92, 0xd4, 0xb8, 0x10, 0x10,
+       0x62, 0x92, 0x94, 0x94, 0x68, 0x08, 0x10, 0x10, 0x20, 0x2c, 0x52, 0x52, 0x92, 0x8c, 0x00, 0x00,
+       0x00, 0x70, 0x88, 0x88, 0x88, 0x90, 0x60, 0x47, 0xa2, 0x92, 0x8a, 0x84, 0x46, 0x39, 0x00, 0x00,
+       0x04, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x00,
+       0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x92, 0x54, 0x38, 0x54, 0x92, 0x10, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x08, 0x10,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+       0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80,
+       0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x18, 0x00, 0x00,
+       0x00, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00,
+       0x00, 0x18, 0x24, 0x42, 0x42, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x7e, 0x00, 0x00,
+       0x00, 0x18, 0x24, 0x42, 0x02, 0x02, 0x04, 0x18, 0x04, 0x02, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00,
+       0x00, 0x0c, 0x0c, 0x0c, 0x14, 0x14, 0x14, 0x24, 0x24, 0x44, 0x7e, 0x04, 0x04, 0x1e, 0x00, 0x00,
+       0x00, 0x7c, 0x40, 0x40, 0x40, 0x58, 0x64, 0x02, 0x02, 0x02, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00,
+       0x00, 0x18, 0x24, 0x42, 0x40, 0x58, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00,
+       0x00, 0x7e, 0x42, 0x42, 0x04, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00,
+       0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00,
+       0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x08, 0x10,
+       0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00,
+       0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x04, 0x08, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
+       0x00, 0x38, 0x44, 0x82, 0x9a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x9c, 0x80, 0x46, 0x38, 0x00, 0x00,
+       0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00,
+       0x00, 0xf0, 0x48, 0x44, 0x44, 0x44, 0x48, 0x78, 0x44, 0x42, 0x42, 0x42, 0x44, 0xf8, 0x00, 0x00,
+       0x00, 0x3a, 0x46, 0x42, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x42, 0x44, 0x38, 0x00, 0x00,
+       0x00, 0xf8, 0x44, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0x44, 0xf8, 0x00, 0x00,
+       0x00, 0xfe, 0x42, 0x42, 0x40, 0x40, 0x44, 0x7c, 0x44, 0x40, 0x40, 0x42, 0x42, 0xfe, 0x00, 0x00,
+       0x00, 0xfe, 0x42, 0x42, 0x40, 0x40, 0x44, 0x7c, 0x44, 0x44, 0x40, 0x40, 0x40, 0xf0, 0x00, 0x00,
+       0x00, 0x3a, 0x46, 0x42, 0x82, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x82, 0x42, 0x46, 0x38, 0x00, 0x00,
+       0x00, 0xe7, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00,
+       0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
+       0x00, 0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x48, 0x30, 0x00,
+       0x00, 0xe7, 0x42, 0x44, 0x48, 0x50, 0x50, 0x60, 0x50, 0x50, 0x48, 0x44, 0x42, 0xe7, 0x00, 0x00,
+       0x00, 0xf0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0xfe, 0x00, 0x00,
+       0x00, 0xc3, 0x42, 0x66, 0x66, 0x66, 0x5a, 0x5a, 0x5a, 0x42, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00,
+       0x00, 0xc7, 0x42, 0x62, 0x62, 0x52, 0x52, 0x52, 0x4a, 0x4a, 0x4a, 0x46, 0x46, 0xe2, 0x00, 0x00,
+       0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00,
+       0x00, 0xf8, 0x44, 0x42, 0x42, 0x42, 0x44, 0x78, 0x40, 0x40, 0x40, 0x40, 0x40, 0xf0, 0x00, 0x00,
+       0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x8a, 0x44, 0x3a, 0x00, 0x00,
+       0x00, 0xfc, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00,
+       0x00, 0x3a, 0x46, 0x82, 0x82, 0x80, 0x40, 0x38, 0x04, 0x02, 0x82, 0x82, 0xc4, 0xb8, 0x00, 0x00,
+       0x00, 0xfe, 0x92, 0x92, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
+       0x00, 0xe7, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x3c, 0x00, 0x00,
+       0x00, 0xe7, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
+       0x00, 0xe7, 0x42, 0x42, 0x42, 0x5a, 0x5a, 0x5a, 0x5a, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00,
+       0x00, 0xe7, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x24, 0x24, 0x24, 0x42, 0x42, 0xe7, 0x00, 0x00,
+       0x00, 0xee, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
+       0x00, 0xfe, 0x84, 0x84, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x42, 0x82, 0xfe, 0x00, 0x00,
+       0x00, 0x3e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3e, 0x00,
+       0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x04, 0x02, 0x02,
+       0x00, 0x7c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x7c, 0x00,
+       0x00, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00,
+       0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x08, 0x04, 0x3c, 0x44, 0x84, 0x84, 0x8c, 0x76, 0x00, 0x00,
+       0xc0, 0x40, 0x40, 0x40, 0x40, 0x58, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x64, 0x58, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x4c, 0x84, 0x84, 0x80, 0x80, 0x82, 0x44, 0x38, 0x00, 0x00,
+       0x0c, 0x04, 0x04, 0x04, 0x04, 0x34, 0x4c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x4c, 0x36, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0xfc, 0x80, 0x82, 0x42, 0x3c, 0x00, 0x00,
+       0x0e, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x4c, 0x84, 0x84, 0x84, 0x84, 0x4c, 0x34, 0x04, 0x04, 0x78,
+       0xc0, 0x40, 0x40, 0x40, 0x40, 0x58, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0xe3, 0x00, 0x00,
+       0x00, 0x10, 0x10, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00,
+       0x00, 0x04, 0x04, 0x00, 0x00, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x30,
+       0xc0, 0x40, 0x40, 0x40, 0x40, 0x4e, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0xe6, 0x00, 0x00,
+       0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0xdb, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0xe3, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x64, 0x58, 0x40, 0xe0,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x4c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x4c, 0x34, 0x04, 0x0e,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x62, 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe0, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x86, 0x82, 0xc0, 0x38, 0x06, 0x82, 0xc2, 0xbc, 0x00, 0x00,
+       0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3b, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x42, 0x42, 0x5a, 0x5a, 0x5a, 0x24, 0x24, 0x24, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x44, 0x28, 0x28, 0x10, 0x28, 0x28, 0x44, 0xc6, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x10, 0x10, 0x60,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x84, 0x08, 0x10, 0x20, 0x42, 0x82, 0xfe, 0x00, 0x00,
+       0x00, 0x06, 0x08, 0x10, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x10, 0x08, 0x06, 0x00, 0x00,
+       0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+       0x00, 0x60, 0x10, 0x08, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x08, 0x10, 0x60, 0x00, 0x00,
+       0x00, 0x72, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x82, 0xfe, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+
+
+// tinyMTの32bit版のアルゴリズムを使っています : http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index-jp.html
 void randStatNext()
 {
        unsigned x, y;
@@ -58,7 +160,7 @@ const char *searchArg(int argc, const char **argv, const char *tag, int i)
        return r;
 }
 
-void devFunc0001(int len, unsigned char *puc, struct Regs *r)
+void devFunc0001(int len, unsigned char *puc, HOSECPU_RuntimeEnvironment *r)
 {
        while (len > 0) {
                putOsaskChar(*puc++, r);
@@ -67,7 +169,7 @@ void devFunc0001(int len, unsigned char *puc, struct Regs *r)
        return;
 }
 
-void devFunc0006(int mod, int sx, int sy, int x, int y, int c, int len, unsigned char *puc, struct Regs *r)
+void devFunc0006(int mod, int sx, int sy, int x, int y, int c, int len, unsigned char *puc, HOSECPU_RuntimeEnvironment *r)
 {
        if (sy == 0) sy = sx;
        int xx = x + sx * 8;
@@ -146,7 +248,7 @@ void devFunc0004(int mod, int x0, int y0, int x1, int y1, int c)
        return;
 }
 
-int devFunc0016(int buflen, unsigned char *buf, int plen, unsigned char *p, int qlen, int *q, struct Regs *r)
+int devFunc0016(int buflen, unsigned char *buf, int plen, unsigned char *p, int qlen, int *q, HOSECPU_RuntimeEnvironment *r)
 {
        int i = 0, base, j, k;
        char sign;
@@ -211,10 +313,10 @@ int devFunc0016(int buflen, unsigned char *buf, int plen, unsigned char *p, int
        return i;
 }
 
-void devFunc(struct Regs *r)
+void devFunc(HOSECPU_RuntimeEnvironment *r)
 {
        FILE *fp;
-       r = (struct Regs *) (((char *)r) - 128); /* サイズを節約するためにEBPを128バイトずらしているのを元に戻す */
+       r = (HOSECPU_RuntimeEnvironment *) (((char *)r) - 128); /* サイズを節約するためにEBPを128バイトずらしているのを元に戻す */
        int i, c;
        int x, y, len, dx, dy;
        unsigned char *puc;
diff --git a/jitc.c b/jitc.c
index 8b1c551..f55b8c7 100644 (file)
--- a/jitc.c
+++ b/jitc.c
@@ -17,7 +17,7 @@
 #define JITC_ERR_PREFIXFAR             (13 | JITC_ERR_PHASE0ONLY)
 #define JITC_ERR_INTERNAL              99
 
-void errorHandler(struct Regs *r)
+void errorHandler(HOSECPU_RuntimeEnvironment *r)
 {
        puts("security error! abort...");
        printf("debugInfo0=%d, debugInfo1=%d\n", r->debugInfo0, r->debugInfo1);
@@ -302,7 +302,7 @@ void funcf6(char *ebp, int pxx, int typ, int len);
 void funcf7(char *ebp, int pxx, int typ, int len); // typとlenはダミーで参照されない.
 // F5の場合、decoderが対応するalloc-freeを結びつけるのが簡単で、typやlenを指定必須にしてもフロントエンドコードに影響はない.
 
-void errHndl(struct Regs *r);
+void errHndl(HOSECPU_RuntimeEnvironment *r);
 
 /*
  * dst : 現在の書き込みアドレス。
@@ -311,7 +311,7 @@ void errHndl(struct Regs *r);
  * src1 : 読み込みアドレスの最大値
  * src0 : 読み込みバイナリのアドレス
  */
-int jitCompiler(unsigned char *dst, unsigned char *dst1, const unsigned char *src, const unsigned char *src1, const unsigned char *src0, struct LabelTable *label, int maxLabels, int level, int debugInfo1, int flags)
+int jitCompiler(unsigned char *dst, unsigned char *dst1, const unsigned char *src, const unsigned char *src1, const unsigned char *src0, HOSECPU_LabelListTag *label, int maxLabels, int level, int debugInfo1, int flags)
 /* IA-32用 */
 /* 本来ならこのレイヤでは文法チェックしない */
 {
@@ -1508,9 +1508,9 @@ unsigned char *jitCompInit(unsigned char *dst)
 
 void func3c(char *ebp, int opt, int r1, int p1, int lenR, int lenP, int r0, int p0)
 {
-       struct Regs *r = (struct Regs *) (ebp - jitCompA0001_EBP128);
+       HOSECPU_RuntimeEnvironment *r = (HOSECPU_RuntimeEnvironment *) (ebp - jitCompA0001_EBP128);
        int i, *pi;
-       struct Ptr *pp;
+       HOSECPU_PointerRegisterEntry *pp;
        if (r->junkStack + 2048 > r->junkStack1) (*(r->errHndl))(r);
        pi = (void *)r->junkStack; r->junkStack += r1 * 4;
        for (i = 0; i < r1; i++)
@@ -1531,10 +1531,11 @@ void func3c(char *ebp, int opt, int r1, int p1, int lenR, int lenP, int r0, int
 
 void func3d(char *ebp, int opt, int r1, int p1, int lenR, int lenP, int r0, int p0)
 {
-       struct Regs *r = (struct Regs *) (ebp - jitCompA0001_EBP128);
+       HOSECPU_RuntimeEnvironment *r = (HOSECPU_RuntimeEnvironment *) (ebp - jitCompA0001_EBP128);
        int i;
        r->junkStack -= 4;
-       r->junkStack -= 32; struct Ptr *pp = (void *)r->junkStack;
+       r->junkStack -= 32;
+    HOSECPU_PointerRegisterEntry *pp = (void *)r->junkStack;
        r->preg[0x30] = *pp;
        r->junkStack -= p1 * 32; pp = (void *)r->junkStack;
        for (i = 0; i < p1; i++)
@@ -1547,7 +1548,7 @@ void func3d(char *ebp, int opt, int r1, int p1, int lenR, int lenP, int r0, int
 
 void funcf4(char *ebp, int pxx, int typ, int len)
 {
-       struct Regs *r = (struct Regs *) (ebp - jitCompA0001_EBP128);
+       HOSECPU_RuntimeEnvironment *r = (HOSECPU_RuntimeEnvironment *) (ebp - jitCompA0001_EBP128);
        int width = jitCompA000_dataWidth(jitCompA000_convTyp(r->ireg[typ])) >> 3;
        if (width < 0 || r->ireg[len] < 0)
                (*(r->errHndl))(r);
@@ -1572,7 +1573,7 @@ void funcf4(char *ebp, int pxx, int typ, int len)
 
 void funcf5(char *ebp, int pxx, int typ, int len)
 {
-       struct Regs *r = (struct Regs *) (ebp - jitCompA0001_EBP128);
+       HOSECPU_RuntimeEnvironment *r = (HOSECPU_RuntimeEnvironment *) (ebp - jitCompA0001_EBP128);
        r->junkStack -= sizeof (int);
        int *pi = (int *)r->junkStack;
        r->junkStack -= *pi;
@@ -1586,7 +1587,7 @@ void funcf5(char *ebp, int pxx, int typ, int len)
 
 void funcf6(char *ebp, int pxx, int typ, int len)
 {
-       struct Regs *r = (struct Regs *) (ebp - jitCompA0001_EBP128);
+       HOSECPU_RuntimeEnvironment *r = (HOSECPU_RuntimeEnvironment *) (ebp - jitCompA0001_EBP128);
        int width = jitCompA000_dataWidth(jitCompA000_convTyp(r->ireg[typ])) >> 3;
        if (width < 0 || r->ireg[len] < 0)
                (*(r->errHndl))(r);
@@ -1608,14 +1609,14 @@ void funcf6(char *ebp, int pxx, int typ, int len)
 
 void funcf7(char *ebp, int pxx, int typ, int len)
 {
-       struct Regs *r = (struct Regs *) (ebp - jitCompA0001_EBP128);
+       HOSECPU_RuntimeEnvironment *r = (HOSECPU_RuntimeEnvironment *) (ebp - jitCompA0001_EBP128);
        free(r->preg[pxx].p);
        return;
 }
 
-void errHndl(struct Regs *r)
+void errHndl(HOSECPU_RuntimeEnvironment *r)
 {
-       r = (struct Regs *) (((char *)r) - jitCompA0001_EBP128);
+       r = (HOSECPU_RuntimeEnvironment *) (((char *)r) - jitCompA0001_EBP128);
        (*(r->errHndl))(r);
        // ここに帰ってきてはいけない.
 }
@@ -1631,7 +1632,7 @@ void errHndl(struct Regs *r)
  * ret=1 : ヘッダのエラー
  * ret=2 : jitコンパイルエラー
  */
-int jitc0(unsigned char **qq, unsigned char *q1, const unsigned char *p0, const unsigned char *p1, int level, struct LabelTable *label)
+int jitc0(unsigned char **qq, unsigned char *q1, const unsigned char *p0, const unsigned char *p1, int level, HOSECPU_LabelListTag *label)
 {
        unsigned char *q = *qq;
        if (p0[0] != 0x05 || p0[1] != SIGN1)
@@ -1674,7 +1675,7 @@ int dbgrGetRegNum(const char *p)
        return r;
 }
 
-void dbgrMain(struct Regs *r)
+void dbgrMain(HOSECPU_RuntimeEnvironment *r)
 {
        if (r->dbgr == 0) return;
        for (;;) {
diff --git a/main.c b/main.c
index c9a00fb..cee2db6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -25,13 +25,13 @@ int osecpuMain(int argc, char **argv)
        unsigned char *systmp0 = malloc(SYSTMP0SIZ);
        unsigned char *systmp1 = malloc(SYSTMP1SIZ);
        unsigned char *systmp2 = malloc(1024 * 1024), *opTbl = malloc(256);
-       struct LabelTable *label = malloc(JITC_MAXLABELS * sizeof (struct LabelTable));
+       HOSECPU_LabelListTag *label = malloc(JITC_MAXLABELS * sizeof (HOSECPU_LabelListTag));
        int level = JITC_LV_SLOWEST, tmpsiz, i;
        keybuf = malloc(KEYBUFSIZ * sizeof (int));
        keybuf_r = keybuf_w = keybuf_c = 0;
        jmp_buf setjmpEnv;
        double tm0, tm1, tm2;
-       struct PtrCtrl *ptrCtrl = malloc(PTRCTRLSIZ * sizeof (struct PtrCtrl));
+       HOSECPU_PointerControlTag *ptrCtrl = malloc(PTRCTRLSIZ * sizeof (HOSECPU_PointerControlTag));
 
        randStatInit((unsigned int)time(NULL));
        for (i = 0; i < PTRCTRLSIZ; i++) {
@@ -65,11 +65,9 @@ int osecpuMain(int argc, char **argv)
                return 1;
        }
        if (syslib[0] == 0x05 && syslib[1] == 0xc1) {
-               
                // 一体この部分ではなにをやっているのだろう?
                // OSECPUに0x05, 0x1bという命令はないが... ヘッダ?
                // どうせ初めからの32バイトは無視されるのだろうに...
-
                memcpy(systmp0, syslib, appsiz0);
                ComLib_main(systmp0 + 2, syslib + 2);
                syslib[0] = 0x05;
@@ -89,7 +87,7 @@ int osecpuMain(int argc, char **argv)
        // もちろんsysjitの値は次の書き込み位置へずらされる。
        // labelはjitc0()内で初期化される。
        i = jitc0(&sysjit, sysjit00 + SJITSIZ1, syslib + 32, syslib + SYSLIBSIZ1, JITC_LV_FASTEST, label);
-       if (i != 0) {
+       if (i != 0){
                fputs("syslib-file JITC error.\n", stderr);
                return 1;
        }
@@ -98,12 +96,15 @@ int osecpuMain(int argc, char **argv)
        di1_serial++;
 
        /* アプリバイナリの読み込み */
-       if (argc <= 1) { return 0; }
+       if (argc <= 1) {
+        return 0;
+    }
        const char *argv1 = argv[1];
        if (argv1[0] == ':' && argv1[2] == ':') {
                level = argv1[1] - '0';
-               if (level < 0 || level > 9)
+               if (level < 0 || level > 9){
                        level = JITC_LV_SLOWEST;
+        }
                argv1 += 3;
        }
        fp = fopen(argv1, "rb");
@@ -118,7 +119,7 @@ int osecpuMain(int argc, char **argv)
                return 1;
        }
        if (appsiz0 < 3) {
-       header_error:
+header_error:
                fputs("app-file header error.\n", stderr);
                return 1;
        }
@@ -139,11 +140,14 @@ int osecpuMain(int argc, char **argv)
 
        int argDebug = 0, stacksiz = 1;
        const  char *cp = searchArg(argc, (const char **)argv, "debug:", 0);
-       if (cp != NULL) argDebug = *cp - '0';
+       if (cp != NULL){
+        argDebug = *cp - '0';
+    }
        cp = searchArg(argc, (const char **)argv, "stack:", 0);
-       if (cp != NULL) stacksiz = strtol(cp, NULL, 0);
-
-       struct Regs regs;
+       if (cp != NULL){
+        stacksiz = strtol(cp, NULL, 0);
+    }
+       HOSECPU_RuntimeEnvironment regs;
        void(*jitfunc)(char *);
        unsigned char *jp = jitbuf; /* JIT-pointer */
 
@@ -175,8 +179,7 @@ int osecpuMain(int argc, char **argv)
                        exit(1);
                }
                tmpsiz = regs.preg[2].p - systmp0;
-       }
-       else {
+       } else{
                memcpy(systmp0, appbin, appsiz1);
                tmpsiz = appsiz1;
        }
@@ -188,8 +191,12 @@ int osecpuMain(int argc, char **argv)
        }
 
        i = jitc0(&jp, jitbuf + 1024 * 1024, systmp0, systmp0 + tmpsiz, level, label);
-       if (i == 1) goto header_error;
-       if (i != 0) return 1;
+       if (i == 1){
+        goto header_error;
+    }
+       if (i != 0){
+        return 1;
+    }
        di1_serial++;
 
        int appsiz2 = jp - jitbuf;
@@ -200,8 +207,9 @@ int osecpuMain(int argc, char **argv)
        tm1 = clock() / (double)CLOCKS_PER_SEC;
 
        /* レジスタ初期化 */
-       for (i = 0; i < 64; i++)
+       for (i = 0; i < 64; i++){
                regs.ireg[i] = 0;
+    }
        for (i = 0; i < 64; i++) {
                regs.preg[i].p = NULL;
                regs.preg[i].typ = -1;
@@ -230,7 +238,9 @@ int osecpuMain(int argc, char **argv)
        regs.jitbuf1 = jitbuf + 1024 * 1024;
        regs.errHndl = &errorHandler;
        regs.dbgr = 0;
-       if (searchArg(argc, (const char **)argv, "dbgr:1", 0) != NULL) regs.dbgr = 1;
+       if (searchArg(argc, (const char **)argv, "dbgr:1", 0) != NULL){
+        regs.dbgr = 1;
+    }
 
        if ((argDebug & 1) != 0) {
                fp = fopen("debug1.bin", "wb");
@@ -240,16 +250,20 @@ int osecpuMain(int argc, char **argv)
 
        /* JITコード実行 */
        jitfunc = (void *)jitbuf;
-       if (setjmp(setjmpEnv) == 0)
+       if (setjmp(setjmpEnv) == 0){
                (*jitfunc)(((char *)&regs) + 128); /* サイズを節約するためにEBPを128バイトずらす */
+    }
        if (regs.autoSleep != 0) {
-               if (vram != NULL)
+               if (vram != NULL){
                        drv_flshWin(v_xsiz, v_ysiz, 0, 0);
-               while (regs.winClosed == 0)
+        }
+               while (regs.winClosed == 0){
                        drv_sleep(100);
+        }
        }
-       if (regs.lastConsoleChar != '\n')
+       if (regs.lastConsoleChar != '\n'){
                putchar('\n');
+    }
 
        tm2 = clock() / (double)CLOCKS_PER_SEC;
 
@@ -269,6 +283,5 @@ int osecpuMain(int argc, char **argv)
 int main(int argc, char **argv)
 {
        // Program entry point
-
        return osecpuMain(argc, argv);
 }
\ No newline at end of file
index 9b24e04..4dd4b48 100644 (file)
--- a/osecpu.h
+++ b/osecpu.h
@@ -15,7 +15,6 @@
 #include <setjmp.h>
 #include <stdlib.h>
 
-
 //
 // Compile options
 //
 //
 // HOSECPU structures
 //
+typedef struct PtrCtrl HOSECPU_PointerControlTag;
 struct PtrCtrl {
        int liveSign;
        int size, typ;
        unsigned char *p0;
 };
-typedef struct PtrCtrl HOSECPU_PointerControlTag;
 
+typedef struct Ptr HOSECPU_PointerRegisterEntry;
 struct Ptr {   /* 32バイト(=256bit!) */
        unsigned char *p;
        int typ;
        unsigned char *p0, *p1;
        int liveSign;
-       struct PtrCtrl *pls;
+       HOSECPU_PointerControlTag *pls;
        int flags, dummy;       /* read/writeなど */
 };
-typedef struct Ptr HOSECPU_PointerRegisterEntry;
 
+typedef struct LabelTable HOSECPU_LabelListTag;
 struct LabelTable {
        unsigned char *p, *p1;
        int opt;
-       
        /*
         * default = -1
         * TYP_CODE = 0
@@ -79,14 +78,13 @@ struct LabelTable {
        int typ;
 };
 
-typedef struct LabelTable HOSECPU_LabelListTag;
-
+typedef struct Regs HOSECPU_RuntimeEnvironment;
 struct Regs {
        int ireg[64];           /* 32bit整数レジスタ */
-       struct Ptr preg[64];    /* ポインタレジスタ */
+       HOSECPU_PointerRegisterEntry preg[64];    /* ポインタレジスタ */
 
        int debugInfo0, debugInfo1, dmy[2]; /* 2304 */
-       struct PtrCtrl *ptrCtrl;            /* 2320 */
+       HOSECPU_PointerControlTag *ptrCtrl;            /* 2320 */
        char winClosed, autoSleep;
        jmp_buf *setjmpEnv;
 
@@ -95,14 +93,15 @@ struct Regs {
        const char **argv;
        unsigned char *buf0, *buf1, *junkStack, lastConsoleChar, *junkStack1;
 
-       struct LabelTable *label;
+       HOSECPU_LabelListTag *label;
        int maxLabels;
        unsigned char *jitbuf, *jitbuf1;
-       void(*errHndl)(struct Regs *);
+       void(*errHndl)(HOSECPU_RuntimeEnvironment *);
        char dbgr;
        int mapDi1s[16][16];
 };
 
+
 //
 // Define constant values
 //
@@ -149,11 +148,11 @@ void drv_flshWin(int sx, int sy, int x0, int y0);
 void drv_sleep(int msec);
 
 // @function.c
-void dbgrMain(struct Regs *r);
+void dbgrMain(HOSECPU_RuntimeEnvironment *r);
 const char *searchArg(int argc, const char **argv, const char *tag, int i); // コマンドライン引数処理.
 void randStatInit(unsigned int seed);
 void randStatNext();
-void devFunc(struct Regs *r); // junkApiを処理する関数
+void devFunc(HOSECPU_RuntimeEnvironment *r); // junkApiを処理する関数
 
 // @jitc.c
 /* JITCのフラグ群 */
@@ -167,126 +166,21 @@ void devFunc(struct Regs *r); // junkApiを処理する関数
 #define JITC_NOSTARTUP         0x0004
 #define JITC_MAXLABELS         4096
 #define PTRCTRLSIZ                     4096
-
-
-int jitc0(unsigned char **qq, unsigned char *q1, const unsigned char *p0, const unsigned char *p1, int level, struct LabelTable *label);
-int jitCompiler(unsigned char *dst, unsigned char *dst1, const unsigned char *src, const unsigned char *src1, const unsigned char *src0, struct LabelTable *label, int maxLabels, int level, int debugInfo1, int flags);
+int jitc0(unsigned char **qq, unsigned char *q1, const unsigned char *p0, const unsigned char *p1, int level, HOSECPU_LabelListTag *label);
+int jitCompiler(unsigned char *dst, unsigned char *dst1, const unsigned char *src, const unsigned char *src1, const unsigned char *src0, HOSECPU_LabelListTag *label, int maxLabels, int level, int debugInfo1, int flags);
 unsigned char *jitCompCallFunc(unsigned char *dst, void *func);
 unsigned char *jitCompInit(unsigned char *dst);
-void errorHandler(struct Regs *r);
+void errorHandler(HOSECPU_RuntimeEnvironment *r);
 
 // @screen.c
-static unsigned char fontdata[] = {
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,
-       0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x44, 0x44, 0x44, 0xfe, 0x44, 0x44, 0x44, 0x44, 0x44, 0xfe, 0x44, 0x44, 0x44, 0x00, 0x00,
-       0x10, 0x3a, 0x56, 0x92, 0x92, 0x90, 0x50, 0x38, 0x14, 0x12, 0x92, 0x92, 0xd4, 0xb8, 0x10, 0x10,
-       0x62, 0x92, 0x94, 0x94, 0x68, 0x08, 0x10, 0x10, 0x20, 0x2c, 0x52, 0x52, 0x92, 0x8c, 0x00, 0x00,
-       0x00, 0x70, 0x88, 0x88, 0x88, 0x90, 0x60, 0x47, 0xa2, 0x92, 0x8a, 0x84, 0x46, 0x39, 0x00, 0x00,
-       0x04, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x02, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x02, 0x00,
-       0x80, 0x40, 0x20, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x40, 0x80, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x92, 0x54, 0x38, 0x54, 0x92, 0x10, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x08, 0x10,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
-       0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40, 0x80, 0x80,
-       0x00, 0x18, 0x24, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x18, 0x00, 0x00,
-       0x00, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00,
-       0x00, 0x18, 0x24, 0x42, 0x42, 0x02, 0x04, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x7e, 0x00, 0x00,
-       0x00, 0x18, 0x24, 0x42, 0x02, 0x02, 0x04, 0x18, 0x04, 0x02, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00,
-       0x00, 0x0c, 0x0c, 0x0c, 0x14, 0x14, 0x14, 0x24, 0x24, 0x44, 0x7e, 0x04, 0x04, 0x1e, 0x00, 0x00,
-       0x00, 0x7c, 0x40, 0x40, 0x40, 0x58, 0x64, 0x02, 0x02, 0x02, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00,
-       0x00, 0x18, 0x24, 0x42, 0x40, 0x58, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00,
-       0x00, 0x7e, 0x42, 0x42, 0x04, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00,
-       0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00,
-       0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x08, 0x10,
-       0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00,
-       0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x04, 0x08, 0x10, 0x10, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
-       0x00, 0x38, 0x44, 0x82, 0x9a, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x9c, 0x80, 0x46, 0x38, 0x00, 0x00,
-       0x00, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x24, 0x24, 0x7e, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00,
-       0x00, 0xf0, 0x48, 0x44, 0x44, 0x44, 0x48, 0x78, 0x44, 0x42, 0x42, 0x42, 0x44, 0xf8, 0x00, 0x00,
-       0x00, 0x3a, 0x46, 0x42, 0x82, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x42, 0x44, 0x38, 0x00, 0x00,
-       0x00, 0xf8, 0x44, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0x44, 0xf8, 0x00, 0x00,
-       0x00, 0xfe, 0x42, 0x42, 0x40, 0x40, 0x44, 0x7c, 0x44, 0x40, 0x40, 0x42, 0x42, 0xfe, 0x00, 0x00,
-       0x00, 0xfe, 0x42, 0x42, 0x40, 0x40, 0x44, 0x7c, 0x44, 0x44, 0x40, 0x40, 0x40, 0xf0, 0x00, 0x00,
-       0x00, 0x3a, 0x46, 0x42, 0x82, 0x80, 0x80, 0x9e, 0x82, 0x82, 0x82, 0x42, 0x46, 0x38, 0x00, 0x00,
-       0x00, 0xe7, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00,
-       0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
-       0x00, 0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x84, 0x48, 0x30, 0x00,
-       0x00, 0xe7, 0x42, 0x44, 0x48, 0x50, 0x50, 0x60, 0x50, 0x50, 0x48, 0x44, 0x42, 0xe7, 0x00, 0x00,
-       0x00, 0xf0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0xfe, 0x00, 0x00,
-       0x00, 0xc3, 0x42, 0x66, 0x66, 0x66, 0x5a, 0x5a, 0x5a, 0x42, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00,
-       0x00, 0xc7, 0x42, 0x62, 0x62, 0x52, 0x52, 0x52, 0x4a, 0x4a, 0x4a, 0x46, 0x46, 0xe2, 0x00, 0x00,
-       0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00,
-       0x00, 0xf8, 0x44, 0x42, 0x42, 0x42, 0x44, 0x78, 0x40, 0x40, 0x40, 0x40, 0x40, 0xf0, 0x00, 0x00,
-       0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x8a, 0x44, 0x3a, 0x00, 0x00,
-       0x00, 0xfc, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0xe7, 0x00, 0x00,
-       0x00, 0x3a, 0x46, 0x82, 0x82, 0x80, 0x40, 0x38, 0x04, 0x02, 0x82, 0x82, 0xc4, 0xb8, 0x00, 0x00,
-       0x00, 0xfe, 0x92, 0x92, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
-       0x00, 0xe7, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x3c, 0x00, 0x00,
-       0x00, 0xe7, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00,
-       0x00, 0xe7, 0x42, 0x42, 0x42, 0x5a, 0x5a, 0x5a, 0x5a, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00,
-       0x00, 0xe7, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x24, 0x24, 0x24, 0x42, 0x42, 0xe7, 0x00, 0x00,
-       0x00, 0xee, 0x44, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
-       0x00, 0xfe, 0x84, 0x84, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x42, 0x82, 0xfe, 0x00, 0x00,
-       0x00, 0x3e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3e, 0x00,
-       0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x04, 0x02, 0x02,
-       0x00, 0x7c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x7c, 0x00,
-       0x00, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00,
-       0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x08, 0x04, 0x3c, 0x44, 0x84, 0x84, 0x8c, 0x76, 0x00, 0x00,
-       0xc0, 0x40, 0x40, 0x40, 0x40, 0x58, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x64, 0x58, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x4c, 0x84, 0x84, 0x80, 0x80, 0x82, 0x44, 0x38, 0x00, 0x00,
-       0x0c, 0x04, 0x04, 0x04, 0x04, 0x34, 0x4c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x4c, 0x36, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0xfc, 0x80, 0x82, 0x42, 0x3c, 0x00, 0x00,
-       0x0e, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x4c, 0x84, 0x84, 0x84, 0x84, 0x4c, 0x34, 0x04, 0x04, 0x78,
-       0xc0, 0x40, 0x40, 0x40, 0x40, 0x58, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0xe3, 0x00, 0x00,
-       0x00, 0x10, 0x10, 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00,
-       0x00, 0x04, 0x04, 0x00, 0x00, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x30,
-       0xc0, 0x40, 0x40, 0x40, 0x40, 0x4e, 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0xe6, 0x00, 0x00,
-       0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0xdb, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0xe3, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x64, 0x42, 0x42, 0x42, 0x42, 0x42, 0x64, 0x58, 0x40, 0xe0,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x4c, 0x84, 0x84, 0x84, 0x84, 0x84, 0x4c, 0x34, 0x04, 0x0e,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x62, 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe0, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x86, 0x82, 0xc0, 0x38, 0x06, 0x82, 0xc2, 0xbc, 0x00, 0x00,
-       0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x3b, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x42, 0x42, 0x5a, 0x5a, 0x5a, 0x24, 0x24, 0x24, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x44, 0x28, 0x28, 0x10, 0x28, 0x28, 0x44, 0xc6, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x10, 0x10, 0x60,
-       0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x84, 0x08, 0x10, 0x20, 0x42, 0x82, 0xfe, 0x00, 0x00,
-       0x00, 0x06, 0x08, 0x10, 0x10, 0x10, 0x10, 0x60, 0x10, 0x10, 0x10, 0x10, 0x08, 0x06, 0x00, 0x00,
-       0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
-       0x00, 0x60, 0x10, 0x08, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x08, 0x10, 0x60, 0x00, 0x00,
-       0x00, 0x72, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x82, 0xfe, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00
-};/* tinyMTの32bit版のアルゴリズムを使っています : http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index-jp.html */
-
 static int iColor1[] = {
        0x000000, 0xff0000, 0x00ff00, 0xffff00,
        0x0000ff, 0xff00ff, 0x00ffff, 0xffffff
 };
-
-void putOsaskChar(int c, struct Regs *r);
-
-void checkString(struct Regs *r, int rxx, int pxx);
-
-void checkRect(struct Regs *r, int rxx);
-
-int loadColor(struct Regs *r, int rxx);
+void putOsaskChar(int c, HOSECPU_RuntimeEnvironment *r);
+void checkString(HOSECPU_RuntimeEnvironment *r, int rxx, int pxx);
+void checkRect(HOSECPU_RuntimeEnvironment *r, int rxx);
+int loadColor(HOSECPU_RuntimeEnvironment *r, int rxx);
 
 #if (USE_TEK5 != 0)
 /* tek.cを移植するのは大変だと思ったので、断念 */
index dfad86e..3d01522 100644 (file)
--- a/screen.c
+++ b/screen.c
@@ -1,6 +1,6 @@
 #include "osecpu.h"
 
-void putOsaskChar(int c, struct Regs *r)
+void putOsaskChar(int c, HOSECPU_RuntimeEnvironment *r)
 {
        if (0x10 <= c && c <= 0x1f)
                c = "0123456789ABCDEF"[c & 0x0f];
@@ -8,7 +8,7 @@ void putOsaskChar(int c, struct Regs *r)
        return;
 }
 
-void checkString(struct Regs *r, int rxx, int pxx)
+void checkString(HOSECPU_RuntimeEnvironment *r, int rxx, int pxx)
 {
        char c = 0;
        if (r->preg[pxx].typ != 0x03) c = 1;
@@ -20,7 +20,7 @@ void checkString(struct Regs *r, int rxx, int pxx)
        return;
 }
 
-int loadColor(struct Regs *r, int rxx)
+int loadColor(HOSECPU_RuntimeEnvironment *r, int rxx)
 {
        int c = r->ireg[rxx], m = r->ireg[0x31] & 0x0c, rr, gg, bb;
        if (m == 0x04) {
@@ -58,7 +58,7 @@ int loadColor(struct Regs *r, int rxx)
        return c;
 }
 
-void checkRect(struct Regs *r, int rxx)
+void checkRect(HOSECPU_RuntimeEnvironment *r, int rxx)
 {
        char c = 0;
        int i;