Changes

Jump to: navigation, search

Programming:Fast Textoutput

31 bytes added, 20:41, 13 March 2014
INC L instead of INC HL in main loop (thanx to BSC!)
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>
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 ;