-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathos.h
141 lines (126 loc) · 4.04 KB
/
os.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#if 0
File name: os.h
x86 Emulating Debugger (EDB)
Copyright (C) 1991-1993 Serge Pachkovsky
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
If you need to contact me, feel free to write to [email protected]
or to Serge Pachkovsky, Erligatterweg 61, Zuerich CH 8038, Switzerland
#endif
/*
* OS and targer machine dependent procedures.
*/
#define MAX_FILE_NAME 80
/*
* Default debug console name.
*/
#define TTY_NAME "con"
#define STDERR_HANDLE 2
void cin( char *buf ) ;
void cprint( char *fmt, ... ) ;
void cputs( char *str ) ;
void cputc( char c ) ;
void cgets( char *buf ) ;
char *hgets( char *buf, int size, int handle ) ;
/*
* switchar( x ) returns non-zero if c is valid command
* switch character.
*/
int switchar( char c ) ;
/*
* load_program( name, param ) loads program image from name
* with arguments param.
* Sets all emulator registers (including cs:ip and ss:sp )
* to correct values.
* Returns -1 (and sets errno) if load failed.
*/
int load_program( char *name, char *param, void (*term_prog)(void) ) ;
extern WORD program_psp ;
extern WORD debug_psp ;
/*
* set_psp(psp) and get_psp(psp) - nothing more
*/
void set_psp( WORD psp ) ;
WORD get_psp( void ) ;
/*
* absolute_name(s) builds absolute file name (which access file 's'
* regardless of current directory, etc.) from relative file name s
*/
void absolute_name( char *s ) ;
/*
* terminate_program() quits execution of currently debugged program
*/
void terminate_program( void ) ;
/*
* execute_system_ISR( n ) simulates standart system int nn action
*/
void execute_system_ISR( WORD cs, WORD ip ) ;
/*
* break_requested() returns non-zero if LShift-Ctrl-Alt pressed.
*/
int break_requested( void ) ;
/*
* revive_screen() sets video mode equal to current one.
*/
void revive_screen( void ) ;
/*
* program_memtop() returns (segment addr. of) top of program memory.
*/
WORD program_memtop( void ) ;
/*
* get_file_size() returns length of file or -1L if error (and sets errno).
*/
long get_file_size( char *name ) ;
/*
*
*/
void close_journal( void ) ;
void start_journal_write( char *name ) ;
void start_journal_read( char *name ) ;
#define MAX_COMMANDS_IN_BUF 5
extern char journal_name[ MAX_FILE_NAME ] ;
extern char journal_status ;
enum { J_CLOSED, J_READING, J_WRITING } ;
void save_memory_area( int handle, WORD seg_start, WORD seg_end ) ;
void grow_by_one_segment( void ) ;
WORD allocate_segment( WORD size ) ;
void free_segment( WORD seg ) ;
void LIBSYM copy_RAM( WORD dest, WORD src, WORD size ) ;
/*
* setup_vector_monitor( vec, space ) will call function
* interrupt_monitor each time then interrupt 'vec' occure
* scratch should be at least MONITOR_SPACE bytes.
* interrupt_monitor should not make any assumptions on ss:sp
* location.
*/
#ifndef __MONITOR_DEFINED__
#define __MONITOR_DEFINED__
typedef struct {
char call[ 6 ] ;
WORD code ;
void interrupt (*old_vec)( void ) ;
} MONITOR ;
#endif
void LIBSYM setup_vector_monitor( WORD vector, MONITOR *scratch ) ;
void LIBSYM interrupt_monitor( MONITOR *mon ) ;
/*
* Magic values in CPU registers after EXEC
*/
extern WORD entry_ax ;
extern WORD entry_bx ;
extern WORD entry_cx ;
extern WORD entry_bp ;
/*
* Setting watch_exec to 1 will cause EDB to emulate DOS exec and terminate
* functions, thus leaving parent processes inside virtual CPU.
*/
extern int watch_exec ;