Skip to content

Commit

Permalink
experimental static test.
Browse files Browse the repository at this point in the history
  • Loading branch information
tschak909 committed Sep 19, 2019
1 parent ad842c2 commit 620eb6e
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CONFIG :=

# Additional C compiler flags and options.
# Default: none
CFLAGS = -Oris --static-locals
CFLAGS = -Os

# Additional assembler flags and options.
# Default: none
Expand Down
Binary file removed dist.atari/files/atrami.mou
Binary file not shown.
Binary file removed dist.atari/files/atrjoy.mou
Binary file not shown.
Binary file removed dist.atari/files/atrrdev.ser
Binary file not shown.
Binary file removed dist.atari/files/atrst.mou
Binary file not shown.
Binary file removed dist.atari/files/atrtrk.mou
Binary file not shown.
Binary file removed dist.atari/files/atrtt.mou
Binary file not shown.
4 changes: 3 additions & 1 deletion src/atari/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <atari.h>
#include <stdbool.h>
#include <peekpoke.h>
#include <peekPOKE.h>
#include <stdint.h>
#include <string.h>
#include <serial.h>
Expand Down Expand Up @@ -69,6 +69,7 @@ void io_recv_serial_flow_off_atari(void)
if (io_load_successful==false)
return;
xoff_enabled=true;
POKE(712,35);
ser_put(0x13);
}

Expand All @@ -80,6 +81,7 @@ void io_recv_serial_flow_on_atari(void)
if (io_load_successful==false)
return;
xoff_enabled=false;
POKE(712,0);
ser_put(0x11);
}

Expand Down
3 changes: 2 additions & 1 deletion src/atari/prefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ void prefs_show_greeting(void)
/* if (io_load_successful==false) */
/* prefs_display("serial driver didn't load. Check handler."); */
/* else */
/* prefs_display("platoterm ready - option for setup"); */
prefs_clear();
prefs_display("platoterm 1.3 ready - option for setup");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/atari/terminal_char_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static const unsigned char PIX_THRESH[]={0x03,0x02,0x03,0x03,0x02, // Pixel thre
0x03,0x02,0x03,0x03,0x02,
0x03,0x02,0x03,0x03,0x02};

static unsigned char PIX_WEIGHTS[16];
static unsigned char PIX_WEIGHTS[30];

static const unsigned char TAB_0_25[]={0,5,10,15,20,25}; // Given index 0 of 5, return multiple of 5.

Expand Down
4 changes: 2 additions & 2 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef CONFIG_H
#define CONFIG_H

#define XON_THRESHOLD 46
#define XOFF_THRESHOLD 127
#define XON_THRESHOLD 16
#define XOFF_THRESHOLD 512

/* C64/128 Driver defines */
#define CONFIG_MOUSE_DRIVER_1351 0
Expand Down
35 changes: 15 additions & 20 deletions src/io_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "protocol.h"
#include "config.h"
#include "prefs.h"
#include <atari.h>

#define NULL 0

Expand All @@ -30,7 +31,7 @@ void (*io_recv_serial_flow_on)(void);
static uint8_t ch=0;
static uint8_t io_res;
uint8_t recv_buffer[384];
static uint16_t recv_buffer_size=0;
static uint16_t recv_buffer_size;
extern ConfigInfo config;

static struct ser_params params = {
Expand All @@ -45,10 +46,9 @@ static struct ser_params params = {
* io_init() - Set-up the I/O
*/
void io_init(void)
{
{
prefs_clear();
prefs_display("serial driver loaded.");
io_res=ser_load_driver(io_ser_driver_name(config.driver_ser));
io_res=ser_install(atrrdev_ser);

if (io_res==SER_ERR_OK)
io_load_successful=true;
Expand All @@ -64,8 +64,8 @@ void io_init(void)
}
else
{
prefs_display("serial driver error.");
prefs_clear();
prefs_display(recv_buffer);
}

}
Expand Down Expand Up @@ -98,24 +98,19 @@ void io_main(void)
// Drain primary serial FIFO as fast as possible.
while (ser_get(&ch)!=SER_ERR_NO_DATA)
{
if ((recv_buffer_size>config.xoff_threshold) && (xoff_enabled==false))
{
io_recv_serial_flow_off();
xoff_enabled=true;
}
else if ((recv_buffer_size<config.xon_threshold) && (xoff_enabled==true))
{
io_recv_serial_flow_on();
xoff_enabled=false;
}
recv_buffer[recv_buffer_size++]=ch;
}

if (xoff_enabled==false)
{
if (recv_buffer_size>config.xoff_threshold)
{
io_recv_serial_flow_off();
}
}
else /* xoff_enabled==true */
{
if (xoff_enabled==true && recv_buffer_size<config.xon_threshold)
{
io_recv_serial_flow_on();
}
}

ShowPLATO(recv_buffer,recv_buffer_size);
recv_buffer_size=0;
}
Expand Down
14 changes: 3 additions & 11 deletions src/plato.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,16 @@

uint8_t already_started=false;

/**
* greeting(void) - Show terminal greeting
*/
void greeting(void)
{
screen_splash();
prefs_show_greeting();
terminal_initial_position();
}

void main(void)
{
screen_init();
config_init();
touch_init();
terminal_init();
screen_splash();
io_init();
greeting();
prefs_show_greeting();
terminal_initial_position();
screen_beep();

already_started=true;
Expand Down
41 changes: 32 additions & 9 deletions src/touch_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <peekpoke.h>
#include "touch.h"
#include "config.h"
#include "prefs.h"

#ifdef __ATARI__
#include <atari.h>
Expand All @@ -35,22 +36,44 @@ extern uint16_t scalety[];
*/
void touch_init(void)
{
#ifndef __APPLE2__
int res;

if (config.driver_mou==CONFIG_MOUSE_DRIVER_NONE)
return;

switch(config.driver_mou)
{
case CONFIG_MOUSE_DRIVER_ATRAMI:
res=mouse_install(&mouse_def_callbacks,atrami_mou);
break;
case CONFIG_MOUSE_DRIVER_ATRJOY:
res=mouse_install(&mouse_def_callbacks,atrjoy_mou);
break;
case CONFIG_MOUSE_DRIVER_ATRST:
res=mouse_install(&mouse_def_callbacks,atrst_mou);
break;
case CONFIG_MOUSE_DRIVER_ATRTRK:
res=mouse_install(&mouse_def_callbacks,atrtrk_mou);
break;
case CONFIG_MOUSE_DRIVER_ATRTT:
res=mouse_install(&mouse_def_callbacks,atrtt_mou);
break;
}

if (mouse_load_driver(&mouse_def_callbacks,touch_driver_name(config.driver_mou)) == MOUSE_ERR_OK)
if (res == MOUSE_ERR_OK)
{
mouse_present=true;
mouse_show();
#ifdef __ATARI__
POKE(0xD000,0);
POKE(0xD001,0);
/* POKE(0xD002,0); */
POKE(0xD003,0);
#endif /* __ATARI__ */
/* #ifdef __ATARI__ */
/* POKE(0xD000,0); */
/* POKE(0xD001,0); */
/* /\* POKE(0xD002,0); *\/ */
/* POKE(0xD003,0); */
/* #endif /\* __ATARI__ *\/ */
}
else
{
}
#endif /* __APPLE2__ */

}

Expand Down

0 comments on commit 620eb6e

Please sign in to comment.