mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-02-21 01:28:59 +00:00
Allow C programs to set the Apple II slot number.
This commit is contained in:
parent
a07e889d7b
commit
7090fb5bdd
21
apps/date.c
21
apps/date.c
@ -1,8 +1,10 @@
|
||||
#include <cc65.h>
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../inc/ip65.h"
|
||||
|
||||
@ -37,14 +39,31 @@ void confirm_exit(void)
|
||||
void main(void)
|
||||
{
|
||||
unsigned long server, time;
|
||||
unsigned char drv_init = DRV_INIT_DEFAULT;
|
||||
|
||||
if (doesclrscrafterexit())
|
||||
{
|
||||
atexit(confirm_exit);
|
||||
}
|
||||
|
||||
#ifdef __APPLE2__
|
||||
{
|
||||
int file;
|
||||
|
||||
printf("\nSetting slot ");
|
||||
file = open("ethernet.slot", O_RDONLY);
|
||||
if (file != -1)
|
||||
{
|
||||
read(file, &drv_init, 1);
|
||||
close(file);
|
||||
drv_init &= ~'0';
|
||||
}
|
||||
printf("- %d\n", drv_init);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("\nInitializing ");
|
||||
if (ip65_init())
|
||||
if (ip65_init(drv_init))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
24
apps/hfs65.c
24
apps/hfs65.c
@ -300,6 +300,7 @@ void error_exit(void)
|
||||
void main(void)
|
||||
{
|
||||
char cwd[FILENAME_MAX];
|
||||
unsigned char drv_init = DRV_INIT_DEFAULT;
|
||||
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
|
||||
@ -308,9 +309,26 @@ void main(void)
|
||||
#endif
|
||||
|
||||
printf("\nHttpFileServer65 v1.0"
|
||||
"\n====================="
|
||||
"\n\nInitializing ");
|
||||
if (ip65_init())
|
||||
"\n=====================");
|
||||
|
||||
#ifdef __APPLE2__
|
||||
{
|
||||
int file;
|
||||
|
||||
printf("\n\nSetting slot ");
|
||||
file = open("ethernet.slot", O_RDONLY);
|
||||
if (file != -1)
|
||||
{
|
||||
read(file, &drv_init, 1);
|
||||
close(file);
|
||||
drv_init &= ~'0';
|
||||
}
|
||||
printf("- %d", drv_init);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("\n\nInitializing ");
|
||||
if (ip65_init(drv_init))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
12
inc/ip65.h
12
inc/ip65.h
@ -45,6 +45,14 @@ extern unsigned long cfg_dns;
|
||||
//
|
||||
extern unsigned long dhcp_server;
|
||||
|
||||
// Driver initialisation parameter values
|
||||
//
|
||||
#ifdef __APPLE2__
|
||||
#define DRV_INIT_DEFAULT 3 // Apple II slot number
|
||||
#else
|
||||
#define DRV_INIT_DEFAULT 0 // Unused
|
||||
#endif
|
||||
|
||||
// Initialise the IP stack
|
||||
//
|
||||
// This calls the individual protocol & driver initialisations, so this is
|
||||
@ -52,10 +60,10 @@ extern unsigned long dhcp_server;
|
||||
// except for dhcp_init which must also be called if the application
|
||||
// is using DHCP rather than hardcoded IP configuration.
|
||||
//
|
||||
// Inputs: None
|
||||
// Inputs: drv_init: Driver initialisation parameter
|
||||
// Output: 1 if there was an error, 0 otherwise
|
||||
//
|
||||
unsigned char ip65_init(void);
|
||||
unsigned char __fastcall__ ip65_init(unsigned char drv_init);
|
||||
|
||||
// Main IP polling loop
|
||||
//
|
||||
|
@ -9,8 +9,10 @@
|
||||
.import ip65_process
|
||||
.import ip65_random_word
|
||||
.import ip65_error
|
||||
.import drv_init
|
||||
|
||||
_ip65_init:
|
||||
jsr drv_init
|
||||
jsr ip65_init
|
||||
ldx #$00
|
||||
txa
|
||||
|
@ -48,7 +48,7 @@ void main(void)
|
||||
}
|
||||
|
||||
printf("Init\n");
|
||||
if (ip65_init())
|
||||
if (ip65_init(DRV_INIT_DEFAULT))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void main(void)
|
||||
}
|
||||
|
||||
printf("Init\n");
|
||||
if (ip65_init())
|
||||
if (ip65_init(DRV_INIT_DEFAULT))
|
||||
{
|
||||
error_exit();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user