10
20
30 OSWRCH=&FFEE:OSNEWL=&FFE7:OSARGS=&FFDA
40 OSWORD=&FFF1:OSBYTE=&FFF4
50 DIM mcode% &200:load%=&FFFF0900
60 num=&AA:num2=&AB:tmp=&AC
70 FOR P=0 TO 1
80 O%=mcode%:P%=load%
90 [OPT P*3+4
100 .pr_flag:BRK
110 .error
120 BRK:EQUB 220:EQUS "Syntax: banner (-p(c)) <afsp>":BRK
130 :
140 .start%
150 LDA #1:LDX #&A8:LDY #0:JSR OSARGS
160 LDA (&A8),Y:CMP #ASC"-":BNE main_loop
170 INY:LDA (&A8),Y:AND #&DF:CMP #ASC"P":BNE error
180 DEC pr_flag:\ Set printer on
190 INY:LDA (&A8),Y:CMP #ASC"!":BCC printer_on
200 AND #&DF:CMP #ASC"C":BNE error
210 INY:DEC pr_flag:\ Don't turn printer off
220 .printer_on
230 LDA #2:JSR OSWRCH
240 TYA:PHA:LDA #3:LDX #10:JSR OSBYTE
250 PLA:TAY:\ Set output to printer
260 .main_loop
270 LDX #0:STX num
280 .skp_spc
290 LDA (&A8),Y:INY:CMP #ASC" ":BEQ skp_spc:DEY
300 .char1lp
310 LDA (&A8),Y:CMP #13:BEQ end_string
320 STA block,X:INY:TYA:PHA:TXA:PHA
330 CLC:ADC #block AND 255:TAX
340 LDY #block DIV 256:LDA #10:JSR OSWORD:\ read definition
350 PLA:TAX:LDY #8:.move_lp
360 LDA block+1,X:STA block,X
370 INX:DEY:BNE move_lp
380 PLA:TAY:INC num
390 LDA num:CMP #10:BCC char1lp
400 .end_string
410 TYA:PHA
420 :
430 \ Now print out the line
440 :
450 LDX #0
460 .out1lp
470 LDA num:STA num2:BEQ all_finished
480 TXA:PHA
490 .out2lp
500 LDA block,X:STA tmp
510 LDY #8
520 .out3lp
530 LDA #0:ASL tmp:PHP:ROL A:PLP:ROL A
540 ADC #32:JSR OSWRCH
550 DEY:BNE out3lp
560 TXA:CLC:ADC #8:TAX
570 DEC num2:BNE out2lp
580 \ one whole pixel-line done
590 LDA num:CMP #10:BNE no_backspace
600 LDA #8:JSR OSWRCH
610 .no_backspace
620 JSR OSNEWL
630 PLA:TAX:INX:CPX #8:BNE out1lp
640 \ all lines done
650 PLA:TAY:LDA (&A8),Y
660 BIT &FF:BMI escape
670 CMP #13:BEQ all_finished
680 JMP main_loop
690 .escape
700 LDA #124:JSR OSBYTE
710 .all_finished
720 LDA #3:LDX #0:JSR OSBYTE
730 INC pr_flag:BNE no_vdu3
740 LDA #3:JSR OSWRCH
750 .no_vdu3
760 RTS
770 .block
780 EQUS "Version 1.00, (C)1992 J.G.Harston":BRK
790 \ This has to be all in one page
800 ]:IF((P%+80)AND&FF00)<>(P%AND&FF00) PRINT"block overlaps pages"
810 NEXT
820 PRINT"*SAVE banner ";~mcode%;" ";~O%;" ";~start%OR&FFFF0000;" ";~load%