by James Newton
This (TOTALLY UNTESTED OFF THE TOP OF MY HEAD) code uses RA as the (4 bit) shift register so that only 3 IO lines are wasted. RA.0 is the video out pin.It assumes a 7 x (ScanLines / Rows) character size with each character pixel row stored in the lower byte of a 12 bit program memory word and that there are 256 characters (a kind of a waste but that could be fixed).
It assumes that the SX's built in hardware comparitor is being used as a Horizontal Sync detector for an external source of video which is being overlaid with text.
;code for generating a frame of character video using the ;Ubicom (Scenix) SX 18 or 28. See ;http://www.sxlist.com/techref/scenix/contest/video.htm mov RowCout, #Rows :RowLoop mov RowScanLine, #(ScanLines/Rows) ;if you wanted to, you could skip a line of video here (between ;rows) and use the time to load a row of character data from ;external RAM or FRAM ;http://www.sxlist.com/techref/mem/srams.htm :ScanLineLoop jnb HorzSync, $ ;wait for the Horizontal sync. mov ColCount, #Cols mov w, ScanLine ;high pointer into the character generator table mov m, w ;(which character pixel row) mov w, ind ;low pointer into the table (which character) iread :CharScanLoop mov ra, w mov DataHi, W rr ra inc fsr rr ra setb fsr.4 rr ra mov w, <>DataHi mov ra, w mov w, ind rr ra iread ;Sadly, this takes 4 cycles, not 1 in turbo rr ra dec ColCount rr ra jnz :CharScanLoop ;And extra cycle or 2 here just spaces the characters a bit more. djnz RowScanLine, :ScanLineLoop djnz RowCount, :RowLoop ;each entry in the character generator table needs to have bits 8..11 (the ;top 4 bits of the 12 bit word) set to the top 4 bits of the address of ;that word so that when M is loaded by the IREAD, its value is retained. ;http://www.sxlist.com/techref/datafile/charsets.htm
I reciently found out that IREAD takes 4 cycles in turbo mode so this code would result in some gaps before the last two pixels of each character. So the IREAD has to be moved out of the loop and some other arrangement of the code in between the port updates will need to be found.
Comments: