Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/check_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#endif /* BUILD_RC2014 */

#ifdef _CMOC_VERSION_
#include "coco/stdbool.h"
#include "coco/io.h"
#include "coco/globals.h"
#endif /* CMOC_VERSION */
Expand All @@ -67,15 +66,15 @@ void check_wifi(void)
state=HOSTS_AND_DEVICES;
}
else if (io_get_wifi_status() == 3)
{
state=HOSTS_AND_DEVICES;
}
{
state = HOSTS_AND_DEVICES;
}
else if (io_get_ssid()->ssid[0] == 0x00)
{
state=SET_WIFI;
}
{
state = SET_WIFI;
}
else
{
state=CONNECT_WIFI;
}
{
state = CONNECT_WIFI;
}
}
1 change: 0 additions & 1 deletion src/coco/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <cmoc.h>
#include "bar.h"
#include "stdbool.h"

/**
* static local variables for bar y, max, and index.
Expand Down
1 change: 0 additions & 1 deletion src/coco/bar.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define true 1
#define false 0

#include "stdbool.h"
#include "globals.h"

/**
Expand Down
2 changes: 0 additions & 2 deletions src/coco/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#ifndef GLOBALS_H
#define GLOBALS_H

#define bool unsigned char

#define NUM_DEVICE_SLOTS 4

// # of files to display on the page. Moved from select_file.c to here, for Atari.
Expand Down
2 changes: 1 addition & 1 deletion src/coco/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#ifndef INPUT_H
#define INPUT_H

#include "stdbool.h"
#include "../typedefs.h"
#include "../fuji_typedefs.h"

/**
* Get input from keyboard/joystick
Expand Down
1 change: 0 additions & 1 deletion src/coco/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

#include <cmoc.h>
#include "stdbool.h"
#include "io.h"
#include "globals.h"
#include "screen.h"
Expand Down
1 change: 0 additions & 1 deletion src/coco/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#ifndef IO_H
#define IO_H

#include "stdbool.h"
#include "../fuji_typedefs.h"

bool io_error(void);
Expand Down
48 changes: 40 additions & 8 deletions src/coco/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern DeviceSlot deviceSlots[NUM_DEVICE_SLOTS];
extern HostSlot hostSlots[8];

char uppercase_tmp[32]; // temp space for strupr(s) output.
// so original strings doesn't get changed.
// so original strings doesn't get changed.

char *screen_upper(char *s)
{
Expand Down Expand Up @@ -95,9 +95,12 @@ void screen_set_wifi(AdapterConfig *ac)
void screen_set_wifi_display_ssid(char n, SSIDInfo *s)
{
char meter[4]={0x20,0x20,0x20,0x00};
char ds[32];
char ds[33];

memset(ds,0x20,32);
ds[32] = 0x00;
// Print spaces first
locate(0,n+2); printf("%-32s",screen_upper(ds));
strncpy(ds,s->ssid,32);

if (s->rssi > -50)
Expand Down Expand Up @@ -126,7 +129,7 @@ void screen_set_wifi_select_network(unsigned char nn)
printf(" up/down TO SELECT ");
printf("hIDDEN SSID rESCAN enter SELECT");
bar_draw(0,false);
bar_set(2,1,nn,0);
bar_set(2,0,nn,0);

screen_add_shadow(nn+2,CYAN);
}
Expand Down Expand Up @@ -386,7 +389,7 @@ void screen_hosts_and_devices_hosts()
locate(0,0);
printf("%32s","host\x80slots");

memset(0x400,0xAF,22);
memset(SCREEN_RAM_TOP,0xAF,22);
(*(unsigned char *)0x041a) = 0x20;

locate(0,13);
Expand Down Expand Up @@ -451,13 +454,16 @@ const char host_slot_char(unsigned char hostSlot)

const char device_slot_mode(unsigned char mode)
{
switch(mode)
// Mask out 0x40
unsigned char masked_mode = mode & ~MODE_MOUNTED;

switch(masked_mode)
{
case 0:
return 0x80;
case 1:
case MODE_READ:
return 0xAF;
case 2:
case MODE_WRITE:
return 0x9F;
}
}
Expand Down Expand Up @@ -513,19 +519,45 @@ void screen_hosts_and_devices_long_filename(const char *f)

void screen_init(void)
{
// TODO: figure out lowercase.
// Make sure the screen is in 32 column mode
width(32);
}

void screen_destination_host_slot(char *h, char *p)
{
cls(3);
locate(0,11);

printf("%32s","copy\x80\x66rom\x80host\x80slot");

locate(0, 12); printf("%-32s", screen_upper(h));
locate(0, 13); printf("%-128s", p);
}

void screen_destination_host_slot_choose(void)
{
locate(0, 0);
printf("%32s","copy\x80to\x80host\x80slot");
screen_hosts_and_devices_host_slots(&hostSlots[0]);
locate(0,13);
printf("1-8 choose\x80slot ENTER select");
locate(0,14);
printf("BREAK quit");
screen_add_shadow(15,BLUE);

bar_set(1,1,8,selected_host_slot);
}

void screen_perform_copy(char *sh, char *p, char *dh, char *dp)
{
cls(3);

locate(0,0); printf("%32s","COPYING FILE FROM:");
locate(0,2); printf("%32s",sh);
locate(0,3); printf("%-128s",p);
locate(0,7); printf("%32s","COPYING FILE TO:");
locate(0,9); printf("%32s",dh);
locate(0,10); printf("%-128s",dp);
}

void screen_connect_wifi(NetConfig *nc)
Expand Down
16 changes: 0 additions & 16 deletions src/coco/stdbool.h

This file was deleted.

35 changes: 5 additions & 30 deletions src/connect_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#ifdef _CMOC_VERSION_
#include <cmoc.h>
#include "coco/stdbool.h"
#include "coco/bar.h"
#include "coco/globals.h"
#include "coco/io.h"
Expand Down Expand Up @@ -79,11 +78,7 @@ extern bool screen_should_be_cleared;

void connect_wifi(void)
{
#ifndef _CMOC_VERSION_
unsigned char retries = 20;
#else
unsigned char retries = 2;
#endif
NetConfig nc;
unsigned char s, key;

Expand All @@ -99,24 +94,14 @@ void connect_wifi(void)
#ifndef _CMOC_VERSION_
// check for esc key and abort
if (input() == KEY_ABORT)
#else
unsigned char c = inkey();
if (c!=0)
{
char szMsg[32];
sprintf(szMsg, "c = %02x\n", c);
screen_error(szMsg);
pause(150);
}
if (c==' ' || c==0x3)
#endif /* _CMOC_VERSION_ */
{
screen_error("CONNECTION ABORTED");
pause(150);
state=HOSTS_AND_DEVICES;
state=SET_WIFI;
return;
}

