asm pixel filler using graphics object problems
IncVoid
Posts: 40
HYDRA not demo board.
playing with the graphics demo stuff stripped down
more like pixel xoring
I've been playing on and off for about 9 hours or so...since 6pm. Finally admitting defeat and asking for help.
padded nops in thinking it was a hub problem, I heard about flag propagation delays on the oled prop, maybe my props just going bad, shorted pins, dirty board, I just dont know. Tried a different 9v wall adapter, same results
Hopefully a keen eye can spot what I'm doing wrong.
my comments try to tell what I want the statements to do, unless I have a big misconception of asm
I've tried going pllx4 still doesn't work,
I am trying to do:
xor graphic longs left to right on screen top to bottom like a type writer would
I know the graphics memory layout is top to bottom then left to right.
as you increment you are going down screen until you pop back up at the top and over a column.
in 4x3 tiles 64x48 pixels video mode stretched out to make nice big blocks I can see the pixels flickering, but only one row, 64x1
I understand my yloop needs to be 16x greater cause there are 16longs per tile, but that is the problem. yloop'ing is when it crashes.
if I set my yloop counter "yl" to more than 1 it crashes on would really love some help if anybody wants to copy/paste this to their hydra or demo board(pin changes?)
playing with the graphics demo stuff stripped down
more like pixel xoring
I've been playing on and off for about 9 hours or so...since 6pm. Finally admitting defeat and asking for help.
padded nops in thinking it was a hub problem, I heard about flag propagation delays on the oled prop, maybe my props just going bad, shorted pins, dirty board, I just dont know. Tried a different 9v wall adapter, same results
Hopefully a keen eye can spot what I'm doing wrong.
my comments try to tell what I want the statements to do, unless I have a big misconception of asm
I've tried going pllx4 still doesn't work,
I am trying to do:
xor graphic longs left to right on screen top to bottom like a type writer would
I know the graphics memory layout is top to bottom then left to right.
as you increment you are going down screen until you pop back up at the top and over a column.
in 4x3 tiles 64x48 pixels video mode stretched out to make nice big blocks I can see the pixels flickering, but only one row, 64x1
I understand my yloop needs to be 16x greater cause there are 16longs per tile, but that is the problem. yloop'ing is when it crashes.
CON _clkmode = xtal1 + pll4x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 10_000_000 _stack = ($3000 + $3000 + $64) >> 2 ' graphics driver and screen constants straight from the book, PARAMCOUNT = 14 OFFSCREEN_BUFFER = $2000 ONSCREEN_BUFFER = $5000 ' size of graphics tile map X_TILES = 4 Y_TILES = 3 SCREEN_WIDTH = X_TILES * 16 SCREEN_HEIGHT = Y_TILES * 16 ' color constant's to make setting colors for parallax graphics setup easier COL_Black = %0000_0010 COL_DarkGrey = %0000_0011 COL_Grey = %0000_0100 COL_LightGrey = %0000_0101 COL_BrightGrey = %0000_0110 COL_White = %0000_0111 'color values COL_PowerBlue = %0000_1_100 COL_Blue = %0001_1_100 COL_SkyBlue = %0010_1_100 COL_AquaMarine = %0011_1_100 COL_LightGreen = %0100_1_100 COL_Green = %0101_1_100 COL_GreenYellow = %0110_1_100 COL_Yellow = %0111_1_100 COL_Gold = %1000_1_110 COL_Orange = %1001_1_100 COL_Red = %1010_1_100 COL_VioletRed = %1011_1_100 COL_Pink = %1100_1_100 COL_Magenta = %1101_1_100 COL_Violet = %1110_1_100 COL_Purple = %1111_1_100 COLOR_0 = (COL_Black << 0) COLOR_1 = (COL_Green << 8 ) COLOR_2 = (COL_SkyBlue << 16 ) COLOR_3 = (COL_Gold << 24 ) VAR long tv_status '0/1/2 = off/visible/invisible long tv_enable '0/? = off/on long tv_pins '%ppmmm= pins long tv_mode '%ccinp = chroma, interlace, ntsc/pal, swap long tv_screen 'pointer to screen (words) long tv_colors 'pointer to colors (longs) long tv_hc 'horizontal cells long tv_vc 'vertical cells long tv_hx 'horizontal cell expansion long tv_vx 'vertical cell expansion long tv_ho 'horizontal offset long tv_vo 'vertical offset long tv_broadcast 'broadcast frequency (Hz) long tv_auralcog 'aural fm cog word screen[X_TILES * Y_TILES] long colors[64] long randomcolor long cogparams[32] OBJ tv : "tv" gr : "graphics" 'ser : "Parallax Serial Terminal" PUB start | i, dx, dy, x, y 'start tv longmove(@tv_status, @tvparams, paramcount) tv_screen := @screen tv_colors := @colors tv.start(@tv_status) randomcolor := 65535 repeat i from 0 to 64 colors[i] := COLOR_3 | COLOR_2 | COLOR_1 | COLOR_0 'init tile screen repeat dx from 0 to 31 cogparams[dx] := 0 repeat dx from 0 to tv_hc -1 repeat dy from 0 to tv_vc -1 screen[dy * tv_hc + dx] := onscreen_buffer >> 6 + dy+dx*tv_vc+((dy&$3f) <<10 ) gr.start gr.setup(X_TILES,Y_TILES,0,0, onscreen_buffer) cogparams[0] := @cogparams cogparams[1] := 2 'x cogparams[2] := 2 'y cogparams[3] := Y_TILES * 16 * 4 'number of longs cognew(@cog,@cogparams) cognew(@cog,@cogparams) repeat while true gr.clear repeat dx from 0 to SCREEN_WIDTH - 1 repeat dy from 0 to SCREEN_HEIGHT - 1 i := (?randomcolor) & $0000_0003 gr.colorwidth(i,0) gr.plot(dx,dy) PRI private_method_name DAT tvparams long 0 'status long 1 'enable long %011_0000 'pins long %0000 'mode long 0 'screen long 0 'colors long x_tiles 'hc long y_tiles 'vc long 40 'hx timing stretch long 4 'vx long 0 'ho long 0 'vo long 0 'broadcast on channel 2 vhf long 0 'auralcog long 0 long 0 dat org 0 cog mov t1, par mov t3,#4 '4 pars get_pars rdlong log, t1 add get_pars,d0 'inc source add t1,#4 'inc dest djnz t3,#get_pars 'get next par mov log,par init_loop mov yp,base_ptr 'reset yp to top of video memory mov xl,#3 'reset xloop counter mov yl,#1 'reset yloop counter yloop mov xp,yp 'reset xpointer to current ypointer xloop rdlong t2,xp 't2 is data, xl is xloop counter xor t2,allset 'xor it wrlong t2,xp 'store it add xp,col_add 'go over a column djnz xl,#xloop 'do it again 'yloop post add yp,#4 'go down a row djnz yl,#yloop 'do it again jmp #init_loop 'djnz timeout,#init_loop cogid cid cogstop cid d0 long $200 highword long $FFFF_0000 lowword long $0000_FFFF allset long $FFFF_FFFF zero long $0000_0000 base_ptr long onscreen_buffer timeout long 5_000_000 t1 res 1 ' t2 res 1 ' t3 res 1 ' xp res 1 'xpointer yp res 1 'ypointer xl res 1 'xloop counter yl res 1 'yloop counter 'PARS log res 1 'feedback/command xcount res 1 'xloops ycount res 1 'yloops col_add res 1 'Y_TILES*16*4, number of longs in a vertical column on screen cid res 1 'cogid
if I set my yloop counter "yl" to more than 1 it crashes on would really love some help if anybody wants to copy/paste this to their hydra or demo board(pin changes?)
Comments
Great reply! You let me know exactly what I was doing, not what I thought I was doing. Let me figure out how to change what it does, to what I want it to do!
I was doing 64k-1 horizontal pixels the next yloop!
the whole night I was sitting there thinking, "The top of every loop must initialize the next inner loop" but missed that.
but I wasn't fixing the inner inner loop, xloop thanks for the quick reply! I knew it had to be something simple. I was this close to "stepping through" it on paper following my DECs and ADDs.
*edit* just moved the line down and it works! now I can go back to my "bigger" program and look for the same mistake.
I think he dreams in PASM...