2dc16e101ec263042597be4c670c6010ff0c9cf9
[h316.git] / pc-tools / boot-maker / main.c
1 #include <stdio.h>
2
3
4 void output(unsigned short * data){
5 int c;
6 char zero=0;
7 unsigned char first_word=020;
8 unsigned short akt=0;
9 for (c=0; c<100; c++) write (1,&zero,1);
10 write (1,&first_word,1); // Anfangsadresse ausgeben
11 c=020;
12 while (data[c]){
13 unsigned char lower=data[c] & 0xff;
14 unsigned char upper=(data[c] >> 8) & 0xff;
15 write (1,&upper,1);
16 write (2,"Locat geschrieben\n",18);
17 write (1,&lower,1);
18 c++;
19 }
20 for (c=0; c<100; c++) write (1,&zero,1); // Abspann
21 }
22
23 void prepare_1(unsigned short * mem){
24 mem[020]=0002010; // Loop back to read boot-strap (must be here!)
25 mem[021]=0004026; // Load A with fancy pattern
26 mem[022]=0024027; // Increment and skip if zero 027
27 mem[023]=0002022; // Loop
28 mem[024]=0040677; // Right rotate a
29 mem[025]=0002022; // Loop back
30 mem[026]=0052000; // Bit pattern to move around
31 }
32
33 void prepare_2(unsigned short * mem){
34 mem[020]=0002010; // Loop back to read boot-strap (must be here!)
35 mem[021]=0024027; // Increment and skip if zero 027
36 mem[022]=0002021; // Loop
37 mem[023]=0141206; // Add one to A
38 mem[024]=0002022; // Loop back
39 mem[025]=0000000; // End
40 }
41
42 void prepare_3(unsigned short * mem){
43 mem[020]=0002010; // Loop back to read boot-strap (must be here!)
44 mem[021]=0004027; // Load Precount
45 mem[022]=0024027; // Increment and skip if zero 027
46 mem[023]=0002021; // Loop
47 mem[024]=0141206; // Add one to A
48 mem[025]=0141340; // Change characters in A
49 mem[026]=0002021; // Loop back
50 mem[027]=0077777; // End
51 mem[030]=0000000;
52 }
53
54
55 int main(){
56 unsigned short memory[0100];
57 prepare_3(memory);
58 output(memory);
59 return 0;
60 }