Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

* UNIX is a Trademark of Bell Laboratories.


computers / comp.sys.apple2 / Re: Question about Disk II Emulation (.woz, .dsk, ...)

SubjectAuthor
* Question about Disk II Emulation (.woz, .dsk, ...)Jens Gaulke
+* Re: Question about Disk II Emulation (.woz, .dsk, ...)David Schmidt
|`- Re: Question about Disk II Emulation (.woz, .dsk, ...)Jens Gaulke
+* Re: Question about Disk II Emulation (.woz, .dsk, ...)Michael 'AppleWin Debugger Dev'
|`- Re: Question about Disk II Emulation (.woz, .dsk, ...)Jens Gaulke
+- Re: Question about Disk II Emulation (.woz, .dsk, ...)Michael 'AppleWin Debugger Dev'
`* Re: Question about Disk II Emulation (.woz, .dsk, ...)mmphosis
 +- Re: Question about Disk II Emulation (.woz, .dsk, ...)Michael 'AppleWin Debugger Dev'
 +- Re: Question about Disk II Emulation (.woz, .dsk, ...)scott
 `- Re: Question about Disk II Emulation (.woz, .dsk, ...)Jens Gaulke

1
Question about Disk II Emulation (.woz, .dsk, ...)

<0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5103&group=comp.sys.apple2#5103

 copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a0c:e253:0:b0:537:6bb8:63d3 with SMTP id x19-20020a0ce253000000b005376bb863d3mr153766qvl.54.1676875943232;
Sun, 19 Feb 2023 22:52:23 -0800 (PST)
X-Received: by 2002:a0c:ab44:0:b0:53c:2e3c:e4d6 with SMTP id
i4-20020a0cab44000000b0053c2e3ce4d6mr108031qvb.19.1676875942924; Sun, 19 Feb
2023 22:52:22 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Sun, 19 Feb 2023 22:52:22 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=193.159.12.99; posting-account=4TUghwoAAABnyztYvJrWTUS8WXFc5m26
NNTP-Posting-Host: 193.159.12.99
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
Subject: Question about Disk II Emulation (.woz, .dsk, ...)
From: jegal...@gmail.com (Jens Gaulke)
Injection-Date: Mon, 20 Feb 2023 06:52:23 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1890
 by: Jens Gaulke - Mon, 20 Feb 2023 06:52 UTC

Hi there,

I'm writing an Apple II Emulator. It boots up perfectly and enters Applesoft. Basic Programs are working fine. To test the sound and graphics, I want to emulate a Disk Drive to be able to load some of the old games and I am quite confused at the moment.

I found out during boot up the Disk II firmware makes heavy use of softswitches - so far, so good.

Where I am stuck is: How do I get a "disk image" in my emulation? Which format must it have? Woz? DSK? Up to know I know "that these formats exist". How can I deal with these formats? What do I have to consider?

How do I "read out" these images to satisfy the emulation and give it the bytes it wants to make the boot up complete?

I don't want just to look up someone else's source code - I want to understand at an more abstract level, what's really going on and start a conversation on this topic.

Cheers,
Jens

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<tsvvko$piai$1@dont-email.me>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5107&group=comp.sys.apple2#5107

 copy link   Newsgroups: comp.sys.apple2
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: schmi...@my-deja.com (David Schmidt)
Newsgroups: comp.sys.apple2
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
Date: Mon, 20 Feb 2023 09:21:12 -0500
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <tsvvko$piai$1@dont-email.me>
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 20 Feb 2023 14:21:12 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="d389f23d2c5804dbacf2db6287036da8";
logging-data="837970"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18DAz/W1tTLZKTupOKEdJTV+Ton9mNM05hd7/Bi35derw=="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.8.0
Cancel-Lock: sha1:WCtVFh3W0tgPvi1oVWL+b6O7Co8=
In-Reply-To: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
Content-Language: en-US
 by: David Schmidt - Mon, 20 Feb 2023 14:21 UTC

On 2/20/23 1:52 AM, Jens Gaulke wrote:
> Hi there,
>
> I'm writing an Apple II Emulator.
> [...]
> Where I am stuck is: How do I get a "disk image" in my emulation? Which format must it have? Woz? DSK? Up to know I know "that these formats exist". How can I deal with these formats? What do I have to consider?

