Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Rodrigo Yeowtch ! (Registered 2024-11-24) You are not logged in - nap
CSDb User Forums


Forums > CSDb Entries > Release id #141145 : Planet 5200
2015-09-14 18:58
Heaven
Account closed

Registered: Jul 2008
Posts: 102
Release id #141145 : Planet 5200

new CIA 4x4

this is basicly the source I have for 4x4:

;-------- init4x4 ----------------------
;blockbegin



.align $0100

init_4x4
sei
; lda #$35 ...already set
; sta $01

lda #$7f
sta $dd0d
lda $dd0d
ldx #<(fake_nmi)
ldy #>(fake_nmi)
stx $fffa
sty $fffb
ldx #<(timer_test)
ldy #>(timer_test)
stx $dd04
sty $dd05
lda #$11
sta $dd0e
lda #$81
sta $dd0d
.byte $ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea
fake_nmi
ldx $dd04
lda #$7f
sta $dd0d
lda $dd0d
plp
pla
pla
cpx #3
beq old_cia
lda #$24 ; bit zp
sta cia_mod
sta cia_mod2
.byte $ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea
.byte $ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea
.byte $ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea,$ea
old_cia
ldx #<(nmi)
ldy #>(nmi)
stx $fffa
sty $fffb
ldx #<(timer_a)
ldy #>(timer_a)
stx $dd04
sty $dd05
ldx #<(timer_b)
ldy #>(timer_b)
stx $dc06
sty $dc07
.page
PalTiming
ldx #3
cpx $d012
bne *-3
ldy #9
dey
bne *-1
cmp ($00),y
inx
cpx $d012
beq PalTiming2
cmp ($00),y
PalTiming2
ldy #9
dey
bne *-1
nop
nop
nop
inx
cpx $d012
beq PalTiming4
b_rts = *+1
cmp $60
PalTiming4
ldy #10
dey
bne *-1
nop
inx
cpx $d012
bne PalTiming6
PalTiming6
.endp
pha
pla
pha
pla
cia_mod cmp #$DB
.if !below_io
bit $DB
.fi
lda #$11
sta $dd0e
ldy #5
dey
bne *-1
cia_mod2 cmp $DB,x
.if below_io
bit $DB
.fi
sta $dc0f
lda #$40
sta b_rti

lda #$7f
sta $d019
sta $dc0d
lda $dc0d
ldx #<(vic_irq_start)
ldy #>(vic_irq_start)
stx $fffe
sty $ffff
lda #ras_start
sta $d012
lda #$1b
sta $d011
lda #1
sta $d01a
lda #$34
sta $01
cli
rts

;lda #%00011000
;lda #%00101000

nmi
sta nmi_accu+1
lda #15
.if below_io
sta $01 ; timing critical^
.fi
eor $dc06
sta timeit+1
.page
timeit bpl timeit+2
.byte $a9,$a9,$a9,$a9,$a9,$a9,$24,$ea
.endp

scrmod1 lda #%10101000
sta $d018
d11b lda #$1f
sta $d011
d11a lda #$1b
sta $d011
scrmod2 lda #%10111000
sta $d018


.if below_io
bit $dd0d
lda #$30 ; not timing critical
sta $01
nmi_accu lda #$FF
rti
.else
nmi_accu lda #$FF
jmp b_rti
.fi

.align $0100
vic_irq_start
sta irq_start_accu+1
.if below_io
lda #$35 ; not timing critical
sta $01
.fi
lda #ras_stop
sta $d012
bit $dd0d

lda #$81
sta $dd0d
sta $d019
lda #<(vic_irq_stop)
sta $fffe
.if below_io
lda #$30 ; not timing critical
sta $01
.fi
irq_start_accu
lda #$FF
rti

vic_irq_stop
sta irq_stop_accu+1
.if below_io
lda #$35 ; not timing critical
sta $01
.fi
.if open_border
lda #$13
sta $d011
.fi
lda #ras_start
sta $d012
lda #1
sta $dd0d
sta $d019
lda #<(vic_irq_start)
sta $fffe

