mirror of
https://github.com/ariejan/i6502.git
synced 2025-04-08 21:43:30 +00:00
Add basics for ACIA 6551:w
This commit is contained in:
parent
7e5984cd6f
commit
90e248e745
28
acia6551.go
Normal file
28
acia6551.go
Normal file
@ -0,0 +1,28 @@
|
||||
package i6502
|
||||
|
||||
/*
|
||||
ACIA 6551 Serial IO
|
||||
*/
|
||||
type Acia6551 struct {
|
||||
rx chan byte // Reading (Acia Input) line
|
||||
tx chan byte // Transmitting (Acia Output) line
|
||||
}
|
||||
|
||||
func NewAcia6551(rx chan byte, tx chan byte) (*Acia6551, error) {
|
||||
return &Acia6551{tx: tx, rx: rx}, nil
|
||||
}
|
||||
|
||||
func (r *Acia6551) Size() uint16 {
|
||||
// We have a only 4 addresses, RX, TX, Command and Control
|
||||
return 0x04
|
||||
}
|
||||
|
||||
/*
|
||||
func (r *Rom) Read(address uint16) byte {
|
||||
return r.data[address]
|
||||
}
|
||||
|
||||
func (r *Rom) Write(address uint16, data byte) {
|
||||
panic(fmt.Errorf("Trying to write to ROM at 0x%04X", address))
|
||||
}
|
||||
*/
|
15
acia6551_test.go
Normal file
15
acia6551_test.go
Normal file
@ -0,0 +1,15 @@
|
||||
package i6502
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewAcia6551(t *testing.T) {
|
||||
tx := make(chan byte)
|
||||
rx := make(chan byte)
|
||||
acia, err := NewAcia6551(rx, tx)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 0x4, acia.Size())
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user