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 > $01 register
2010-09-10 01:25
Kickback

Registered: Apr 2004
Posts: 97
$01 register

I know this was asked most-likely 1000 times already but my mind isn't as it use to be because of age and all LOL!!!

If I swap out all of the rom (store $34 into $01) do I need to have some sort of interrupt enabled? I seem to remember if you have the ROM off to long the system will crash? Is this the case or is it just plain ol bad programming LOL!!!

So basically I have my exomizer decrunch and I do the following....

lda #$34
sta $01

jsr decrunch

lda #$37
sta $01

Which I know the decrunch can take some time and not sure is this is why the system is getting hosed out!

2010-09-10 01:43
Frantic

Registered: Mar 2003
Posts: 1634
Just do a "sei" before you swap the Romz out and you'll be fine. Then enable the interrupts again afterwards with "cli", if desired...

(But just for your information... The "default" interrupt enabled when the C64 is turned on is a CIA1 Timer A irq, which jumps through the vector in $0314/$0315.)
2010-09-10 01:47
Kickback

Registered: Apr 2004
Posts: 97
Quote: Just do a "sei" before you swap the Romz out and you'll be fine. Then enable the interrupts again afterwards with "cli", if desired...

(But just for your information... The "default" interrupt enabled when the C64 is turned on is a CIA1 Timer A irq, which jumps through the vector in $0314/$0315.)


I figured this also, but stopping irq's a good amount of time will crash the system also? No?

And if I have irq's running for say music then the music will stop playing also?



2010-09-10 01:51
Frantic

Registered: Mar 2003
Posts: 1634
Stopping interrupts does not by necessity crash anything.

...but yes, if you do in fact use interrupts for something already, then stopping them is not a good idea of course. :) If your non-interrupt code somehow depends on interrupt code being executed, then you will have a crash of course.

What you need to do to have IRQs working even if you swap out the roms is to use the IRQ vectors at $fffe/$ffff instead of $0314/$0315:

http://unusedino.de/ec64/technical/aay/c64/romfffe.htm

Perhaps that is your problem?

By the way, I don't remember by heart exactly which state that is caused by $34, but if this also switches out the IO area including the SID, you cannot play music unless you swap this area in again temporarily in your music playing interrupt, and then out again before the interrupt quits, so the decrunching stuff can continue where it left before the interrupt got executed.

2010-09-10 01:56
Kickback

Registered: Apr 2004
Posts: 97
Quote: Stopping interrupts does not by necessity crash anything.

...but yes, if you do in fact use interrupts for something already, then stopping them is not a good idea of course. :) If your non-interrupt code somehow depends on interrupt code being executed, then you will have a crash of course.

What you need to do to have IRQs working even if you swap out the roms is to use the IRQ vectors at $fffe/$ffff instead of $0314/$0315:

http://unusedino.de/ec64/technical/aay/c64/romfffe.htm

Perhaps that is your problem?

By the way, I don't remember by heart exactly which state that is caused by $34, but if this also switches out the IO area including the SID, you cannot play music unless you swap this area in again temporarily in your music playing interrupt, and then out again before the interrupt quits, so the decrunching stuff can continue where it left before the interrupt got executed.



Ahhhhhh see I knew my mind was slipping!! Yes this jogs the memory!!! Thanks dude for the help MUCH appreciated!!!

James
2010-09-10 02:13
Frantic

Registered: Mar 2003
Posts: 1634
You're welcome. Just don't forget to save the registers if you use $fffe instead of $0314. When roms are enabled, the IRQ jumps through the following code ($ff48 is where the IRQ vector in the ROM is pointing):

FF48: 48 PHA
FF49: 8A TXA
FF4A: 48 PHA
FF4B: 98 TYA
FF4C: 48 PHA
FF4D: BA TSX
FF4E: BD 04 01 LDA $0104,X ; 6510 Hardware Stack Area
FF51: 29 10 AND #$10
FF53: F0 03 BEQ $FF58
FF55: 6C 16 03 JMP ($0316) ; Vector: BRK Instruction Interrupt Address
FF58: 6C 14 03 JMP ($0314) ; Vector: Hardware IRQ Interrupt Address

...so you would have to do the register-stack pushing yourself if you use $fffe directly.

2010-09-10 02:43
TWW

Registered: Jul 2009
Posts: 541
A small tip:

You can set $01 to 34 and simply inc / dec $01 when you want to enable/disable the IO area.

Then you consecvently use $fffe/$ffff to handle your IRQs.

This gives you access to all memory and opens IO when you need it.

This assuming youre not using kernal for anything.

Maybee this was already answered :)
2010-09-10 03:02
Frantic

Registered: Mar 2003
Posts: 1634
A better way may be to do:

lda $01
pha
lda #$35 (or whatever suits the music player irq)
sta $01

[call music player]

pla
sta $01

..since this will work no matter what value that is currently in $01 (I got the impression that this would change over the course of Kickback's program). Then again DEI/INC $01 of course consumes fewer cycles, if that is the priority...
2010-09-10 04:27
Kickback

Registered: Apr 2004
Posts: 97
Quote: A better way may be to do:

lda $01
pha
lda #$35 (or whatever suits the music player irq)
sta $01

[call music player]

pla
sta $01

..since this will work no matter what value that is currently in $01 (I got the impression that this would change over the course of Kickback's program). Then again DEI/INC $01 of course consumes fewer cycles, if that is the priority...


Actually this is the way I am doing it, that way my outside program can change $01 to anything and it will be preserved during the irq process. This works well with music under ROM areas.
2010-09-10 05:46
TWW

Registered: Jul 2009
Posts: 541
For wedge code i agree.

however if YOU run the show (I have extreeeeemly high performance requirements!) why not only access RAM and pull in ROM when(if) you need it instead of using time to preserve states which probably doesen't exist anyway?

and why not:

lda $01
sta mem+1
and #%11111100 /removes ROM (of the top of my head)
sta $01

[call music player]

mem: lda #$00
sta $01

saves a cycle :)

ps. don't forget that dec/inc don't mess with your regs either^^
2010-09-10 07:20
Frantic

Registered: Mar 2003
Posts: 1634
@TWW: My answer was based on my impression of what Kickback wanted to do. I never actually used that kind of solution myself. :) (Well, once or twice maybe..)
 
... 24 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 | 4 - Next
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
bugjam
hedning/G★P
DeMOSic/MS^LSD^ONS
Dr. Doom/RAD
Starfox
morphfrog
rexbeng
Guests online: 95
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 Uncensored  (9.6)
7 Comaland 100%  (9.6)
8 No Bounds  (9.6)
9 Wonderland XIV  (9.6)
10 Aliens in Wonderland  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Dawnfall V1.1  (9.5)
8 Daah, Those Acid Pil..  (9.5)
9 Birth of a Flower  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Offence  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Stinsen  (9.7)
3 Jeroen Tel  (9.6)
4 Linus  (9.6)
5 psych858o  (9.6)

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