Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #4287 > unrolled thread
| Started by | "Frank M." <frank_o_rama@hotmail.com> |
|---|---|
| First post | 2018-03-06 14:46 -0800 |
| Last post | 2018-03-14 21:23 -0700 |
| Articles | 20 on this page of 56 — 14 participants |
Back to article view | Back to comp.sys.apple2.programmer
Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-06 14:46 -0800
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-06 19:03 -0800
Re: Emulator Detection gids.rs@sasktel.net - 2018-03-07 01:07 -0800
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-07 07:18 -0800
Re: Emulator Detection TomCh <tomcharlesworth26@gmail.com> - 2018-03-07 12:53 -0800
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-07 13:24 -0800
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-08 04:42 -0800
Re: Emulator Detection Tom Porter <laseractiveguy@gmail.com> - 2018-03-08 07:41 -0800
Re: Emulator Detection Tom Porter <laseractiveguy@gmail.com> - 2018-03-08 07:46 -0800
Re: Emulator Detection Tom Porter <laseractiveguy@gmail.com> - 2018-03-08 08:55 -0800
Re: Emulator Detection Steve Nickolas <usotsuki@buric.co> - 2018-03-07 05:49 -0500
Re: Emulator Detection Mark Pilgrim <markpilgrimfastmail@gmail.com> - 2018-03-08 10:21 -0800
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-08 22:41 -0800
Re: Emulator Detection MG <michael@apps.guidero.us> - 2018-03-10 13:24 -0800
Re: Emulator Detection Zellyn <zellyn@gmail.com> - 2018-03-11 14:21 -0700
Re: Emulator Detection qkumba <peter.ferrie@gmail.com> - 2018-03-11 14:50 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-11 22:02 -0700
Re: Emulator Detection TomCh <tomcharlesworth26@gmail.com> - 2018-03-12 13:25 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-11 22:19 -0700
Re: Emulator Detection gids.rs@sasktel.net - 2018-03-12 10:17 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-12 11:11 -0700
Re: Emulator Detection mmphosis <mmphosis@macgui.com> - 2018-03-12 22:37 +0000
Re: Emulator Detection gids.rs@sasktel.net - 2018-03-12 17:03 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-12 17:27 -0700
Re: Emulator Detection gids.rs@sasktel.net - 2018-03-12 17:39 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-12 20:02 -0700
Re: Emulator Detection gids.rs@sasktel.net - 2018-03-12 20:39 -0700
Re: Emulator Detection gids.rs@sasktel.net - 2018-03-12 20:40 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-12 20:58 -0700
Re: Emulator Detection qkumba <peter.ferrie@gmail.com> - 2018-03-12 21:51 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-13 18:45 -0700
Re: Emulator Detection gids.rs@sasktel.net - 2018-03-13 22:22 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-13 22:43 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-14 00:08 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-14 00:30 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-14 08:38 -0700
Re: Emulator Detection Zellyn <zellyn@gmail.com> - 2018-03-14 09:03 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-14 13:58 -0700
Re: Emulator Detection Zellyn <zellyn@gmail.com> - 2018-03-15 06:11 -0700
Re: Emulator Detection Michael Pohoreski <michael.pohoreski@gmail.com> - 2018-03-12 21:55 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-12 22:50 -0700
Re: Emulator Detection Zellyn <zellyn@gmail.com> - 2018-03-12 13:40 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-14 08:42 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-14 13:57 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-14 21:07 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-15 14:56 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-16 20:49 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-16 22:20 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-16 22:24 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-03-17 02:32 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-17 08:09 -0700
Re: Emulator Detection Michael J. Mahon <mjmahon@aol.com> - 2018-03-17 17:01 -0500
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-04-28 02:44 -0700
Re: Emulator Detection John Brooks <jbrooks@blueshiftinc.com> - 2018-04-28 22:01 -0700
Re: Emulator Detection Antoine Vignau <antoine.vignau@laposte.net> - 2018-04-29 08:16 -0700
Re: Emulator Detection "Frank M." <frank_o_rama@hotmail.com> - 2018-03-14 21:23 -0700
Page 1 of 3 [1] 2 3 Next page →
| From | "Frank M." <frank_o_rama@hotmail.com> |
|---|---|
| Date | 2018-03-06 14:46 -0800 |
| Subject | Emulator Detection |
| Message-ID | <518989de-cd5a-4715-9f9f-5446cf4df1e5@googlegroups.com> |
Hi All! I have a use for being able to detect if a program is running under emulation. I found this presentation from Kfest and have a couple of questions. https://archive.org/details/EmulatorDetectionIn6502AssemblyKansasfest2014Presentation The code seems to count how many times the emulator "flies over" the data stream as it's presented to the emulator. Each emulator has a different speed that it emulates the disk hardware using, and the detector just calculates what that slowdown speed is, and links that to a specific emulator. 2. The code is written to work on a disk II. Can this method also work using a hard drive? I have only seen documentation for how the disk II rwts calls are made (c08c, etc) and am not sure how to make the same calls to a hard drive. ORG $300 SEC ; Emulator Detection Code CLD ; for slot 6-based Disk II CLI ; There must be a disk in the drive CLV LDX #$60 ; Slot 6 LDY #$00 LDA $C089,X ; Turn on motor LOOP1 LDA $C08C,X ; Read data BPL LOOP1 CMP #$DE ; There is 1 "DE" on track 0 sector 0 BNE LOOP1 LOOP2 LDA $C08C,X BPL LOOP2 CMP #$AA ; There is 1 "AA" on track 0 sector 0 BNE LOOP1 LOOP3 LDA $C08C,X BPL LOOP3 LOOP4 LDA $C08C,X BPL LOOP4 CMP #$FF ; There are 5 "FF"s on track 0 sector 0 BNE DONE INY BNE LOOP4 DONE STY $B6FC ; Output in location 46844 / PEEK (46844) LDA $C088,X ; turn off motor RTS The basic program shows these timings... (reordered low to high) I'm assuming that lower numbers = faster virtual drive access. Is this true? Virtual II, for one, seems to have correct-ish disk ii speeds, while has basically zero waiting for hard drive access. AppleWin seems to be faithful for both. Wondering if this would also be a problem for detecting it via hard drive. 80 IF X = 7 THEN PRINT "WELCOME MESS USER": END 30 IF X = 19 THEN PRINT "WELCOME VIRTUAL ][ USER": END 60 IF X = 21 THEN PRINT "WELCOME KEGS/ACTIVEGS/GSPORT USER": END 20 IF X = 27 THEN PRINT "WELCOME APPLEWIN USER": END 70 IF X = 30 THEN PRINT "WELCOME OPENEMULATOR USER": END 40 IF X = 33 THEN PRINT "WELCOME SWEET16 USER": END 50 IF X = 49 THEN PRINT "WELCOME JACE USER": END 90 PRINT "REAL HARDWARE OR UNKNOWN EMULATOR" Frank
[toc] | [next] | [standalone]
| From | "Frank M." <frank_o_rama@hotmail.com> |
|---|---|
| Date | 2018-03-06 19:03 -0800 |
| Message-ID | <19fbe230-b939-4b42-8069-37dd42841c69@googlegroups.com> |
| In reply to | #4287 |
The above code works with the Kfest disk image in the virtual disk II drive. On the image it's loaded to $0800 with the initial boot sector that's loaded by the disk II controller ROM. I updated the disassembly with my labels and comments. The BASIC program does X = PEEK(46844)/$B6FC which I didn't include. f
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2018-03-07 01:07 -0800 |
| Message-ID | <a85398dc-0253-40f3-bd49-bbf36c7cd0ff@googlegroups.com> |
| In reply to | #4289 |
On Tuesday, March 6, 2018 at 9:03:23 PM UTC-6, Frank M. wrote: > The above code works with the Kfest disk image in the virtual disk II drive. On the image it's loaded to $0800 with the initial boot sector that's loaded by the disk II controller ROM. I updated the disassembly with my labels and comments. > > The BASIC program does X = PEEK(46844)/$B6FC which I didn't include. > > f I can confirm it works with Sweet16. With Mac version of GSPort, it alternates between being recognized and unknown emulator, with alternating values of 21 and 6. Would have been nice to see what real hardware values are to compare to. I don't have any real hardware set up right now.
[toc] | [prev] | [next] | [standalone]
| From | "Frank M." <frank_o_rama@hotmail.com> |
|---|---|
| Date | 2018-03-07 07:18 -0800 |
| Message-ID | <32c58d01-4814-4f48-a5bb-866115632329@googlegroups.com> |
| In reply to | #4293 |
Since the program is only counting how many times "FF" shows up in the read stream, on real hardware I would expect that to be 5. Emulators present this value faster than the program can read it, so it takes multiple passes through track 0 sector 0 to sense the FF, hence numbers higher than 5. I haven't tried it on actual hardware though. Does booting from the archive.org floppy give different results than my included disassembly? On Virtual II for me it always returns the same number (19). I tried to setup the same state, but there are other instructions on track 0, sector 0 that I may be missing. Also note, if you run CATALOG or other disk command you will change the value, as the head is no longer on track 0 sector 0 as it would be when you boot up. (the archive.org disk is designed to be booted from--My goal is to repurpose this code and method for virtual hard drive or CFFA/Floppy Emu). F On Wednesday, March 7, 2018 at 1:07:08 AM UTC-8, gid...@sasktel.net wrote: > > Would have been nice to see what real hardware values are to compare to. I don't have any real hardware set up right now.
[toc] | [prev] | [next] | [standalone]
| From | TomCh <tomcharlesworth26@gmail.com> |
|---|---|
| Date | 2018-03-07 12:53 -0800 |
| Message-ID | <77a66608-d9f4-4d86-82f4-fc9459cad170@googlegroups.com> |
| In reply to | #4296 |
On Wednesday, March 7, 2018 at 3:18:39 PM UTC, Frank M. wrote: > Since the program is only counting how many times "FF" shows up in the read stream, on real hardware I would expect that to be 5. Emulators present this value faster than the program can read it, so it takes multiple passes through track 0 sector 0 to sense the FF, hence numbers higher than 5. I haven't tried it on actual hardware though. > > Does booting from the archive.org floppy give different results than my included disassembly? On Virtual II for me it always returns the same number (19). I tried to setup the same state, but there are other instructions on track 0, sector 0 that I may be missing. > > Also note, if you run CATALOG or other disk command you will change the value, as the head is no longer on track 0 sector 0 as it would be when you boot up. (the archive.org disk is designed to be booted from--My goal is to repurpose this code and method for virtual hard drive or CFFA/Floppy Emu). > > F > > > On Wednesday, March 7, 2018 at 1:07:08 AM UTC-8, gid...@sasktel.net wrote: > > > > Would have been nice to see what real hardware values are to compare to. I don't have any real hardware set up right now. re. AppleWin As Steve says, it'll return either 6 (gap2 between addr epilogue & data prologue) or 75 (gap3+gap1 = 27+48) at the end->start of the track. Of course this is for a .dsk (or .po or .do) and not a .nib image. AppleWin will consistently give these numbers. It has a buffer of disk nibbles, and just returns the next nibble when you read $C0EC... irrespective of the number of cycles between accesses(*). (*) Actually this is the default (ie. Disk Access Speed = Enhance Speed). When using Disk Access Speed = Authentic Speed, then there's some crude rotation emulation which will advance the nibble buffer's index by 1 for every 32 cycles between accesses. NB. The above is correct for AppleWin 1.27.0.0, but shouldn't be relied on for any future versions! Tom
[toc] | [prev] | [next] | [standalone]
| From | "Frank M." <frank_o_rama@hotmail.com> |
|---|---|
| Date | 2018-03-07 13:24 -0800 |
| Message-ID | <e29fde9f-abad-43c9-9e9d-ebef98edbd95@googlegroups.com> |
| In reply to | #4298 |
Gotcha. Interesting. The disk must be relying on the rotation being in a certain position when the test loop is run. It does some other disk commands before calling the subroutine, and the motor has already been turned on. Any way to sense this using virtual mass storage? I don't know the code to read from slot 7. Do you need the "motor on" command to do a read? Not sure I understand how mass storage devices work in regards to that. F
[toc] | [prev] | [next] | [standalone]
| From | Antoine Vignau <antoine.vignau@laposte.net> |
|---|---|
| Date | 2018-03-08 04:42 -0800 |
| Message-ID | <0ce6b970-68ee-40df-96e8-aadeb2689ff6@googlegroups.com> |
| In reply to | #4299 |
You assume a dos 3.3 formatted disk. what if I write more FF/10 than the 5 described above? 5 is the value for the head to be in sync.
[toc] | [prev] | [next] | [standalone]
| From | Tom Porter <laseractiveguy@gmail.com> |
|---|---|
| Date | 2018-03-08 07:41 -0800 |
| Message-ID | <269223a2-f05c-44f4-95b6-ae73a6ce7a18@googlegroups.com> |
| In reply to | #4301 |
I've been thinking about how to detect an emulator for copy protection purposes... didn't think it was possible... wowzers this is great!
[toc] | [prev] | [next] | [standalone]
| From | Tom Porter <laseractiveguy@gmail.com> |
|---|---|
| Date | 2018-03-08 07:46 -0800 |
| Message-ID | <6efc6474-c48f-425e-82b1-1ecc62183ed5@googlegroups.com> |
| In reply to | #4302 |
I do not know what I am doing most of the time... but here... BPL LOOP2 CMP #$AA ; There is 1 "AA" on track 0 sector 0 BNE LOOP1 LOOP3 LDA $C08C,X shouldn't that be BNE LOOP2?
[toc] | [prev] | [next] | [standalone]
| From | Tom Porter <laseractiveguy@gmail.com> |
|---|---|
| Date | 2018-03-08 08:55 -0800 |
| Message-ID | <3a7db933-18ba-4572-a34c-3d336a06a441@googlegroups.com> |
| In reply to | #4303 |
I got the program working and it tests 6 or 75 with AppleWIN depending on drive speed settings. Checked with IIE plat with both the A2Heaven SD Floppy and 5.25 Disk Drive returns "0"... is that right? I transferred the program over 3 times to make sure I did it correctly. I did have one non "0" reading when I first did it but flicked thru the code/screens so fast I don't remember what that was. Then I thought I corrupted the code, so kept transferring it over, on the emulator it still shows its numbers.
[toc] | [prev] | [next] | [standalone]
| From | Steve Nickolas <usotsuki@buric.co> |
|---|---|
| Date | 2018-03-07 05:49 -0500 |
| Message-ID | <alpine.BSF.2.02.1803070543540.53959@frieza.hoshinet.org> |
| In reply to | #4287 |
I punched it in and half the time AppleWin gives me 6, with an occasional 75. XD My results with other emulators: ApplePC gives me 8 with the occasional 72. Modapple alternates between 5 and 6 with the occasional 0. MAME goes 5 31 30 0, with the occasional stray 31. Agat Emulator alternates (mostly) between 6 and 16 with the occasional 0. -uso.
[toc] | [prev] | [next] | [standalone]
| From | Mark Pilgrim <markpilgrimfastmail@gmail.com> |
|---|---|
| Date | 2018-03-08 10:21 -0800 |
| Message-ID | <bf30f4ba-598b-4b6e-9131-8749cc32e4a4@googlegroups.com> |
| In reply to | #4287 |
On Tuesday, March 6, 2018 at 5:46:40 PM UTC-5, Frank M. wrote: > Hi All! > > I have a use for being able to detect if a program is running under emulation. I found this presentation from Kfest and have a couple of questions. > > https://archive.org/details/EmulatorDetectionIn6502AssemblyKansasfest2014Presentation Oh hi, I am the author of this demo. > The code seems to count how many times the emulator "flies over" the data stream as it's presented to the emulator. Each emulator has a different speed that it emulates the disk hardware using, and the detector just calculates what that slowdown speed is, and links that to a specific emulator. No, it is counting the number of sync nibbles between the address field and the data field. These nibbles do not exist on a .dsk image (which only stores sector data), so emulators must recreate them. It turns out that each emulator recreates them slightly differently. > 2. The code is written to work on a disk II. Can this method also work using a hard drive? I have only seen documentation for how the disk II rwts calls are made (c08c, etc) and am not sure how to make the same calls to a hard drive. I don't know what hard drives look like at the bit or nibble level. There are copy protection routines that act on 3.5-inch disks, including weak/floating bytes (Rastan GS) and misplaced timing bits (Rampage //c), so maybe code could be written to operate on hard drive images. I've never tried it. > I'm assuming that lower numbers = faster virtual drive access. Is this true? No, the number it returns is the number of $FF nibbles after the address field epilogue and before the data field prologue. Also, in response to someone else's question, the original demo disk runs the routine during the boot process of a standard DOS 3.3 disk, after the boot1 code on sector 0 has loaded the 9 sectors of RWTS code into memory. So the head of the drive is always at a specific place on track 0 (having just finished reading sector 0 for the second time), so the results are consistent. Your standalone program might catch the drive head anywhere on the track, so the string of $FF nibbles it finds might be anywhere -- after the address epilogue (like the original demo), after the data epilogue (higher numbers), or at the end of a track (possibly even higher numbers). To reproduce the results of the original demo disk, you would need to call something like $B944 (to search for and parse the next available address field) in order to position the drive head so the next thing it reads is the nibbles after address epilogue. Hope this helps. -Mark
[toc] | [prev] | [next] | [standalone]
| From | "Frank M." <frank_o_rama@hotmail.com> |
|---|---|
| Date | 2018-03-08 22:41 -0800 |
| Message-ID | <8e4008eb-5b60-4af3-84bf-ffbf868d76aa@googlegroups.com> |
| In reply to | #4305 |
Thanks for chiming in Mark. It's very helpful. I just spent some time reading about the sync bytes and the Disk II. Doesn't look like a hard drive-based method would work, as all of this interleaving/sync bytes/etc is because the Disk II hardware relies on software to work properly. For what it's worth, the code below seems to provide a working output under either DOS 3.3 or ProDOS, with either a DOS 3.3 or ProDOS disk in drive 1. Unfortunately, not relevant to my application, but thought the code might be of use to someone else. Frank * * Emulator Detection Code * for slot 6-based Disk II * There must be a disk in the drive * (Can be either DOS 3.3 or ProDOS format) * Works under DOS 3.3 and ProDOS * Code to be pasted into Merlin (8) v2.33 * * Output is at $03CF: * $07/ 7 = MESS * $13/19 = VIRTUAL ][ * $15/21 = KEGS/ACTIVEGS/GSPORT * $1B/27 = APPLEWIN * $1E/30 = OPENEMULATOR * $21/33 = SWEET16 * $31/49 = JACE USER * ANY OTHER VALUE = REAL HARDWARE OR UNKNOWN EMULATOR * ORG $300 LDX #$60 ; Slot 6 LDY #$00 LDA $C089,X ; Turn on motor LDA #$FF JSR $FCA8 ; DELAY based on accumulator JSR RDADR16 ; Wait for sync bytes LOOP1 LDA $C08C,X ; Read data BPL LOOP1 CMP #$DE ; Find closing byte #1 BNE LOOP1 LOOP2 LDA $C08C,X BPL LOOP2 CMP #$AA ; Find closing byte #2 BNE LOOP1 LOOP3 LDA $C08C,X ; Loop to count number of $FF nibbles BPL LOOP3 LOOP4 LDA $C08C,X ; after the address field epilogue BPL LOOP4 CMP #$FF ; and before the data field prologue BNE DONE INY BNE LOOP4 DONE STY $03CF ; Output in location 975 / PEEK (975) LDA $C088,X ; turn off motor RTS * * The below section is taken from DOS 3.3 source code * For the RDADR16 routine located at $B944 * (Needed for ProDOS) * COUNT EQU $26 ; 'MUST FIND' COUNT. AKA GBASL LAST EQU $26 ; 'ODD BIT' NIBLS. AKA HBASL CSUM EQU $27 ; CHECKSUM BYTE. CSSTV EQU $2C ; FOUR BYTES, * CHECKSUM, SECTOR, TRACK, AND VOLUME. Q6L EQU $C08C DELAY EQU $FCA8 * RDERR SEC ;INDICATE 'ERROR EXIT'. RTS ;RETURN FROM READ16 OR RDADR16. RDADR16 LDY #$FC ; AKA $B944 under DOS 3.3 STY COUNT 'MUST FIND' COUNT. RDASYN INY BNE RDA1 ;LOW ORDER OF COUNT. INC COUNT ;(2K NIBLS TO FIND BEQ RDERR ;ADR MARK, ELSE ERR) RDA1 LDA Q6L,X ;READ NIBL. BPL RDA1 ;*** NO PAGE CROSS! *** RDASN1 CMP #$D5 ;ADR MARK 1? BNE RDASYN ;(LOOP IF NOT) NOP ;ADDED NIBL DELAY. RDA2 LDA Q6L,X BPL RDA2 ;*** NO PAGE CROSS! *** CMP #$AA ;ADR MARK 2? BNE RDASN1 ;(IF NOT, IS IT AM1?) LDY #$3 ;INDEX FOR 4-BYTE READ. * (ADDED NIBL DELAY) RDA3 LDA Q6L,X BPL RDA3 ;*** NO PAGE CROSS! *** CMP #$96 ;ADR MARK 3? BNE RDASN1 ;(IF NOT, IS IT AM1?) * (LEAVES CARRY SET!) LDA #$0 INIT CHECKSUM. RDAFLD STA CSUM RDA4 LDA Q6L,X ;READ 'ODD BIT' NIBL. BPL RDA4 ;*** NO PAGE CROSS! *** ROL ;(Accum) ALIGN ODD BITS, '1' INTO LSB. STA LAST ;(SAVE THEM) RDA5 LDA Q6L,X ;READ 'EVEN BIT' NIBL. BPL RDA5 ;*** NO PAGE CROSS! *** AND LAST ;MERGE ODD AND EVEN BITS. STA CSSTV,Y ;STORE DATA BYTE. EOR CSUM ;XOR CHECKSUM. DEY BPL RDAFLD ;LOOP ON 4 DATA BYTES. TAY ;IF FINAL CHECKSUM BNE RDERR ;NONZERO, THEN ERROR. RDA6 LDA Q6L,X ;FIRST BIT-SLIP NIBL. BPL RDA6 ;*** NO PAGE CROSS! *** CMP #$DE BNE RDERR ;ERROR IF NONMATCH. NOP ;DELAY BETWEEN NIBLS. RDA7 LDA Q6L,X ;SECOND BIT-SLIP NIBL. BPL RDA7 ;*** NO PAGE CROSS! *** CMP #$AA BNE RDERR ;ERROR IF NONMATCH. RDEXIT CLC ;CLEAR CARRY ON RTS ;NORMAL READ EXITS. or CALL-151 300:A2 60 A0 00 BD 89 C0 A9 308:FF 20 A8 FC 20 3B 03 BD 310:8C C0 10 FB C9 DE D0 F7 318:BD 8C C0 10 FB C9 AA D0 320:EE BD 8C C0 10 FB BD 8C 328:C0 10 FB C9 FF D0 03 C8 330:D0 F4 8C CF 03 BD 88 C0 338:60 38 60 A0 FC 84 26 C8 340:D0 04 E6 26 F0 F3 BD 8C 348:C0 10 FB C9 D5 D0 F0 EA 350:BD 8C C0 10 FB C9 AA D0 358:F2 A0 03 BD 8C C0 10 FB 360:C9 96 D0 E7 A9 00 85 27 368:BD 8C C0 10 FB 2A 85 26 370:BD 8C C0 10 FB 25 26 99 378:2C 00 45 27 88 10 E7 A8 380:D0 B7 BD 8C C0 10 FB C9 388:DE D0 AE EA BD 8C C0 10 390:FB C9 AA D0 A4 18 60 300G 3CF
[toc] | [prev] | [next] | [standalone]
| From | MG <michael@apps.guidero.us> |
|---|---|
| Date | 2018-03-10 13:24 -0800 |
| Message-ID | <1f077ebc-4478-4819-87e7-72ff8d386f06@googlegroups.com> |
| In reply to | #4309 |
On Thursday, March 8, 2018 at 10:41:47 PM UTC-8, Frank M. wrote: > Doesn't look like a hard drive-based method would work, as all of this interleaving/sync bytes/etc is because the Disk II hardware relies on software to work properly. There are other ways to detect various emulators, either because they implement a de-facto standard for identifying them, or because almost none of them get the hardware I/O page exactly right. https://github.com/mgcaret/davex-mg-utils/blob/master/idemu.s That only supports a few emulators that I've actually tried. Others may be added. MG
[toc] | [prev] | [next] | [standalone]
| From | Zellyn <zellyn@gmail.com> |
|---|---|
| Date | 2018-03-11 14:21 -0700 |
| Message-ID | <e34e31b8-e8f2-49f2-9de5-f5260c9a0555@googlegroups.com> |
| In reply to | #4313 |
On Saturday, March 10, 2018 at 4:24:59 PM UTC-5, MG wrote: > There are other ways to detect various emulators, either because they implement a de-facto standard for identifying them, or because almost none of them get the hardware I/O page exactly right. > > https://github.com/mgcaret/davex-mg-utils/blob/master/idemu.s Hmmm. My a2audit project should eliminate that method eventually :-) https://github.com/zellyn/a2audit Zellyn
[toc] | [prev] | [next] | [standalone]
| From | qkumba <peter.ferrie@gmail.com> |
|---|---|
| Date | 2018-03-11 14:50 -0700 |
| Message-ID | <049b32e2-e298-452e-940b-8083dc15b7db@googlegroups.com> |
| In reply to | #4305 |
> No, the number it returns is the number of $FF nibbles after the address field epilogue and before the data field prologue. Actually, it's after the data field epilogue of the next sector and before the address field prologue of the sector after that, because the denibbilisation causes the next sector data to be reached part-way in before the epilogue is polled.
[toc] | [prev] | [next] | [standalone]
| From | "Frank M." <frank_o_rama@hotmail.com> |
|---|---|
| Date | 2018-03-11 22:02 -0700 |
| Message-ID | <636c9de5-d242-4072-afbf-8ff61bed9c6f@googlegroups.com> |
| In reply to | #4317 |
For what it's worth, I removed a couple sections of the DOS 3.3 routine on qkumba's suggestion. It seems to be returning pretty constant values based on what emulator it's in. Again, requires a disk II (real or otherwise) to function. I also added a 0.6 second wait for actual hardware to spin up once the motor has been turned on. Unfortunately not seeing consistent results on a real A2, but didn't see any of the emulator values I tested in 30 or so iterations. F * * Emulator Detection Code * for slot 6-based Disk II * There must be a disk in the drive * (Can be either DOS 3.3 or ProDOS format) * Code works under DOS 3.3 or ProDOS * Code to be pasted into Merlin (8) v2.33 * * Output is at $03CF: * $05/ 5 = SWEET16 * $06/ 6 = APPLEWIN * $07/ 7 = VIRTUAL ][ * $00,$01,$02,$03,$09 ? = REAL HARDWARE * $XX/ ? = MESS * $XX/ ? = KEGS/ACTIVEGS/GSPORT * $XX/ ? = OPENEMULATOR * $XX/ ? = JACE * ANY OTHER VALUE = REAL HARDWARE OR UNKNOWN EMULATOR * ORG $300 LDX #$60 ; Slot 6 LDY #$00 LDA $C089,X ; Turn on motor LDA #$05 ; do WAIT 6 times STA $26 WAIT LDA #$C6 JSR $FCA8 ; WAIT = .1 sec each time DEC $26 LDA $26 CMP #$00 ; done waiting 0.6 seconds for drive to spin up BNE WAIT JSR RDADR16 ; Wait for sync bytes LOOP1 LDA $C08C,X ; Read data BPL LOOP1 CMP #$DE ; Find closing byte #1 BNE LOOP1 LOOP2 LDA $C08C,X BPL LOOP2 CMP #$AA ; Find closing byte #2 BNE LOOP1 LOOP3 LDA $C08C,X ; Loop to count number of $FF nibbles BPL LOOP3 LOOP4 LDA $C08C,X ; after the address field epilogue BPL LOOP4 CMP #$FF ; and before the data field prologue BNE DONE INY BNE LOOP4 DONE STY $03CF ; Output in location 975 / PEEK(975) LDA $C088,X ; turn off motor RTS * * The below section is taken from DOS 3.3 source code * For the RDADR16 routine located at $B944 * COUNT EQU $26 ; 'MUST FIND' COUNT. AKA GBASL LAST EQU $26 ; 'ODD BIT' NIBLS. AKA HBASL CSUM EQU $27 ; CHECKSUM BYTE. CSSTV EQU $2C ; FOUR BYTES, * CHECKSUM, SECTOR, TRACK, AND VOLUME. Q6L EQU $C08C DELAY EQU $FCA8 * RDERR SEC ;INDICATE 'ERROR EXIT'. RTS ;RETURN FROM READ16 OR RDADR16. RDADR16 LDY #$FC ; AKA $B944 under DOS 3.3 STY COUNT 'MUST FIND' COUNT. RDASYN INY BNE RDA1 ;LOW ORDER OF COUNT. INC COUNT ;(2K NIBLS TO FIND BEQ RDERR ;ADR MARK, ELSE ERR) RDA1 LDA Q6L,X ;READ NIBL. BPL RDA1 ;*** NO PAGE CROSS! *** RDASN1 CMP #$D5 ;ADR MARK 1? BNE RDASYN ;(LOOP IF NOT) NOP ;ADDED NIBL DELAY. RDA2 LDA Q6L,X BPL RDA2 ;*** NO PAGE CROSS! *** CMP #$AA ;ADR MARK 2? BNE RDASN1 ;(IF NOT, IS IT AM1?) LDY #$3 ;INDEX FOR 4-BYTE READ. * (ADDED NIBL DELAY) RDA3 LDA Q6L,X BPL RDA3 ;*** NO PAGE CROSS! *** CMP #$96 ;ADR MARK 3? BNE RDASN1 ;(IF NOT, IS IT AM1?) * (LEAVES CARRY SET!) LDA #$0 INIT CHECKSUM. RDAFLD STA CSUM RDA4 LDA Q6L,X ;READ 'ODD BIT' NIBL. BPL RDA4 ;*** NO PAGE CROSS! *** ROL ;(Accum) ALIGN ODD BITS, '1' INTO LSB. STA LAST ;(SAVE THEM) RDA5 LDA Q6L,X ;READ 'EVEN BIT' NIBL. BPL RDA5 ;*** NO PAGE CROSS! *** AND LAST ;MERGE ODD AND EVEN BITS. STA CSSTV,Y ;STORE DATA BYTE. EOR CSUM ;XOR CHECKSUM. DEY BPL RDAFLD ;LOOP ON 4 DATA BYTES. TAY ;IF FINAL CHECKSUM BNE RDERR ;NONZERO, THEN ERROR. * * This section is commented out from original DOS 3.3 source * Read address epilogue FFs, not data epilogue FFs * *RDA6 LDA Q6L,X ;FIRST BIT-SLIP NIBL. * BPL RDA6 ;*** NO PAGE CROSS! *** * CMP #$DE * BNE RDERR ;ERROR IF NONMATCH. * NOP ;DELAY BETWEEN NIBLS. *RDA7 LDA Q6L,X ;SECOND BIT-SLIP NIBL. * BPL RDA7 ;*** NO PAGE CROSS! *** * CMP #$AA * BNE RDERR ;ERROR IF NONMATCH. * RDEXIT CLC ;CLEAR CARRY ON RTS ;NORMAL READ EXITS. On Sunday, March 11, 2018 at 2:50:16 PM UTC-7, qkumba wrote: > > No, the number it returns is the number of $FF nibbles after the address field epilogue and before the data field prologue. > > Actually, it's after the data field epilogue of the next sector and before the address field prologue of the sector after that, because the denibbilisation causes the next sector data to be reached part-way in before the epilogue is polled.
[toc] | [prev] | [next] | [standalone]
| From | TomCh <tomcharlesworth26@gmail.com> |
|---|---|
| Date | 2018-03-12 13:25 -0700 |
| Message-ID | <dfc2f8a2-cf7a-40bb-8f17-b234dbd9d5e8@googlegroups.com> |
| In reply to | #4317 |
On Sunday, March 11, 2018 at 9:50:16 PM UTC, qkumba wrote: > > No, the number it returns is the number of $FF nibbles after the address field epilogue and before the data field prologue. > > Actually, it's after the data field epilogue of the next sector and before the address field prologue of the sector after that, because the denibbilisation causes the next sector data to be reached part-way in before the epilogue is polled. Unless it's an emulator like AppleWin :) ...where the disk only spins when you access $C0EC.
[toc] | [prev] | [next] | [standalone]
| From | "Frank M." <frank_o_rama@hotmail.com> |
|---|---|
| Date | 2018-03-11 22:19 -0700 |
| Message-ID | <da59849b-6d13-48e7-8669-1d0947ee0044@googlegroups.com> |
| In reply to | #4287 |
Thanks for the tip MG. I looked into location $C04F and it seemed to have interesting behavior for testing emulators.
$C04F - I/O [reserved location] ("de-facto standard among IIgs emulators")
LDA $C04F seems to always return:
$00 - Virtual II
$30 - Sweet16
AppleWin + real hardware fluctuates (floating bus). You can see the bus fluctuations by entering the following short program...
CALL-151
300:AD 4F c0 20 ED FD 4C 00 03
300G
Probably returning similar values to the "vapor lock" method of detecting the vertical blank period. Not tested on any other emulators, so feedback would be appreciated.
Both Virtual II & Sweet16 totally mess up mass storage emulation, which was what I wanted to detect in the first place.
F
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2018-03-12 10:17 -0700 |
| Message-ID | <9f23ca3b-ad90-4c75-bcc5-7b8d0929b418@googlegroups.com> |
| In reply to | #4319 |
On Sunday, March 11, 2018 at 11:19:13 PM UTC-6, Frank M. wrote:
> Thanks for the tip MG. I looked into location $C04F and it seemed to have interesting behavior for testing emulators.
>
>
> $C04F - I/O [reserved location] ("de-facto standard among IIgs emulators")
>
>
> LDA $C04F seems to always return:
>
> $00 - Virtual II
> $30 - Sweet16
>
> AppleWin + real hardware fluctuates (floating bus). You can see the bus fluctuations by entering the following short program...
>
> CALL-151
> 300:AD 4F c0 20 ED FD 4C 00 03
> 300G
>
> Probably returning similar values to the "vapor lock" method of detecting the vertical blank period. Not tested on any other emulators, so feedback would be appreciated.
>
>
> Both Virtual II & Sweet16 totally mess up mass storage emulation, which was what I wanted to detect in the first place.
>
> F
Detecting emulators would be kind of redundant unless every little idiosyncracy
is logged for every problem that happens within each emulator.
Is there a plan to use this code for work-arounds in certain emulators?
I would like to see a list of issues that break the code under each emulator.
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | comp.sys.apple2.programmer
csiph-web