I would start with what your goals are and work backwards from that.
The Disk II is an analog device at is core, and has various layers of
hardware, firmware, and software to decode the analog signal into a
stream of bits. You can insert your emulation at any level along that
spectrum, depending on the fidelity you are interested in achieving -
which will dictate the ultimate capabilities of your disk emulation (and
by extension, your emulator).

At one extreme is the ".dsk" which is only the bytes that the operating
system would ever present to a user; the data within all tracks and
sectors. A layer beneath that is the nibble stream, represented by the
decoded nibbles that are actually recorded on a disk; that affords you
access to all the in-band data and enveloping headers and trailers. And
beneath that is a ".woz" representation that defines lots more
meta-information about the recorded signals and their environment which
are important for encapsulating and decoding the many copy protection
schemes that were devised using the Disk II. That level of information
isn't available in any other encoding.

The place to start getting a complete understanding of the physical Disk
II ecosystem is Sather's seminal work, Understanding the Apple II (and
Apple IIe) - chapter 9, "The Disk Controller". That's every detail at
the bottom layer.

Sather's books (and more) are available here:
https://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Books/

The Woz specification is available here:
https://applesaucefdc.com/woz/reference2/

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<c51951f9-e622-48a4-8f4c-2305ec4f3742n@googlegroups.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5109&group=comp.sys.apple2#5109

 copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:6214:9cc:b0:56e:ab9d:6534 with SMTP id dp12-20020a05621409cc00b0056eab9d6534mr177022qvb.9.1676909352516;
Mon, 20 Feb 2023 08:09:12 -0800 (PST)
X-Received: by 2002:a0c:f24c:0:b0:571:91e:2e62 with SMTP id
z12-20020a0cf24c000000b00571091e2e62mr328443qvl.8.1676909352111; Mon, 20 Feb
2023 08:09:12 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Mon, 20 Feb 2023 08:09:11 -0800 (PST)
In-Reply-To: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:600:c67f:5fc0:d89:c2bb:22a:f5ef;
posting-account=9Dd-GgoAAAAjVgCPcBurQ6c4EXW6Wi8v
NNTP-Posting-Host: 2601:600:c67f:5fc0:d89:c2bb:22a:f5ef
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c51951f9-e622-48a4-8f4c-2305ec4f3742n@googlegroups.com>
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
From: michael....@gmail.com (Michael 'AppleWin Debugger Dev')
Injection-Date: Mon, 20 Feb 2023 16:09:12 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4776
 by: Michael 'AppleW - Mon, 20 Feb 2023 16:09 UTC

On Sunday, February 19, 2023 at 10:52:24 PM UTC-8, Jens Gaulke wrote:
> I'm writing an Apple II Emulator. It boots up perfectly and enters Applesoft. Basic Programs are working fine.

Gratulations on your emulator working! You are (mostly) over the hard/tedious part!

Usually emulation questions are handled over in comp.emulators.apple2 but I'll answer here for convenience.

> I found out during boot up the Disk II firmware makes heavy use of softswitches - so far, so good.

Eventually you will probably need to emulate the Logic State Sequencer (P6/P6A) PROM but for now you can skip it.
i.e.
http://mirrors.apple2.org.za/ground.icaen.uiowa.edu/Mirrors/uni-kl/hardware/diskIIcontroller_hardware

> Where I am stuck is: How do I get a "disk image" in my emulation?

First, the usual pre-requisite reading:

* Beneath Apple DOS (or the combined Beneath Apple DOS and Beneath Apple ProDOS 2020)
* Understanding the Apple II (or Understanding the Apple IIe)
* Tome of Copy Protection -- https://www.amazon.com/Copy-Protection-Bruce-Jones/dp/1387907271
* Be familiar with 4&4 encoding
* Be familiar with 6&2 encoding
* Know how to read nibbles from assembly language, i.e. https://stackoverflow.com/questions/69369122/apple-iie-6502-assembly-accessing-disk
* Optional: SWIM_Chip_Users_Ref_198801.pdf While this covers the IWM (Integrated Woz Machine in the IIgs) it has some useful diagrams.

I would start with:

* motor on/off
* track movement
* write sensor
* add .DSK reading support
* add .DSK writing support
* add .WOZ reading support
* add .WOZ writing support.

