3763f3c73b9f47278d344efe019d055d8f2400a6
[swan-dev] / src / main.c
1 /* #include <code16bit.h> */
2 #include <memory.h>
3
4 void outport(c)
5         unsigned c;
6 {
7 #asm
8         xor dx, dx
9         mov dx, ax
10         shr dx, 8
11         out dx, al
12         ;out 0x15, al
13 #endasm
14 }
15
16 static unsigned char data[] = {
17 0x65, 0x06, 0x67, 0x06, 0x79, 0x07, 0x8c, 0x08, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f,
18 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f
19 };
20
21 static unsigned char data2[] = {
22 0x65, 0x06, 0x67, 0x06, 0x79, 0x07, 0x8c, 0x08, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f,
23 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f
24 };
25
26 static unsigned char data3[] = {
27 0x65, 0x06, 0x67, 0x06, 0x79, 0x07, 0x8c, 0x08, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f,
28 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f, 0xff, 0x0f
29 };
30         
31
32
33 unsigned short *memcpy(dest, src, cnt)
34         unsigned short *dest;
35         unsigned short *src;
36         int cnt;
37 {
38
39         int i;
40 #asm
41         ;push ds
42         ;push es
43         mov ax, 0x0
44         mov ds, ax
45         xor ax, ax
46         mov es, ax
47 #endasm
48         for (i = 0; i < cnt; ++i) {
49                 *dest++ = *src++;
50                 //*dest++ = 0x66;
51         }
52 #asm    
53         ;pop es
54         ;pop ds
55         mov ds, 0xF000
56 #endasm
57         return dest;
58 }
59
60 void test_copy()
61 {
62 #asm 
63         ;mov ds, 0
64 #endasm
65       
66 //      unsigned short dest = 0xFE00;
67 //      unsigned * ptr = dest;
68 //      *ptr++ = 0xDEAD;
69 //      *ptr++ = 0xAAAA;
70 //      *ptr++ = 0xDEAD;
71         memcpy(0xFE00, 0x1000, 16);
72 #asm 
73         ;mov ds, 0xF000
74 #endasm
75         //wmemcpy(WSC_PALETTES, 0x2F000, 32);
76         return;
77 }
78
79 int main()
80 {
81         unsigned short data_seg = 0xF000;
82         unsigned short data_ram = 0x1000;
83         unsigned short rel_ram = data_seg - data_ram;
84
85         /* dummy */
86         memcpy(0x0, 0x0, 0);
87
88         memcpy(0xFE00, data - rel_ram, 16);
89         //memcpy(0xFE00, data_seg + data, 16);
90         
91         //while(1) {
92         //      /* outport(0x15EE); */
93         //      unsigned reg = 0x15;
94         //      unsigned val = 0xEE;
95         //      outport((reg << 8) | val);
96
97         //}
98
99
100         return 0;
101 }