Skip to content

Commit

Permalink
C128 port.
Browse files Browse the repository at this point in the history
  • Loading branch information
tschak909 committed Jul 6, 2018
1 parent a71d9a8 commit 2cabbc8
Show file tree
Hide file tree
Showing 26 changed files with 2,137 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Makefile
Expand Up @@ -9,7 +9,7 @@

# Space or comma separated list of cc65 supported target platforms to build for.
# Default: c64 (lowercase!)
TARGETS := c64,atari,apple2
TARGETS := c64,c128,atari,apple2

# Name of the final, single-file executable.
# Default: name of the current dir with target name appended
Expand Down Expand Up @@ -349,6 +349,16 @@ dist-c64: $(PROGRAM).c64
c1541 -attach dist.c64/platoterm64-1_0.d64 -write dist.c64/c64-swlink.ser ser-swlink
c1541 -attach dist.c64/platoterm64-1_0.d64 -write dist.c64/c64-up2400.ser ser-up2400

dist-c128: $(PROGRAM).c128
c1541 -format "platoterm128,01" d64 dist.c128/platoterm128-1_0.d64
c1541 -attach dist.c128/platoterm128-1_0.d128 -write plato.c128 platoterm
c1541 -attach dist.c128/platoterm128-1_0.d128 -write dist.c128/gpl-3.0 gpl-3.0
c1541 -attach dist.c128/platoterm128-1_0.d128 -write dist.c128/c128-1351.mou mou-1351
c1541 -attach dist.c128/platoterm128-1_0.d128 -write dist.c128/c128-inkwell.mou mou-inkwell
c1541 -attach dist.c128/platoterm128-1_0.d128 -write dist.c128/c128-joy.mou mou-joy
c1541 -attach dist.c128/platoterm128-1_0.d128 -write dist.c128/c128-pot.mou mou-pot
c1541 -attach dist.c128/platoterm128-1_0.d128 -write dist.c128/c128-swlink.ser ser-swlink

dist-atari: $(PROGRAM).atari
cp plato.atari dist.atari/plato.com

Expand Down
Binary file added dist.c128/c128-1351.mou
Binary file not shown.
Binary file added dist.c128/c128-inkwell.mou
Binary file not shown.
Binary file added dist.c128/c128-joy.mou
Binary file not shown.
Binary file added dist.c128/c128-pot.mou
Binary file not shown.
Binary file added dist.c128/c128-swlink.ser
Binary file not shown.
Binary file added dist.c128/gpl-3.0
Binary file not shown.
9 changes: 9 additions & 0 deletions src/apple2/screen.c
Expand Up @@ -20,6 +20,15 @@ extern ConfigInfo config;

extern void install_nmi_trampoline(void); /* nmi_trampoline.s */

/**
* screen_load_driver()
* Load the TGI driver
*/
void screen_load_driver(void)
{
tgi_install(tgi_static_stddrv);
}

/**
* screen_init_hook()
* Called after tgi_init to set any special features, e.g. nmi trampolines.
Expand Down
9 changes: 9 additions & 0 deletions src/atari/screen.c
Expand Up @@ -23,6 +23,15 @@ void screen_init_hook(void)
{
}

/**
* screen_load_driver()
* Load the TGI driver
*/
void screen_load_driver(void)
{
tgi_install(tgi_static_stddrv);
}

/**
* screen_cycle_foreground()
* Go to the next foreground color in palette
Expand Down
41 changes: 41 additions & 0 deletions src/c128/config.c
@@ -0,0 +1,41 @@
/**
* PLATOTerm64 - A PLATO Terminal for the Commodore 64
* Based on Steve Peltz's PAD
*
* Author: Thomas Cherryhomes <thom.cherryhomes at gmail dot com>
*
* config.c - Configuration routines
*/

#include <c128.h>
#include <cbm.h>
#include <serial.h>
#include <stdbool.h>
#include <string.h>
#include "../config.h"

extern ConfigInfo config;

#define CONFIG_DEFAULT_SERIAL_DRIVER CONFIG_SERIAL_DRIVER_UP2400
#define CONFIG_DEFAULT_MOUSE_DRIVER CONFIG_MOUSE_DRIVER_1351

