Sx52(48) vga - 64 colors!!!

Since Bean has done such a great job with NTSC and I felt like I should just wait to see what he comes up with the next couple of weeks, I thought I would dig up my old VGA code and get it going.
First thing I have to mention is that my SECOND camera is broke! argh...dang kids keep breaking my cameras.
Anyway, below is the source in ASM that will generate a nice color orange on a VGA monitor.
If anyone needs help wiring a VGA connector let me know and I can explain how I did it. When I get a new camera I am going to take some pictures so please be patient.
Also, when I get that camera I am going to do an official tutorial on my new site (shameless plug ahead) www.codershangout.com
Enjoy!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Coders' Hangout
A place for programmers to hangout!
http://www.codershangout.com
METROID?
Metroid Classic
First thing I have to mention is that my SECOND camera is broke! argh...dang kids keep breaking my cameras.
Anyway, below is the source in ASM that will generate a nice color orange on a VGA monitor.
If anyone needs help wiring a VGA connector let me know and I can explain how I did it. When I get a new camera I am going to take some pictures so please be patient.
Also, when I get that camera I am going to do an official tutorial on my new site (shameless plug ahead) www.codershangout.com
Enjoy!
;======================================================================= ;TITLE: sx52_vga_01 ; ;PURPOSE: SX52 based GPU ; ;AUTHOR: cbmeeks ; ;CONNECTIONS: ; ; TAPE = VSYNC ; hsync = rc.1 ; vsync = rc.0 ; ;DETAILS: ; ; ; 470 ; RB.0---\/\/--| ; 1.5k +------------- RED (0.0 - 0.7V) ; RB.1---\/\/--| ; ; 470 ; RB.2---\/\/--| ; 1.5k +------------- GREEN (0.0 - 0.7V) ; RB.3---\/\/--| ; ; 470 ; RB.4---\/\/--| ; 1.5k +------------- BLUE (0.0 - 0.7V) ; RB.5---\/\/--| ; ; ; ; RC.0------------------------ VSYNC (5v OK) ; RC.1------------------------ HSYNC (5v OK) ; ; ; RB is used for the image signal. ; You have 8 bits to do what you want. ; I recommend using 6 bits so that you get 2 bits ; per color (RGB) giving you 64 colors. ; ; Make sure RB doesn't go over 1 volt! (0.7v is the spec) ; ; ; If you have any questions, please ask! ; ; cbmeeks ; cbmeeks@gmail.com ; http://www.codershangout.com ; ;======================================================================= ;-------------------------- DEVICE DIRECTIVES -------------------------- DEVICE SX52,CARRYX FREQ 80_000_000 DEVICE OSCHS3 ; High-speed external oscillator DEVICE IFBD ; Crystal feedback disabled DEVICE XTLBUFD ; Crystal drive disabled IRC_CAL IRC_SLOW ; Calibrate Internal Crystal to the slowest setting RESET Initialize ;=============================================================================================== ; REGISTERS ;=============================================================================================== ;=============================================================================================== ; VARIABLES ;=============================================================================================== org $10 bank_0 d1 ds 1 ; general counter d2 ds 1 ; general counter d3 ds 1 ; general counter d4 ds 1 ; general counter Pixel ds 1 ; current pixel ScanLine ds 1 ; current scanline PixelCount ds 1 ; number of pixels wide hsync equ rc.1 vsync equ rc.0 WHITE equ %00111111 BLACK equ %00000000 ;------------------------ INITIALIZATION ROUTINE ----------------------- org $02 ;allow 2 for the debugger (PAGE 0) ;=============================================================================================== ; HORIZONTAL SCANLINE 31.77µS ;=============================================================================================== HScanline ;SYNC PULSE 3.77us clrb hsync ;(1) mov w, #$4B mov d1, w hsync_0: decsz d1 jmp hsync_0 ;(300) ;BACK PORCH 1.89us setb hsync ;(1) mov rb, #%00000000 ;(2) mov w, #$25 mov d1, w backporch_0: decsz d1 jmp backporch_0 ;ACTIVE VIDEO 25.17us mov rb, #%00001011 ;(2) ORANGE HERE mov w, #$1F mov d1, w mov w, #$02 mov d2, w active_0: decsz d1 jmp $+2 decsz d2 jmp active_0 nop nop ;FRONT PORCH 0.94us mov rb, #%00000000 ;(2) mov w, #$10 mov d1, w frontporch_0: decsz d1 jmp frontporch_0 jmp $+1 ret BlankLine ;SYNC PULSE 3.77us clrb hsync ;(1) mov w, #$4B mov d1, w bhsync_0: decsz d1 jmp bhsync_0 ;(300) ;BACK PORCH 1.89us setb hsync ;(1) mov rb, #%00000000 ;(2) mov w, #$25 mov d1, w bbackporch_0: decsz d1 jmp bbackporch_0 ;ACTIVE VIDEO 25.17us mov rb, #%00000000 ;(2) mov w, #$1F mov d1, w mov w, #$02 mov d2, w bactive_0: decsz d1 jmp $+2 decsz d2 jmp bactive_0 nop nop ;FRONT PORCH 0.94us mov rb, #%00000000 ;(2) mov w, #$10 mov d1, w bfrontporch_0: decsz d1 jmp bfrontporch_0 jmp $+1 ret ;=============================================================================================== ; SETUP ;=============================================================================================== Initialize ;Configure port settings mov rb, #%00000000 ;Port B output zero mov !rb,#%00000000 ;Port B all output mov rc, #%00000000 ;Port C output zero mov !rc,#%00000000 ;Port C all output ;other setup ;=============================================================================================== ; MAIN LOOP ;=============================================================================================== Main ;SYNC LENGTH 0.06ms clrb vsync call BlankLine call BlankLine ;BACK PORCH 1.02ms setb vsync ;(1) call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine ;ACTIVE VIDEO 480 lines (15.25ms) mov ScanLine, #240 LOOP1 call HScanline call HScanline djnz ScanLine, LOOP1 ;FRONT PORCH 0.35ms call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine call BlankLine ;=============================================================================================== ; JUMP BACK TO MAIN - Total lines: ;=============================================================================================== jmp Main ;goto main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Coders' Hangout
A place for programmers to hangout!
http://www.codershangout.com
METROID?
Metroid Classic
Comments
I guess it would help if I had a working camera.
I played with it some more this weekend and got 256x192 resolution but that was pushing it. 160x192 looks pretty good. I hope to get some SRAM working with it soon.
cbmeeks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Coders' Hangout
A place for programmers to hangout!
http://www.codershangout.com
METROID?
Metroid Classic
I hope you have better luck using the SRAM than I'm having...
I used SRAM on my data logger without any problems, but I guess with the video interrupt accessing the RAM at the same time the main code is accessing it is causing me all kinds of problems. I've been working on it for days now...
Right now, it goes goofy for the first 5 seconds then it works fine ??? If I reprogram the SX without turning off the power, it goes goofy again for 5 seconds... ARRRG.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
why are you having the main code and video interrrupt access the SRAM at the same time? Or is that something you are trying to fix. I would try to build the scanline (reading from SRAM) during the HBlank and only allow the main code to access the SRAM during VBlank
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Coders' Hangout
A place for programmers to hangout!
http://www.codershangout.com
METROID?
Metroid Classic
Good news! I just received my brand new $3.99 webcam in the mail yesterday from eBay! hahahaha
So I will be able to take some lo-res videos of my VGA circuit and post them tonight or tomorrow.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Coders' Hangout
A place for programmers to hangout!
http://www.codershangout.com
METROID?
Metroid Classic
So the main code can write to SRAM anytime (much faster).
But I still have the startup problem...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Coders' Hangout
A place for programmers to hangout!
http://www.codershangout.com
METROID?
Metroid Classic
Then let's say I clear the screen to red, there will be less of the black. After about 5 or 6 clears the screen is fine (no black).
I'm beginning to think it's my PCB, I can't think of anything else. Because even if I·only access SRAM duing VBlank, I still get the problem.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
Post Edited (Bean (Hitt Consulting)) : 9/14/2006 2:22:09 PM GMT
I chalked it up to me not clearing the SRAM correctly and it was displaying garbage.
I will see if I can find those pics
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Coders' Hangout
A place for programmers to hangout!
http://www.codershangout.com
METROID?
Metroid Classic