> Which format must it have? Woz? DSK?

You probably "need" .DSK and .WOZ since those will cover the majority of disk images. There are also .do and .po extensions but that only effects the logical <--> physical sector order.

You will need to keep track of a few things:

* motor on/off
* reading/writing state
* track number (eventually you need quarter track support but stick with integers for now)
* byte offset (eventually will be a bitstream offset)

For .DSK images when your emulator mounts a virtual image:

* Have a 35 tracks * 16 sector disk image buffer
* Whenever the disk head is moved to a new track build a virtual disk nibble trackr by denibblizing a track. This mean converting each 256 8-bit values back into the 342 6-bit values. This means filling in for each sector
* the FF sync byte gap, say 48 of them,
* the address field,
* another FF sync gap, say 6 bytes,
* the data field,
* the checksum, and
* another FF sync gap, say 27 bytes

* Then when $C0EC is accessed (assuming the motor is on and in read mode), return trackbuffer[ nibbleoffset++ & TRACK_BUFFER ]

This will fail most copy-protection since you aren't emulating any timing but this should let you boot most non-protected software.

> Up to know I know "that these formats exist". How can I deal with these formats? What do I have to consider?

Make sure your 6502 has accurate cycle emulation.

Eventually you will need to emulate the LSS, specifically at the microsecond level, for correctness. i.e. $C0ED will reset the LSS.
> How do I "read out" these images to satisfy the emulation and give it the bytes it wants to make the boot up complete?

See above.
> I don't want just to look up someone else's source code - I want to understand at an more abstract level, what's really going on and start a conversation on this topic.

Have you read the pre-requisite books?

Good luck!

m.

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<8380e023-3767-4a8f-9efc-17f02f60c913n@googlegroups.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5110&group=comp.sys.apple2#5110

 copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:ac8:4302:0:b0:3bd:7a9:400f with SMTP id z2-20020ac84302000000b003bd07a9400fmr231505qtm.7.1676913660602;
Mon, 20 Feb 2023 09:21:00 -0800 (PST)
X-Received: by 2002:a0c:f204:0:b0:571:942:1b13 with SMTP id
h4-20020a0cf204000000b0057109421b13mr859187qvk.78.1676913660332; Mon, 20 Feb
2023 09:21:00 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Mon, 20 Feb 2023 09:20:59 -0800 (PST)
In-Reply-To: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:600:c67f:5fc0:d89:c2bb:22a:f5ef;
posting-account=9Dd-GgoAAAAjVgCPcBurQ6c4EXW6Wi8v
NNTP-Posting-Host: 2601:600:c67f:5fc0:d89:c2bb:22a:f5ef
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8380e023-3767-4a8f-9efc-17f02f60c913n@googlegroups.com>
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
From: michael....@gmail.com (Michael 'AppleWin Debugger Dev')
Injection-Date: Mon, 20 Feb 2023 17:21:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2836
 by: Michael 'AppleW - Mon, 20 Feb 2023 17:20 UTC

Addendum:

When you are ready to dive in the LSS world of timing for 6-bit values (24 cycles), 7-bit values (28 cycles), 8-bit values (32 cycles), 9-bit values (36 cycles), and 10-bit values (40 cycles), or maybe just curious ...

qkumba has this most excellent write-up:

