-
Notifications
You must be signed in to change notification settings - Fork 48
/
host_pc.h
117 lines (87 loc) · 3.79 KB
/
host_pc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// -----------------------------------------------------------------------------
// Altair 8800 Simulator
// Copyright (C) 2017 David Hansel
// -----------------------------------------------------------------------------
#ifndef HOST_PC_H
#define HOST_PC_H
#include "switch_serial.h"
#include "Altair8800.h"
#ifdef _WIN32
struct DIR;
#else
typedef struct __dirstream DIR;
#endif
#define MEMSIZE 0x10000 /* 64k */
#define HOST_STORAGESIZE 0x80000 /* 512k */
#define HOST_BUFFERSIZE 0x400 /* 1k */
// maximum is 4
#define HOSTPC_NUM_SOCKET_CONN 4
#define HOST_NUM_SERIAL_PORTS (HOSTPC_NUM_SOCKET_CONN+1)
#define HOST_PERFORMANCE_FACTOR 75.0
// PC host is always standalone
#undef STANDALONE
#define STANDALONE 1
// PC host provides a filesystem
#define HOST_HAS_FILESYS
#define HOST_FILESYS_FILE_TYPE FILE*
#define HOST_FILESYS_DIR_TYPE DIR*
#ifdef _MSC_VER
#define snprintf sprintf_s
#define asm(x) __asm NOP
#endif
#define PROF_DISPLAY_INTERVAL 10000000
#undef MAX_BREAKPOINTS
#define MAX_BREAKPOINTS 10
extern byte data_leds;
extern uint16_t status_leds;
extern uint16_t addr_leds;
extern byte stop_request;
#define host_read_sense_switches() 0
uint16_t host_read_addr_switches();
#define host_set_status_led_INT() status_leds |= ST_INT
#define host_set_status_led_WO() status_leds &= ~ST_WO
#define host_set_status_led_STACK() status_leds |= ST_STACK
#define host_set_status_led_HLTA() status_leds |= ST_HLTA
#define host_set_status_led_OUT() status_leds |= ST_OUT
#define host_set_status_led_M1() status_leds |= ST_M1
#define host_set_status_led_INP() status_leds |= ST_INP
#define host_set_status_led_MEMR() status_leds |= ST_MEMR
#define host_set_status_led_INTE() status_leds |= ST_INTE
#define host_set_status_led_PROT() status_leds |= ST_PROT
#define host_set_status_led_WAIT() { status_leds |= ST_WAIT; status_wait = true; }
#define host_set_status_led_HLDA() status_leds |= ST_HLDA
#define host_clr_status_led_INT() status_leds &= ~ST_INT
#define host_clr_status_led_WO() status_leds |= ST_WO
#define host_clr_status_led_STACK() status_leds &= ~ST_STACK
#define host_clr_status_led_HLTA() status_leds &= ~ST_HLTA
#define host_clr_status_led_OUT() status_leds &= ~ST_OUT
#define host_clr_status_led_M1() status_leds &= ~ST_M1
#define host_clr_status_led_INP() status_leds &= ~ST_INP
#define host_clr_status_led_MEMR() status_leds &= ~ST_MEMR
#define host_clr_status_led_INTE() status_leds &= ~ST_INTE
#define host_clr_status_led_PROT() status_leds &= ~ST_PROT
#define host_clr_status_led_WAIT() { status_leds &= ~ST_WAIT; status_wait = false; }
#define host_clr_status_led_HLDA() status_leds &= ~ST_HLDA
#define host_read_status_led_WAIT() status_wait
#define host_read_status_led_M1() (status_leds & ST_M1)
#define host_read_status_led_HLTA() (status_leds & ST_HLTA)
// reading from memory (MEMR on, WO on)
#define host_set_status_leds_READMEM() status_leds |= ST_MEMR | ST_WO
// reading opcode from memory (MEMR on, M1 on, WO on)
#define host_set_status_leds_READMEM_M1() status_leds |= ST_MEMR | ST_WO | ST_M1
// reading from stack (MEMR on, STACK on, WO on)
#define host_set_status_leds_READMEM_STACK() status_leds |= ST_MEMR | ST_WO | ST_STACK
// writing to memory (MEMR off, WO off)
#define host_set_status_leds_WRITEMEM() status_leds &= ~(ST_MEMR | ST_WO)
#define host_read_status_leds() status_leds
#define host_set_addr_leds(v) addr_leds = v
#define host_read_addr_leds() addr_leds
#define host_set_data_leds(v) data_leds = v
#define host_read_data_leds() data_leds
void host_check_interrupts();
void host_serial_interrupts_pause();
void host_serial_interrupts_resume();
// external bus I/O not supported on this platform
#define host_read_status_WAIT() 0
#define host_read_data_bus() 0xFF
#endif