.if below_io
lda #$30 ; not timing critical
sta $01
.fi
irq_stop_accu
lda #$FF
rti

question...

what does the .page command do?
 
... 16 posts hidden. Click here to view all posts....
 
2015-09-15 11:37
Bitbreaker

Registered: Oct 2002
Posts: 504
Depending on your effect the range of jitter may vary, thus the jitter correction might work, no matter what CIA type you have, but when going out of range ($ff or beyond the last NOP on the bpl timeit+2) things might go south, as new and old cia trigger the irq with 1 cycle difference. This also needs to be taken care of on the correction routine.
More precicely, with an old CIA you should take care that the sta nmi_acc+1 takes 4 cycles, and with a new CIA it should only take 3 cylces, so you best transform it into a sta $some_zeropage_location when a new CIA is used.

Also, when timers from CIA 1 and 2 are used, a detection per CIA is needed, as both types can exist on a single board.
2015-09-15 15:50
Ninja

Registered: Jan 2002
Posts: 411
Heaven: you might try something like 'tax; sta debug_page,x' after 'eor $dc06' in the nmi and check what jitter values you actually get. I am quite sure I positioned the timers to handle jitter 0..7, but a) it has been years ago and b) the source has wandered around quite much (even across different assembler versions). And if the timers are started one cycle off, then problems...

Bitbreaker: The timers are started at different cycles to handle the CIA differences.
2015-09-15 16:42
Bitbreaker

Registered: Oct 2002
Posts: 504
Sure, but arent' the resulting counter values one cycle off on an occuring IRQ, depending on CIA type still? So you still have to cope with that offset when eliminating the jitter by reading back for e.g. $dc06, right? Means, 0 .. 7 or 1 .. 8 cycles to compensate.
2015-09-15 18:21
Heaven
Account closed

Registered: Jul 2008
Posts: 102
Good old Atari.... A simple STA WSYNC and I am done ;)
2015-09-15 18:51
Oswald

Registered: Apr 2002
Posts: 5086
source must be fine, because its the same thing that was used in Ditch, where no such errors were reported.
2015-09-15 19:08
Ninja

Registered: Jan 2002
Posts: 411
OK. Well, and the timing method has been used in various demos since 2004. I wonder...
2015-09-15 19:50
Heaven
Account closed

Registered: Jul 2008
Posts: 102
Oswald... I suspect some other issue... With a proper debugger like in Altirra it would be quicker to detect.
2015-09-15 19:52
Heaven
Account closed

Registered: Jul 2008
Posts: 102
As the plasma I showed you uses same code and it works there an c64 and c64c with new CIA.

I moved the sprites up and reduced the fli area but it still keeps crashing on c64c.
2015-09-15 20:54
Oswald

Registered: Apr 2002
Posts: 5086
so you must have changed a lot of things to put sprites on top of it, and 99% that the bug is there in the changes, something is about 1 cycle off I bet.

Maybe Ninja would care to take a look if you send him the source. Unfortunately I'm a dumbfuck when it comes to this kind of coding.
2015-09-16 00:08
chatGPZ

Registered: Dec 2001
Posts: 11353
einfach mal weniger lack saufen!
Previous - 1 | 2 | 3 - 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
aNdy/AL/Cosine
hedning/G★P
DnP
DJ Gruby/TRiAD
CreaMD/React
anonym/padua
Airwolf/F4CG
megasoftargentina
Unlock/Padua/Albion
MWR/Visdom
A3/AFL
wil
bexxx
Barfly/Extend
gorans
Yogibear/Protovision
Didi/Laxity
Guests online: 168
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 The Demo Coder  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Comaland 100%  (9.6)
10 What Is The Matrix 2  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Libertongo  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Morph  (9.5)
9 Dawnfall V1.1  (9.5)
10 It's More Fun to Com..  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Nostalgia  (9.3)
5 Censor Design  (9.3)
Top Fullscreen Graphicians
1 Joe  (9.7)
2 Veto  (9.6)
3 Facet  (9.6)
4 The Sarge  (9.6)
5 Carrion  (9.5)

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