The following is probably the fastest possible text output routine for the CPC in Mode 2, coded by [[Prodatron]] for the [[SymbOS]] [[SymShell]] fullscreen mode including strong optimization ideas by [[MaV]] and one 1NOP tweak by [[BSC]]. It needs between 62 61 and 69 68 microseconds per char, depending on the amount of 0- and repeating-bytes within a char matrix. For average english texts 66 65 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,132 13 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.1) ==
This is the actual version from 20122014. It has a size of about 3,5KB.
<pre>
;@ SymbOS SymShell Command Line Interface @
;@ @
;@ F A S T T E X T O U T P U T (v2.1) @
;@ @
;@ (c)oded 2012 2014 by Prodatron/SymbiosiS and MaV +BSC @
;@ @
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;### 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,IX
mftout xor a
jr mftout2
ld h,mftchrtab/256 ;2
ld c,(hl) ;2
inc hl l ;21
ld h,(hl) ;2
ld l,c ;1
jp (hl) ;1 27 26 + 35-43 -> 6261-69 68 (67 66 average for all 96 chars, 66 65 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 ;