mirror of
https://github.com/ariejan/i6502.git
synced 2024-06-11 08:29:35 +00:00
WIP
This commit is contained in:
parent
856ff00573
commit
44738e191f
49
acia6551.go
49
acia6551.go
|
@ -14,8 +14,9 @@ type Acia6551 struct {
|
||||||
Rx chan byte // Reading (Acia Input) line
|
Rx chan byte // Reading (Acia Input) line
|
||||||
Tx chan byte // Transmitting (Acia Output) line
|
Tx chan byte // Transmitting (Acia Output) line
|
||||||
|
|
||||||
rxData byte
|
rxData byte
|
||||||
txData byte
|
txData byte
|
||||||
|
|
||||||
commandData byte
|
commandData byte
|
||||||
controlData byte
|
controlData byte
|
||||||
|
|
||||||
|
@ -24,6 +25,8 @@ type Acia6551 struct {
|
||||||
|
|
||||||
rxIrqEnabled bool
|
rxIrqEnabled bool
|
||||||
txIrqEnabled bool
|
txIrqEnabled bool
|
||||||
|
|
||||||
|
overrun bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAcia6551(rx chan byte, tx chan byte) (*Acia6551, error) {
|
func NewAcia6551(rx chan byte, tx chan byte) (*Acia6551, error) {
|
||||||
|
@ -46,6 +49,7 @@ func (a *Acia6551) Size() uint16 {
|
||||||
return 0x04
|
return 0x04
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emulates a hardware reset
|
||||||
func (a *Acia6551) Reset() {
|
func (a *Acia6551) Reset() {
|
||||||
a.rxData = 0
|
a.rxData = 0
|
||||||
a.rxFull = false
|
a.rxFull = false
|
||||||
|
@ -55,14 +59,43 @@ func (a *Acia6551) Reset() {
|
||||||
|
|
||||||
a.rxIrqEnabled = false
|
a.rxIrqEnabled = false
|
||||||
a.txIrqEnabled = false
|
a.txIrqEnabled = false
|
||||||
|
|
||||||
|
a.overrun = false
|
||||||
|
|
||||||
|
a.setControl(0)
|
||||||
|
a.setCommand(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
func (a *Acia6551) setControl(data byte) {
|
||||||
func (r *Rom) Read(address uint16) byte {
|
|
||||||
return r.data[address]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Rom) Write(address uint16, data byte) {
|
func (a *Acia6551) setCommand(data byte) {
|
||||||
panic(fmt.Errorf("Trying to write to ROM at 0x%04X", address))
|
}
|
||||||
|
|
||||||
|
func (a *Acia6551) Read(address uint16) byte {
|
||||||
|
switch address {
|
||||||
|
case aciaData:
|
||||||
|
// Read Rx
|
||||||
|
case aciaStatus:
|
||||||
|
// Read Status reg.
|
||||||
|
case aciaCommand:
|
||||||
|
// Read command
|
||||||
|
case aciaControl:
|
||||||
|
// Read control
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0x00
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Acia6551) Write(address uint16, data byte) {
|
||||||
|
switch address {
|
||||||
|
case aciaData:
|
||||||
|
// Write Tx
|
||||||
|
case aciaStatus:
|
||||||
|
// Reset
|
||||||
|
case aciaCommand:
|
||||||
|
// Write command
|
||||||
|
case aciaControl:
|
||||||
|
// Write control
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
@ -34,6 +34,9 @@ func TestAciaReset(t *testing.T) {
|
||||||
|
|
||||||
assert.False(t, a.txIrqEnabled)
|
assert.False(t, a.txIrqEnabled)
|
||||||
assert.False(t, a.rxIrqEnabled)
|
assert.False(t, a.rxIrqEnabled)
|
||||||
|
|
||||||
|
assert.False(t, a.overrun)
|
||||||
|
assert.Equal(t, 0, a.controlData)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAciaCommand(t *testing.T) {
|
func TestAciaCommand(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user