|
Post by C128Man on Mar 24, 2015 15:08:12 GMT
Hi All :-)
Do you known if vice emulate machines with the real speed? It's only for fun, naturally. Here with this little BASIC program. I run it on all machines in VICE.
10 T=TI 20 A=2 30 FOR I=1 TO 20 40 A=SQR(A) 50 NEXT I 60 FOR I=1 TO 20 70 A=A*A 80 NEXT I 90 PRINT "A=";A 100 PRINT "TIME=";TI-T
All the machines give the same result for A=2.00041079
But, for the TIME:
C-128 (mode fast): 41 VIC-20: 62 PET2001: 69 C64:73 C-128 (mode slow 40Col): 82 C-128 (mode slow 80Col): 85
Does it mean that the C128 is the slowest Commodore machine?
|
|
|
Post by donno128 on Mar 25, 2015 13:17:09 GMT
I don't know about VICE128, but on real hardware that looks about right. Or rather, on a C128 that looks right for 64 mode vs 128 mode. Play the same music file in 64mode and 128 mode, tempo is a little quicker in 64 mode. I used a version of Wachet Auf written for to check it some time ago, similar disparity of 128 mode being about 7/8 as fast as 64 mode. I have no idea about the real hardware C64. Mine has crapped out, works only with a few cartridges.
|
|
|
Post by C128Man on Mar 25, 2015 19:27:52 GMT
I will try on real hardware, but I haven't got nor PET nor VIC-20
|
|
|
Post by hydrophilic on Mar 28, 2015 16:33:05 GMT
It has been reported before: the C128 is *both* the fastest and slowest 8-bit by CBM.
In slow (1MHz) mode, it is much slower than VIC-20 or C-64 (not sure about Plus/4). Based on my analysis of BASIC ROM, this is because many extra things are done by BASIC 7 (of the C128)... for example, it checks for Errors and Interrupts for every instruction (thus many delays if multiple BASIC instructions on a single line). Also, the IRQ manages split-screen, sound/music, and sprites... even if you don't use any of those features, the same program will run slower in "standard" (1MHz) on the C128 (as compared to C64 etc.)
But in fast (2Hz) mode, BASIC 7 will run faster than VIC-20/64/Plus4 despite all the extra baggage... no surprise because the CPU is working "double time"!
So obviously, use 80-colum 2MHz if you want speed... but if you need/want 40-column, here are some things you can do:
- Easy - POKE 216,255 ... this will disable split-screen (Time 82 -> 81 = 1.22% speed boost) [until GRAPHIC command is used!]
- Easy - POKE 2564,192... this will disable sound/music/sprites to gain speed (Time 82 -> 81 = 1.22% speed boost)
- Easy - POKE both... disable many obscure BASIC 7 features (Time 82 -> 80 = 2.50% speed boost)
- Hard - Custom IRQ to enable 2MHz during the VIC border (17% [NTSC] to 25% [PAL] speed boost)
I tested the first 3 with your demo... the last option is generic/untested (but it works best).
[Edit]
OK, I installed "lame" 2MHz-Border trick (see attached files). With this method, I get: PAL "time" 82 -> 61 (25.6% speed boost) NTSC "time" 82 -> 67 (18.3% speed boost)
Thus I have proved (IMHO) my estimate of the 17% / 25% boost for 2MHz-Border (NTSC/PAL respectively)... if you believe VICE, the boost is a tiny bit more.
I have attached 3 files for everyone: - bendevil speed (a BASIC test program)
- 2MHZ BORDER.SRC (assembly text file)
- 2MHzV0.prg (compiled ASM file... enable 2MHz-Border with SYS 5888)
Note my 2MHz-Border program is ULTRA simple... it only works (well tested) with standard 40-column text. May work with full-screen HI-RES graphics or full-screen MULTI-Color graphics.... but it is will surely fail with split-screen 40-column modes.... hey, don't say I didn't warn you
bendevil speed (120 B) 2MHZ BORDER.SRC (2.11 KB) 2MHzV0.prg (159 B)
[/Edit]
|
|
|
Post by donno128 on Mar 28, 2015 19:02:35 GMT
Thanks, Hydro... for your pokes which I did not know of and the Plus/4 mention reminded me to check xplus4...
The Plus/4 is slower as an NTSC machine, faster as PAL. In VICE Plus/4 bendevil's prg results: NTSC=89 PAL=64 There are pokes to speed up NTSC Plus/4. I can't remember what they are. One is to put an NTSC in PAL mode. The Plus/4 goes at 1.77Mhz during borders and 0.88Mhz for screen draws.
It would be interesting to try the other good Plus/4 emulators and see if they produce the same results.
|
|
|
Post by C128Man on Mar 29, 2015 14:30:24 GMT
Hi Hydro,
You know the C128 very well! :-)
Thus, this mean that emulator work with real speed?
Thanks for the tips! :-)
|
|
|
Post by hydrophilic on Mar 30, 2015 8:14:42 GMT
I submitted 2MHz hack to VICE team around v2.0 ; I believe they made it official with improvements (clock-stretching) in v2.1 (?)
Anyway, if you use v2.2+ of VICE, it should be accurate for 8502 CPU (both C64 and C128 modes). However, speed is still not right for Z80... my submission to VICE team also included 4MHz / 2 hack for Z80 (thus virtual 2MHz)... but as far as I can tell (and as reported by other forum members) the Z80 still runs at wrong speed of 1MHz -- thus CP/M mode is not real speed. Also there are problems with some disk drives; like 1571 and CMD FD-Drives.
Hopefully next version of VICE will improve those issue(s)!
[Edit] I hear there is Super-CPU emulation for VICE? I don't know if this is true... but I would be very skeptical about timing accuracy of 65816!
Also, Bendevil, I posted your test program on my website. I hope it is okay; if not, let me know and I will remove it. [/Edit]
|
|
|
Post by VDC 8x2 on Mar 30, 2015 19:06:36 GMT
So far the only Super-CPU emulation is for the x64 version only. Makes me sad. bah
They need to do it for x128 too!
|
|
|
Post by C128Man on Mar 31, 2015 7:30:24 GMT
hydrophilic, no problem for publishing code ;-)
The Super-CPU emulation isn't in the official release, this is a fork.
|
|
|
Post by hydrophilic on Apr 1, 2015 7:56:15 GMT
Thanks, bendevil, for allowing me to share your test code!
Real shame 65816/Super-CPU not available for C128 yet... but considering the other issues, I am glad to wait for a real/accurate emulator (go VICE team!)
Also, I want to warn everybody that my *lame* 2MHz-Border hack only works with RASTER interrupts (and as explained before, only standard, non-split-screen). In particular, BASIC 7 is very powerful... it can also "intercept" VIC-II(e) IRQs which are for SPRITES and/or the light-PEN (that is, not a Raster). But my published "lame" code will NOT work for SPRITE or PEN interrupts... just so you know!
Maybe one day I will find the time (or somebody will pay me) to publish more advanced code... If you are cheap (don't want to pay) then I suggest you examine my BASIC 7.80 code and/or my MediaPlayer128 code... they both employ some advance IRQ (interrupt) processing... but neither are a simple hack...
Sorry about that, I just wanted to publish a quick/cheap hack to help/motivate programmers... more sophistication will (obviously) require more advanced code!
Err, I guess that may seem like a lame "cop out"... so feel free to "grill" me for more details if you want!
|
|