mirror of
https://github.com/ivanizag/izapple2.git
synced 2025-03-12 19:31:47 +00:00
WOZ cross track sync for tracks with different size. Now Hard Hat Mack and Blazing Paddles work.
This commit is contained in:
parent
95998ba37d
commit
ffe644caf4
@ -9,7 +9,7 @@ import (
|
||||
See:
|
||||
https://applesaucefdc.com/woz/
|
||||
|
||||
Emulation status for the disk used on the reference:
|
||||
Emulation status for the disks used on the reference:
|
||||
- How to begin
|
||||
- DOS 3.3: Works
|
||||
- * DOS 3.2: Not working, 13 sector disks can't boot
|
||||
@ -18,12 +18,12 @@ Emulation status for the disk used on the reference:
|
||||
- *** Commando: Not working
|
||||
- Planetfall: Working
|
||||
- Rescue Raiders: Working
|
||||
- Sammy Lightfoot: Working (failed if no 6502 extra cycle is added on branches done)
|
||||
- Sammy Lightfoot: Working
|
||||
- Stargate: Working
|
||||
- Cross track sync
|
||||
- *** Blazing Paddles: Not working
|
||||
- Blazing Paddles: Working
|
||||
- Take 1: Working
|
||||
- *** Hard Hat Mack: Not working
|
||||
- Hard Hat Mack: Working
|
||||
- Half tracks
|
||||
- The Bilestoad: Working
|
||||
- Even more bit fiddling
|
||||
@ -47,9 +47,10 @@ type disketteWoz struct {
|
||||
cycleOn uint64 // Cycle when the disk was last turned on
|
||||
turning bool
|
||||
|
||||
latch uint8
|
||||
position uint32
|
||||
cycle uint64
|
||||
latch uint8
|
||||
position uint32
|
||||
cycle uint64
|
||||
lastQuarterTrack int
|
||||
|
||||
mc3470Buffer uint8 // Four bit buffer to detect weak bits and to add latency
|
||||
|
||||
@ -89,8 +90,9 @@ func (d *disketteWoz) Read(quarterTrack int, cycle uint64) uint8 {
|
||||
// TODO: avoid processing too many bits if delta is big
|
||||
for i := uint64(0); i < deltaBits; i++ {
|
||||
// Get next bit taking into account the MC3470 latency and weak bits
|
||||
d.position++
|
||||
fluxBit := d.data.getBit(d.position, quarterTrack)
|
||||
var fluxBit uint8
|
||||
fluxBit, d.position = d.data.getNextBitAndPosition(d.position, quarterTrack, d.lastQuarterTrack)
|
||||
d.lastQuarterTrack = quarterTrack
|
||||
d.mc3470Buffer = (d.mc3470Buffer<<1 + fluxBit) & 0x0f
|
||||
bit := (d.mc3470Buffer >> 1) & 0x1 // Use the previous to last bit to add latency
|
||||
if d.mc3470Buffer == 0 && rand.Intn(100) < 3 {
|
||||
|
@ -80,10 +80,20 @@ const (
|
||||
var headerWoz1 = []uint8{0x57, 0x4f, 0x5A, 0x31, 0xFF, 0x0A, 0x0D, 0x0A}
|
||||
var headerWoz2 = []uint8{0x57, 0x4f, 0x5A, 0x32, 0xFF, 0x0A, 0x0D, 0x0A}
|
||||
|
||||
func (f *fileWoz) getBit(position uint32, quarterTrack int) uint8 {
|
||||
func (f *fileWoz) getNextBitAndPosition(position uint32, quarterTrack int, prevQuarterTrack int) (uint8, uint32) {
|
||||
trackWoz := f.tracks[f.trackMap[quarterTrack]]
|
||||
|
||||
if prevQuarterTrack != quarterTrack {
|
||||
// Adjust position as tracks may have different length
|
||||
prevTrackWoz := f.tracks[f.trackMap[prevQuarterTrack]]
|
||||
newPosition := position * trackWoz.bitCount / prevTrackWoz.bitCount
|
||||
//fmt.Printf("%03d to %03d: adjustmend %d\n", prevQuarterTrack, quarterTrack, int64(newPosition)-int64(position))
|
||||
position = newPosition
|
||||
}
|
||||
|
||||
position++
|
||||
position %= trackWoz.bitCount
|
||||
return trackWoz.data[position/8] >> (7 - position%8) & 1
|
||||
return trackWoz.data[position/8] >> (7 - position%8) & 1, position
|
||||
}
|
||||
|
||||
func isFileWoz(data []uint8) bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user