/**
* config_set_defaults()
* Set default values for config file
*/
void config_set_defaults(void)
{
config.io_mode = IO_MODE_SERIAL;
config.baud = SER_BAUD_2400;
config.use_dhcp = false;
config.ip_address=0;
config.netmask=0;
config.gateway=0;
config.dns=0;
strcpy(config.driver_ser,CONFIG_DEFAULT_SERIAL_DRIVER);
strcpy(config.driver_mou,CONFIG_DEFAULT_MOUSE_DRIVER);
config.color_foreground=TGI_COLOR_LIGHTBLUE;
config.color_background=TGI_COLOR_BLUE;
config.color_border=TGI_COLOR_LIGHTBLUE;
config_save();
}
41 changes: 41 additions & 0 deletions src/c128/config.c~
@@ -0,0 +1,41 @@
/**
* PLATOTerm64 - A PLATO Terminal for the Commodore 64
* Based on Steve Peltz's PAD
*
* Author: Thomas Cherryhomes <thom.cherryhomes at gmail dot com>
*
* config.c - Configuration routines
*/

#include <c64.h>
#include <cbm.h>
#include <serial.h>
#include <stdbool.h>
#include <string.h>
#include "../config.h"

extern ConfigInfo config;

#define CONFIG_DEFAULT_SERIAL_DRIVER CONFIG_SERIAL_DRIVER_UP2400
#define CONFIG_DEFAULT_MOUSE_DRIVER CONFIG_MOUSE_DRIVER_1351

/**
* config_set_defaults()
* Set default values for config file
*/
void config_set_defaults(void)
{
config.io_mode = IO_MODE_SERIAL;
config.baud = SER_BAUD_2400;
config.use_dhcp = false;
config.ip_address=0;
config.netmask=0;
config.gateway=0;
config.dns=0;
strcpy(config.driver_ser,CONFIG_DEFAULT_SERIAL_DRIVER);
strcpy(config.driver_mou,CONFIG_DEFAULT_MOUSE_DRIVER);
config.color_foreground=TGI_COLOR_LIGHTBLUE;
config.color_background=TGI_COLOR_BLUE;
config.color_border=TGI_COLOR_LIGHTBLUE;
config_save();
}
174 changes: 174 additions & 0 deletions src/c128/font.c
@@ -0,0 +1,174 @@
/**
* Font definitions for font memories M0 and M1
*/

#include <stdint.h>

uint8_t FONT_SIZE_X=5;
uint8_t FONT_SIZE_Y=6;

