Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #4309

Re: Emulator Detection

Newsgroups comp.sys.apple2.programmer
Date 2018-03-08 22:41 -0800
References <518989de-cd5a-4715-9f9f-5446cf4df1e5@googlegroups.com> <bf30f4ba-598b-4b6e-9131-8749cc32e4a4@googlegroups.com>
Message-ID <8e4008eb-5b60-4af3-84bf-ffbf868d76aa@googlegroups.com> (permalink)
Subject Re: Emulator Detection
From "Frank M." <frank_o_rama@hotmail.com>

Show all headers | View raw


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

Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web