simh-testsetgenerator/AltairZ80/altairz80_defs.h
Patrick Linstruth 7a5432d9e2 AltairZ80: Add "MEM" and "REG" simulator-specific commands
sim> mem df00
DF00 C3 5C E2 C3 58 E2 7F 00 43 6F 70 79 72 69 67 68 .\..X...Copyrigh
DF10 74 20 31 39 37 39 20 28 63 29 20 62 79 20 44 69 t 1979 (c) by Di
DF20 67 69 74 61 6C 20 52 65 73 65 61 72 63 68 20 20 gital Research
DF30 20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00     ............
DF40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
DF50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
DF60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ....s...ub...m..
DF70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..I..tT...e.....
DF80 00 00 00 00 00 00 00 00 08 DF 00 00 5F 0E 02 C3 d....4...l.._0.r
DF90 05 00 C5 CD 8C DF C1 C9 3E 0D CD 92 DF 3E 0A C3 .d..M...>....>..
DFA0 92 DF 3E 20 C3 92 DF C5 CD 98 DF E1 7E B7 C8 23 ..> ..a.....~..#
DFB0 E5 CD 8C DF E1 C3 AC DF 0E 0D C3 05 00 5F 0E 0E ...r........._..
DFC0 C3 05 00 CD 05 00 32 EE E6 3C C9 0E 0F C3 C3 DF ...K..2..<..'.s.
DFD0 AF 32 ED E6 11 CD E6 C3 CB DF 0E 10 C3 C3 DF 0E .2...a...p.P....
DFE0 11 C3 C3 DF 0E 12 C3 C3 DF 11 CD E6 C3 DF DF 0E ...r...0..v.....
DFF0 13 C3 05 00 CD 05 00 B7 C9 0E 14 C3 F4 DF 11 CD .....a.l........

sim> reg
C0Z1M0E1I1 A=02 B=007F D=DF06 H=EA0E S=EA37 P=FA6B ANI 01h
sim> set on
sim> on error reg
sim> s

Step expired, PC: 0FA6D (JZ 0FA69h)
C0Z1M0E1I1 A=00 B=007F D=DF06 H=EA0E S=EA37 P=FA6D JZ 0FA69h
sim> s

Step expired, PC: 0FA69 (IN 10h)
C0Z1M0E1I1 A=00 B=007F D=DF06 H=EA0E S=EA37 P=FA69 IN 10h
sim> s

Step expired, PC: 0FA6B (ANI 01h)
C0Z1M0E1I1 A=02 B=007F D=DF06 H=EA0E S=EA37 P=FA6B ANI 01h
2022-11-23 11:22:12 -05:00

103 lines
6 KiB
C

/* altairz80_defs.h: MITS Altair simulator definitions
Copyright (c) 2002-2014, Peter Schorn
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
PETER SCHORN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Peter Schorn shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Peter Schorn.
Based on work by Charles E Owen (c) 1997
*/
#ifndef ALTAIRZ80_DEFS_H_
#define ALTAIRZ80_DEFS_H_ 0
#include "sim_defs.h" /* simulator definitions */
#define MAXBANKSIZE 65536 /* maximum memory size, a power of 2 */
#define MAXBANKSIZELOG2 16 /* log2 of MAXBANKSIZE */
#define MAXBANKS 16 /* max number of memory banks, a power of 2 */
#define MAXBANKSLOG2 4 /* log2 of MAXBANKS */
#define MAXMEMORY (MAXBANKS * MAXBANKSIZE) /* maximum, total memory size */
#define ADDRMASK (MAXBANKSIZE - 1) /* address mask */
#define ADDRMASKEXTENDED (MAXMEMORY - 1) /* extended address mask */
#define BANKMASK (MAXBANKS - 1) /* bank mask */
#define MEMORYSIZE (cpu_unit.capac) /* actual memory size */
#define MEMORYMASK (cpu_unit.capac - 1) /* actual memory size mask */
#define KB 1024 /* kilo byte */
#define KBLOG2 10 /* log2 of KB */
#define ALTAIR_ROM_LOW 0xff00 /* start address of regular Altair ROM */
#define RESOURCE_TYPE_MEMORY 1
#define RESOURCE_TYPE_IO 2
#define MAX_INT_VECTORS 32 /* maximum number of interrupt vectors */
#define NUM_OF_DSK 16 /* NUM_OF_DSK must be power of two */
#define LDA_INSTRUCTION 0x3e /* op-code for LD A,<8-bit value> instruction */
#define UNIT_NO_OFFSET_1 0x37 /* LD A,<unitno> */
#define UNIT_NO_OFFSET_2 0xb4 /* LD a,80h | <unitno> */
#define CPU_INDEX_8080 4 /* index of default PC register */
typedef enum {
CHIP_TYPE_8080 = 0,
CHIP_TYPE_Z80,
CHIP_TYPE_8086,
CHIP_TYPE_M68K, /* must come after 8080, Z80 and 8086 */
NUM_CHIP_TYPE, /* must be last */
} ChipType;
/* simulator stop codes */
#define STOP_HALT 0 /* HALT */
#define STOP_IBKPT 1 /* breakpoint (program counter) */
#define STOP_MEM 2 /* breakpoint (memory access) */
#define STOP_INSTR 3 /* breakpoint (instruction access) */
#define STOP_OPCODE 4 /* invalid operation encountered (8080, Z80, 8086) */
#define UNIT_CPU_V_OPSTOP (UNIT_V_UF+0) /* stop on invalid operation */
#define UNIT_CPU_OPSTOP (1 << UNIT_CPU_V_OPSTOP)
#define UNIT_CPU_V_BANKED (UNIT_V_UF+1) /* banked memory is used */
#define UNIT_CPU_BANKED (1 << UNIT_CPU_V_BANKED)
#define UNIT_CPU_V_ALTAIRROM (UNIT_V_UF+2) /* ALTAIR ROM exists */
#define UNIT_CPU_ALTAIRROM (1 << UNIT_CPU_V_ALTAIRROM)
#define UNIT_CPU_V_VERBOSE (UNIT_V_UF+3) /* warn if ROM is written to */
#define UNIT_CPU_VERBOSE (1 << UNIT_CPU_V_VERBOSE)
#define UNIT_CPU_V_MMU (UNIT_V_UF+4) /* use MMU and slower CPU */
#define UNIT_CPU_MMU (1 << UNIT_CPU_V_MMU)
#define UNIT_CPU_V_STOPONHALT (UNIT_V_UF+5) /* stop simulation on HALT */
#define UNIT_CPU_STOPONHALT (1 << UNIT_CPU_V_STOPONHALT)
#define UNIT_CPU_V_SWITCHER (UNIT_V_UF+6) /* switcher 8086 <--> 8080/Z80 enabled */
#define UNIT_CPU_SWITCHER (1 << UNIT_CPU_V_SWITCHER)
#define ADDRESS_FORMAT "[0x%08x]"
#if (defined (__MWERKS__) && defined (macintosh)) || defined(__DECC)
#define __FUNCTION__ __FILE__
#endif
typedef struct {
uint32 mem_base; /* Memory Base Address */
uint32 mem_size; /* Memory Address space requirement */
uint32 io_base; /* I/O Base Address */
uint32 io_size; /* I/O Address Space requirement */
} PNP_INFO;
extern ChipType chiptype;
#endif