The following is probably the fastest possible text output routine for the CPC in Mode 2, coded by [[Prodatron]] for the [[SymbOS]] [[SymShell]] fullscreen modeincluding strong optimization ideas by [[MaV]]. It needs between 84 62 and 92 69 microseconds per char, depending on the amount of 0- and repeating-bytes within a char matrix contains. For average english texts 66 microseconds (a little bit more than 1 raster line) per char is needed. That means that a complete 2000char screen with mixed text is filled in 0,176 132 seconds.You can still accelerate it by simplifying the font to increase the amount of repeating-bytes within a char matrix. Another possibility is to move the whole main loop to each single char routine. That would only save one microsecond but blow up the whole code by about 2KB. == Actual version (v2) == This is the actual version from 2012. It has a size of about 3,5KB.
You may even optimize it more by placing "mftchrtab" at a 512byte border (ds -$ mod 512) and replace
<pre>
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@;@ @;@ SymbOS SymShell Command Line Interface @;@ @;@ F A S T T E X T O U T P U T (v2) @;@ @;@ (c)oded 2012 by Prodatron/SymbiosiS and MaV @;@ @;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ds -$ mod 256mftchrtabdw mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032dw mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032dw mftchr032,mftchr033,mftchr034,mftchr035,mftchr036,mftchr037,mftchr038,mftchr039dw mftchr040,mftchr041,mftchr042,mftchr043,mftchr044,mftchr045,mftchr046,mftchr047dw mftchr048,mftchr049,mftchr050,mftchr051,mftchr052,mftchr053,mftchr054,mftchr055dw mftchr056,mftchr057,mftchr058,mftchr059,mftchr060,mftchr061,mftchr062,mftchr063dw mftchr064,mftchr065,mftchr066,mftchr067,mftchr068,mftchr069,mftchr070,mftchr071dw mftchr072,mftchr073,mftchr074,mftchr075,mftchr076,mftchr077,mftchr078,mftchr079dw mftchr080,mftchr081,mftchr082,mftchr083,mftchr084,mftchr085,mftchr086,mftchr087dw mftchr088,mftchr089,mftchr090,mftchr091,mftchr092,mftchr093,mftchr094,mftchr095dw mftchr096,mftchr097,mftchr098,mftchr099,mftchr100,mftchr101,mftchr102,mftchr103dw mftchr104,mftchr105,mftchr106,mftchr107,mftchr108,mftchr109,mftchr110,mftchr111dw mftchr112,mftchr113,mftchr114,mftchr115,mftchr116,mftchr117,mftchr118,mftchr119dw mftchr120,mftchr121,mftchr122,mftchr123,mftchr124,mftchr125,mftchr126,mftchr127 ;### MFTOUT -> Plots up to 256 chars in Mode2 starting from a specified screen address;### Chars 0-31 won't be plotted, but you can add the single char-routines by yourself;### Chars 128-255 will be plotted as chars 0-127;### Input IX=text, B=number of chars, DE=screen address;### Output HL=next screen address + #1000 - 1, IX=next char;### Destroyed AF,BC,DE,HL,IXmftout xor a jr mftout2mftout1 res 4,h ;2 inc hl ;2 res 3,h ;2 ex de,hl ;1mftout2 ld l,(ix+0) ;5 inc ix ;3 sla l ;2 ld h,a mftchrtab/256 ;2 ld c,(hl) ;2 inc hl ;2 ld h,(hl) ;2 ld l,c ;1 add jp (hl) ;1 27 + 35-43 -> 62-69 (67 average for all 96 chars, 66 for random text) mftchr032 ex de,hl : ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),a :set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),a :dec b:jp nz,mftout1:ret ;mftchr033 ex de,hl:ld c,#18:ld (hl),c :set 3,h:ld (hl),#3C:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),#3C:dec b:jp nz,mftout1:ret ;!mftchr034 ex de,hl: ld bc(hl),mftchrtab #6C:set 3,h:ld (hl),#6C:set 4,h:ld (hl),a :set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),#28:dec b:jp nz,mftout1:ret ;"mftchr035 ex de,hl:ld c,#6c:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),#FE:set 4,h:ld (hl),c :res 5,h:ld (hl),#FE:dec b:jp nz,mftout1:ret ;#mftchr036 ex de,hl: add ld (hl),bc #18:set 3,h:ld (hl),#3E:set 4,h:ld (hl),#3C:set 5,h:ld (hl),a :res 4,h:ld (hl),#7C:res 3,h:ld (hl),#06:set 4,h:ld (hl),#18:res 5,h:ld (hl),#60:dec b:jp nz,mftout1:ret ;$mftchr037 ex de,hl: ld (hl),a :set 3,h:ld (hl),#C6:set 4,h:ld (hl),#18:set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#30:set 4,h:ld (hl),#C6:res 5,h:ld (hl),#CC:dec b:jp nz,mftout1:ret ;%<mftchr038 ex de,hl: ld (hl),#38:set 3,h:ld (hl),#6C:set 4,h:ld (hl),#76:set 5,h:ld (hl),a :res 4,h:ld (hl),#CC:res 3,h:ld (hl),#DC:set 4,h:ld (hl),#76:res 5,h:ld (hl),#38:dec b:jp nz,mftout1:ret ;&mftchr039 ex de,hl: ld (hl),#18:set 3,h:ld (hl),#18:set 4,h:ld (hl),a :set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),#30:dec b:jp nz,mftout1:ret ;'mftchr040 ex de,hl:ld c,#30:ld (hl),#0C:set 3,h:ld (hl),#18:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#18:res 3,h:ld (hl),c :set 4,h:ld (hl),#0C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;(mftchr041 ex de,hl:ld c,#0c:ld (hl),#30:set 3,h:ld (hl),#18:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#18:res 3,h:ld (hl),c :set 4,h:ld (hl),#30:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;)mftchr042 ex de,hl: ld (hl),a :set 3,h:ld (hl),#66:set 4,h:ld (hl),#FF:set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#3C:set 4,h:ld (hl),a :res 5,h:ld (hl),#3C:dec b:jp nz,mftout1:ret ;*mftchr043 ex de,hl:ld c,#18:ld (hl),a :set 3,h:ld (hl),c :set 4,h:ld (hl),#7E:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),a :res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;+mftchr044 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),a :set 5,h:ld (hl),#30:res 4,h:ld (hl),#18:res 3,h:ld (hl),a :set 4,h:ld (hl),#18:res 5,h:ld (hl),a :dec b:jp nz,mftout1:ret ;,mftchr045 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#7E:set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),a :dec b:jp nz,mftout1:ret ;-mftchr046 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),a :set 5,h:ld (hl),a :res 4,h:ld (hl),#18:res 3,h:ld (hl),a :set 4,h:ld (hl),#18:res 5,h:ld (hl),a :dec b:jp nz,mftout1:ret ;.mftchr047 ex de,hl: ld (hl),#06:set 3,h:ld (hl),#0C:set 4,h:ld (hl),#30:set 5,h:ld (hl),a :res 4,h:ld (hl),#C0:res 3,h:ld (hl),#60:set 4,h:ld (hl),#80:res 5,h:ld (hl),#18:dec b:jp nz,mftout1:ret ;/pre>withmftchr048 ex de,hl: ld (hl),#38:set 3,h:ld (hl),#6C:set 4,h:ld (hl),#D6:set 5,h:ld (hl),a :res 4,h:ld (hl),#6C:res 3,h:ld (hl),#C6:set 4,h:ld (hl),#38:res 5,h:ld (hl),#C6:dec b:jp nz,mftout1:ret ;0mftchr049 ex de,hl:ld c,#18:ld (hl),c :set 3,h:ld (hl),#38:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#7E:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;1mftchr050 ex de,hl: ld (hl),#7C:set 3,h:ld (hl),#C6:set 4,h:ld (hl),#1C:set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#30:set 4,h:ld (hl),#FE:res 5,h:ld (hl),#06:dec b:jp nz,mftout1:ret ;2mftchr051 ex de,hl: ld (hl),#7C:set 3,h:ld (hl),#C6:set 4,h:ld (hl),#3C:set 5,h:ld (hl),a :res 4,h:ld (hl),#C6:res 3,h:ld (hl),#06:set 4,h:ld (hl),#7C:res 5,h:ld (hl),#06:dec b:jp nz,mftout1:ret ;3mftchr052 ex de,hl: ld (hl),#1C:set 3,h:ld (hl),#3C:set 4,h:ld (hl),#CC:set 5,h:ld (hl),a :res 4,h:ld (hl),#0C:res 3,h:ld (hl),#FE:set 4,h:ld (hl),#1E:res 5,h:ld (hl),#6C:dec b:jp nz,mftout1:ret ;4mftchr053 ex de,hl: ld (hl),#FE:set 3,h:ld (hl),#C0:set 4,h:ld (hl),#FC:set 5,h:ld (hl),a :res 4,h:ld (hl),#C6:res 3,h:ld (hl),#06:set 4,h:ld (hl),#7C:res 5,h:ld (hl),#C0:dec b:jp nz,mftout1:ret ;5mftchr054 ex de,hl: ld (hl),#38:set 3,h:ld (hl),#60:set 4,h:ld (hl),#FC:set 5,h:ld (hl),a :res 4,h:ld (hl),#C6:res 3,h:ld (hl),#C6:set 4,h:ld (hl),#7C:res 5,h:ld (hl),#C0:dec b:jp nz,mftout1:ret ;6mftchr055 ex de,hl:ld c,#30:ld (hl),#FE:set 3,h:ld (hl),#C6:set 4,h:ld (hl),#18:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),#0C:dec b:jp nz,mftout1:ret ;7mftchr056 ex de,hl:ld c,#c6:ld (hl),#7C:set 3,h:ld (hl),c :set 4,h:ld (hl),#7C:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#7C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;8mftchr057 ex de,hl: ld (hl),#7C:set 3,h:ld (hl),#C6:set 4,h:ld (hl),#7E:set 5,h:ld (hl),a :res 4,h:ld (hl),#C6:res 3,h:ld (hl),#06:set 4,h:ld (hl),#7C:res 5,h:ld (hl),#C6:dec b:jp nz,mftout1:ret ;9mftchr058 ex de,hl:ld c,#18:ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),a :set 4,h:ld (hl),c :res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;:mftchr059 ex de,hl:ld c,#18:ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),c :set 5,h:ld (hl),#30:res 4,h:ld (hl),c :res 3,h:ld (hl),a :set 4,h:ld (hl),c :res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;;mftchr060 ex de,hl: ld (hl),#0C:set 3,h:ld (hl),#18:set 4,h:ld (hl),#60:set 5,h:ld (hl),a :res 4,h:ld (hl),#18:res 3,h:ld (hl),#30:set 4,h:ld (hl),#0C:res 5,h:ld (hl),#30:dec b:jp nz,mftout1:ret ;<premftchr061 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),a :set 5,h:ld (hl),a :res 4,h:ld (hl),#7E:res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),#7E:dec b:jp nz,mftout1:ret ;=mftchr062 ex de,hl: ld (hl),#60:set 3,h:ld (hl),#30:set 4,h:ld (hl),#0C:set 5,h:ld (hl),a :res 4,h:ld (hl),#30:res 3,h:ld (hl),#18:set 4,h:ld (hl),#60:res 5,h:ld (hl),#18:dec b:jp nz,mftout1:ret ;>mftchr063 ex de,hl:ld c,#18:ld (hl),#7C:set 3,h:ld (hl),#C6:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),#0C:dec b:jp nz,mftout1:ret ;?mftchr064 ex de,hl: ld (hl),#7C:set 3,h:ld (hl),mftchrtab/512 #C6:set 4,h:ld (hl),#DE:set 5,h:ld (hl),a :res 4,h:ld (hl),#C0:res 3,h:ld (hl),#DE:set 4,h:ld (hl),#78:res 5,h:ld (hl),#DE:dec b:jp nz,mftout1:ret ;2@mftchr065 ex de,hl:ld c,#c6:ld (hl),#38:set 3,h:ld (hl),#6C:set 4,h:ld (hl),#FE:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Amftchr066 ex de,hl:ld c,#66:ld (hl),#FC:set 3,h:ld (hl),c :set 4,h:ld (hl),#7C:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#FC:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Bmftchr067 ex de,hl:ld c,#c0:ld (hl),#3C:set 3,h:ld (hl),#66:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),c :set 4,h:ld (hl),#3C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Cmftchr068 ex de,hl:ld c,#66:ld (hl),#F8:set 3,h:ld (hl),#6C:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#6C:res 3,h:ld (hl),c :set 4,h:ld (hl),#F8:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Dmftchr069 ex de,hl: add ld (hl),#FE:set 3,h:ld (hl ),#62:set 4,h:ld (hl),#78:set 5,h:ld (hl),a :res 4,h:ld (hl),#62:res 3,h:ld (hl),#68:set 4,h:ld (hl),#FE:res 5,h:ld (hl),#68:dec b:jp nz,mftout1:ret ;Emftchr070 ex de,hl: ld (hl),#FE:set 3,h:ld (hl),#62:set 4,h:ld (hl),#78:set 5,h:ld (hl),a :res 4,h:ld (hl),#60:res 3,h:ld (hl),#68:set 4,h:ld (hl),#F0:res 5,h:ld (hl),#68:dec b:jp nz,mftout1:ret ;Fmftchr071 ex de,hl: ld (hl),#3C:set 3,h:ld (hl),#66:set 4,h:ld (hl),#C0:set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#CE:set 4,h:ld (hl),#3A:res 5,h:ld (hl),#C0:dec b:jp nz,mftout1:ret ;Gmftchr072 ex de,hl:ld c,#c6:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),#FE:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Hmftchr073 ex de,hl:ld c,#18:ld (hl),#3C:set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#3C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Imftchr074 ex de,hl:ld c,#0c:ld (hl),#1E:set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#CC:res 3,h:ld (hl),#CC:set 4,h:ld (hl),#78:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Jmftchr075 ex de,hl: ld (hl),#E6:set 3,h:ld (hl),#66:set 4,h:ld (hl),#78:set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#6C:set 4,h:ld (hl),#E6:res 5,h:ld (hl),#6C:dec b:jp nz,mftout1:ret ;Kmftchr076 ex de,hl:ld c,#60:ld (hl),#F0:set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#62:set 4,h:ld (hl),#FE:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Lmftchr077 ex de,hl:ld c,#c6:ld (hl),c :set 3,h:ld (hl),#EE:set 4,h:ld (hl),#FE:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),#D6:set 4,h:ld (hl),c :res 5,h:ld (hl),#FE:dec b:jp nz,mftout1:ret ;Mmftchr078 ex de,hl:ld c,#c6:ld (hl),c :set 3,h:ld (hl),#E6:set 4,h:ld (hl),#DE:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),#CE:set 4,h:ld (hl),c :res 5,h:ld (hl),#F6:dec b:jp nz,mftout1:ret ;Nmftchr079 ex de,hl:ld c,#c6:ld (hl),#7C:set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#7C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Omftchr080 ex de,hl: ld (hl),#FC:set 3,h:ld (hl),#66:set 4,h:ld (hl),#7C:set 5,h:ld (hl),a :res 4,h:ld (hl),#60:res 3,h:ld (hl),#60:set 4,h:ld (hl),#F0:res 5,h:ld (hl),#66:dec b:jp nz,mftout1:ret ;Pmftchr081 ex de,hl:ld c,#c6:ld (hl),#7C:set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),#0E:res 4,h:ld (hl),#CE:res 3,h:ld (hl),c :set 4,h:ld (hl),#7C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Qmftchr082 ex de,hl:ld c,#66:ld (hl),#FC:set 3,h:ld (hl),c :set 4,h:ld (hl),#7C:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),#6C:set 4,h:ld (hl),#E6:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Rmftchr083 ex de,hl: ld (hl),#3C:set 3,h:ld (hl),#66:set 4,h:ld (hl),#18:set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#0C:set 4,h:ld (hl),#3C:res 5,h:ld (hl),#30:dec b:jp nz,mftout1:ret ;Smftchr084 ex de,hl:ld c,#18:ld (hl),#7E:set 3,h:ld (hl),#7E:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#3C:res 5,h:ld (hl),#5A:dec b:jp nz,mftout1:ret ;Tmftchr085 ex de,hl:ld c,#66:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#3C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Umftchr086 ex de,hl:ld c,#c6:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#6C:res 3,h:ld (hl),c :set 4,h:ld (hl),#38:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Vmftchr087 ex de,hl:ld c,#c6:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),#D6:set 5,h:ld (hl),a :res 4,h:ld (hl),#FE:res 3,h:ld (hl),#D6:set 4,h:ld (hl),#6C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Wmftchr088 ex de,hl:ld c,#c6:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),#38:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),#6C:set 4,h:ld (hl),c :res 5,h:ld (hl),#6C:dec b:jp nz,mftout1:ret ;Xmftchr089 ex de,hl:ld c,#66:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),#3C:set 5,h:ld (hl),a :res 4,h:ld (hl),#18:res 3,h:ld (hl),#18:set 4,h:ld (hl),#3C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;Ymftchr090 ex de,hl: ld (hl),#FE:set 3,h:ld (hl),#C6:set 4,h:ld (hl),#18:set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#32:set 4,h:ld (hl),#FE:res 5,h:ld (hl),#8C:dec b:jp nz,mftout1:ret ;Zmftchr091 ex de,hl:ld c,#30:ld (hl),#3C:set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#3C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;[mftchr092 ex de,hl: ld (hl),#C0:set 3,h:ld (hl),#60:set 4,h:ld (hl),#18:set 5,h:ld (hl),a :res 4,h:ld (hl),#06:res 3,h:ld (hl),#0C:set 4,h:ld (hl),#02:res 5,h:ld (hl),#30:dec b:jp nz,mftout1:ret ;\mftchr093 ex de,hl:ld c,#0c:ld (hl),#3C:set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#3C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;]mftchr094 ex de,hl: ld (hl),#10:set 3,h:ld (hl),#38:set 4,h:ld (hl),#C6:set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),#6C:dec b:jp nz,mftout1:ret ;^mftchr095 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),a :set 5,h:ld (hl),#FF:res 4,h:ld (hl),a :res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),a :dec b:jp nz,mftout1:ret ;_mftchr096 ex de,hl: ld (hl),#30:set 3,h:ld (hl),#18:set 4,h:ld (hl),a :set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),#0C:dec b:jp nz,mftout1:ret ;`mftchr097 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#0C:set 5,h:ld (hl),a :res 4,h:ld (hl),#CC:res 3,h:ld (hl),#7C:set 4,h:ld (hl),#76:res 5,h:ld (hl),#78:dec b:jp nz,mftout1:ret ;amftchr098 ex de,hl:ld c,#66:ld (hl),#E0:set 3,h:ld (hl),#60:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#DC:res 5,h:ld (hl),#7C:dec b:jp nz,mftout1:ret ;bmftchr099 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#C6:set 5,h:ld (hl),a :res 4,h:ld (hl),#C6:res 3,h:ld (hl),#C0:set 4,h:ld (hl),#7C:res 5,h:ld (hl),#7C:dec b:jp nz,mftout1:ret ;cmftchr100 ex de,hl:ld c,#cc:ld (hl),#1C:set 3,h:ld (hl),#0C:set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#76:res 5,h:ld (hl),#7C:dec b:jp nz,mftout1:ret ;dmftchr101 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#C6:set 5,h:ld (hl),a :res 4,h:ld (hl),#C0:res 3,h:ld (hl),#FE:set 4,h:ld (hl),#7C:res 5,h:ld (hl),#7C:dec b:jp nz,mftout1:ret ;emftchr102 ex de,hl:ld c,#60:ld (hl),#3C:set 3,h:ld (hl),#66:set 4,h:ld (hl),#F8:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#F8:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;fmftchr103 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#CC:set 5,h:ld (hl),#F8:res 4,h:ld (hl),#7C:res 3,h:ld (hl),#CC:set 4,h:ld (hl),#0C:res 5,h:ld (hl),#76:dec b:jp nz,mftout1:ret ;gmftchr104 ex de,hl: ld (hl),#E0:set 3,h:ld (hl),#60:set 4,h:ld (hl),#76:set 5,h:ld (hl),a :res 4,h:ld (hl),#66:res 3,h:ld (hl),#66:set 4,h:ld (hl),#E6:res 5,h:ld (hl),#6C:dec b:jp nz,mftout1:ret ;hmftchr105 ex de,hl:ld c,#18:ld (hl),c :set 3,h:ld (hl),a :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#3C:res 5,h:ld (hl),#38:dec b:jp nz,mftout1:ret ;imftchr106 ex de,hl:ld c,#06:ld (hl),c :set 3,h:ld (hl),a :set 4,h:ld (hl),c :set 5,h:ld (hl),#3C:res 4,h:ld (hl),#66:res 3,h:ld (hl),c :set 4,h:ld (hl),#66:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;jmftchr107 ex de,hl: ld (hl),#E0:set 3,h:ld (hl),#60:set 4,h:ld (hl),#6C:set 5,h:ld (hl),a :res 4,h:ld (hl),#6C:res 3,h:ld (hl),#78:set 4,h:ld (hl),#E6:res 5,h:ld (hl),#66:dec b:jp nz,mftout1:ret ;kmftchr108 ex de,hl:ld c,#18:ld (hl),#38:set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#3C:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;lmftchr109 ex de,hl:ld c,#d6:ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#FE:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),#EC:dec b:jp nz,mftout1:ret ;mmftchr110 ex de,hl:ld c,#66:ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),#DC:dec b:jp nz,mftout1:ret ;nmftchr111 ex de,hl:ld c,#c6:ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#7C:res 5,h:ld (hl),#7C:dec b:jp nz,mftout1:ret ;omftchr112 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#66:set 5,h:ld (hl),#F0:res 4,h:ld (hl),#7C:res 3,h:ld (hl),#66:set 4,h:ld (hl),#60:res 5,h:ld (hl),#DC:dec b:jp nz,mftout1:ret ;pmftchr113 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#CC:set 5,h:ld (hl),#1E:res 4,h:ld (hl),#7C:res 3,h:ld (hl),#CC:set 4,h:ld (hl),#0C:res 5,h:ld (hl),#76:dec b:jp nz,mftout1:ret ;qmftchr114 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#76:set 5,h:ld (hl),a :res 4,h:ld (hl),#60:res 3,h:ld (hl),#60:set 4,h:ld (hl),#F0:res 5,h:ld (hl),#DC:dec b:jp nz,mftout1:ret ;rmftchr115 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#C0:set 5,h:ld (hl),a :res 4,h:ld (hl),#06:res 3,h:ld (hl),#7C:set 4,h:ld (hl),#FC:res 5,h:ld (hl),#7E:dec b:jp nz,mftout1:ret ;smftchr116 ex de,hl:ld c,#30:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#36:res 3,h:ld (hl),c :set 4,h:ld (hl),#1C:res 5,h:ld (hl),#FC:dec b:jp nz,mftout1:ret ;tmftchr117 ex de,hl:ld c,#cc:ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#76:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;umftchr118 ex de,hl:ld c,#c6:ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),#6C:res 3,h:ld (hl),c :set 4,h:ld (hl),#38:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;vmftchr119 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#D6:set 5,h:ld (hl),a :res 4,h:ld (hl),#FE:res 3,h:ld (hl),#D6:set 4,h:ld (hl),#6C:res 5,h:ld (hl),#C6:dec b:jp nz,mftout1:ret ;wmftchr120 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#6C:set 5,h:ld (hl),a :res 4,h:ld (hl),#6C:res 3,h:ld (hl),#38:set 4,h:ld (hl),#C6:res 5,h:ld (hl),#C6:dec b:jp nz,mftout1:ret ;xmftchr121 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#C6:set 5,h:ld (hl),#FC:res 4,h:ld (hl),#7E:res 3,h:ld (hl),#C6:set 4,h:ld (hl),#06:res 5,h:ld (hl),#C6:dec b:jp nz,mftout1:ret ;ymftchr122 ex de,hl: ld (hl),a :set 3,h:ld (hl),a :set 4,h:ld (hl),#4C:set 5,h:ld (hl),a :res 4,h:ld (hl),#32:res 3,h:ld (hl),#18:set 4,h:ld (hl),#7E:res 5,h:ld (hl),#7E:dec b:jp nz,mftout1:ret ;zmftchr123 ex de,hl:ld c,#18:ld (hl),#0E:set 3,h:ld (hl),c :set 4,h:ld (hl),#70:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#0E:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;{mftchr124 ex de,hl:ld c,#18:ld (hl),c :set 3,h:ld (hl),c :set 4,h:ld (hl),c :set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;|mftchr125 ex de,hl:ld c,#18:ld (hl),#70:set 3,h:ld (hl),c :set 4,h:ld (hl),#0E:set 5,h:ld (hl),a :res 4,h:ld (hl),c :res 3,h:ld (hl),c :set 4,h:ld (hl),#70:res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;}mftchr126 ex de,hl: ld (hl),#76:set 3,h:ld (hl),#DC:set 4,h:ld (hl),a :set 5,h:ld (hl),a :res 4,h:ld (hl),a :res 3,h:ld (hl),a :set 4,h:ld (hl),a :res 5,h:ld (hl),a :dec b:jp nz,mftout1:ret ;~mftchr127 ex de,hl:ld c,#cc:ld (hl),c :set 3,h:ld (hl),#33:set 4,h:ld (hl),#33:set 5,h:ld (hl),#33:res 4,h:ld (hl),#33:res 3,h:ld (hl),c :set 4,h:ld (hl),c :res 5,h:ld (hl),c :dec b:jp nz,mftout1:ret ;
</pre>
In this case you would save additional 5 microseconds (short == Original version == This is the old version from 2005. It has a size of 6%)about 3KB. The routine actual version is OS510 bytes larger but has several improvements:* optimized inchar-friendlyscreen-line-jump by using SET x, as it H/RES x,H instead of ADD HL,x (idea by [[MaV]])* this let BC free, which now doesn't touch need to be defined for every char and is used for the char counter and repeating bytes inside a char matrix* 256byte aligned jump table, limited to 128 chars to speed up jump table access* loop-handling moved from main loop to each single char routine to save one JP instructionThat all together makes the actual version more then 30% faster compared to the 2nd register setfollowing version.
<pre>
dw mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032
dw mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032,mftchr032
mftchr032 ex de,hl:ld (hl),a :add hl,bc:ld (hl),a :add hl,bc:ld (hl),a :add hl,bc:ld (hl),a :add hl,bc:ld (hl),a :add hl,bc:ld (hl),a :add hl,bc:ld (hl),a :add hl,bc:ld (hl),a :jp mftout2 ;