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 > Detect C128 in C64-mode without exploiting 2mhz mode?
2020-04-03 08:04
JackAsser

Registered: Jun 2002
Posts: 1989
Detect C128 in C64-mode without exploiting 2mhz mode?

Reason: Easyflash emulation in 1541u2 doesn’t work in 2mhz mode.
 
... 40 posts hidden. Click here to view all posts....
 
2020-04-03 09:52
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: Define "exploiting 2 MHz mode". =)

Is it okay to read $D030 after reset?
Should be $FD (turbo mode off, line-skip off).

(Beware for Turbo Chameleon: it has $FE for turbo mode off but $FF for turbo mode on, which is the same value a C-64 reads there.)

Either way, only C-128 can have bit 1 (line-skip) set to 0.


By exploiting 2Mhz mode I mean enable 2Mhz mode and measure something compared to say raster or CIA timer etc.

ROM code can't run safely in 2Mhz using a 1541u2. But as Groepaz said, why don't I run that code in RAM? I really feel stupid now.
2020-04-03 10:08
chatGPZ

Registered: Dec 2001
Posts: 11111
Quote:
Or a Turbo Chameleon in turbo mode, no?

depends :) when d030 bit is emulated, then not =P
2020-04-03 10:39
oziphantom

Registered: Oct 2014
Posts: 478
just use the VDC. Read D600, you will get something in the form of
%slv0000c

where s is the status bit which may be 0 or 1 depending if the VDC is ready. So you could write an address to D600, then read D600 and wait for bit 7 to become 1 if it doesn't within a few hundred clocks, not a VDC.
l is the light pen, should be 0 but it can be triggered the same way a VIC one can be so not 100% safe. Or even set up the "trigger light pen" state and make sure it happens?
V is vblank, so you can expect it to be 0 for most of a frame, then 1 for quite a while.
c will be 0 or 1 depending on the VDC version the 128 has and is thus stable.

checking for VBlank should be a pretty solid check, using the wait for ready will fail on VICE as the VDC is "always" ready on x128.

a C64 will hit D400 for the reads, which is open bus.

also D500&D700 are open bus on a C128. Is there a setup for the SID to output something on it readable registers that are "stable" across cycles? I.e does the random number change every cycle? or you can set up the envelope to be a long pulse. then
lda D41C
cmp D51C
on a C64 they will match, on a C128 they won't.

Has anybody done a solid investigation of the Z80 boot ROM. It must modify some RAM values which might survive the 6502 boot sequence, which one could snoop for.
2020-04-03 10:56
chatGPZ

Registered: Dec 2001
Posts: 11111
Quote:
a C64 will hit D400 for the reads, which is open bus.

this is kinda unreliable, you can read back what was written to SID for a surprisingly long time
2020-04-03 11:33
oziphantom

Registered: Oct 2014
Posts: 478
does it just store 1 or does it store multiple 'values'

say could you
write D600
write D601 <- trash values stored in SID??
read D600

or since the VDC mirrors all the way through

lda D600
write other value to D601
lda D602 <- should give you D600 value, not what you wrote to D601?
2020-04-03 11:37
chatGPZ

Registered: Dec 2001
Posts: 11111
as said, its not reliable, you usually get the last value written to the register - but it may or may not be different, randomly.
2020-04-03 12:02
tlr

Registered: Sep 2003
Posts: 1714
I use this in superfluid:
        ldx     #$fe
        cpx     $d030           ; C=1 if C128
Getting the state into carry allows it to be rol:ed into acc or a zp loc.
2020-04-03 12:23
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: I use this in superfluid:
        ldx     #$fe
        cpx     $d030           ; C=1 if C128
Getting the state into carry allows it to be rol:ed into acc or a zp loc.


Brilliant, thanks
2020-04-03 12:40
chatGPZ

Registered: Dec 2001
Posts: 11111
now the question is... how does any of this help with "Easyflash emulation in 1541u2 doesn’t work in 2mhz mode." ? =) wouldnt you have to detect 1541u2 instead? =)
2020-04-03 16:00
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: now the question is... how does any of this help with "Easyflash emulation in 1541u2 doesn’t work in 2mhz mode." ? =) wouldnt you have to detect 1541u2 instead? =)

That’s the follow up question!
Previous - 1 | 2 | 3 | 4 | 5 - 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
zzarko
Guests online: 125
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

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