uint8_t font[]={
0x00,0x00,0x00,0x00,0x00,0x00, /* SPACE 0x20 */
0x40,0x40,0x40,0x00,0x40,0x00, /* ! 0x21 */
0x50,0x50,0x00,0x00,0x00,0x00, /* " 0x22 */
0x50,0xF8,0x50,0xF8,0x50,0x00, /* # 0x23 */
0x40,0xF0,0xC0,0x30,0xF0,0x20, /* $ 0x24 */
0x90,0x20,0x20,0x40,0x90,0x00, /* % 0x25 */
0x40,0xA0,0x40,0xB0,0x50,0x00, /* & 0x26 */
0x20,0x40,0x00,0x00,0x00,0x00, /* ' 0x27 */
0x20,0x40,0x40,0x40,0x20,0x00, /* ( 0x28 */
0x40,0x20,0x20,0x20,0x40,0x00, /* ) 0x29 */
0x90,0x60,0xF0,0x60,0x90,0x00, /* * 0x2a */
0x20,0x20,0xF8,0x20,0x20,0x00, /* + 0x2b */
0x00,0x00,0x40,0x40,0x80,0x00, /* , 0x2c */
0x00,0x00,0xF0,0x00,0x00,0x00, /* - 0x2d */
0x00,0x00,0x00,0x40,0x40,0x00, /* . 0x2e */
0x00,0x10,0x20,0x40,0x80,0x00, /* / 0x2f */
0x60,0x90,0x90,0x90,0x60,0x00, /* 0 0x30 */
0x20,0x60,0x20,0x20,0x70,0x00, /* 1 0x31 */
0x60,0x90,0x20,0x40,0xF0,0x00, /* 2 0x32 */
0xF0,0x10,0x20,0x10,0xE0,0x00, /* 3 0x33 */
0x20,0x60,0xA0,0xF0,0x20,0x00, /* 4 0x34 */
0xE0,0x80,0xE0,0x10,0xE0,0x00, /* 5 0x35 */
0x60,0x80,0xE0,0x90,0xE0,0x00, /* 6 0x36 */
0xF0,0x10,0x20,0x40,0x40,0x00, /* 7 0x37 */
0x60,0x90,0x60,0x90,0x60,0x00, /* 8 0x38 */
0x60,0x90,0x70,0x10,0xE0,0x00, /* 9 0x39 */
0x00,0x40,0x00,0x40,0x00,0x00, /* : 0x3a */
0x00,0x40,0x00,0x40,0x80,0x00, /* ; 0x3b */
0x20,0x40,0x80,0x40,0x20,0x00, /* < 0x3c */
0x00,0xF0,0x00,0xF0,0x00,0x00, /* = 0x3d */
0x40,0x20,0x10,0x20,0x40,0x00, /* > 0x3e */
0x60,0x90,0x20,0x00,0x40,0x00, /* ? 0x3f */
0x60,0x90,0xB0,0x80,0x60,0x00, /* @ 0x40 */
0x60,0x90,0xF0,0x90,0x90,0x00, /* A 0x41 */
0xE0,0x90,0xE0,0x90,0xE0,0x00, /* B 0x42 */
0x70,0x80,0x80,0x80,0x70,0x00, /* C 0x43 */
0xE0,0x90,0x90,0x90,0xE0,0x00, /* D 0x44 */
0xF0,0x80,0xE0,0x80,0xF0,0x00, /* E 0x45 */
0xF0,0x80,0xE0,0x80,0x80,0x00, /* F 0x46 */
0x60,0x80,0x90,0x90,0x70,0x00, /* G 0x47 */
0x90,0x90,0xF0,0x90,0x90,0x00, /* H 0x48 */
0xE0,0x40,0x40,0x40,0xE0,0x00, /* I 0x49 */
0x10,0x10,0x10,0x90,0x60,0x00, /* J 0x4a */
0x90,0xA0,0xC0,0xA0,0x90,0x00, /* K 0x4b */
0x80,0x80,0x80,0x80,0xF0,0x00, /* L 0x4c */
0x88,0xD8,0xA8,0x88,0x88,0x00, /* M 0x4d */
0x90,0xD0,0xB0,0x90,0x90,0x00, /* N 0x4e */
0xF0,0x90,0x90,0x90,0xF0,0x00, /* O 0x4f */
0xE0,0x90,0xE0,0x80,0x80,0x00, /* P 0x50 */
0xF0,0x90,0x90,0xB0,0xF8,0x00, /* Q 0x51 */
0xE0,0x90,0xE0,0xA0,0x90,0x00, /* R 0x52 */
0x70,0x80,0xE0,0x10,0xE0,0x00, /* S 0x53 */
0xF8,0x20,0x20,0x20,0x20,0x00, /* T 0x54 */
0x90,0x90,0x90,0x90,0xF0,0x00, /* U 0x55 */
0x90,0x90,0x90,0x60,0x60,0x00, /* V 0x56 */
0x88,0x88,0xA8,0xD8,0x88,0x00, /* W 0x57 */
0x90,0x90,0x60,0x90,0x90,0x00, /* X 0x58 */
0x90,0x90,0xE0,0x40,0x40,0x00, /* Y 0x59 */
0xF0,0x10,0x20,0x40,0xF0,0x00, /* Z 0x5a */
0x70,0x40,0x40,0x40,0x70,0x00, /* [ 0x5b */
0x00,0x80,0x40,0x20,0x10,0x00, /* \ 0x5c */
0x70,0x10,0x10,0x10,0x70,0x00, /* ] 0x5d */
0x20,0x50,0x00,0x00,0x00,0x00, /* CIRCUMFLEX ^ 0x5e*/
0x00,0x00,0x00,0x00,0x00,0xF0, /* _ 0x5f */
0x40,0x20,0x00,0x00,0x00,0x00, /* GRAVE ACCENT ` 0x60 */
0x00,0xC0,0x20,0xA0,0XF0,0x00, /* a 0x61 */
0x80,0xE0,0x90,0x90,0xE0,0x00, /* b 0x62 */
0x00,0x60,0x80,0x80,0x60,0x00, /* c 0x63 */
0x10,0x70,0x90,0x90,0x70,0x00, /* d 0x64 */
0x00,0x60,0xB0,0x80,0x60,0x00, /* e 0x65 */
0x60,0x80,0xE0,0x80,0x80,0x00, /* f 0x66 */
0x00,0x60,0x90,0xF0,0x10,0x60, /* g 0x67 */
0x80,0xE0,0x90,0x90,0x90,0x00, /* h 0x68 */
0x40,0x00,0x40,0x40,0x40,0x00, /* i 0x69 */
0x20,0x00,0x20,0x20,0x20,0xC0, /* j 0x6a */
0x80,0xA0,0xC0,0xA0,0x90,0x00, /* k 0x6b */
0x40,0x40,0x40,0x40,0x40,0x00, /* l 0x6c */
0x00,0x90,0xF0,0x90,0x90,0x00, /* m 0x6d */
0x00,0xE0,0x90,0x90,0x90,0x00, /* n 0x6e */
0x00,0x60,0x90,0x90,0x60,0x00, /* o 0x6f */
0x00,0xE0,0x90,0x90,0xE0,0x80, /* p 0x70 */
0x00,0x70,0x90,0x90,0x70,0x10, /* q 0x71 */
0x00,0x70,0x40,0x40,0x40,0x00, /* r 0x72 */
0x00,0x70,0xC0,0x30,0xE0,0x00, /* s 0x73 */
0x40,0xE0,0x40,0x40,0x60,0x00, /* t 0x74 */
0x00,0x90,0x90,0x90,0x70,0x00, /* u 0x75 */
0x00,0x90,0xA0,0xA0,0x40,0x00, /* v 0x76 */
0x00,0x90,0x90,0xF0,0x90,0x00, /* w 0x77 */
0x00,0x90,0x60,0x60,0x90,0x00, /* x 0x78 */
0x00,0x90,0x90,0x70,0x10,0x60, /* y 0x79 */
0x00,0xF0,0x20,0x40,0xF0,0x00, /* z 0x7a */
0x60,0x40,0x80,0x40,0x60,0x00, /* { 0x7b */
0x20,0x20,0x20,0x20,0x20,0x20, /* | 0x7c */
0xC0,0x40,0x20,0x40,0xC0,0x00, /* } 0x7d */
0x00,0x00,0x68,0xB0,0x00,0x00, /* ~ 0x7e */
0x00,0x70,0x50,0x70,0x00,0x00, /* BOX 0x7f */
0x00,0x00,0x00,0x00,0x00,0x00, /* SPACE 0xa0 */
0x00,0x10,0x20,0x40,0x80,0x00, /* / 0xa1 */
0x00,0xF0,0x00,0xF0,0x00,0xF0, /* EQUIVALENT 0xa2 */
0x00,0x00,0x00,0x00,0x68,0xB0, /* LOW TILDE 0xa3 */
0x20,0x70,0x80,0x70,0x20,0x00, /* ASSIGN 0xa4 */
0x20,0xF0,0x20,0xF0,0x40,0x00, /* NOT EQUAL 0xa5 */
0x00,0x20,0x70,0x20,0x20,0x00, /* UP ARROW 0xa6 */
0x00,0x00,0x20,0xF0,0x20,0x00, /* RIGHT ARROW 0xa7 */
0x00,0x20,0x20,0x70,0x20,0x00, /* DOWN ARROW 0xa8 */
0x00,0x00,0x40,0xF0,0x40,0x00, /* LEFT ARROW 0xa9 */
0x00,0x50,0x20,0x50,0x00,0x00, /* MULTIPLY 0xaa */
0xF0,0x80,0x60,0x80,0xF0,0x00, /* SIGMA 0xab */
0x00,0x20,0x50,0x88,0xF8,0x00, /* DELTA 0xac*/
0x00,0x90,0x90,0x60,0x00,0x00, /* UNION 0xad*/
0x00,0x60,0x90,0x90,0x00,0x00, /* INTERSECT 0xae */
0x00,0x60,0x00,0x60,0x00,0x00, /* DIVIDE 0xaf */
0x00,0x50,0xA0,0x70,0x00,0x00, /* ALPHA 0xb0 */
0x20,0x50,0xA0,0x90,0xE0,0x80, /* BETA 0xb1 */
0x20,0x40,0x20,0x50,0x70,0x00, /* DELTA 0xb2 */
0x80,0x40,0x20,0x50,0x90,0x00, /* LAMBDA 0xb3 */
0x00,0x00,0x50,0x50,0x60,0x80, /* MU 0xb4 */
0x08,0x78,0xD0,0x50,0x50,0x00, /* PI 0xb5 */
0x00,0x20,0x50,0x50,0xA0,0x80, /* RHO 0xb6 */
0x30,0x40,0xA0,0xA0,0x40,0x00, /* SIGMA 0xb7 */
0x00,0x00,0x90,0xB0,0x60,0x00, /* OMEGA 0xb8 */
0x20,0x40,0x80,0x40,0x20,0xE0, /* LESS THAN OR EQUAL 0xb9 */
0x80,0x40,0x20,0x40,0x80,0xE0, /* GREATER THAN OR EQUAL 0xba */
0x20,0x50,0x70,0x50,0x20,0x00, /* THETA 0xbb */
0x30,0x60,0xA0,0x60,0x30,0x00, /* l-embed 0xbc */
0x00,0x60,0x90,0x60,0x00,0x00, /* DEGREE 0xbd */
0xC0,0x60,0x50,0x60,0xC0,0x00, /* r-embed 0xbe */
0xC0,0xA0,0x50,0x50,0xA0,0xC0, /* ANSWER ARROW 0xbf */
0xF8,0x20,0x40,0x40,0x20,0xF8, /* COPYRIGHT 0xc0 */
0x50,0x00,0x00,0x00,0x00,0x00, /* DIERESIS 0xc1 */
0x00,0x70,0x50,0x70,0x00,0x00, /* BOX 0xc2 */
0x00,0x00,0x20,0x00,0x00,0x00, /* INTERPUNCT 0xc3 */
0x20,0x70,0xF8,0x70,0x20,0x00, /* DIAMOND 0xc4 */
0x00,0x50,0x20,0x50,0x00,0x00, /* MULTIPLY 0xc5 */
0x10,0x20,0x00,0x00,0x00,0x00, /* ACUTE ACCENT 0xc6 */
0x00,0x00,0x00,0x08,0x10,0x00, /* CEDILLA 0xc7 */
0x10,0x20,0x00,0x00,0x00,0x00, /* HACEK 0xc8 */
0x20,0x70,0xF8,0x70,0x20,0x00, /* DIAMOND 0xc9 */
0x20,0x20,0x20,0x20,0x20,0x20, /* | 0xca */
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00
};

