please dont rip this site

SX Video IO

Untested SX code for shifting out one pixel every other cycle from a character data table using the RA port as a 4 bit shift register

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

        mov RowCout, #Rows
        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

        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)
        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.

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.


file: /Techref/scenix/lib/io/dev/video/chgenra-jmn.htm, 3KB, , updated: 2010/2/24 20:18, local time: 2024/6/24 19:02,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> Shift out one pixel every other cycle from a character data table using the RA port as a 4 bit shift register</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!


Welcome to!