Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > SuperCPU interrupts
2004-02-27 18:46
AmiDog

Registered: Mar 2003
Posts: 97
SuperCPU interrupts

I've run into a problem I don't know how to solve. I've been using native mode interrupts for a FLI routine, and it's working just fine as long as the data bank register is set to zero in the main program. If I just make a simple raster IRQ (just making it up here, may not really work but the source for the working code is on my C64):

* = $1000
sei
clc
xce ; native mode
sep #$30 ; 8bit acc & idx
stz $d020
lda #$33
sta $d012
lda #$01
sta $d01a
lda $d019
sta $d019
lda #<irq
sta $ffee
lda #>irq
sta $ffef
rep #$30 ; 16bit acc & idx
cli
loop jmp loop

irq
sep #$30 ; 8bit acc & idx
lda #$01
sta $00d020 ; long addressing
die jmp die

This will set the border color to white, but if I add the following lines BEFORE the cli above it doesn't work.

pea $1000
plb
plb

This will set program bank to $10xxxx. Now I don't get the interrupt (atleast the border never changes color). Changing the value above to $0000 (bank zero) and it works again...

Any idea what I'm doing wrong?
2004-02-27 22:37
Dosoo
Account closed

Registered: Apr 2002
Posts: 32
I went through some of my papers and couldn't find a waterproof solution. So I just write something here and try to look intelligent.

First of all, what are you trying to accomplish using code like that? If you want the program to run in bank $10, why don't you just use *=$101000 in the beginning? It works at least in Virtual Assembler by protovision.

What my source said about data bank register is that it is used only in certain addressing modes, that go beyond 64k. In that case it looks like that your code fucks up the machine completely and that's why it doesn't work. I mean when the code reaches "loop jmp loop" the jmp really jumps in bank $10xxxx and that's the end of program.

Then two things I have to say. Do have enough memory to reach bank $10? I bet you do, but I still ask.

Second I've noticed while coding myself that those rep and sep instructions are extremely delicate. Try put those stack -related commands before the rep #$30 and see what happens. When I coded F19 SCPU intro I had to constantly debug sep/rep -related commands.

Still the main question remains. Please let us know what you are trying to do using that complex pea+plb combination. Maybe I'm too amateur to see it straight away. Or then there is another way.
2004-02-27 23:21
Stryyker

Registered: Dec 2001
Posts: 465
Have you downloaded the WDC PDF docs for the 65816? It details a few catches like interrupts etc.
2004-02-28 08:42
AmiDog

Registered: Mar 2003
Posts: 97
The program should run in bank zero (at $1000) as I've written as the start address, but it should access data in bank $10, and since ldx/ldy doesn't have long addressing, the only way to access data in another bank than bank zero is to change the data bank register (which is what I do).

And yes, I've got 16MB, so I've got memory all the way. The actual code works just fine, but it should use an FLI screen to look right, and if any interrupts are enabled, the program just stops, but with them all disabled, it works as it should (using long addressing for the sta's that creates the bitmap at $4000, and using ldx/ldy with 16bit addresses combined with the bank register to access the tables and such I have at $10xxxx).

AFAIK, the only way to access the entire memory is to use the bank register. Also, using the direct page register along with the bank register will allow fast access to memory anywhere in the 16MB, just like if all your memory were zero-page memory.

The entire idea of the data bank register is to allow code and data to be stored in different banks. There is also a program bank register, but that's not what we are dealing with here. AFAIK, the code must always be in the same bank, but one can jump to a different bank (long jump) which will change the program bank register accordingly, but it's not possible to have the code begin in one bank and end in another without jumping between the banks (I may have misunderstood some things though.)
2004-02-28 17:55
AmiDog

Registered: Mar 2003
Posts: 97
Ehrm, I think I've found the problem. I forgot to force absolute addressing in some cases and did end up getting direct page addressing instead (which apparently doesn't care about the data bank register, it's always assumed to be zero) and thus I did end up messing with address $00-$20 (not good).

I'll try to move the direct page to $340 (in the tape I/O buffer) and see if it helps.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
alwyz/udi
Exile/Anubis
Mason/Unicess
kbs/Pht/Lxt
McMeatLoaf
A3/AFL
Guests online: 108
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Jeroen Tel  (9.7)
3 Stinsen  (9.6)
4 Mutetus  (9.6)
5 Linus  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.053 sec.