Background change at Raster Location

Basic and Machine Language

Moderator: Moderators

tlr
Vic 20 Nerd
Posts: 567
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: 1340
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: 567
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: 1452
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: 567
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: 1452
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...
Post Reply