Sega Master System / Mark III / Game Gear|
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew
64 colors raster bar routinePosted: Sun Sep 14, 2008 10:24 am
I made a little static raster bar routine, i suppose its not very optimized and actually it miss something but anyway here is it (with a 64 colors raster example, call this in you'r program loop):
; fill the rest with black color
; load first color
; change the first color in the palette
inc hl ; go to the next color value
djnz rasterLoop ; loop over all stored colors
; 64 colors of the raster (you can put any value in it though)
.db $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E, $0F, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2A, $2B, $2C, $2D, $2E, $2F, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3A, $3B, $3C, $3D, $3E, $3F
I have 2 problems actually to complete this routine:
- I got some strange flickers, i think its because i dont care much right now about where is the beam, i use a tiny counter actually but i think its unefficient.
- For the next step i need to setup a 'beginning' position for the raster bar but i don't know how to calculate it, i tried something but the speed is too fast. :/
If anyone can help me out to ameliorate this routine. :)
||Posted: Sun Sep 14, 2008 5:49 pm|
A simple way to check which scanline you are on is to read the V counter at port $7E. For example
; Wait for line 112
in a, ($7E)
jr nz, loop
If you have completed your color update for one scanline, you can read port $7E, then read it again and wait for the value to change from the last read. By the time it does, you will be on the next scanline and can repeat your color changes.
The SMS can trigger interrupts on different scanlines, but if you are just starting it is easier to work with port $7E.
||Posted: Sun Sep 14, 2008 7:16 pm|
Thank, i finished it!
Now ill need to do some optimization and adding animation. :)