mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-24 06:34:02 +00:00
host mli support
intercepts ProDOS MLI calls for the /HOST/ path.
This commit is contained in:
parent
8e53c19f66
commit
3390a35f84
1028
src/host_common.c
Normal file
1028
src/host_common.c
Normal file
File diff suppressed because it is too large
Load Diff
105
src/host_common.h
Normal file
105
src/host_common.h
Normal file
@ -0,0 +1,105 @@
|
||||
enum {
|
||||
file_non,
|
||||
file_regular,
|
||||
file_resource,
|
||||
file_directory,
|
||||
};
|
||||
|
||||
enum {
|
||||
translate_none,
|
||||
translate_crlf,
|
||||
translate_merlin,
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct file_info {
|
||||
|
||||
time_t create_date;
|
||||
time_t modified_date;
|
||||
word16 access;
|
||||
word16 storage_type;
|
||||
word16 file_type;
|
||||
word32 aux_type;
|
||||
word32 eof;
|
||||
word32 blocks;
|
||||
word32 resource_eof;
|
||||
word32 resource_blocks;
|
||||
mode_t st_mode;
|
||||
int has_fi;
|
||||
byte finder_info[32];
|
||||
};
|
||||
|
||||
|
||||
extern Engine_reg engine;
|
||||
|
||||
#define SEC() engine.psr |= 0x01
|
||||
#define CLC() engine.psr &= ~0x01
|
||||
#define SEV() engine.psr |= 0x40
|
||||
#define CLV() engine.psr &= ~0x40
|
||||
#define SEZ() engine.psr |= 0x02
|
||||
#define CLZ() engine.psr &= ~0x02
|
||||
#define SEI() engine.psr |= 0x04
|
||||
#define CLI() engine.psr &= ~0x04
|
||||
|
||||
enum {
|
||||
C = 0x01,
|
||||
Z = 0x02,
|
||||
I = 0x04,
|
||||
D = 0x08,
|
||||
X = 0x10,
|
||||
M = 0x20,
|
||||
V = 0x40,
|
||||
N = 0x80
|
||||
};
|
||||
|
||||
extern int g_cfg_host_read_only;
|
||||
extern int g_cfg_host_crlf;
|
||||
extern int g_cfg_host_merlin;
|
||||
extern char *host_root;
|
||||
|
||||
unsigned host_startup(void);
|
||||
void host_shutdown(void);
|
||||
|
||||
int host_is_root(struct stat *);
|
||||
|
||||
/* garbage collected string routines */
|
||||
|
||||
void *host_gc_malloc(size_t size);
|
||||
void host_gc_free(void);
|
||||
char *host_gc_strdup(const char *src);
|
||||
char *host_gc_append_path(const char *a, const char *b);
|
||||
char *host_gc_append_string(const char *a, const char *b);
|
||||
|
||||
/* text conversion */
|
||||
void host_cr_to_lf(byte *buffer, size_t size);
|
||||
void host_lf_to_cr(byte *buffer, size_t size);
|
||||
void host_merlin_to_text(byte *buffer, size_t size);
|
||||
void host_text_to_merlin(byte *buffer, size_t size);
|
||||
|
||||
/* errno -> IIgs/mli error */
|
||||
word32 host_map_errno(int xerrno);
|
||||
word32 host_map_errno_path(int xerrno, const char *path);
|
||||
const char *host_error_name(word16 error);
|
||||
|
||||
/* file info */
|
||||
|
||||
int host_file_type_to_finder_info(byte *buffer, word16 file_type, word32 aux_type);
|
||||
void host_get_file_xinfo(const char *path, struct file_info *fi);
|
||||
word32 host_get_file_info(const char *path, struct file_info *fi);
|
||||
word32 host_set_file_info(const char *path, struct file_info *fi);
|
||||
|
||||
|
||||
void host_set_date_time_rec(word32 ptr, time_t time);
|
||||
void host_set_date_time(word32 ptr, time_t time);
|
||||
|
||||
time_t host_get_date_time(word32 ptr);
|
||||
time_t host_get_date_time_rec(word32 ptr);
|
||||
|
||||
/* convert to prodos date/time */
|
||||
word32 host_convert_date_time(time_t time);
|
||||
|
||||
|
||||
void host_hexdump(word32 address, int size);
|
||||
void host_hexdump_native(void *data, unsigned address, int size);
|
||||
|
1066
src/host_fst.c
1066
src/host_fst.c
File diff suppressed because it is too large
Load Diff
1430
src/host_mli.c
Normal file
1430
src/host_mli.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -207,6 +207,10 @@ __attribute__ ((aligned(256)))
|
||||
|
||||
;
|
||||
|
||||
/* SLOT 7 DEVSEL RAM (used by HOST.MLI) */
|
||||
static byte slot7_devsel[15] = { 0 };
|
||||
|
||||
|
||||
// OG Added moremem_init()
|
||||
void moremem_init() {
|
||||
g_em_emubyte_cnt = 0;
|
||||
@ -1637,7 +1641,7 @@ int io_read(word32 loc, double *cyc_ptr) {
|
||||
case 0xf4: case 0xf5: case 0xf6: case 0xf7:
|
||||
case 0xf8: case 0xf9: case 0xfa: case 0xfb:
|
||||
case 0xfc: case 0xfd: case 0xfe: case 0xff:
|
||||
return 0;
|
||||
return slot7_devsel[loc & 0x0f] /* 0 */;
|
||||
|
||||
default:
|
||||
printf("loc: %04x bad\n", loc);
|
||||
@ -2378,7 +2382,9 @@ void io_write(word32 loc, int val, double *cyc_ptr) {
|
||||
case 0xf4: case 0xf5: case 0xf6: case 0xf7:
|
||||
case 0xf8: case 0xf9: case 0xfa: case 0xfb:
|
||||
case 0xfc: case 0xfd: case 0xfe: case 0xff:
|
||||
UNIMPL_WRITE;
|
||||
slot7_devsel[loc & 0x0f] = val; /* UNIMPL_WRITE; */
|
||||
return;
|
||||
|
||||
default:
|
||||
printf("WRite loc: %x\n",loc);
|
||||
exit(-300);
|
||||
|
@ -2510,6 +2510,8 @@ static void wdm_hexdump() {
|
||||
}
|
||||
}
|
||||
}
|
||||
extern void host_mli_head(void);
|
||||
extern void host_mli_tail(void);
|
||||
|
||||
void
|
||||
do_wdm(word32 arg)
|
||||
@ -2532,6 +2534,14 @@ do_wdm(word32 arg)
|
||||
|
||||
/* 0xFx shouldn't be called unless you know what you're doing */
|
||||
|
||||
case 0xfc: /* mli head patch */
|
||||
host_mli_head();
|
||||
break;
|
||||
|
||||
case 0xfd: /* mli tail patch */
|
||||
host_mli_tail();
|
||||
break;
|
||||
|
||||
case 0xfe: /* used for ModemWorks branch */
|
||||
break;
|
||||
|
||||
|
@ -846,8 +846,8 @@ static char * get_gsstr(word32 ptr) {
|
||||
|
||||
static char * get_pstr(word32 ptr) {
|
||||
if (!ptr) return NULL;
|
||||
int length = get_memory16_c(ptr, 0);
|
||||
ptr += 2;
|
||||
int length = get_memory_c(ptr, 0);
|
||||
ptr += 1;
|
||||
char *str = gc_malloc(length + 1);
|
||||
for (int i = 0; i < length; ++i) {
|
||||
char c = get_memory_c(ptr+i, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user