From 81640f15874cb703dbb6f8b08426621cfe02c393 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 25 Feb 2022 03:20:55 +1100 Subject: dgn_beta.cpp: Reduced scope of stuff, sorted #includes, removed unused local string. --- src/mame/includes/dgn_beta.h | 105 +++++++++++++++++++++--------------------- src/mame/machine/dgn_beta.cpp | 24 +++++----- 2 files changed, 64 insertions(+), 65 deletions(-) diff --git a/src/mame/includes/dgn_beta.h b/src/mame/includes/dgn_beta.h index 9cacd165e73..b1fe2bd9ac1 100644 --- a/src/mame/includes/dgn_beta.h +++ b/src/mame/includes/dgn_beta.h @@ -11,11 +11,12 @@ #pragma once -#include "video/mc6845.h" #include "imagedev/floppy.h" -#include "machine/wd_fdc.h" #include "machine/6821pia.h" #include "machine/ram.h" +#include "machine/wd_fdc.h" +#include "video/mc6845.h" + #include "emupal.h" /* Tags */ @@ -30,56 +31,6 @@ #define DGNBETA_CPU_SPEED_HZ 2000000 /* 2MHz */ #define DGNBETA_FRAMES_PER_SECOND 50 -#define RamSize 256 /* 256K by default */ -#define RamPageSize 4096 /* ram pages are 4096 bytes */ - -#define MaxTasks 16 /* Tasks 0..15 */ -#define MaxPage 16 /* 16 4K pages */ -#define NoPagingTask MaxTasks /* Task registers to use when paging disabled 16 */ - -#define RAMPage 0 /* Page with RAM in at power on */ -#define VideoPage 6 /* Page where video ram mapped */ -#define IOPage MaxPage-1 /* Page for I/O */ -#define ROMPage MaxPage-2 /* Page for ROM */ -#define LastPage MaxPage-1 - -#define RAMPageValue 0x00 /* page with RAM at power on */ -#define VideoPageValue 0x1F /* Default page for video ram */ -#define NoMemPageValue 0xC0 /* Page guaranteed not to have memory in */ -#define ROMPageValue 0xFE /* Page with boot ROM */ -#define IOPageValue 0xFF /* Page with I/O & Boot ROM */ - -#define TextVidBasePage 0x18 /* Base page of text video ram */ - -/***** Keyboard stuff *****/ -#define NoKeyrows 0x0a /* Number of rows in keyboard */ - -/* From Dragon Beta OS9 keyboard driver */ -#define KAny 0x04 /* Any key pressed mask PB2 */ -#define KOutClk 0x08 /* Output shift register clock */ -#define KInClk 0x10 /* Input shift register clock */ -#define KOutDat KInClk /* Also used for data into output shifter */ -#define KInDat 0x20 /* Keyboard data in from keyboard (serial stream) */ - -/***** Video Modes *****/ - -enum BETA_VID_MODES -{ - TEXT_40x25, /* Text mode 40x25 */ - TEXT_80x25, /* Text mode 80x25 */ - GRAPH_320x256x4, /* Graphics 320x256x4 */ - GRAPH_320x256x16, /* Graphics 320x256x16 */ - GRAPH_640x512x2 /* Graphics 640X512X2 */ -}; - -#define iosize (0xfEFF-0xfc00) - -struct PageReg -{ - int value; /* Value of the page register */ - uint8_t *memory; /* The memory it actually points to */ -}; - class dgn_beta_state : public driver_device { @@ -109,6 +60,56 @@ protected: virtual void machine_reset() override; private: + static constexpr unsigned RamSize = 256; // 256K by default + static constexpr unsigned RamPageSize = 4096; // ram pages are 4096 bytes + + static constexpr unsigned MaxTasks = 16; // Tasks 0..15 + static constexpr unsigned MaxPage = 16; // 16 4K pages + static constexpr unsigned NoPagingTask = MaxTasks; // Task registers to use when paging disabled 16 + + static constexpr unsigned RAMPage = 0; // Page with RAM in at power on + static constexpr unsigned VideoPage = 6; // Page where video ram mapped + static constexpr unsigned IOPage = MaxPage-1; // Page for I/O + static constexpr unsigned ROMPage = MaxPage-2; // Page for ROM + static constexpr unsigned LastPage = MaxPage-1; + + static constexpr uint8_t RAMPageValue = 0x00; // page with RAM at power on + static constexpr uint8_t VideoPageValue = 0x1f; // Default page for video ram + static constexpr uint8_t NoMemPageValue = 0xc0; // Page guaranteed not to have memory in + static constexpr uint8_t ROMPageValue = 0xfe; // Page with boot ROM + static constexpr uint8_t IOPageValue = 0xff; // Page with I/O & Boot ROM + + static constexpr uint8_t TextVidBasePage = 0x18; // Base page of text video RAM + + /***** Keyboard stuff *****/ + static constexpr uint8_t NoKeyrows = 0x0a; // Number of rows in keyboard + + /* From Dragon Beta OS9 keyboard driver */ + static constexpr uint8_t KAny = 0x04; // Any key pressed mask PB2 + static constexpr uint8_t KOutClk = 0x08; // Output shift register clock + static constexpr uint8_t KInClk = 0x10; // Input shift register clock + static constexpr uint8_t KOutDat = KInClk; // Also used for data into output shifter + static constexpr uint8_t KInDat = 0x20; // Keyboard data in from keyboard (serial stream) + + /***** Video Modes *****/ + + enum BETA_VID_MODES + { + TEXT_40x25, /* Text mode 40x25 */ + TEXT_80x25, /* Text mode 80x25 */ + GRAPH_320x256x4, /* Graphics 320x256x4 */ + GRAPH_320x256x16, /* Graphics 320x256x16 */ + GRAPH_640x512x2 /* Graphics 640X512X2 */ + }; + + static constexpr unsigned iosize = 0xfeff-0xfc00; + + struct PageReg + { + int value; /* Value of the page register */ + uint8_t *memory; /* The memory it actually points to */ + }; + static void floppy_formats(format_registration &fr); required_device m_mc6845; diff --git a/src/mame/machine/dgn_beta.cpp b/src/mame/machine/dgn_beta.cpp index 05066fab936..57ef3ec8fc7 100644 --- a/src/mame/machine/dgn_beta.cpp +++ b/src/mame/machine/dgn_beta.cpp @@ -2,7 +2,7 @@ // copyright-holders:Nathan Woods /*************************************************************************** - machine\dgn_beta.c (machine.c) + machine/dgn_beta.cpp Moved out of dragon.c, 2005-05-05, P.Harvey-Smith. @@ -57,21 +57,22 @@ ***************************************************************************/ -#include - -#include #include "emu.h" -#include "debug/debugcon.h" +#include "includes/dgn_beta.h" + +#include "includes/coco.h" // for CoCo OS-9 disassembler enhancements + #include "cpu/m6809/m6809.h" +#include "imagedev/floppy.h" #include "machine/6821pia.h" -#include "includes/dgn_beta.h" -#include "includes/coco.h" #include "machine/mos6551.h" -#include "imagedev/floppy.h" +#include "machine/ram.h" -#include "debugger.h" #include "debug/debugcon.h" -#include "machine/ram.h" +#include "debugger.h" + +#include +#include #define VERBOSE 0 @@ -118,13 +119,10 @@ void dgn_beta_state::UpdateBanks(int first, int last) int bank_start; int bank_end; int MapPage; - char page_num[10]; LOG_BANK_UPDATE(("\n\n%s Updating banks %d to %d\n", machine().describe_context(), first, last)); for(Page=first;Page<=last;Page++) { - sprintf(page_num,"bank%d",Page+1); - bank_start = Page < 16 ? Page * 0x1000 : 0xff00; bank_end = Page < 15 ? bank_start + 0xfff : Page == 15 ? 0xfbff : 0xffff; -- cgit v1.2.3