-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cpc] ga, crt, fdc (mario bros demo rhino)
- Loading branch information
Showing
8 changed files
with
208 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cpc | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/laullon/b2t80s/emulator/fdc" | ||
) | ||
|
||
type fdc765 struct { | ||
chip fdc.FDC | ||
} | ||
|
||
func NewCPCFDC765() *fdc765 { | ||
return &fdc765{ | ||
chip: fdc.New765(), | ||
} | ||
} | ||
|
||
func (fdc *fdc765) ReadPort(port uint16) (byte, bool) { | ||
if (port & (1 << 10)) == 0 { | ||
f := ((port & (1 << 8)) >> (8 - 1)) | (port & 0x01) | ||
switch f { | ||
case 2: | ||
return fdc.chip.ReadStatus(), false | ||
case 3: | ||
return fdc.chip.ReadData(), false | ||
default: | ||
panic(f) | ||
} | ||
} else { | ||
panic(fmt.Sprintf("port: 0x%04X", port)) | ||
} | ||
} | ||
|
||
func (fdc *fdc765) WritePort(port uint16, data byte) { | ||
switch port { | ||
case 0xFA7E: | ||
fdc.chip.SetMotor(data == 1) | ||
case 0xFB7F: | ||
fdc.chip.WriteData(data) | ||
default: | ||
fmt.Printf("port: 0x%04X data: 0x%02X \n", port, data) | ||
} | ||
} |
Oops, something went wrong.