Quote:
amigaksi wrote:
As an example, try putting an instruction like $009C,$8010 into the copper list and write an interrupt routine (pointed to by location $68) that does something time critical like writing to joystick ports and there your emulator won't work. The PC timer goes only as accurate as 1.19318Mhz whereas the copper is timing the color clocks at 3.57954525Mhz.
>This is weird, because you don't need hi-res timers to do accurate emulation. Usually it's a matter of accurately interleaving CPU- and hardware emulation, not synchronizing emulation to the host hardware.
Depends on what you are emulating. The case above won't work on your emulator as the frequency of bits being toggled on the joystick port won't be what the emulator will output assuming it even emulates a joystick port. I like my clocks running at the same speed even on faster CPUs just like the copper sets bits at the same exact color clock on the A500 or A4000 w/higher CPU speed. [aside: that vector should be $6C for Copper and $68 for CIA timers.]
>In theory, nothing prevents perfect emulation of the Amiga hardware today, including copper timing.
Nice joke but you should have corrected yourself by now (if you had read all the posts). It should read "In theory (software-wise), not even an Atari 800 can be perfect emulated what to speak of Amiga." I just gave a simple example that's not doable although it may seem like it's doing it. A fake diamond and a real diamond are different in molecular structure/density although they may look the same. Your emulator cannot be doing timing at 3.579545Mhz if it's timer is only accurate to 1.19318Mhz where reading the tick count itself takes more time than the quantum of the timer. You may need new hardware graphics card or joystick card when we start discussing writing to overscan areas of the screen, hi-speed reading joystick ports (for periperhals or other reasons), other port emulation, etc. The Commodore 64 can read a joystick port faster (@ $DC01) than a modern PC (@ 201h). Here-- I posted this before somewhere on this forum (see if you can get an interrupt to occur consistently on some color clock then we can discuss further):
;*** Test timer accuracy on Atari 400/800 by Krishna Software Inc. without using DLIs.
TIMERFREQLSB = 53760
TIMERFREQMSB = 53762
WSYNC = 54282
VCOUNT = 54283
DOSVEC = 10
CASINI = 2
WARMSTART = 58484
VMIRQ = 534 ;hardware irq ptr
ORG = 600h
;DW 0FFFFh
;DW StartAdr
;DW LastOffset-1
DB 0,3 ;# of sectors to load 1..255
DW ORG
DW StartAdr
Rts
StartAdr: Lda #MyReset,L
Sta CASINI
Lda #MyReset,H
Sta CASINI+1
Lda #0
Sta 580
Lda #2
Sta 9
Jmp WARMSTART
MyReset: Lda #2
Sta 9
Lda #MyReset,L
Sta CASINI
Lda #MyReset,H
Sta CASINI+1
Sei
Lda #0 ;no VBIs nor DLIs for maximum performance
Sta 54286
Sta 53774 ;disable all IRQs
Sta 54272 ;turn off screen
Lda #TimerTwoIRQ,L ;general IRQ routine but we use only for timer #2
Sta VMIRQ
Lda #TimerTwoIRQ,H
Sta VMIRQ+1
Lda #80 ;40 for join channels 3,4; +80 for channels 1+2 @1.79Mhz
Sta 53768 ;join channels at 1.79 Mhz
Lda #165 ;lsb 165
Sta 53760 ;timer #2 freq = 1789790/[A+1]
Lda #116 ;msb for rate divisor A
Sta 53762
Lda #2 ;2=timer interrupt
Sta 53774 ;enable IRQ #2
NotMidScreen: Lda VCOUNT
Cmp #65
Bne NotMidScreen
Sta WSYNC
Sta 53769 ;start timer counter
CLI
Lda #34
Sta 54272
IdleLoop: ;put your code here
Jmp IdleLoop
TimerTwoIRQ: Pha
Lda #255
Sta 53272 ;change register (like color for example)
Lda #0
Sta 53774
Lda #2
Sta 53774 ;send ack to timer irq
Nop
Nop
Lda #96
Sta 53272 ;change register (like color for example)
Pla
Rti
;LastOffset: DW 2e0h,2e1h,ORG