add annunciator display, rev 0 speaker/cassette out, 3 decimal Hz

This commit is contained in:
Christopher Mosher 2019-01-27 01:41:23 -05:00
parent ce3badc281
commit f3357525ce
5 changed files with 51 additions and 34 deletions

View File

@ -26,8 +26,8 @@
#include "cassetteout.h"
#include "slots.h"
AddressBus::AddressBus(Memory& ram, Memory& rom, Keyboard& kbd, VideoMode& vid, Paddles& paddles, PaddleButtonStates& paddleButtonStates, SpeakerClicker& speaker, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Slots& slts):
ram(ram), rom(rom), kbd(kbd), vid(vid), paddles(paddles), paddleButtonStates(paddleButtonStates), speaker(speaker), cassetteIn(cassetteIn), cassetteOut(cassetteOut), slts(slts)
AddressBus::AddressBus(ScreenImage& gui, int revision, Memory& ram, Memory& rom, Keyboard& kbd, VideoMode& vid, Paddles& paddles, PaddleButtonStates& paddleButtonStates, SpeakerClicker& speaker, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Slots& slts):
gui(gui), revision(revision), ram(ram), rom(rom), kbd(kbd), vid(vid), paddles(paddles), paddleButtonStates(paddleButtonStates), speaker(speaker), cassetteIn(cassetteIn), cassetteOut(cassetteOut), slts(slts)
{
}
@ -50,7 +50,7 @@ unsigned char AddressBus::read(const unsigned short address)
{
if ((address >> 12) == 0xC)
{
// 11007sssxxxxxxxx
// 11007sss,xxxxxxxx
const bool seventh = address & 0x0800;
const int slot = (address >> 8) & 7;
if (seventh)
@ -91,7 +91,7 @@ void AddressBus::write(const unsigned short address, const unsigned char d)
{
if ((address >> 12) == 0xC)
{
// 11007sssxxxxxxxx
// 11007sss,xxxxxxxx
const bool seventh = address & 0x0800;
const int slot = (address >> 8) & 7;
if (!seventh && slot == 0)
@ -137,11 +137,14 @@ unsigned char AddressBus::readSwitch(unsigned short address)
}
else if (islot == 0x3)
{
if (this->revision == 0) {
this->cassetteOut.output();
}
this->speaker.click();
}
else if (islot == 0x4)
{
// ignore utility strobe
// TODO ? utility strobe
}
else if (islot == 0x5)
{
@ -151,7 +154,12 @@ unsigned char AddressBus::readSwitch(unsigned short address)
}
else
{
// ignore annunciator outputs
// 11000000,01011aaf
// aa = annunciator, 0-3
// f == on/off
const bool on = iswch & 1;
const int ann = (iswch >> 1) & 3;
this->gui.setAnnunciator(ann, on);
}
}
else if (islot == 0x6)

View File

@ -18,6 +18,7 @@
#ifndef ADDRESSBUS_H
#define ADDRESSBUS_H
class ScreenImage;
class Memory;
class Keyboard;
class VideoMode;
@ -28,37 +29,38 @@ class CassetteIn;
class CassetteOut;
class Slots;
class AddressBus
{
private:
Memory& ram;
Memory& rom;
Keyboard& kbd;
VideoMode& vid;
Paddles& paddles;
PaddleButtonStates& paddleButtonStates;
SpeakerClicker& speaker;
class AddressBus {
private:
ScreenImage& gui;
int revision;
Memory& ram;
Memory& rom;
Keyboard& kbd;
VideoMode& vid;
Paddles& paddles;
PaddleButtonStates& paddleButtonStates;
SpeakerClicker& speaker;
CassetteIn& cassetteIn;
CassetteOut& cassetteOut;
Slots& slts;
unsigned char data; // this emulates the (floating) data bus
unsigned char data; // this emulates the (floating) data bus
public:
AddressBus(Memory& ram, Memory& rom, Keyboard& kbd, VideoMode& vid, Paddles& paddles, PaddleButtonStates& paddleButtonStates, SpeakerClicker& speaker, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Slots& slts);
~AddressBus();
public:
AddressBus(ScreenImage& gui, int revision, Memory& ram, Memory& rom, Keyboard& kbd, VideoMode& vid, Paddles& paddles, PaddleButtonStates& paddleButtonStates, SpeakerClicker& speaker, CassetteIn& cassetteIn, CassetteOut& cassetteOut, Slots& slts);
~AddressBus();
unsigned char read(const unsigned short address);
void write(const unsigned short address, const unsigned char d);
unsigned char readSwitch(unsigned short address);
void setD7(const bool set);
void writeSwitch(unsigned short address);
enum { MOTHERBOARD_RAM_BAS = 0x00000 } ;
enum { MOTHERBOARD_RAM_LIM = 0x0C000 } ;
enum { MOTHERBOARD_RAM_SIZ = MOTHERBOARD_RAM_LIM-MOTHERBOARD_RAM_BAS };
enum { MOTHERBOARD_ROM_BAS = 0x0D000 } ;
enum { MOTHERBOARD_ROM_LIM = 0x10000 } ;
enum { MOTHERBOARD_ROM_SIZ = MOTHERBOARD_ROM_LIM-MOTHERBOARD_ROM_BAS } ;
unsigned char read(const unsigned short address);
void write(const unsigned short address, const unsigned char d);
unsigned char readSwitch(unsigned short address);
void setD7(const bool set);
void writeSwitch(unsigned short address);
enum { MOTHERBOARD_RAM_BAS = 0x00000 } ;
enum { MOTHERBOARD_RAM_LIM = 0x0C000 } ;
enum { MOTHERBOARD_RAM_SIZ = MOTHERBOARD_RAM_LIM-MOTHERBOARD_RAM_BAS };
enum { MOTHERBOARD_ROM_BAS = 0x0D000 } ;
enum { MOTHERBOARD_ROM_LIM = 0x10000 } ;
enum { MOTHERBOARD_ROM_SIZ = MOTHERBOARD_ROM_LIM-MOTHERBOARD_ROM_BAS } ;
};
#endif

View File

@ -45,7 +45,7 @@ Apple2::Apple2(KeypressQueue& keypresses, PaddleButtonStates& paddleButtonStates
ram(AddressBus::MOTHERBOARD_RAM_SIZ),
cassetteIn(gui),
cassetteOut(gui),
addressBus(ram,rom,kbd,videoMode,paddles,paddleButtonStates,speaker,cassetteIn,cassetteOut,slts),
addressBus(gui,revision,ram,rom,kbd,videoMode,paddles,paddleButtonStates,speaker,cassetteIn,cassetteOut,slts),
picgen(tv,videoMode,this->revision),
video(videoMode,addressBus,picgen,textRows),
#ifdef USE_EMU

View File

@ -107,8 +107,9 @@ void ScreenImage::createScreen() {
void ScreenImage::drawLabels() {
drawText("EPPLE ][", 0, 141);
drawSlots();
drawText("ANNUNCIATORS: 0: 1: 2: 3:", 65, 17);
drawCassette();
drawSlots();
drawFnKeys();
}
@ -256,7 +257,7 @@ void ScreenImage::drawChar(const char ch, int row, int col, int color, int bgcol
void ScreenImage::displayHz(int hz) {
char s[20];
sprintf(s, "%4.2f MHz ", hz / 1e6);
sprintf(s, "%5.3f MHz ", hz / 1e6);
drawText(s, 3, 141);
}
@ -435,6 +436,10 @@ void ScreenImage::setTrack(int slot, int drive, int track) {
this->slotnames[slot][c - 20] = nibl;
}
void ScreenImage::setAnnunciator(int ann, bool on) {
drawChar(' ', 65, 33+4*ann, 0xFFFFFF, on ? 0xFF0000 : 0);
}
void ScreenImage::setIO(int slot, int drive, bool on) {
int r(R_SLOT + slot);
int c(35 + 32 * drive);

View File

@ -82,6 +82,8 @@ public:
void setDiskFile(int slot, int drive, const std::string& filename);
void setAnnunciator(int ann, bool on);
void clearCurrentDrive(int slt, int drv);
void setCurrentDrive(int slt, int drv, int track, bool on);
void setTrack(int slot, int drive, int track);