Jump to content
  • Advertisement
  • entries
  • comments
  • views

It's Alive!

Sign in to follow this  


I finally got SOMETHING showing up on a TV screen. Granted, it doesn't do much yet, and doesn't look pretty either, but still, it's progress. At this point, I can safely assume that all of my hardware is hooked up correctly and that the layout on the breadboard isn't messing anything up. Time to move into software world.

I started looking at the sample TV driver provided by Parallax. Suffice it to say, NTSC is a pain in the neck to work with. I'll probably use their driver for almost all of my projects, since it is heavily optimized and easily customizable by setting a few parameters. This is very nice, as I was dreading having to look into NTSC timings and other such nonsense.

Here are a few snippets of the TV driver:

field mov x,vinv 'do invisible back porch lines
:black call #hsync 'do hsync
waitvid burst,sync_high2 'do black
jmpret taskret,taskptr 'call task section (z undisturbed)
djnz x,#:black 'another black line?

wrlong visible,par 'set status to visible

mov x,vb 'do visible back porch lines
call #blank_lines

mov screen,_screen 'point to first tile (upper-leftmost)
mov y,_vt 'set vertical tiles
:line mov vx,_vx 'set vertical expand
:vert if_z xor interlace,#1 'interlace skip?
if_z tjz interlace,#:skip

call #hsync 'do hsync

mov vscl,hb 'do visible back porch pixels
xor tile,colortable
waitvid tile,#0

mov x,_ht 'set horizontal tiles
mov vscl,hx 'set horizontal expand

:tile rdword tile,screen 'read tile
or tile,line 'set pointer bits into tile
rol tile,#6 'read tile pixels
rdlong pixels,tile '(2 instructions between reads)
shr tile,#10+6 'set tile colors
movs :color,tile
add screen,#2 'point to next tile
mov tile,phaseflip
:color xor tile,colortable
waitvid tile,pixels 'pass colors and pixels to video
djnz x,#:tile 'another tile?

sub screen,hc2x 'repoint to first tile in same line

mov vscl,hf 'do visible front porch pixels
mov tile,phaseflip
xor tile,colortable
waitvid tile,#0

:skip djnz vx,#:vert 'vertical expand?
ror line,linerot 'set next line
add line,lineadd wc
rol line,linerot
if_nc jmp #:line
add screen,hc2x 'point to first tile in next line
djnz y,#:line 'another tile line?

if_z xor interlace,#1 wz 'get interlace and field1 into z

test _mode,#%0001 wc 'do visible front porch lines
mov x,vf
if_nz_and_c add x,#1
call #blank_lines

if_nz wrlong invisible,par 'unless interlace and field1, set status to invisible

if_z_eq_c call #hsync 'if required, do short line
if_z_eq_c mov vscl,hrest
if_z_eq_c waitvid burst,sync_high2
if_z_eq_c xor phaseflip,phasemask

call #vsync_high 'do high vsync pulses

movs vsync1,#sync_low1 'do low vsync pulses
movs vsync2,#sync_low2
call #vsync_low

call #vsync_high 'do high vsync pulses

if_nz mov vscl,hhalf 'if odd frame, do half line
if_nz waitvid burst,sync_high2

if_z jmp #field 'if interlace and field1, display field2
jmp #superfield 'else, new superfield
' Blank lines
blank_lines call #hsync 'do hsync

xor tile,colortable 'do background
waitvid tile,#0

djnz x,#blank_lines

blank_lines_ret ret


' NTSC/PAL metrics tables
' ntsc pal
' ----------------------------------------------
wtab word lntsc - sntsc, lpal - spal 'hvis
word lntsc / 2 - sntsc, lpal / 2 - spal 'hrest
word lntsc / 2, lpal / 2 'hhalf
word 243, 286 'vvis
word 10, 18 'vinv
word 6, 5 'vrep
word $02_8A, $02_AA 'burst
ltab long fntsc 'fcolor
long fpal
long sntsc >> 4 << 12 + sntsc 'sync_scale1
long spal >> 4 << 12 + spal
long 67 << 12 + lntsc / 2 - sntsc 'sync_scale2
long 79 << 12 + lpal / 2 - spal
long %0101_00000000_01_10101010101010_0101 'sync_normal
long %010101_00000000_01_101010101010_0101

Moving on then, we come down to the first project. I'm thinking of going with Pong. It's a staple, as old as game development itself. It has relatively simple graphics, minimal logic, can be played by two people, and will allow me to test out TV, graphics, and input all at once.

I want to post screenshots once I am done with the game, but I'm not quite sure how to do that. Should I take a picture of it running on a TV? Can the camera handle that, or will it look retarded? It's these issues that make me want to forge ahead with that custom scripting language that will compile to both C# and Spin, as that will allow me to show you guys the demos I come up with and allow you to play them on a PC, while I can take the spin version, load it up on the Prop, and go amaze people.
Sign in to follow this  


Recommended Comments

Guess you didn't see my comment on the article about the input code. Well I'm a hobby roboticist along with programming, and think building a console/computer would be fun. Do you have any cool links to share? I've thought about making a 8x8? LED matrix and having a few atmega8's stringed up, and each output pin is assigned to 1 LED, but I somehow need to figure out how to implement a cartridge. I'm thinking somehow set up the cartridge as an in-circuit programmer somehow. Any ideas or links? Thanks!

Share this comment

Link to comment
I don't really have any experience with that sort of thing. As it stands right, I'm kind of figuring things out as I go.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!