#endif /* _CMOC_VERSION_ */

s = io_get_wifi_status();

switch (s)
Expand All @@ -134,23 +119,13 @@ void connect_wifi(void)
pause(60);
return;
case 4:
screen_error("CONNECT FAILED1");
//pause(150);
// ws_subState = WS_SCAN;
state = HOSTS_AND_DEVICES;
screen_error("CONNECT FAILED");
pause(150);
return;
case 5:
screen_error("CONNECTION LOST");
pause(150);
return;
#ifdef _CMOC_VERSION_
case 6:
//screen_error("CONNECT FAILED");
screen_error("BAD PSK");
pause(150);
state = HOSTS_AND_DEVICES;
return;
#endif
default:
screen_error("PLEASE WAIT...");
pause(150);
Expand Down
1 change: 0 additions & 1 deletion src/destination_host_slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#ifdef _CMOC_VERSION_
#include <cmoc.h>
#include "coco/stdbool.h"
#include "coco/screen.h"
#include "coco/input.h"
#include "coco/globals.h"
Expand Down
1 change: 1 addition & 0 deletions src/fuji_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#define MODE_READ 1
#define MODE_WRITE 2
#define MODE_MOUNTED 0x40

#define MAX_HOST_LEN 32
#define NUM_HOST_SLOTS 8
Expand Down
6 changes: 6 additions & 0 deletions src/fuji_typedefs_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
#define FILE_MAXLEN 36
#define SSID_MAXLEN 33 /* 32 + NULL */

#ifdef _CMOC_VERSION_
typedef unsigned char bool;
#define true 1
#define false 0
#endif /* _CMOC_VERSION_ */

/**
* Returned info for a single SSID entry
* from a WiFi scan
Expand Down
9 changes: 3 additions & 6 deletions src/hosts_and_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#ifdef _CMOC_VERSION_
#include <cmoc.h>
#include "coco/stdbool.h"
#include "coco/globals.h"
#include "coco/io.h"
#include "coco/screen.h"
Expand Down Expand Up @@ -147,7 +146,7 @@ void hosts_and_devices_edit_host_slot(unsigned char i)
{
// re-use 'o' here to save a little memory. If it's original value is needed in some future enhancement,
// declare a new variable for the loop counter.
for ( o = 0; o<NUM_DEVICE_SLOTS; o++)
for (o = 0; o<NUM_DEVICE_SLOTS; o++)
{
if ( deviceSlots[o].hostSlot == i )
{
Expand Down Expand Up @@ -340,7 +339,7 @@ void hosts_and_devices_done(void)
if (deviceSlots[i].hostSlot != 0xFF)
{
#ifdef _CMOC_VERSION_
printf("%d:%s\n",i,strupr(deviceSlots[i].file));
printf("%d:%s\n",i,deviceSlots[i].file);
#endif
#ifdef BUILD_APPLE2
s = i + 1;
Expand All @@ -359,9 +358,7 @@ void hosts_and_devices_done(void)
io_mount_disk_image(i, deviceSlots[i].mode);
}
}
#ifdef DRAGON
printf("DON'T FORGET TO MAP DISKS\n I.E. \"LINK 1,5\"");
#endif

state = DONE;
}

Expand Down
17 changes: 17 additions & 0 deletions src/key_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@

#include <apple2.h>

#elif defined(_CMOC_VERSION_)

#define KEY_LEFT_ARROW 0x08
#define KEY_RIGHT_ARROW 0x09
#define KEY_UP_ARROW 0x5E
#define KEY_DOWN_ARROW 0x0A
#define KEY_SHIFT_UP_ARROW 0x5F
#define KEY_SHIFT_DOWN_ARROW 0x5B
#define KEY_ENTER 0x0D
#define KEY_BREAK 0x03
#define KEY_CLEAR 0x0C

#define KEY_0 0x30
#define KEY_1 0x31
#define KEY_2 0x32
#define KEY_3 0x33

#endif // defined(...)

#endif // KEY_CODES_H
4 changes: 3 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
*/

#ifdef _CMOC_VERSION_
#include "coco/stdbool.h"
#include <cmoc.h>
#include <coco.h>
#else
#include <stdlib.h>
#endif /* CMOC_VERSION */

#include "fuji_typedefs.h"
#include "typedefs.h"
#include "check_wifi.h"
#include "connect_wifi.h"
Expand Down
1 change: 0 additions & 1 deletion src/perform_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#ifdef _CMOC_VERSION_
#include <cmoc.h>
#include "coco/stdbool.h"
#include "coco/screen.h"
#include "coco/io.h"
#include "coco/globals.h"
Expand Down
Loading