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: 468
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.
Refresh
Subscribe to this thread:
You need to be logged in to post in the forum.
Search the forum:
Search
All forums
C64 Coding
C64 Composing
C64 Pixeling
C64 Productions
CSDb Bug Reports
CSDb Development
CSDb Discussions
CSDb Entries
CSDb Feedback
CSDb Info
CSDb moderators
CSDb Questions
Messages to moderators
Requests
for
in
Writer & text
Text
Writer
All times are CET.
Search CSDb
All
Releases
Groups
Sceners
Events
BBS
SIDs
-------
Forum
Comments
Advanced
Users Online
Peacemaker/CENSOR/Hi..
kbs/Pht/Lxt
fieserWolF/Abyss-Con..
Freeze/Blazon
BYB/Hokuto Force
MWR/Visdom
WVL/Xenon
The Human Co../Maste..
Brittle/Dentifrice^(?)
iAN CooG/HVSC
Guests online: 89
Top Demos
1
Next Level
(9.7)
2
13:37
(9.7)
3
Mojo
(9.7)
4
Coma Light 13
(9.6)
5
The Demo Coder
(9.6)
6
Edge of Disgrace
(9.6)
7
What Is The Matrix 2
(9.6)
8
Uncensored
(9.6)
9
Comaland 100%
(9.6)
10
Wonderland XIV
(9.6)
Top onefile Demos
1
No Listen
(9.6)
2
Layers
(9.6)
3
Cubic Dream
(9.6)
4
Party Elk 2
(9.6)
5
Copper Booze
(9.6)
6
X-Mas Demo 2024
(9.5)
7
Dawnfall V1.1
(9.5)
8
Rainbow Connection
(9.5)
9
Onscreen 5k
(9.5)
10
Morph
(9.5)
Top Groups
1
Performers
(9.3)
2
Booze Design
(9.3)
3
Oxyron
(9.3)
4
Censor Design
(9.3)
5
Triad
(9.3)
Top Crackers
1
Mr. Z
(9.9)
2
Antitrack
(9.8)
3
OTD
(9.8)
4
Fungus
(9.8)
5
S!R
(9.8)
Home
-
Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.044 sec.