/[projet1]/users/barnsey123/HNEFATAFL-LOADER/main.c
Defence Force logotype

Contents of /users/barnsey123/HNEFATAFL-LOADER/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 997 - (show annotations)
Fri Dec 6 16:23:49 2013 UTC (6 years, 5 months ago) by barnsey123
File MIME type: text/plain
File size: 3487 byte(s)
v0.091
1 //
2 // This program simply display a compressed picture on the hires screen
3 //
4 // 02-11-2013 NB removed lprintf from file_unpackc saving a couple of K
5 // adding routine to wipe the screen
6 // 04-11-2013 NB Added credits and tribute text, setting font here instead of main prog
7 // 05-11-2013 NB Calling Hires from CopyFont saving 3 bytes!
8 // 02-12-2013 NB slightly different message
9 #include <lib.h>
10 void WipeScreen();
11 void Pause();
12 void PrintMessage();
13 extern unsigned char LabelPicture[];
14 unsigned int PauseTime;
15 extern unsigned char Font_6x8_runic1_partial[472]; // runic oric chars (59chars * 8)
16 unsigned char erasetext=120; // how many lines to erase (3*40)=120;
17 extern char* message;
18 void file_unpackc(unsigned char *buf_dest,unsigned char *buf_src)
19 {
20 unsigned int size;
21 unsigned char value;
22 unsigned char maskvalue;
23 unsigned char andvalue;
24 unsigned int offset;
25 unsigned int nb;
26 //buf_src+=4; // Skipp LZ77 heqder
27 size=8000; //8000;
28 //buf_src+=4; // Skipp the size
29 buf_src+=8; // Skipp LZ77 header and Size
30 andvalue=0;
31 while (size)
32 {
33 //
34 // Reload encoding type mask
35 //
36 if (!andvalue)
37 {
38 andvalue=1;
39 value=*buf_src++;
40 maskvalue=value;
41 }
42 if (maskvalue & andvalue)
43 {
44 //
45 // Copy 1 unsigned char
46 //
47 value=*buf_src++;
48 *buf_dest++=value;
49 size--;
50 }
51 else
52 {
53 //
54 // Copy with offset
55 //
56 // At this point, the source pointer points to a two byte
57 // value that actually contains a 4 bits counter, and a
58 // 12 bit offset to point back into the depacked stream.
59 // The counter is in the 4 high order bits.
60 //
61 // Original
62 offset = buf_src[0]; // Read 16 bits non alligned datas...
63 offset|=((unsigned int)(buf_src[1]&0x0F))<<8;
64 offset+=1;
65
66 nb =(buf_src[1]>>4)+3;
67
68 buf_src+=2;
69
70 size-=nb;
71 while (nb)
72 {
73 value=*(buf_dest-offset);
74 *buf_dest=value;
75 buf_dest++;
76 nb--;
77 }
78 }
79 andvalue<<=1;
80 }
81 *(unsigned char*)(0xbfde)=18;
82 }
83 /*
84 WipeScreen wipes the hires screen attractively
85 */
86 void WipeScreen(){
87 unsigned char Row;
88 unsigned int Cell;
89 //unsigned int EvenScreenAddress=0xA001; // start address of hires screen (even rows)
90 //unsigned int OddScreenAddress=0xA029; // start address of hires screen (odd rows)
91 unsigned int StartAddress;
92 unsigned char x;
93 unsigned char z;
94 unsigned char Count;
95 char Color;
96 PauseTime=55000; Pause(); // linger on screen for a while
97 for (Color=7;Color>=1;Color--){ // cycle through colors before blanking
98 for ( x=0; x<2 ; x++ ){
99 Count=0;
100 StartAddress=0xA001;
101 z=198;
102 if (x==1){
103 StartAddress=0xA029;
104 z=199;
105 }
106 //poke(StartAddress,0x0000);
107 PauseTime=1250;Pause();
108 for (Row=x; Row<=z; Row+=2){
109 poke(StartAddress+(Count*80),Color);
110 Count++;
111 }
112 }
113 }
114 }
115 /* paustime */
116 void Pause(){
117 int p;
118 for (p=0; p<PauseTime;p++){};
119 }
120 void main()
121 {
122 CopyFont(); // hires called from CopyFont ASM routine
123 //hires();
124 setflags(0); // No keyclick, no cursor, no nothing
125 message=" HNEFATAFL V0.091 BY NEIL BARNES\n ORIGINAL ARTWORK : DARREN BENNETT\nTHX TO:DBUG,CHEMA,JAMESD,XERON,IBISUM";
126 PrintMessage();
127 //file_unpackc((unsigned char*)0xa000,LabelPicture);
128 file_unpack((unsigned char*)0xa000,LabelPicture);
129 WipeScreen();
130 message=" IN MEMORY OF\n JONATHAN 'TWILIGHTE' BRISTOW\n ORIC LEGEND: 1968-2013";
131 PrintMessage();
132 }
133

  ViewVC Help
Powered by ViewVC 1.1.26