%begin %integer index, i, j %integer %array font(0:4999) %integer %array junk(1:64) %routine read font(%string(255) file); ! Read in (one) font description %integer char,num,i,n,min,max,height,width,maxwidth,minwidth,wide,depth %integerfn reverse(%integer x) %integer n=0,y=16_80000000,c=32 %cycle n = n+y %if x&1#0 x = x>>1; y = y>>1; c = c-1 %repeatuntil c=0 %result=n %end openinput(3,file) height = 0 maxwidth = 0 minwidth = 17 font(i) = 520 %for i=0,1,255; !Default: null character font(i) = 0 %for i=263, 1, 4999 font(260) = 0; font(261) = 0; font(262) = 0; !This is the null character index = 263; !This is where the rest starts read(min); read(max) %for char=min,1,max %cycle readsymbol(num) %until num=':'; !Ignore character name font(char)=index<<1 read(num) read(width) maxwidth = width %if width>maxwidth minwidth = width %if widthheight; !Note highest character index = index+3 %while i<=num %cycle %if wide=0 %start font(index) = junk(i)>>16 index = index+1 %else font(index) = junk(i)>>16 font(index+1) = junk(i)&16_FFFF index = index+2 %finish i = i+1 %repeat %repeat n = font(65)>>1 depth = height-font(n+2)-font(n) font(256) = height font(257) = depth font(258) = maxwidth font(259) = minwidth write(height, 5); write(depth, 5); write(maxwidth, 5); write(minwidth, 5); newline index = index-1 %for char = min, 1, max %cycle num = font(char)>>1 font(num+2) = height-depth-font(num+2)-font(num) %repeat closeinput; selectinput(0) %end %routine pnib(%integer n) n = n&15 %if n>9 %then printsymbol('A'+n-10) %else printsymbol('0'+n) %end %routine pbyte(%integer b) pnib(b>>4) pnib(b) %end %routine pword(%integer w) pbyte(w>>8) pbyte(w) %end %routine pint(%integer i) pword(i>>16) pword(i) %end %string(255) f f = cliparam readfont(f.".fnt") openoutput(1,f.".asm") select output(1) %for i = 0, 1, index//8 %cycle print string(" dc.w $") pword(font(i<<3)) %for j = i<<3+1, 1, i<<3+7 %cycle print string(",$") pword(font(j)) %repeat new line %repeat %end %of %program