stuck on passing an adress from one object to the next.
mike goettling
Posts: 31
i am trying to pass the adress of vgacolors to another object and start a new cog.
what am i doing wrong.
main program has vgacolors prams. using VGA 1280x1024 Tile Driver v0.9 for vid driver.
DAT
·
vgacolors long
· long $3C043C04······ 'lt grey on dk grey···················· 110
· long $3C3C0404
· long $C000C000······ 'red··································· 111
· long $C0C00000
· long $30003000······ 'green································· 112
call to object blinking colors
colors.start(@vgacolors)
this should pass the adress of vgacolors to the object blinking colors
this is blinking colors program
var
long stack[noparse][[/noparse]9]
long i
pub start(colortable)
····
· cognew (toggle(colortable),@stack)
pub toggle(colortable)
···
repeat
···· i := cnt
···· waitcnt(i += 22500000)
···· colortable := $C000C000·················
···· colortable[noparse][[/noparse]+1] := $C0C00000
···· waitcnt(i += 22500000)
···· colortable := $3C043C04
···· colortable[noparse][[/noparse]+1] := $3C3C0404
the repeat works if i put it in the main program and change colortable to vgacolors. the charactors will flash on the screen. i know that the adress is not passing to the blinking colors object but i cant figure out why.
·
what am i doing wrong.
main program has vgacolors prams. using VGA 1280x1024 Tile Driver v0.9 for vid driver.
DAT
·
vgacolors long
· long $3C043C04······ 'lt grey on dk grey···················· 110
· long $3C3C0404
· long $C000C000······ 'red··································· 111
· long $C0C00000
· long $30003000······ 'green································· 112
call to object blinking colors
colors.start(@vgacolors)
this should pass the adress of vgacolors to the object blinking colors
this is blinking colors program
var
long stack[noparse][[/noparse]9]
long i
pub start(colortable)
····
· cognew (toggle(colortable),@stack)
pub toggle(colortable)
···
repeat
···· i := cnt
···· waitcnt(i += 22500000)
···· colortable := $C000C000·················
···· colortable[noparse][[/noparse]+1] := $C0C00000
···· waitcnt(i += 22500000)
···· colortable := $3C043C04
···· colortable[noparse][[/noparse]+1] := $3C3C0404
the repeat works if i put it in the main program and change colortable to vgacolors. the charactors will flash on the screen. i know that the adress is not passing to the blinking colors object but i cant figure out why.
·
Comments
try this code.
repeat
·····i·:=·cnt
·····waitcnt(i·+=·22500000)
·····LONG[noparse][[/noparse]colortable]·:=·$C000C000
·····LONG[noparse]/noparse]colortable[b[noparse][[/noparse][/b]1]·:=·$C0C00000
·····waitcnt(i·+=·22500000)
·····LONG[noparse][[/noparse]colortable]·:=·$3C043C04
·····LONG[noparse]/noparse]colortable[b[noparse][[/noparse][/b]1]·:=·$3C3C040
thanks