Videopac / Odyssey2 forum

Programming the Videopac / Odyssey2 => Programming => Topic started by: Chris! on May 22, 2017, 08:46:39 AM



Title: How to turn the screen to black upon reset
Post by: Chris! on May 22, 2017, 08:46:39 AM
So I'm using this code to color the screen with:
Code:
vsync
stop tcnt
;mov r0,#000h ; (first color: I used black/black here, to keep SELECT GAME screen black)
;mov a,#0a3h
movx @r0,a
mov a,#0ffh ; (Hereīs the size. FF is the smallest trace, the same size of a horizontal bar, at this size it will not visible on screen)
mov t,a
strt cnt
jmp 001ah

timer
sel rb0
mov r5,a ; save accumulator
stop tcnt
mov r0,#030h ; get color data pointer
mov a,@r0
add a,#colordata & 0ffh ; get color data address
mov r2,a
movp a,@a ; get color
mov r1,#0a3h
waitline1
jt1 waitline1 ; wait for end of video line
waitline2
jnt1 waitline2
movx @r1,a ; set color
inc @r0 ; update data pointer
inc r2
mov a,r2
movp a,@a ; get timer data
mov t,a
strt cnt ; start timer
inc @r0 ; update data pointer
inc r2
mov a,r2 ; check if next data = 0
movp a,@a
jnz timerend
mov @r0,a ; reset pointer if end of data
stop tcnt
timerend
mov a,r5 ; restore accumulator
retr

colordata:   ;(2nd color) (itīs size)   (3rdcolor) (itīs size)    ...

   db 01ah,      0e9h,        01ah,          0ech,       01ah,0fdh,01ah,0c0h
  db 01ah,0fah,01bh,0dbh,011h,0d6h,009h,0feh,009h,0feh,000h ;(use 000h to close)
But whenever the game resets, it resets to what should be at the beginning, but not on a black background, it displays the background colors that were in the game. I noticed when I reset the game with the reset button, it went to a black background. So my question is how do I reset the game and have a black background?


Title: Re: How to turn the screen to black upon reset
Post by: Rene_G7400 on May 22, 2017, 09:33:12 AM
When you reset the game you need to disable the timer interrupts with DIS TCNTI.


Title: Re: How to turn the screen to black upon reset
Post by: Chris! on May 22, 2017, 09:39:03 AM
That worked! Thank you so much!


Title: Re: How to turn the screen to black upon reset
Post by: Chris! on May 22, 2017, 10:51:52 AM
OK, I'm making an 8k game. If I die in a different bank, it shows the colors of that bank regardless of where I put "dis tcnti." Not only that, it shows the sprites as well. What should I do?


Title: Re: How to turn the screen to black upon reset
Post by: Chris! on May 22, 2017, 10:56:34 AM
Never mind, I figured it out.