; How to use proportional fonts: leave the font unpacking to another source ; code file, and hopefully reuse it easily in another demo! crawlamigainit move.l #ca_font0,a0 ; default to font 0 jsr fnt_setfont rts crawlamiga tst.w ca_pixleft ; if no new pixel left, beq ca_newchar ; get a new char bsr ca_moveit ; else move bitmap sub.w #1,ca_pixleft ; and now one less pixel rts ca_newchar add.l #1,ca_messptr ; move message pointer move.l ca_messptr,a0 ; get message pointer move.b (a0),d0 ; test current char beq ca_restart ; if 0(NUL), restart cmp.b #32,d0 ; if char<32, skip char... bcs ca_newchar ; ...get new one tst.w ca_setfontflag ; if setting font... bne ca_setfontcheck ; ...use char as font number cmp.b #'~',d0 ; ~# to set font beq ca_setfont and.w #$ff,d0 move.w #24,d1 ; 48 bytes in screen row move.w #4,d2 ; 8 bytes in buffer row move.w #32,d3 ; 32 rows before baseline move.l MemBase,a0 add.l #7560,a0 ; my screen (hidden) move.l #ca_buffer1,a1 ; my buffer add.l #2,a1 jsr fnt_unpakchar move.w d0,ca_pixleft cmp.w #$ffff,d0 beq ca_newchar bsr ca_moveit sub.w #1,ca_pixleft rts ca_restart move.l #ca_message-1,ca_messptr ; pretty obvious bra ca_newchar ca_setfont move.w #1,ca_setfontflag ; set a flag for main routine bra ca_newchar ca_setfontcheck move.w #0,ca_setfontflag ; what font is wanted? cmp.b #'0',d0 bcs ca_newchar sub.b #'0',d0 cmp.b #10,d0 bcc ca_newchar ; if invalid, try next char ; NOTE: if the font number is ; valid but the font does not ; exist, the routine will ; probably crash the computer ; immediately it tries to put ; a character on-screen. If ; it doesn't, it may take 3 ; or four attempts to crash! and.l #$f,d0 lsl.l #2,d0 move.l #ca_fonttable,a0 move.l (a0,d0),a0 jsr fnt_setfont bra ca_newchar ca_moveit jsr WaitForBlit move.l #$7fffffff,bltafwm(a6) move.l #$f9f00000,bltcon0(a6) move.w #0,bltamod(a6) move.w #0,bltdmod(a6) move.l MemBase,a0 add.l #7520,a0 ; was 7522 (before qwik fix) move.l a0,bltapt(a6) sub.l #2,a0 move.l a0,bltdpt(a6) move.w (a0),d0 ; store this word as it move.w #2840,bltsize(a6) ; should not be changed nop ; wait till blitter done that nop ; word (plus safety margin) nop move.w d0,(a0) ; put word back rts ;------ DATA ------ ca_pixleft dc.w 0 ca_messptr dc.l ca_message-1 ca_message incbin "crawlamiga.mess" dc.b 0 even ca_fonttable dc.l ca_font0,ca_font1,ca_font2,ca_font3,ca_font4,ca_font5 ca_font0 incbin "afonts:0001/Palatino-Roman/24" ; a serif font even ca_font1 incbin "mfonts:1002/MNewBerolina/24" ; a script font even ca_font2 incbin "afonts:0034/Revue/24" ; a 'title' font even ca_font3 incbin "afonts:0122/Juniper/24" ; an 'effect' font even ca_font4 incbin "fonts:HsOutline/24" ; for 81st track logo: ; This brilliant font was ; designed by Aardvark, and ; has been approved by ; Powerslave, and is one of ; the most original fonts in ; The 81st Track font 'library' even ca_font5 incbin "mfonts:1028/MGoudyText/24" ; for 'GREETINGS!' even ca_buffer1 dcb.b 352,0 ca_setfontflag dc.w 0