uint16_t fontptr[]={0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,102,108,114,120,126,132,138,144,150,156,162,168,174,180,186,192,198,204,210,216,222,228,234,240,246,252,258,264,270,276,282,288,294,300,306,312,318,324,330,336,342,348,354,360,366,372,378,384,390,396,402,408,414,420,426,432,438,444,450,456,462,468,474,480,486,492,498,504,510,516,522,528,534,540,546,552,558,564,570,576,582,588,594,600,606,612,618,624,630,636,642,648,654,660,666,672,678,684,690,696,702,708,714,720,726,732,738,744,750,756,762,768,774,780,786,792,798,804,810,816,822,828,834,840,846,852,858,864,870,876,882,888,894,900,906,912,918,924,930,936,942,948,954};

21 changes: 21 additions & 0 deletions src/c128/io.c
@@ -0,0 +1,21 @@
/**
* PLATOTerm64 - A PLATO Terminal for the Commodore 64
* Based on Steve Peltz's PAD
*
* Author: Thomas Cherryhomes <thom.cherryhomes at gmail dot com>
*
* io.c - Input/output functions (serial/ethernet) (c64 specific)
*/

#include <cbm.h>
#include <c128.h>
#include <peekpoke.h>
#include <stdint.h>

/**
* Return the serial buffer size
*/
uint8_t io_serial_buffer_size(void)
{
return PEEK(0x29B)-PEEK(0x29C)&0xff;
}
21 changes: 21 additions & 0 deletions src/c128/io.c~
@@ -0,0 +1,21 @@
/**
* PLATOTerm64 - A PLATO Terminal for the Commodore 64
* Based on Steve Peltz's PAD
*
* Author: Thomas Cherryhomes <thom.cherryhomes at gmail dot com>
*
* io.c - Input/output functions (serial/ethernet) (c64 specific)
*/

#include <cbm.h>
#include <c64.h>
#include <peekpoke.h>
#include <stdint.h>

/**
* Return the serial buffer size
*/
uint8_t io_serial_buffer_size(void)
{
return PEEK(0x29B)-PEEK(0x29C)&0xff;
}

0 comments on commit 2cabbc8

Please sign in to comment.