" > TextToCmd 1.01 01-Nov-2010 8 Build a *runnable command to display embedded text  v1.01 Some more debugging (: 2E ctrl% 31,name% 31 : Control block for OSFILE call <>X%=ctrl%:Y%=X%256 : Point to control block F: "File to display: "file$ : Ask for file to load P9 "*command to save: "save$ : Filename to save as Z7 "Load address (RETURN for top of memory): &"load$ d: nFA%=file(file$,5) : Read file info to block at X% x; A%=0: "File '"file$"' not found": : No file found Dmax%=X%!10 : Get file length from X%!10 8 load$<>"":load%=("&"+load$) load%=&8000-max%-42 @load%=load%&FFFF0000 : Ensure in I/O processor : NB: This assumes you will be in a shadow screen mode F *** Change &8000 to a relevant HIMEM value for non-shadow screen 5 *** Or specify an address when prompted earlier : Now build the machine code E mcode% max%+42 : DIM a block for code and data Kaddr=&A8:end=&AA:OSWRCH=&FFEE : Workspace locations for *commands P=0 1:P%=load%:O%=mcode% [OPT P*2+4 .display %LDA #data_start% 255:STA addr+0 GLDA #data_start% 256:STA addr+1 :\ addr=>start of stored data "LDA #data_end% 255:STA end+0 "DLDA #data_end% 256:STA end+1 :\ end=>end of stored data , LDY #0 6 .loop @JLDA (addr),Y:JSR OSWRCH :\ Fetch a byte and send it to J>INC addr+0:BNE P%+4:INC addr+1 :\ Increment address T!LDA addr+0:CMP end+0:BNE loop ^@LDA addr+1:CMP end+1:BNE loop :\ Loop until addr=end hRTS r:.data_start% :\ Start of data |=]P%=P%+max%:O%=O%+max%:[OPT P*2+4 :\ Space for data 8.data_end% :\ End of data ] C "Load "+file$+" "+~(mcode%+data_start%-display) : Load file BA$="SAVE "+save$+" "+~mcode%+" "+~O%+" "+~load%+" "+~load%  "Saving ";save$;: A$:  Bݤfile(A$,A%):$name%=A$:?X%=name%:X%?1=name%256:=(&FFDD)&FF