| | 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.... |
| | 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. |
| | 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. |
| | 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. |
| | Heaven Account closed
Registered: Jul 2008 Posts: 102 |
Good old Atari.... A simple STA WSYNC and I am done ;) |
| | 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. |
| | Ninja
Registered: Jan 2002 Posts: 411 |
OK. Well, and the timing method has been used in various demos since 2004. I wonder... |
| | 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. |
| | 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. |
| | 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. |
| | chatGPZ
Registered: Dec 2001 Posts: 11353 |
einfach mal weniger lack saufen! |
Previous - 1 | 2 | 3 - Next | |