Background change at Raster Location

Basic and Machine Language

Moderator: Moderators

tlr
Vic 20 Nerd
Posts: 571
Joined: Mon Oct 04, 2004 10:53 am

Re: Background change at Raster Location

Post by tlr »

vicassembly wrote: Thu Jun 18, 2020 7:49 pmI just loved this into vice and it didn't do anything. I'm not sure what happened. I tried PAL and NTSC
It’s currently assembled for PAL with 8KB expansion or more. Maybe you tried to start it on an unexpanded configuration?
User avatar
srowe
Vic 20 Scientist
Posts: 1353
Joined: Mon Jun 16, 2014 3:19 pm

Re: Background change at Raster Location

Post by srowe »

vicassembly wrote: Thu Jun 18, 2020 7:44 pm 2. At that point timer 2 will fire. I don't understand the numbers stored in VIA2T2CH. My little understanding tells me that this fires timer 2 after counting down the number in VIA2T2CL.
Timer 2 is a 16 bit counter, but because the only one register at a time can be set the VIA requires you to first write the LSB then the MSB. The write to VIA2TCH starts the timer running.
4. I intuit that EABF is just doing the normal IRQ. What does EB18 do? Rate Collin West used EB15. What is the difference?
These are entrypoints back into the KERNAL IRQ routine

Code: Select all

10560     LAB_EB12
10561         JSR     FSCNKEY                 ; scan keyboard
10562         BIT     VIA2T1CL                ; test VIA 2 T1C_l, clear the timer interrupt flag
10563         PLA                             ; pull .Y
10564         TAY                             ; restore .Y
10565         PLA                             ; pull .X
10566         TAX                             ; restore .X
10567         PLA                             ; restore .A
10568         RTI
so the difference is in whether the IFR flag for the timer is cleared.
tlr
Vic 20 Nerd
Posts: 571
Joined: Mon Oct 04, 2004 10:53 am

Re: Background change at Raster Location

Post by tlr »

srowe wrote: Mon Jun 08, 2020 12:05 am Best home work is to read the 6522 datasheet. There are details in there such as the order of writing to the 16 bit timer registers and interrupt enabling that just aren't obvious from looking at code.

In short you load the timer register with a value and when it crosses from 0>FFFF it flags an event. If that event is defined to cause a CPU interrupt then one is raised. Depending on which VIA it is this is either an IRQ or an NMI.

The tricky bit with raster interrupts is that the cycles to set up the timer and those needed to reach the interrupt handler code are significant.
I just realized these data sheets never surfaced in this thread, so hear goes:

A "recent" one from Rockwell, should be mostly correct: rockwell_r6522_via.pdf
Synerteks version from 1978 seems quite elaborate: synertek_sy6522_via_1978_jan.pdf
Some details might be buried in the preliminary data sheet from MOS: mos_6522_preliminary_nov_1977.pdf
User avatar
beamrider
Vic 20 Scientist
Posts: 1462
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Background change at Raster Location

Post by beamrider »

deleted
Last edited by beamrider on Fri Jun 19, 2020 10:11 am, edited 1 time in total.
tlr
Vic 20 Nerd
Posts: 571
Joined: Mon Oct 04, 2004 10:53 am

Re: Background change at Raster Location

Post by tlr »

beamrider wrote: Fri Jun 19, 2020 8:24 am @tlr

I just realised there's a typo in your listing.

Code: Select all

time_list:
	SPLIT	76*LINETIME,$1b
should be

Code: Select all

	SPLIT	7*6*LINETIME,$1b
76 is intentional. PAL only. Admittedly only tested using the latest vice trunk build.
User avatar
beamrider
Vic 20 Scientist
Posts: 1462
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Background change at Raster Location

Post by beamrider »

My bad...

I had 12*8 further down...
User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 196
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Background change at Raster Location (was: ** Stable rasters on the VIC-20)

Post by MrSterlingBS »

Hi,

here is my first demo with stable raster bars.
The Music runs via the IRQ.
The main loop is the raster bar effect.

I borrowed the music from the demo ALPHA RANGE 89.
The source code is included.
Program.zip
(2.68 KiB) Downloaded 29 times
2024-05-30 14_26_24-Clipboard.png
2024-05-30 14_26_24-Clipboard.png (4.2 KiB) Viewed 487 times
Have fun ;-)
User avatar
Mike
Herr VC
Posts: 4897
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Background change at Raster Location (was: ** Stable rasters on the VIC-20)

Post by Mike »

MrSterlingBS wrote:[...]
It is somewhat frustrating to install this thread just to see Marko's outdated method being resurrected. :(

Edit: to explain, and for posteriority - MrSterlingBS originally wrote his post above into the topic '** Stable rasters on the VIC-20' which has me as OP. I had started that other topic to present my own, better alternative to Marko's stable raster routine. At various places, I had often enough pointed out the shortcomings of Marko's routine, so I found it reasonable to show how to do it better. That's all from my side regarding that matter.
tlr
Vic 20 Nerd
Posts: 571
Joined: Mon Oct 04, 2004 10:53 am

Re: Background change at Raster Location (was: ** Stable rasters on the VIC-20)

Post by tlr »

MrSterlingBS wrote: Thu May 30, 2024 6:40 am Hi,

here is my first demo with stable raster bars.
The Music runs via the IRQ.
The main loop is the raster bar effect.

I borrowed the music from the demo ALPHA RANGE 89.
The source code is included.

Have fun ;-)
Nicely done!

The music takes me back. I wrote that. :)
Post Reply