In Search of the Most Amazing Thing; or Towards a Universal Method to Defeat E7 Protection on the Apple ][ Platform
http://pferrie.epizy.com/papers/apple2_e7.pdf?i=1

HIGHLY recommend watching is Mark's Kansasfest videos. The first video is "mandatory", remaining are optional, but you will probably want to watch all of them:

Kansasfest 2015: Mark Pilgrim - E7 E7 E7 EE: the story of the greatest copy protection ever invented
https://archive.org/details/2015_Kfest_Pilgrim_Copy_Protection

Kansasfest 2016: Automated Verification of Copy-Protected Disk Images
https://www.youtube.com/watch?v=T9J_zCVLUjs

KansasFest 2017: Cracking at Scale – Mark Pilgrim
https://www.youtube.com/watch?v=tDVI0OV9e2w

Funny enough there was an OLD post from 1993 that briefly discussed the E7 E7 E7 protection and how to remove it for some games:

Copy protection of most 86-90 II programs
https://groups.google.com/g/comp.sys.apple2/c/3zdIhTxSqY4/m/IddZHUro20oJ

You may also be interested in the source code for Roland Gustaffson's famous RWTS18 where he stores **18 sectors** on a disk instead of the usual 16.
https://github.com/Michaelangel007/apple2_rwts18

Welcome to the rabbit hole of managing the LSS clock and state. =P

Cheers,
m.

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<mmphosis-1676924948@macgui.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5111&group=comp.sys.apple2#5111

 copy link   Newsgroups: comp.sys.apple2
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: mmpho...@macgui.com (mmphosis)
Newsgroups: comp.sys.apple2
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
Date: Mon, 20 Feb 2023 20:29:09 -0000 (UTC)
Organization: Mac GUI
Lines: 12
Message-ID: <mmphosis-1676924948@macgui.com>
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 20 Feb 2023 20:29:09 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="c2299dc87e3e2f6040ed686a4cccada7";
logging-data="916126"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZE3RSMOJwCoVdhGJQQS/F"
User-Agent: Mac GUI Usenet
Cancel-Lock: sha1:IBNmeJtx7stTANRJb+tMz6JaAi0=
In-Reply-To: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com>
 by: mmphosis - Mon, 20 Feb 2023 20:29 UTC

Other nasty protection schemes come to mind, ultimately they be defeated but
emulating edge cases is a challenge.

I've wondered how far those stepper motors could be pushed. Are we really
only limited to quarter tracks? Fractional tracking anyone?

https://pages.cpsc.ucalgary.ca/~aycock/ra/disk2.html

The spiral disk protection used on Choplifter gives a neat effect.

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<a5c950fe-98a6-419d-8b0a-f7bd3faec5dfn@googlegroups.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5112&group=comp.sys.apple2#5112

 copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a0c:b2ce:0:b0:56e:f5a2:f4bf with SMTP id d14-20020a0cb2ce000000b0056ef5a2f4bfmr228909qvf.45.1676926205022;
Mon, 20 Feb 2023 12:50:05 -0800 (PST)
X-Received: by 2002:a0c:f204:0:b0:571:942:1b13 with SMTP id
h4-20020a0cf204000000b0057109421b13mr939973qvk.78.1676926204718; Mon, 20 Feb
2023 12:50:04 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Mon, 20 Feb 2023 12:50:04 -0800 (PST)
In-Reply-To: <mmphosis-1676924948@macgui.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:600:c67f:5fc0:d89:c2bb:22a:f5ef;
posting-account=9Dd-GgoAAAAjVgCPcBurQ6c4EXW6Wi8v
NNTP-Posting-Host: 2601:600:c67f:5fc0:d89:c2bb:22a:f5ef
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com> <mmphosis-1676924948@macgui.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a5c950fe-98a6-419d-8b0a-f7bd3faec5dfn@googlegroups.com>
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
From: michael....@gmail.com (Michael 'AppleWin Debugger Dev')
Injection-Date: Mon, 20 Feb 2023 20:50:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2505
 by: Michael 'AppleW - Mon, 20 Feb 2023 20:50 UTC

On Monday, February 20, 2023 at 12:29:11 PM UTC-8, mmphosis wrote:
> I've wondered how far those stepper motors could be pushed. Are we really
> only limited to quarter tracks? Fractional tracking anyone?

John (from AppleSauce) commented in the AppleSauce slack channel which Tom copied into our this AppleWin issue: https://github.com/AppleWin/AppleWin/issues/930
"A track is never an integral number."

To expand upon that.

Technically there are infinite tracks due to the voltage of the stepper motors (a clever user could use PWM of the stepper motors for (relative) positioning) however for practical purposes there are only quarter tracks resolution due to the area of flux interference.

i.e. My understanding is that you can't write data with a smaller "width" then at the 1/2 track width. i.e. Data on Track 1 will have flux influencing tracks 0.75 and tracks 1.25. I can't recall who had a graph of this years ago? I would have thought the Applesauce Wiki had it but I guess not.
https://wiki.reactivemicro.com/Applesauce
> https://pages.cpsc.ucalgary.ca/~aycock/ra/disk2.html
> The spiral disk protection used on Choplifter gives a neat effect.

Neat link!

m.

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<Pl7JL.727765$gGD7.15139@fx11.iad>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5115&group=comp.sys.apple2#5115

 copy link   Newsgroups: comp.sys.apple2
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx11.iad.POSTED!not-for-mail
Sender: Scott Alfter <salfter@linode.members.linode.com>
From: sco...@alfter.diespammersdie.us
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
Newsgroups: comp.sys.apple2
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com> <mmphosis-1676924948@macgui.com>
Organization: USS Voyager NCC-74656, Delta Quadrant
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.88-gentoo-x86_64 (x86_64))
Lines: 18
Message-ID: <Pl7JL.727765$gGD7.15139@fx11.iad>
X-Complaints-To: https://www.astraweb.com/aup
NNTP-Posting-Date: Tue, 21 Feb 2023 17:39:59 UTC
Date: Tue, 21 Feb 2023 17:39:59 GMT
X-Received-Bytes: 1592
 by: sco...@alfter.diespammersdie.us - Tue, 21 Feb 2023 17:39 UTC

