mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
alto2: remove more cruft and fix comments
I want this child to become a grown up some day.
This commit is contained in:
parent
8a5da5ddf4
commit
057474989c
@ -7,6 +7,52 @@
|
||||
*****************************************************************************/
|
||||
#include "alto2cpu.h"
|
||||
|
||||
/*
|
||||
* Copied from ALTOCODE24.MU
|
||||
* ;Display Horizontal Task.
|
||||
* ;11 cycles if no block change, 17 if new control block.
|
||||
*
|
||||
* DHT: MAR← CBA-1;
|
||||
* L← SLC -1, BUS=0;
|
||||
* SLC← L, :DHT0;
|
||||
*
|
||||
* DHT0: T← 37400; MORE TO DO IN THIS BLOCK
|
||||
* SINK← MD;
|
||||
* L← T← MD AND T, SETMODE;
|
||||
* HTAB← L LCY 8, :NORMODE;
|
||||
*
|
||||
* NORMODE:L← T← 377 . T;
|
||||
* AECL← L, :REST;
|
||||
*
|
||||
* HALFMODE: L← T← 377 . T;
|
||||
* AECL← L, :REST, T← 0;
|
||||
*
|
||||
* REST: L← DWA + T,TASK; INCREMENT DWA BY 0 OR NWRDS
|
||||
* NDNX: DWA← L, :DHT;
|
||||
*
|
||||
* DHT1: L← T← MD+1, BUS=0;
|
||||
* CBA← L, MAR← T, :MOREB;
|
||||
*
|
||||
* NOMORE: BLOCK, :DNX;
|
||||
* MOREB: T← 37400;
|
||||
* L← T← MD AND T, SETMODE;
|
||||
* MAR← CBA+1, :NORMX, EVENFIELD;
|
||||
*
|
||||
* NORMX: HTAB← L LCY 8, :NODD;
|
||||
* HALFX: HTAB← L LCY 8, :NEVEN;
|
||||
*
|
||||
* NODD: L←T← 377 . T;
|
||||
* AECL← L, :XREST; ODD FIELD, FULL RESOLUTION
|
||||
*
|
||||
* NEVEN: L← 377 AND T; EVEN FIELD OR HALF RESOLUTION
|
||||
* AECL←L, T←0;
|
||||
*
|
||||
* XREST: L← MD+T;
|
||||
* T←MD-1;
|
||||
* DNX: DWA←L, L←T, TASK;
|
||||
* SLC←L, :DHT;
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief f1_dht_block early: disable the display word task
|
||||
*/
|
||||
|
@ -1620,14 +1620,6 @@ void alto2_cpu_device::disk_bitclk(void* ptr, INT32 arg)
|
||||
kwd_timing(clk, bit, 0);
|
||||
}
|
||||
|
||||
#if USE_BITCLK_TIMER
|
||||
/* more bits to clock? */
|
||||
if (++arg < dhd->bits_per_sector()) {
|
||||
m_dsk.bitclk_timer->adjust(dhd->bit_time(), arg);
|
||||
} else {
|
||||
m_dsk.bitclk_timer->reset();
|
||||
}
|
||||
#else
|
||||
if (++arg < dhd->bits_per_sector()) {
|
||||
m_bitclk_time += m_dsk.bitclk_time[m_dsk.drive];
|
||||
m_bitclk_index = arg;
|
||||
@ -1635,7 +1627,6 @@ void alto2_cpu_device::disk_bitclk(void* ptr, INT32 arg)
|
||||
// stop the bitclock timer
|
||||
m_bitclk_time = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1649,16 +1640,11 @@ void alto2_cpu_device::next_sector(int unit)
|
||||
LOG((this,LOG_DISK,0,"%s dhd=%p\n", __FUNCTION__, dhd));
|
||||
// get bit time in pico seconds
|
||||
m_dsk.bitclk_time[unit] = static_cast<int>(dhd->bit_time().as_attoseconds() / 1000000);
|
||||
#if USE_BITCLK_TIMER
|
||||
LOG((this,LOG_DISK,0," unit #%d stop bitclk\n", unit));
|
||||
m_dsk.bitclk_timer->enable(false);
|
||||
#else
|
||||
if (m_bitclk_time >= 0) {
|
||||
LOG((this,LOG_DISK,0," unit #%d stop bitclk\n", unit));
|
||||
m_bitclk_time = -1;
|
||||
m_bitclk_index = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* KSTAT[0-3] update the current sector in the kstat field */
|
||||
PUT_KSTAT_SECTOR(m_dsk.kstat, dhd->get_sector());
|
||||
@ -1669,12 +1655,6 @@ void alto2_cpu_device::next_sector(int unit)
|
||||
|
||||
LOG((this,LOG_DISK,1," unit #%d sector %d start\n", unit, GET_KSTAT_SECTOR(m_dsk.kstat)));
|
||||
|
||||
#if USE_BITCLK_TIMER
|
||||
// HACK: no command, no bit clock
|
||||
if (debug_read_mem(0521))
|
||||
/* start a timer chain for the bit clock */
|
||||
disk_bitclk(0, 0);
|
||||
#else
|
||||
// TODO: verify current sector == requested sector and only then run the bitclk?
|
||||
// HACK: no command, no bit clock
|
||||
if (debug_read_mem(0521))
|
||||
@ -1683,7 +1663,6 @@ void alto2_cpu_device::next_sector(int unit)
|
||||
m_bitclk_time = 0;
|
||||
m_bitclk_index = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1769,10 +1748,6 @@ void alto2_cpu_device::init_disk()
|
||||
|
||||
m_dsk.kcom = 066000;
|
||||
|
||||
#if USE_BITCLK_TIMER
|
||||
m_dsk.bitclk_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_bitclk),this));
|
||||
#endif
|
||||
|
||||
m_dsk.strobon_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_strobon),this));
|
||||
m_dsk.strobon_timer->reset();
|
||||
|
||||
@ -1821,12 +1796,8 @@ void alto2_cpu_device::reset_disk()
|
||||
m_dsk.strobe = 0;
|
||||
m_dsk.strobon_timer->reset();
|
||||
m_dsk.bitclk = 0;
|
||||
#if USE_BITCLK_TIMER
|
||||
m_dsk.bitclk_timer->reset();
|
||||
#else
|
||||
m_dsk.bitclk_time[0] = static_cast<int>(attotime::from_nsec(300).as_attoseconds() / 1000000);
|
||||
m_dsk.bitclk_time[1] = static_cast<int>(attotime::from_nsec(300).as_attoseconds() / 1000000);
|
||||
#endif
|
||||
m_dsk.datin = 0;
|
||||
m_dsk.bitcount = 0;
|
||||
m_dsk.seclate = 0;
|
||||
|
@ -37,11 +37,7 @@ struct {
|
||||
UINT8 strobe; //!< strobe (still) active
|
||||
emu_timer* strobon_timer; //!< set strobe on timer
|
||||
UINT8 bitclk; //!< current bitclk state (either crystal clock, or rdclk from the drive)
|
||||
#if USE_BITCLK_TIMER
|
||||
emu_timer* bitclk_timer; //!< bit clock timer
|
||||
#else
|
||||
int bitclk_time[2]; //!< per drive time in clocks per bit
|
||||
#endif
|
||||
UINT8 datin; //!< current datin from the drive
|
||||
UINT8 bitcount; //!< bit counter
|
||||
UINT8 carry; //!< carry output of the bitcounter
|
||||
@ -78,11 +74,7 @@ TIMER_CALLBACK_MEMBER( disk_seclate ); //!< timer callback to take away
|
||||
TIMER_CALLBACK_MEMBER( disk_ok_to_run ); //!< timer callback to take away the OK TO RUN pulse (reset)
|
||||
TIMER_CALLBACK_MEMBER( disk_strobon ); //!< timer callback to pulse the STROBE' signal to the drive
|
||||
TIMER_CALLBACK_MEMBER( disk_ready_mf31a ); //!< timer callback to change the READY monoflop 31a
|
||||
#if USE_BITCLK_TIMER
|
||||
TIMER_CALLBACK_MEMBER( disk_bitclk ); //!< callback to update the disk controller with a new bitclk
|
||||
#else
|
||||
void disk_bitclk(void *ptr, int arg); //!< function to update the disk controller with a new bitclk
|
||||
#endif
|
||||
void disk_block(int task); //!< called if one of the disk tasks (task_kwd or task_ksec) blocks
|
||||
void bs_early_read_kstat(); //!< bus source: bus driven by disk status register KSTAT
|
||||
void bs_early_read_kdata(); //!< bus source: bus driven by disk data register KDATA input
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
/**
|
||||
* @brief PROM a38 contains the STOPWAKE' and MBEMBPTY' signals for the FIFO
|
||||
* <PRE>
|
||||
* The inputs to a38 are the UNLOAD counter RA[0-3] and the DDR<- counter
|
||||
* WA[0-3], and the designer decided to reverse the address lines :-)
|
||||
*
|
||||
* <PRE>
|
||||
* a38 counter
|
||||
* -------------
|
||||
* A0 RA[0]
|
||||
@ -50,10 +50,10 @@ static const prom_load_t pl_displ_a38 =
|
||||
};
|
||||
|
||||
//! PROM a38 bit O1 is STOPWAKE' (stop DWT if bit is zero)
|
||||
#define FIFO_STOPWAKE(a38) (0 == (a38 & disp_a38_STOPWAKE) ? true : false)
|
||||
#define FIFO_STOPWAKE(a38) ((a38 & disp_a38_STOPWAKE) ? false : true)
|
||||
|
||||
//! PROM a38 bit O3 is MBEMPTY' (FIFO is empty if bit is zero)
|
||||
#define FIFO_MBEMPTY(a38) (0 == (a38 & disp_a38_MBEMPTY) ? true : false)
|
||||
#define FIFO_MBEMPTY(a38) ((a38 & disp_a38_MBEMPTY) ? false : true)
|
||||
|
||||
/**
|
||||
* @brief emulation of PROM a63 in the display schematics page 8
|
||||
@ -224,17 +224,17 @@ static const UINT16 double_bits[256] = {
|
||||
0xffc0,0xffc3,0xffcc,0xffcf,0xfff0,0xfff3,0xfffc,0xffff
|
||||
};
|
||||
|
||||
#define HLC1 ((m_dsp.hlc >> 0) & 1) //!< horizontal line counter bit 0 (mid of the scanline)
|
||||
#define HLC2 ((m_dsp.hlc >> 1) & 1) //!< horizontal line counter bit 1
|
||||
#define HLC4 ((m_dsp.hlc >> 2) & 1) //!< horizontal line counter bit 2
|
||||
#define HLC8 ((m_dsp.hlc >> 3) & 1) //!< horizontal line counter bit 3
|
||||
#define HLC16 ((m_dsp.hlc >> 4) & 1) //!< horizontal line counter bit 4
|
||||
#define HLC32 ((m_dsp.hlc >> 5) & 1) //!< horizontal line counter bit 5
|
||||
#define HLC64 ((m_dsp.hlc >> 6) & 1) //!< horizontal line counter bit 6
|
||||
#define HLC128 ((m_dsp.hlc >> 7) & 1) //!< horizontal line counter bit 7
|
||||
#define HLC256 ((m_dsp.hlc >> 8) & 1) //!< horizontal line counter bit 8
|
||||
#define HLC512 ((m_dsp.hlc >> 9) & 1) //!< horizontal line counter bit 9
|
||||
#define HLC1024 ((m_dsp.hlc >> 10) & 1) //!< horizontal line counter bit 10 (odd/even field)
|
||||
#define HLC1 X_BIT(m_dsp.hlc,16,15) //!< horizontal line counter bit 0 (mid of the scanline)
|
||||
#define HLC2 X_BIT(m_dsp.hlc,16,14) //!< horizontal line counter bit 1
|
||||
#define HLC4 X_BIT(m_dsp.hlc,16,13) //!< horizontal line counter bit 2
|
||||
#define HLC8 X_BIT(m_dsp.hlc,16,12) //!< horizontal line counter bit 3
|
||||
#define HLC16 X_BIT(m_dsp.hlc,16,11) //!< horizontal line counter bit 4
|
||||
#define HLC32 X_BIT(m_dsp.hlc,16,10) //!< horizontal line counter bit 5
|
||||
#define HLC64 X_BIT(m_dsp.hlc,16, 9) //!< horizontal line counter bit 6
|
||||
#define HLC128 X_BIT(m_dsp.hlc,16, 8) //!< horizontal line counter bit 7
|
||||
#define HLC256 X_BIT(m_dsp.hlc,16, 7) //!< horizontal line counter bit 8
|
||||
#define HLC512 X_BIT(m_dsp.hlc,16, 6) //!< horizontal line counter bit 9
|
||||
#define HLC1024 X_BIT(m_dsp.hlc,16, 5) //!< horizontal line counter bit 10 (odd/even field
|
||||
|
||||
#define GET_SETMODE_SPEEDY(mode) X_RDBITS(mode,16,0,0) //!< get the pixel clock speed from a SETMODE<- bus value
|
||||
#define GET_SETMODE_INVERSE(mode) X_RDBITS(mode,16,1,1) //!< get the inverse video flag from a SETMODE<- bus value
|
||||
@ -287,12 +287,12 @@ void alto2_cpu_device::unload_word()
|
||||
|
||||
if (m_dsp.halfclock)
|
||||
{
|
||||
UINT16 word1 = double_bits[word / 256];
|
||||
UINT16 word2 = double_bits[word % 256];
|
||||
const UINT16 word1 = double_bits[word / 256];
|
||||
update_framebuf_word(framebuf, x, y, word1);
|
||||
x++;
|
||||
if (x < ALTO2_DISPLAY_VISIBLE_WORDS)
|
||||
{
|
||||
const UINT16 word2 = double_bits[word % 256];
|
||||
update_framebuf_word(framebuf, x, y, word2);
|
||||
x++;
|
||||
}
|
||||
@ -329,7 +329,7 @@ void alto2_cpu_device::display_state_machine()
|
||||
{
|
||||
// count horizontal line counters and wrap
|
||||
m_dsp.hlc += 1;
|
||||
if (m_dsp.hlc == ALTO2_DISPLAY_HLC_END)
|
||||
if (m_dsp.hlc > ALTO2_DISPLAY_HLC_END)
|
||||
m_dsp.hlc = ALTO2_DISPLAY_HLC_START;
|
||||
// wake up the memory refresh task _twice_ on each scanline
|
||||
m_task_wakeup |= 1 << task_mrt;
|
||||
|
@ -2,13 +2,13 @@
|
||||
// copyright-holders:Juergen Buchmueller
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Xerox AltoII display block
|
||||
* Xerox AltoII display emulation
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifdef ALTO2_DEFINE_CONSTANTS
|
||||
|
||||
/**
|
||||
* @brief start value for the horizontal line counter
|
||||
* @brief Start value for the horizontal line counter.
|
||||
*
|
||||
* This value is loaded into the three 4 bit counters (type 9316)
|
||||
* with numbers 65, 67, and 75.
|
||||
@ -21,12 +21,14 @@
|
||||
#define ALTO2_DISPLAY_HLC_START (2+4+16+128)
|
||||
|
||||
/**
|
||||
* @brief end value for the horizontal line counter
|
||||
* @brief End value for the horizontal line counter.
|
||||
*
|
||||
* This is decoded by H30, an 8 input NAND gate.
|
||||
* The value is 1899; horz. line count range 150...1899 = 1750.
|
||||
* So there are 1750 / 2 = 875 total scanlines.
|
||||
*
|
||||
* There are 1750 / 2 = 875 total scanlines.
|
||||
* Note: The horizontal line counts 150 ... 1023 for the even field,
|
||||
* and 1024 ... 1899 for the odd field.
|
||||
*/
|
||||
#define ALTO2_DISPLAY_HLC_END (1+2+8+32+64+256+512+1024)
|
||||
|
||||
@ -37,7 +39,7 @@
|
||||
* scanlines to the monitor. The frame rate is 60Hz, which is actually the rate
|
||||
* of the half-frames. The rate for full frames is thus 30Hz.
|
||||
*/
|
||||
#define ALTO2_DISPLAY_TOTAL_HEIGHT ((ALTO2_DISPLAY_HLC_END + 1 - ALTO2_DISPLAY_HLC_START) / 2)
|
||||
#define ALTO2_DISPLAY_TOTAL_HEIGHT ((ALTO2_DISPLAY_HLC_END - ALTO2_DISPLAY_HLC_START) / 2)
|
||||
|
||||
/**
|
||||
* @brief display total width, including horizontal blanking
|
||||
@ -68,18 +70,37 @@
|
||||
*/
|
||||
#define ALTO2_DISPLAY_TOTAL_WIDTH 768
|
||||
|
||||
//! The display fifo has 16 words.
|
||||
#define ALTO2_DISPLAY_FIFO 16
|
||||
|
||||
#define ALTO2_DISPLAY_FIFO 16 //!< the display fifo has 16 words
|
||||
#define ALTO2_DISPLAY_SCANLINE_WORDS (ALTO2_DISPLAY_TOTAL_WIDTH/16) //!< words per scanline
|
||||
#define ALTO2_DISPLAY_HEIGHT 808 //!< number of visible scanlines per frame; 808 really, but there are some empty lines?
|
||||
#define ALTO2_DISPLAY_WIDTH 606 //!< visible width of the display; 38 x 16 bit words - 2 pixels
|
||||
#define ALTO2_DISPLAY_VISIBLE_WORDS ((ALTO2_DISPLAY_WIDTH+15)/16) //!< visible words per scanline
|
||||
#define ALTO2_DISPLAY_BITCLOCK 20160000ll //!< display bit clock in Hertz (20.16MHz)
|
||||
#define ALTO2_DISPLAY_BITTIME(n) (U64(1000000000000)*(n)/ALTO2_DISPLAY_BITCLOCK) //!< display bit time in pico seconds (~= 49.6031ns)
|
||||
#define ALTO2_DISPLAY_SCANLINE_TIME ALTO2_DISPLAY_BITTIME(ALTO2_DISPLAY_TOTAL_WIDTH)//!< time for a scanline in pico seconds (768 * 49.6031ns ~= 38095.1808ns)
|
||||
#define ALTO2_DISPLAY_VISIBLE_TIME ALTO2_DISPLAY_BITTIME(ALTO2_DISPLAY_WIDTH) //!< time of the visible part of a scanline in pico seconds (606 * 49.6031ns ~= 30059.4786ns)
|
||||
#define ALTO2_DISPLAY_WORD_TIME ALTO2_DISPLAY_BITTIME(16) //!< time for a word in pico seconds (16 pixels * 49.6031ns ~= 793.6496ns)
|
||||
#define ALTO2_DISPLAY_VBLANK_TIME ((ALTO2_DISPLAY_TOTAL_HEIGHT-ALTO2_DISPLAY_HEIGHT)*HZ_TO_ATTOSECONDS(26250)/2)
|
||||
//! Words per scanline.
|
||||
#define ALTO2_DISPLAY_SCANLINE_WORDS (ALTO2_DISPLAY_TOTAL_WIDTH/16)
|
||||
|
||||
//! Number of visible scanlines per frame; 808 really, but there are some empty lines?
|
||||
#define ALTO2_DISPLAY_HEIGHT 808
|
||||
|
||||
//! Visible width of the display; 38 x 16 bit words - 2 pixels.
|
||||
#define ALTO2_DISPLAY_WIDTH 606
|
||||
|
||||
//! Visible words per scanline.
|
||||
#define ALTO2_DISPLAY_VISIBLE_WORDS ((ALTO2_DISPLAY_WIDTH+15)/16)
|
||||
|
||||
//! Display bit clock in Hertz (20.16MHz).
|
||||
#define ALTO2_DISPLAY_BITCLOCK 20160000ll
|
||||
|
||||
//! Display bit time in pico seconds (~= 49.6031ns).
|
||||
#define ALTO2_DISPLAY_BITTIME(n) (U64(1000000000000)*(n)/ALTO2_DISPLAY_BITCLOCK)
|
||||
|
||||
//! Time for a scanline in pico seconds (768 * 49.6031ns ~= 38095.1808ns).
|
||||
#define ALTO2_DISPLAY_SCANLINE_TIME ALTO2_DISPLAY_BITTIME(ALTO2_DISPLAY_TOTAL_WIDTH)
|
||||
|
||||
//!< Time of the visible part of a scanline in pico seconds (606 * 49.6031ns ~= 30059.4786ns).
|
||||
#define ALTO2_DISPLAY_VISIBLE_TIME ALTO2_DISPLAY_BITTIME(ALTO2_DISPLAY_WIDTH)
|
||||
|
||||
//!< Time for a word in pico seconds (16 pixels * 49.6031ns ~= 793.6496ns).
|
||||
#define ALTO2_DISPLAY_WORD_TIME ALTO2_DISPLAY_BITTIME(16)
|
||||
|
||||
#define ALTO2_DISPLAY_VBLANK_TIME ((ALTO2_DISPLAY_TOTAL_HEIGHT-ALTO2_DISPLAY_HEIGHT)*HZ_TO_ATTOSECONDS(26250))
|
||||
|
||||
#else // ALTO2_DEFINE_CONSTANTS
|
||||
/**
|
||||
@ -172,26 +193,26 @@
|
||||
#ifndef _A2DISP_H_
|
||||
#define _A2DISP_H_
|
||||
struct {
|
||||
UINT16 state; //!< current state of the display_state_machine()
|
||||
UINT16 hlc; //!< horizontal line counter
|
||||
UINT16 setmode; //!< value written by last SETMODE<-
|
||||
UINT16 inverse; //!< set to 0xffff if line is inverse, 0x0000 otherwise
|
||||
bool halfclock; //!< set 0 for normal pixel clock, 1 for half pixel clock
|
||||
UINT32 state; //!< current state of the display_state_machine()
|
||||
UINT32 hlc; //!< horizontal line counter
|
||||
UINT32 setmode; //!< value written by last SETMODE<-
|
||||
UINT32 inverse; //!< set to 0xffff if line is inverse, 0x0000 otherwise
|
||||
bool halfclock; //!< false for normal pixel clock, true for half pixel clock
|
||||
UINT16 fifo[ALTO2_DISPLAY_FIFO]; //!< display word fifo
|
||||
UINT8 wa; //!< fifo input pointer (write address; 4-bit)
|
||||
UINT8 ra; //!< fifo output pointer (read address; 4-bit)
|
||||
UINT8 a63; //!< most recent value read from the PROM a63
|
||||
UINT8 a66; //!< most recent value read from the PROM a66
|
||||
bool dht_blocks; //!< set non-zero, if the DHT executed BLOCK
|
||||
bool dwt_blocks; //!< set non-zero, if the DWT executed BLOCK
|
||||
bool curt_blocks; //!< set non-zero, if the CURT executed BLOCK
|
||||
bool curt_wakeup; //!< set non-zero, if CURT wakeups are generated
|
||||
UINT16 vblank; //!< most recent HLC with VBLANK still high (11-bit)
|
||||
UINT16 xpreg; //!< cursor cursor x position register (10-bit)
|
||||
UINT16 csr; //!< cursor shift register (16-bit)
|
||||
UINT32 wa; //!< fifo input pointer (write address; 4-bit)
|
||||
UINT32 ra; //!< fifo output pointer (read address; 4-bit)
|
||||
UINT32 a63; //!< most recent value read from the PROM a63
|
||||
UINT32 a66; //!< most recent value read from the PROM a66
|
||||
bool dht_blocks; //!< set true, if the DHT executed BLOCK
|
||||
bool dwt_blocks; //!< set true, if the DWT executed BLOCK
|
||||
bool curt_blocks; //!< set true, if the CURT executed BLOCK
|
||||
bool curt_wakeup; //!< set true, if CURT wakeups are generated
|
||||
UINT32 vblank; //!< most recent HLC with VBLANK still high (11-bit)
|
||||
UINT32 xpreg; //!< cursor cursor x position register (10-bit)
|
||||
UINT32 csr; //!< cursor shift register (16-bit)
|
||||
UINT32 curxpos; //!< helper: first cursor word in scanline
|
||||
UINT16 cursor0; //!< helper: shifted cursor data for left word
|
||||
UINT16 cursor1; //!< helper: shifted cursor data for right word
|
||||
UINT32 cursor0; //!< helper: shifted cursor data for left word
|
||||
UINT32 cursor1; //!< helper: shifted cursor data for right word
|
||||
std::unique_ptr<UINT16[]> framebuf; //!< array of words of the raw bitmap that is displayed
|
||||
UINT8 *patterns; //!< array of 65536 patterns (16 bytes) with 1 byte per pixel
|
||||
std::unique_ptr<bitmap_ind16> bitmap; //!< MAME bitmap with 16 bit indices
|
||||
|
@ -7,6 +7,29 @@
|
||||
*****************************************************************************/
|
||||
#include "alto2cpu.h"
|
||||
|
||||
/*
|
||||
* Copied from ALTOCODE24.MU
|
||||
*
|
||||
* ;Display Vertical Task
|
||||
*
|
||||
* DVT: MAR← L← DASTART+1;
|
||||
* CBA← L, L← 0;
|
||||
* CURDATA← L;
|
||||
* SLC← L;
|
||||
* T← MD; CAUSE A VERTICAL FIELD INTERRUPT
|
||||
* L← NWW OR T;
|
||||
* MAR← CURLOC; SET UP THE CURSOR
|
||||
* NWW← L, T← 0-1;
|
||||
* L← MD XOR T; HARDWARE EXPECTS X COMPLEMENTED
|
||||
* T← MD, EVENFIELD;
|
||||
* CURX← L, :DVT1;
|
||||
*
|
||||
* DVT1: L← BIAS-T-1, TASK, :DVT2; BIAS THE Y COORDINATE
|
||||
* DVT11: L← BIAS-T, TASK;
|
||||
*
|
||||
* DVT2: YPOS← L, :DVT;
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief f1_dvt_block early: disable the display word task
|
||||
*/
|
||||
|
@ -16,10 +16,19 @@ enum {
|
||||
f2_dvt_evenfield = f2_task_10 //!< f2 10: load even field
|
||||
};
|
||||
|
||||
void f1_early_dvt_block(); //!< F1 func: disable the display word task
|
||||
void activate_dvt(); //!< called by the CPU when the display vertical task becomes active
|
||||
void init_dvt(int task = task_dvt); //!< initialize the display vertical task
|
||||
void exit_dvt(); //!< deinitialize the display vertical task
|
||||
void reset_dvt(); //!< reset the display vertical task
|
||||
//! F1 func: Disable the display word task.
|
||||
void f1_early_dvt_block();
|
||||
|
||||
//! Called by the CPU when the display vertical task becomes active.
|
||||
void activate_dvt();
|
||||
|
||||
//! Initialize the display vertical task.
|
||||
void init_dvt(int task = task_dvt);
|
||||
|
||||
//! Deinitialize the display vertical task.
|
||||
void exit_dvt();
|
||||
|
||||
//! Reset the display vertical task.
|
||||
void reset_dvt();
|
||||
#endif // _A2DVT_H_
|
||||
#endif // ALTO2_DEFINE_CONSTANTS
|
||||
|
@ -7,6 +7,37 @@
|
||||
*****************************************************************************/
|
||||
#include "alto2cpu.h"
|
||||
|
||||
/*
|
||||
* Copied from ALTOCODE24.MU
|
||||
*
|
||||
* ;Display Word Task
|
||||
*
|
||||
* DWT: T← DWA;
|
||||
* T←-3+T+1;
|
||||
* L← AECL+T,BUS=0,TASK; AECL CONTAINS NWRDS AT THIS TIME
|
||||
* AECL←L, :DWTZ;
|
||||
*
|
||||
* DWTY: BLOCK;
|
||||
* TASK, :DWTF;
|
||||
*
|
||||
* DWTZ: L←HTAB-1, BUS=0,TASK;
|
||||
* HTAB←L, :DOTAB;
|
||||
*
|
||||
* DOTAB: DDR←0, :DWTZ;
|
||||
* NOTAB: MAR←T←DWA;
|
||||
* L←AECL-T-1;
|
||||
* ALUCY, L←2+T;
|
||||
* DWA←L, :XNOMORE;
|
||||
*
|
||||
* DOMORE: DDR←MD, TASK;
|
||||
* DDR←MD, :NOTAB;
|
||||
*
|
||||
* XNOMORE:DDR← MD, BLOCK;
|
||||
* DDR← MD, TASK;
|
||||
*
|
||||
* DWTF: :DWT;
|
||||
*/
|
||||
|
||||
//! PROM a38 bit O1 is STOPWAKE' (stop DWT if bit is zero)
|
||||
#define FIFO_STOPWAKE(a38) (0 == (a38 & disp_a38_STOPWAKE) ? true : false)
|
||||
|
||||
|
@ -31,7 +31,7 @@ struct {
|
||||
UINT32 mar; //!< memory address register
|
||||
UINT32 rmdd; //!< read memory data double-word
|
||||
UINT32 wmdd; //!< write memory data double-word
|
||||
UINT16 md; //!< memory data register
|
||||
UINT32 md; //!< memory data register
|
||||
UINT64 cycle; //!< cycle when the memory address register was loaded
|
||||
|
||||
/**
|
||||
@ -44,8 +44,8 @@ struct {
|
||||
int access;
|
||||
bool error; //!< non-zero after a memory error was detected
|
||||
UINT32 mear; //!< memory error address register
|
||||
UINT16 mesr; //!< memory error status register
|
||||
UINT16 mecr; //!< memory error control register
|
||||
UINT32 mesr; //!< memory error status register
|
||||
UINT32 mecr; //!< memory error control register
|
||||
} m_mem;
|
||||
|
||||
/**
|
||||
|
@ -876,10 +876,8 @@ void alto2_cpu_device::device_start()
|
||||
save_item(NAME(m_dsp_time));
|
||||
save_item(NAME(m_unload_time));
|
||||
save_item(NAME(m_unload_word));
|
||||
#if (USE_BITCLK_TIMER == 0)
|
||||
save_item(NAME(m_bitclk_time));
|
||||
save_item(NAME(m_bitclk_index));
|
||||
#endif
|
||||
save_item(NAME(m_mouse.x));
|
||||
save_item(NAME(m_mouse.y));
|
||||
save_item(NAME(m_mouse.dx));
|
||||
@ -1458,6 +1456,8 @@ void alto2_cpu_device::bs_late_load_r()
|
||||
{
|
||||
if (f2() != f2_emu_load_dns) {
|
||||
m_r[m_rsel] = m_shifter;
|
||||
if (m_rsel == 037)
|
||||
m_r[m_rsel] &= ~3;
|
||||
LOG((this,LOG_CPU,2," R%02o<-; %s = SHIFTER (%#o)\n", m_rsel, r_name(m_rsel), m_shifter));
|
||||
}
|
||||
}
|
||||
@ -2279,8 +2279,6 @@ void alto2_cpu_device::execute_run()
|
||||
m_next2 = m_task_next2[m_task];
|
||||
|
||||
do {
|
||||
int do_bs, flags;
|
||||
|
||||
m_mpc = m_next; // next instruction's micro program counter
|
||||
m_mir = RD_UCODE(m_mpc); // fetch the micro code
|
||||
|
||||
@ -2303,13 +2301,15 @@ void alto2_cpu_device::execute_run()
|
||||
* or f2 == f2_const. These functions use the MIR BS field to
|
||||
* provide a part of the address to the constant ROM instead.
|
||||
*/
|
||||
do_bs = !(f1() == f1_const || f2() == f2_const);
|
||||
bool do_bs = f1() != f1_const && f2() != f2_const;
|
||||
if (do_bs && bs() == bs_read_md && check_mem_read_stall()) {
|
||||
LOG((this,LOG_CPU,3, " <-MD stall\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
// now read the next instruction field from the MIR and modify it
|
||||
m_next = next() | m_next2;
|
||||
|
||||
// prefetch the next instruction's next field as next2
|
||||
m_next2 = X_RDBITS(RD_UCODE(m_next), 32, NEXT0, NEXT9) | (m_next2 & ~ALTO2_UCODE_PAGE_MASK);
|
||||
LOG((this,LOG_CPU,2,"%s-%04o: %011o r:%02o aluf:%02o bs:%02o f1:%02o f2:%02o t:%o l:%o next:%05o next2:%05o\n",
|
||||
@ -2323,9 +2323,9 @@ void alto2_cpu_device::execute_run()
|
||||
|
||||
// The constant memory is gated to the bus by F1 == f1_const, F2 == f2_const, or BS >= 4
|
||||
if (!do_bs || bs() >= bs_task_4) {
|
||||
UINT32 addr = 8 * m_rsel + bs();
|
||||
const UINT32 addr = 8 * m_rsel + bs();
|
||||
// FIXME: is the format of m_const_data endian safe?
|
||||
UINT16 data = m_const_data[2*addr] | (m_const_data[2*addr+1] << 8);
|
||||
const UINT16 data = m_const_data[2*addr] | (m_const_data[2*addr+1] << 8);
|
||||
m_bus &= data;
|
||||
LOG((this,LOG_CPU,2," %#o; BUS &= %#o CONST[%03o]\n", m_bus, data, addr));
|
||||
}
|
||||
@ -2353,10 +2353,10 @@ void alto2_cpu_device::execute_run()
|
||||
*
|
||||
* B1 and B3-B7 are inverted on loading the PROM
|
||||
*/
|
||||
UINT8 a10 = m_alu_a10[(m_emu.skip << 4) | aluf()];
|
||||
UINT32 alu = alu_74181(m_bus, m_t, a10);
|
||||
const UINT8 a10 = m_alu_a10[(m_emu.skip << 4) | aluf()];
|
||||
const UINT32 alu = alu_74181(m_bus, m_t, a10);
|
||||
const int flags = a10 & (TSELECT | ALUM);
|
||||
m_aluc0 = (alu >> 16) & 1;
|
||||
flags = a10 & (TSELECT | ALUM);
|
||||
m_alu = static_cast<UINT16>(alu);
|
||||
|
||||
// WRTRAM must happen now before L is changed
|
||||
@ -2426,17 +2426,18 @@ void alto2_cpu_device::execute_run()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtract the microcycle time from the display time accu.
|
||||
* If it underflows, call the display state machine and add
|
||||
* the time for 32(!) pixel clocks to the accu.
|
||||
* This is very close to every seventh CPU cycle (really?)
|
||||
*/
|
||||
if (m_dsp_time >= 0) {
|
||||
/**
|
||||
* Subtract the microcycle time from the display time accu.
|
||||
* If it underflows, call the display state machine and add
|
||||
* the time for 32(!) pixel clocks to the accu.
|
||||
* This is very close to every seventh CPU cycle
|
||||
*/
|
||||
m_dsp_time -= ALTO2_UCYCLE;
|
||||
if (m_dsp_time < 0)
|
||||
display_state_machine();
|
||||
}
|
||||
|
||||
if (m_unload_time >= 0) {
|
||||
/**
|
||||
* Subtract the microcycle time from the unload time accu.
|
||||
@ -2448,9 +2449,9 @@ void alto2_cpu_device::execute_run()
|
||||
if (m_unload_time < 0)
|
||||
unload_word();
|
||||
}
|
||||
#if (USE_BITCLK_TIMER == 0)
|
||||
|
||||
if (m_bitclk_time >= 0) {
|
||||
/*
|
||||
/**
|
||||
* Subtract the microcycle time from the bitclk time accu.
|
||||
* If it underflows, call the disk bitclk function which adds
|
||||
* the time for one bit as clocks to the accu, or ends
|
||||
@ -2459,7 +2460,6 @@ void alto2_cpu_device::execute_run()
|
||||
m_bitclk_time -= ALTO2_UCYCLE;
|
||||
disk_bitclk(nullptr, m_bitclk_index);
|
||||
}
|
||||
#endif
|
||||
} while (m_icount-- > 0);
|
||||
|
||||
/* save this task's mpc and address modifier */
|
||||
@ -2566,7 +2566,5 @@ void alto2_cpu_device::soft_reset()
|
||||
|
||||
m_dsp_time = 0; // reset the display state machine timing accu
|
||||
m_unload_time = 0; // reset the word unload timing accu
|
||||
#if (USE_BITCLK_TIMER == 0)
|
||||
m_bitclk_time = 0; // reset the bitclk timing accu
|
||||
#endif
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ enum {
|
||||
#endif
|
||||
|
||||
#define USE_PRIO_F9318 0 //!< define to 1 to use the F9318 priority encoder code (broken)
|
||||
#define USE_BITCLK_TIMER 0 //!< define to 1 to use a very high rate timer for the disk bit clock
|
||||
|
||||
#define ALTO2_TASKS 16 //!< 16 task slots
|
||||
#define ALTO2_REGS 32 //!< 32 16-bit words in the R register file
|
||||
@ -592,10 +591,8 @@ private:
|
||||
int m_dsp_time; //!< display_state_machine() time accu
|
||||
int m_unload_time; //!< unload word time accu
|
||||
int m_unload_word; //!< unload word number
|
||||
#if (USE_BITCLK_TIMER == 0)
|
||||
int m_bitclk_time; //!< bitclk call time accu
|
||||
int m_bitclk_index; //!< bitclk index (bit number)
|
||||
#endif
|
||||
int m_bitclk_index; //!< bitclk index (bit number in sector)
|
||||
|
||||
static const char *task_name(int task); //!< human readable task names
|
||||
static const char *r_name(UINT8 reg); //!< human readable register names
|
||||
|
@ -214,14 +214,14 @@ offs_t alto2_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
|
||||
(static_cast<UINT32>(oprom[1]) << 16) |
|
||||
(static_cast<UINT32>(oprom[2]) << 8) |
|
||||
(static_cast<UINT32>(oprom[3]) << 0);
|
||||
UINT8 rsel = static_cast<UINT8>((mir >> 27) & 31);
|
||||
UINT8 aluf = static_cast<UINT8>((mir >> 23) & 15);
|
||||
UINT8 bs = static_cast<UINT8>((mir >> 20) & 7);
|
||||
UINT8 f1 = static_cast<UINT8>((mir >> 16) & 15);
|
||||
UINT8 f2 = static_cast<UINT8>((mir >> 12) & 15);
|
||||
UINT8 t = static_cast<UINT8>((mir >> 11) & 1);
|
||||
UINT8 l = static_cast<UINT8>((mir >> 10) & 1);
|
||||
offs_t next = static_cast<offs_t>(mir & 1023);
|
||||
int rsel = (mir >> 27) & 31;
|
||||
int aluf = (mir >> 23) & 15;
|
||||
int bs = (mir >> 20) & 7;
|
||||
int f1 = (mir >> 16) & 15;
|
||||
int f2 = (mir >> 12) & 15;
|
||||
int t = (mir >> 11) & 1;
|
||||
int l = (mir >> 10) & 1;
|
||||
offs_t next = mir & 1023;
|
||||
const UINT8* src = oprom - 4 * pc + 4 * next;
|
||||
UINT32 next2 = (static_cast<UINT32>(src[0]) << 24) |
|
||||
(static_cast<UINT32>(src[1]) << 16) |
|
||||
@ -244,52 +244,52 @@ offs_t alto2_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
|
||||
switch (aluf) {
|
||||
case 0: // T?: BUS
|
||||
// this is somehow redundant and just wasting space
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS) ");
|
||||
// dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS) ");
|
||||
break;
|
||||
case 1: // : T
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(T) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "T ");
|
||||
break;
|
||||
case 2: // T?: BUS OR T
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS|T) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS|T ");
|
||||
break;
|
||||
case 3: // : BUS AND T
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS&T) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS&T ");
|
||||
break;
|
||||
case 4: // : BUS XOR T
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS^T) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS^T ");
|
||||
break;
|
||||
case 5: // T?: BUS + 1
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS+1) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS+1 ");
|
||||
break;
|
||||
case 6: // T?: BUS - 1
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS-1) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS-1 ");
|
||||
break;
|
||||
case 7: // : BUS + T
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS+T) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS+T ");
|
||||
break;
|
||||
case 8: // : BUS - T
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS-T) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS-T ");
|
||||
break;
|
||||
case 9: // : BUS - T - 1
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS-T-1) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS-T-1 ");
|
||||
break;
|
||||
case 10: // T?: BUS + T + 1
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS+T+1) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS+T+1 ");
|
||||
break;
|
||||
case 11: // T?: BUS + SKIP
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS+SKIP) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS+SKIP ");
|
||||
break;
|
||||
case 12: // T?: BUS, T (AND)
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS,T) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS,T ");
|
||||
break;
|
||||
case 13: // : BUS AND NOT T
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS&~T) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS&~T ");
|
||||
break;
|
||||
case 14: // : undefined
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "*ALUF(BUS) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "*BUS ");
|
||||
break;
|
||||
case 15: // : undefined
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "*ALUF(BUS) ");
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "*BUS ");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ offs_t alto2_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
|
||||
break;
|
||||
case 7: // put the constant from PROM (RSELECT,BS) on the bus
|
||||
pa = (rsel << 3) | bs;
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-%05o CONST[%03o]", const_prom[pa], pa);
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-%05o", const_prom[pa]);
|
||||
break;
|
||||
default:
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "F1_%02o ", f1);
|
||||
@ -373,13 +373,13 @@ offs_t alto2_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "[ALUC0 ? %s:%s] ",
|
||||
addrname((prefetch | 1) & MCODE_MASK), addrname(prefetch & MCODE_MASK));
|
||||
break;
|
||||
case 6: // deliver BUS data to memory
|
||||
case 6: // write BUS data to memory
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "MD<-BUS ");
|
||||
break;
|
||||
case 7: // put on the bus the constant from PROM (RSELECT,BS)
|
||||
case 7: // put the constant from PROM (RSELECT,BS) on the bus
|
||||
if (f1 != 7) {
|
||||
pa = 8 * rsel + bs;
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-%05o CONST[%03o]", const_prom[pa], pa);
|
||||
dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-%05o", const_prom[pa]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -387,10 +387,5 @@ offs_t alto2_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
|
||||
break;
|
||||
}
|
||||
|
||||
// Simplify output based on text
|
||||
// ALUF(BUS) is a no-op if followed by BUS<-
|
||||
while (NULL != (dst = strstr(buffer, "ALUF(BUS) BUS<-")))
|
||||
strcpy(dst, dst + 15);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user