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 > 2 bit irq loader
2006-06-21 22:11
MRT
Account closed

Registered: Sep 2005
Posts: 149
2 bit irq loader

Hmm, just a question...

Is there a 2 bit irq loader, which doesn't require blocking other interrupts while loading a byte?

i.o.w. Is there a realy fast irq loader which doesn't block any interrupts and let me use my beloved sprites? :-)
 
... 42 posts hidden. Click here to view all posts....
 
2006-12-18 22:40
ChristopherJam

Registered: Aug 2004
Posts: 1409
@MRT - are you sure you didn't get clock and data the wrong way around on either your reads or your writes? That would explain the seeming lack of inversion when they are different to each other :)

err, but not the 00. I'll go get some coffee now :-P
2006-12-19 06:27
Krill

Registered: Apr 2002
Posts: 2980
MRT: The bit instruction is to and what cmp is to sbc, more or less. It does mainly the same, just that your registers aren't altered, instead only the flags. So if the Z-flag is set after the bit instruction, both lines are low, if not, directly branch to the bit opcode again.

And that table seems b0rked. :)

Oh, and i just made a new version of my loader, still interesed, MRT?
2006-12-19 07:42
MRT
Account closed

Registered: Sep 2005
Posts: 149
@ChristopherJam:
poor me some too ;-)

@Krill:
He he, I know how bit works :)
Just saying you can use it only to check if all is low or all is not low.

And hell yeah... I'm interrested!
2006-12-19 09:48
Ninja

Registered: Jan 2002
Posts: 411
Quote: Yes it is. But since the 1541 is the least common denominator, all other drive types don't really have to be faster, at least for demos. And i'd always prefer more compatibility over more speed. :)

Really? Now, that's good news >:->
2006-12-19 10:29
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: @ChristopherJam:
poor me some too ;-)

@Krill:
He he, I know how bit works :)
Just saying you can use it only to check if all is low or all is not low.

And hell yeah... I'm interrested!


@MRT: BIT conviniently copies bit 6 and 7 to the N and V flags. Hence:

lda #$c0
bit $dd00
beq data_and_clock_low
bvc data_low
bvs data_hi
bmi clock_low
bpl clock_hi

I might have mixed up data and clock ofcourse...
2006-12-19 16:00
MRT
Account closed

Registered: Sep 2005
Posts: 149
Quote: @MRT: BIT conviniently copies bit 6 and 7 to the N and V flags. Hence:

lda #$c0
bit $dd00
beq data_and_clock_low
bvc data_low
bvs data_hi
bmi clock_low
bpl clock_hi

I might have mixed up data and clock ofcourse...


I understand the bit opcode, but when scanning for both bit set, I don't think your code is cheaper then the code below?
        ;wait for both lines high
        lda #%11000000
        and $dd00
        cmp #%11000000
        bne *-7

When both bits are set I use 10 cc. When both bits are set in your example it would also take 10 cc, when I take the shortest path (see code below)
        ;wait for both lines high
        lda #%11000000
        bit $dd00
        bvc *-3
        bmi *-5


The difference here is thet your code is faster when both bits aren't set. But... You can only do this for $dd00 and not for $1800, and your code will have a different timing for each different pair of bits.

I'm writing a loader which is partly time-based, so I need to have stable timing.
2006-12-19 16:33
j0x

Registered: Mar 2004
Posts: 215
MRT: It's not necessary to load the accumulator when only using the N and V flags

How about this one (assuming you want to do what your first code snippet does, not the second):

lda #$bf
cmp $dd00
bcs *-3

?
2006-12-19 17:21
Krill

Registered: Apr 2002
Posts: 2980
MRT: how stable? Bit+branch still gives you at least 7 cycles jitter. For less jitter, you need to apply a technique known from stable rasters, called half variance. But you only need that if you don't handshake/sync for many many cycles.
2006-12-19 19:23
MagerValp

Registered: Dec 2001
Posts: 1078
BIT has an implicit AND that sets the Z reg. To wait for DATA use BMI/BPL. To wait for CLOCK use BVC/BVS. To wait for both, use lda #$c0 and BEQ/BNE.

On the 1541 you lda #1, #4, or #5 and then BEQ/BNE.
2006-12-20 09:45
j0x

Registered: Mar 2004
Posts: 215
Magervalp: I think MRT questions using BIT for checking that *both* bits are 1. lda #$c0 bit $dd00 will set the zero flag if and only if both bits are zero. If one bit is 1 and the other is 0, then the BNE will branch, which is not (if I understand MRT correctly) the desired behaviour. But you're right: checking that both bits are 0 can be achieved by checking the zero flag.

/Stefan
Previous - 1 | 2 | 3 | 4 | 5 | 6 - 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
Rebok/BOOM!/Tropyx
fuzzybad
iceout/Avatar/HF
McGurk/Coma
radius75
t0m3000/hf^boom!^ibx
Magic/Nah-Kolor
psych
Guests online: 125
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (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 Fullscreen Graphicians
1 Joe  (9.7)
2 Sulevi  (9.6)
3 The Sarge  (9.6)
4 Veto  (9.6)
5 Facet  (9.6)

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