mmphosis <mmphosis@macgui.com> wrote:
> I've wondered how far those stepper motors could be pushed. Are we really
> only limited to quarter tracks? Fractional tracking anyone?

NEMA 17 motors in 3D printers are routinely driven by anywhere from 1/16
steps to 1/256 steps. This sort of fractional stepping, though, is produced
with dedicated stepper-motor controllers. If I remember right, two steps
span one track, with half-steps (quarter tracks) produced by turning
adjacent coils on. That's about as much control as you can get without
twiddling coils on the fly, and since just reading the disk takes the CPU's
full attention, I don't think there's time left to do more than
quarter-tracking.

--
_/_
/ v \ Scott Alfter (remove the obvious to send mail)
(IIGS( https://alfter.us/ Top-posting!
\_^_/ >What's the most annoying thing on Usenet?

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<36e53910-8f08-49b8-9cf4-62be3783b642n@googlegroups.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5122&group=comp.sys.apple2#5122

 copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:6214:5c45:b0:56e:9197:4ccd with SMTP id lz5-20020a0562145c4500b0056e91974ccdmr1303704qvb.0.1677078810593;
Wed, 22 Feb 2023 07:13:30 -0800 (PST)
X-Received: by 2002:a0c:f204:0:b0:571:942:1b13 with SMTP id
h4-20020a0cf204000000b0057109421b13mr1980994qvk.78.1677078810259; Wed, 22 Feb
2023 07:13:30 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Wed, 22 Feb 2023 07:13:30 -0800 (PST)
In-Reply-To: <tsvvko$piai$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:c1:d702:3f00:483f:b810:7262:8e6c;
posting-account=4TUghwoAAABnyztYvJrWTUS8WXFc5m26
NNTP-Posting-Host: 2003:c1:d702:3f00:483f:b810:7262:8e6c
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com> <tsvvko$piai$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <36e53910-8f08-49b8-9cf4-62be3783b642n@googlegroups.com>
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
From: jegal...@gmail.com (Jens Gaulke)
Injection-Date: Wed, 22 Feb 2023 15:13:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 49
 by: Jens Gaulke - Wed, 22 Feb 2023 15:13 UTC

On Monday, February 20, 2023 at 3:21:14 PM UTC+1, David Schmidt wrote:
> On 2/20/23 1:52 AM, Jens Gaulke wrote:
> > Hi there,
> >
> > I'm writing an Apple II Emulator.
> > [...]
> > Where I am stuck is: How do I get a "disk image" in my emulation? Which format must it have? Woz? DSK? Up to know I know "that these formats exist". How can I deal with these formats? What do I have to consider?
> I would start with what your goals are and work backwards from that.
> The Disk II is an analog device at is core, and has various layers of
> hardware, firmware, and software to decode the analog signal into a
> stream of bits. You can insert your emulation at any level along that
> spectrum, depending on the fidelity you are interested in achieving -
> which will dictate the ultimate capabilities of your disk emulation (and
> by extension, your emulator).
>
> At one extreme is the ".dsk" which is only the bytes that the operating
> system would ever present to a user; the data within all tracks and
> sectors. A layer beneath that is the nibble stream, represented by the
> decoded nibbles that are actually recorded on a disk; that affords you
> access to all the in-band data and enveloping headers and trailers. And
> beneath that is a ".woz" representation that defines lots more
> meta-information about the recorded signals and their environment which
> are important for encapsulating and decoding the many copy protection
> schemes that were devised using the Disk II. That level of information
> isn't available in any other encoding.
>
> The place to start getting a complete understanding of the physical Disk
> II ecosystem is Sather's seminal work, Understanding the Apple II (and
> Apple IIe) - chapter 9, "The Disk Controller". That's every detail at
> the bottom layer.
>
> Sather's books (and more) are available here:
> https://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Books/
>
> The Woz specification is available here:
> https://applesaucefdc.com/woz/reference2/

I have understood that so far, thank you for the explanation. What I have problems with is "You can insert your emulation at any level along that spectrum". I don't understand how I could write only one emulation for the dsk format when my emulator gives me one Disk II softswitch after another. Then don't I have to start at that level and edit/implement the softswitches?

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<df00c64b-e3dd-4575-bc74-0960e30caa0en@googlegroups.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5123&group=comp.sys.apple2#5123

 copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:6214:1a4e:b0:56c:235e:2840 with SMTP id fi14-20020a0562141a4e00b0056c235e2840mr1033183qvb.4.1677078966210;
Wed, 22 Feb 2023 07:16:06 -0800 (PST)
X-Received: by 2002:a05:620a:1d60:b0:73b:aa08:79ea with SMTP id
dm32-20020a05620a1d6000b0073baa0879eamr1044184qkb.5.1677078965885; Wed, 22
Feb 2023 07:16:05 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Wed, 22 Feb 2023 07:16:05 -0800 (PST)
In-Reply-To: <c51951f9-e622-48a4-8f4c-2305ec4f3742n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:c1:d702:3f00:483f:b810:7262:8e6c;
posting-account=4TUghwoAAABnyztYvJrWTUS8WXFc5m26
NNTP-Posting-Host: 2003:c1:d702:3f00:483f:b810:7262:8e6c
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com> <c51951f9-e622-48a4-8f4c-2305ec4f3742n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <df00c64b-e3dd-4575-bc74-0960e30caa0en@googlegroups.com>
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
From: jegal...@gmail.com (Jens Gaulke)
Injection-Date: Wed, 22 Feb 2023 15:16:06 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Jens Gaulke - Wed, 22 Feb 2023 15:16 UTC

On Monday, February 20, 2023 at 5:09:13 PM UTC+1, Michael 'AppleWin Debugger Dev' wrote:
> On Sunday, February 19, 2023 at 10:52:24 PM UTC-8, Jens Gaulke wrote:
> > I'm writing an Apple II Emulator. It boots up perfectly and enters Applesoft. Basic Programs are working fine.
> Gratulations on your emulator working! You are (mostly) over the hard/tedious part!
>
> Usually emulation questions are handled over in comp.emulators.apple2 but I'll answer here for convenience.
> > I found out during boot up the Disk II firmware makes heavy use of softswitches - so far, so good.
> Eventually you will probably need to emulate the Logic State Sequencer (P6/P6A) PROM but for now you can skip it.
> i.e.
> http://mirrors.apple2.org.za/ground.icaen.uiowa.edu/Mirrors/uni-kl/hardware/diskIIcontroller_hardware
> > Where I am stuck is: How do I get a "disk image" in my emulation?
> First, the usual pre-requisite reading:
>
> * Beneath Apple DOS (or the combined Beneath Apple DOS and Beneath Apple ProDOS 2020)
> * Understanding the Apple II (or Understanding the Apple IIe)
> * Tome of Copy Protection -- https://www.amazon.com/Copy-Protection-Bruce-Jones/dp/1387907271
> * Be familiar with 4&4 encoding
> * Be familiar with 6&2 encoding
> * Know how to read nibbles from assembly language, i.e. https://stackoverflow.com/questions/69369122/apple-iie-6502-assembly-accessing-disk
> * Optional: SWIM_Chip_Users_Ref_198801.pdf While this covers the IWM (Integrated Woz Machine in the IIgs) it has some useful diagrams.
>
> I would start with:
>
> * motor on/off
> * track movement
> * write sensor
> * add .DSK reading support
> * add .DSK writing support
> * add .WOZ reading support
> * add .WOZ writing support.
> > Which format must it have? Woz? DSK?
> You probably "need" .DSK and .WOZ since those will cover the majority of disk images. There are also .do and .po extensions but that only effects the logical <--> physical sector order.
>
>
> You will need to keep track of a few things:
>
> * motor on/off
> * reading/writing state
> * track number (eventually you need quarter track support but stick with integers for now)
> * byte offset (eventually will be a bitstream offset)
>
> For .DSK images when your emulator mounts a virtual image:
>
> * Have a 35 tracks * 16 sector disk image buffer
> * Whenever the disk head is moved to a new track build a virtual disk nibble trackr by denibblizing a track. This mean converting each 256 8-bit values back into the 342 6-bit values. This means filling in for each sector
> * the FF sync byte gap, say 48 of them,
> * the address field,
> * another FF sync gap, say 6 bytes,
> * the data field,
> * the checksum, and
> * another FF sync gap, say 27 bytes
>
> * Then when $C0EC is accessed (assuming the motor is on and in read mode), return trackbuffer[ nibbleoffset++ & TRACK_BUFFER ]
>
> This will fail most copy-protection since you aren't emulating any timing but this should let you boot most non-protected software.
> > Up to know I know "that these formats exist". How can I deal with these formats? What do I have to consider?
> Make sure your 6502 has accurate cycle emulation.
>
> Eventually you will need to emulate the LSS, specifically at the microsecond level, for correctness. i.e. $C0ED will reset the LSS.
> > How do I "read out" these images to satisfy the emulation and give it the bytes it wants to make the boot up complete?
> See above.
> > I don't want just to look up someone else's source code - I want to understand at an more abstract level, what's really going on and start a conversation on this topic.
> Have you read the pre-requisite books?
>
> Good luck!
>
> m.

Thank you for your reply. That's about what I was thinking too. Then I know which way I have to go. I didn't know the "Tome of Copy Protection", I ordered it once as a reading on Amazon. Sorry for posting in the wrong group, I'll sign up for the group you suggested as well.

Re: Question about Disk II Emulation (.woz, .dsk, ...)

<45138de2-6b9f-4e64-9805-9efab982b24dn@googlegroups.com>

 copy mid

https://www.novabbs.com/computers/article-flat.php?id=5124&group=comp.sys.apple2#5124

 copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:620a:342:b0:73b:a6e7:adb7 with SMTP id t2-20020a05620a034200b0073ba6e7adb7mr1118781qkm.14.1677079009468;
Wed, 22 Feb 2023 07:16:49 -0800 (PST)
X-Received: by 2002:a05:6214:4c1a:b0:56e:f63b:634e with SMTP id
qh26-20020a0562144c1a00b0056ef63b634emr1086246qvb.6.1677079009181; Wed, 22
Feb 2023 07:16:49 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Wed, 22 Feb 2023 07:16:48 -0800 (PST)
In-Reply-To: <mmphosis-1676924948@macgui.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:c1:d702:3f00:483f:b810:7262:8e6c;
posting-account=4TUghwoAAABnyztYvJrWTUS8WXFc5m26
NNTP-Posting-Host: 2003:c1:d702:3f00:483f:b810:7262:8e6c
References: <0f7e4d81-2972-42fe-bf2e-9b201528900cn@googlegroups.com> <mmphosis-1676924948@macgui.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <45138de2-6b9f-4e64-9805-9efab982b24dn@googlegroups.com>
Subject: Re: Question about Disk II Emulation (.woz, .dsk, ...)
From: jegal...@gmail.com (Jens Gaulke)
Injection-Date: Wed, 22 Feb 2023 15:16:49 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 11
 by: Jens Gaulke - Wed, 22 Feb 2023 15:16 UTC

On Monday, February 20, 2023 at 9:29:11 PM UTC+1, mmphosis wrote:
> Other nasty protection schemes come to mind, ultimately they be defeated but
> emulating edge cases is a challenge.
>
> I've wondered how far those stepper motors could be pushed. Are we really
> only limited to quarter tracks? Fractional tracking anyone?
>
> https://pages.cpsc.ucalgary.ca/~aycock/ra/disk2.html
>
> The spiral disk protection used on Choplifter gives a neat effect.

That is a very useful link. Thanks for sharing!

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor