3 # GEOS .cvt header generator...
4 # it's a really quick and dirty hack ... big and ugly...
6 # by Maciej 'YTM/Alliance' Witkowiak
13 #include resource file
17 #test is arguments are really given, if not - set defaults
20 if [ -z "$progtype" ]; then progtype="APPLICATION"; fi
23 if [ -z "$dosname" ]; then dosname="testapp" ; fi
24 if [ -z "$dostype" ]; then dostype="USR" ; fi
27 if [ -z "$year" ]; then year=`date +%y` ; fi
28 if [ -z "$month" ]; then month=`date +%m` ; fi
29 if [ -z "$day" ]; then day=`date +%e` ; fi
30 if [ -z "$hour" ]; then hour=`date +%k` ; fi
31 if [ -z "$minute" ]; then minute=`date +%M` ; fi
34 if [ -z "$screenmode" ]; then screenmode=0 ; fi
37 if [ -z "$class" ]; then class="Programname"; fi
38 if [ -z "$version" ]; then version="V1.0" ; fi
39 if [ -z "$author" ]; then author="cc65"; fi
40 if [ -z "$note" ]; then note="Program compiled with cc65 and GEOSLib."; fi
46 ; Maciej 'YTM/Alliance' Witkowiak
49 ; This is .cvt header for GEOS files, it is recognized by Convert v2.5 for GEOS
50 ; and Star Commander (when copying GEOS files to/from .d64 images)
52 ; currently only SEQUENTIAL structure is supported, no overlays
54 ; THIS IS GENERATED FILE, ANY CHANGES WILL BE LOST!!!
91 echo -e ProgType\\t\\t=\\t$progtype
92 echo -e \\n\\t\\t.byte $dostype '| $80'\\t\\t'; DOS filetype'
93 echo -e \\t\\t.word 0\\t\\t'; T&S, will be fixed by converter'
95 { len=length($0); printf "\t\t.byte %c%s%c\n", 34, substr($0,0,16), 34;
96 if (len<16) { len=15-len; printf "\t\t.byte $a0"
97 while (len>0) { printf ", $a0"; len-=1 } }
100 echo -e \\t\\t.word 0\\t\\t'; header T&S'
101 echo -e \\t\\t.byte SEQUENTIAL
102 echo -e \\t\\t.byte ProgType
103 echo -e \\t\\t.byte $year
104 echo -e \\t\\t.byte $month
105 echo -e \\t\\t.byte $day
106 echo -e \\t\\t.byte $hour
107 echo -e \\t\\t.byte $minute
108 echo -e \\n\\t\\t.word 0
111 .byte "PRG formatted GEOS file V1.0"
113 .res \$c4 ; some bytes are left
115 .byte 3, 21, 63 | \$80 ; icon picture header, 63 bytes follow
117 ;** hey, uberhacker! edit icon here!!! ;-))
118 .byte %11111111, %11111111, %11111111
119 .byte %10000000, %00000000, %00000001
120 .byte %10000000, %00000000, %00000001
121 .byte %10000000, %00000000, %00000001
122 .byte %10000000, %00000000, %00000001
123 .byte %10000000, %00000000, %00000001
124 .byte %10000000, %00000000, %00000001
125 .byte %10000000, %00000000, %00000001
126 .byte %10000000, %00000000, %00000001
127 .byte %10000000, %00000000, %00000001
128 .byte %10000000, %00000000, %00000001
129 .byte %10000000, %00000000, %00000001
130 .byte %10000000, %00000000, %00000001
131 .byte %10000000, %00000000, %00000001
132 .byte %10000000, %00000000, %00000001
133 .byte %10000000, %00000000, %00000001
134 .byte %10000000, %00000000, %00000001
135 .byte %10000000, %00000000, %00000001
136 .byte %10000000, %00000000, %00000001
137 .byte %10000000, %00000000, %00000001
138 .byte %11111111, %11111111, %11111111
142 echo -e \\n\\t\\t.byte $dostype '| $80'\\t\\t';DOS filetype again'
145 .byte ProgType ;again GEOS type
146 .byte SEQUENTIAL ;structure
147 .word \$0400 ;ProgStart
148 .word \$0400-1 ;ProgEnd (needs proper value for DESK_ACC)
149 .word \$0400 ;ProgExec
152 echo -e \\t\\t'; GEOS class (11 chars padded with spaces, terminated with space (12th))'
154 { len=length($0); printf "\t\t.byte %c%s%c\n", 34, substr($0,0,12), 34;
155 if (len<12) { len=11-len; printf "\t\t.byte $20"
156 while (len>0) { printf ", $20"; len-=1 } }
159 echo -e \\t\\t'; version info (4 characters)'
161 echo $version | awk '{ printf " %c%s%c\n", 34, substr($0,1,4), 34}'
162 echo -e \\t\\t.byte 0\\t\\t\\t';string terminator'
163 echo -e \\t\\t.word 0
164 echo -e \\n\\t\\t.byte $screenmode\\t\\t\\t';40/80 columns capability'
165 echo -e \\n\\t\\t'; author, up to 62 characters'
167 { printf "\t\t.byte %c%s%c\n\t\t.byte 0\n\t\t.res (63-%i)\n", 34, substr($0,0,62), 34, length($0)+1; }'
168 echo -e \\n\\t\\t';note (up to 95 chars)'
170 { printf "\t\t.byte %c%s%c\n\t\t.byte 0\n\t\t.res (96-%i)\n", 34, substr($0,0,95), 34, length($0)+1; }'
171 echo -e \\n\\n';end of .cvt header, real code follows'
175 echo "This is GEOSLib .cvt header generator by Maciej Witkowiak"
177 echo " headergen resourcefile.res"
179 echo "Contents of resource file are (case sensitive):"
180 echo "dostype=[PRG,SEQ,USR]"
181 echo "dosname=filename"
182 echo "progtype=[APPLICATION,ASSEMBLY,DESK_ACC,PRINTER,INPUT_DEVICE,AUTO_EXEC,INPUT_128]"
183 echo " currently only APPLICATION is supported"
184 echo "year,month,date,hour,minute=XX - if not given current will be used"
185 echo "screenmode=[0,64,128,192] -"
186 echo " 0 - GEOS128 only 40 columns"
187 echo " 64 - GEOS128 both 40/80 columns"
188 echo " 128 - does not run under GEOS128"
189 echo " 192 - GEOS128 only 80 columns"
190 echo "class=Class - GEOS class name"
191 echo "author=Author - author name"
192 echo "note=Note - note field"
194 echo "If any of those parameters is not given, default will be used"
195 echo "Output should be redirected to a file e.g. cvthead.s"
196 echo "compiled with ca65 and used in linking process as the first object file -"
197 echo "even before crt0.o"