kasse: build/config.o build/kasse.o build/general.o build/credit_manager.o build/c128time.o build/print.o build/vdc_patch_charset.o build/vdc_util.o build/globals.o build/bcd2dec.o
${LD} -Ln $@.lbl -t c128 $^ -o $@
-itemz: build/config.o build/itemz.o build/general.o build/credit_manager.o build/c128time.o build/print.o build/globals.o
+itemz: build/config.o build/itemz.o build/general.o build/credit_manager.o build/c128time.o build/print.o build/globals.o build/bcd2dec.o build/vdc_util.o
${LD} -Ln $@.lbl -t c128 $^ -o $@
cat: build/general.o build/cat.o build/config.o build/print.o build/globals.o
/*
* RGB2R-C128-Kassenprogramm
- * © 2007-2009 phil_fry, sECuRE, sur5r
+ * © 2007-2017 phil_fry, sECuRE, sur5r, mxf
* See LICENSE for license information
*
*/
#include "bcd2dec.h"
#include "general.h"
#include "globals.h"
+#include "vdc_util.h"
/* This file uses the CIA TOD (Complex Interface Adapter, Time of Day)
* for timekeeping, see https://www.c64-wiki.com/wiki/CIA and its Links section
/* the Time of Day PM bit is set for hours >= 12 */
#define TOD_PM 0x80
+/* VDC charmap starts at 0x0000; 80 chars per line.
+ * We want to draw at 72 chars on the 1st line.
+ */
+#define CLOCK_ADDR 72
+
+/* arbitrarly chosen stack size, should be large enough */
#define DAYTIME_IRQ_STACK_SIZE 32
uint8_t daytime_irq_stack[DAYTIME_IRQ_STACK_SIZE];
void update_time(void) {
- volatile static uint8_t bcd_hour, hour, min, sec, tenth;
+ uint8_t bcd_hour, hour, min, sec, dummy;
/* Read the hour register first to stop the clock from updating the external
* registers from the internal (still ticking!) CIA registers. */
min = bcd2dec(CIA1.tod_min);
/* MUST read tod_10 to enable the clock latch again */
- tenth = CIA1.tod_10;
+ dummy = CIA1.tod_10;
/* it's a new day when hour wraps */
if (daytime.hour > hour) {
}
uint8_t _daytime_irq(void) {
- static char *t;
- static uint8_t x, y;
+ char *t;
/* We are called 60 times a second. We only want to draw a clock
* when we are a) on the mainscreen and b) the seconds changed */
if (kasse_menu == MENU_MAIN && CIA1.tod_sec != daytime.sec) {
t = get_time();
- x = wherex();
- y = wherey();
- cputsxy(70, 3, t);
- gotoxy(x, y);
+ vdc_write_mem(CLOCK_ADDR, t, 8);
}
/* always call additional handlers */
return (IRQ_NOT_HANDLED);
profit[0] = '\0';
}
textcolor(TC_CYAN);
- cprintf("C128-Kassenprogramm (phil_fry, sECuRE, sur5r, mxf) " GV "\r\n");
+ /* fill whole line with cyan, so color bits are set up for the clock */
+ cprintf("%-80s", "C128-Kasse (phil_fry, sECuRE, sur5r, mxf) " GV);
textcolor(TC_LIGHT_GRAY);
- cprintf("\r\n\r\n"
+ cprintf("\r\n\r\n\r\n"
"Ertrag: %s (%ld Artikel); Drucken: %s\r\n",
profit, items_sold, (printing == 1 ? "ein" : "aus"));
textcolor(TC_LIGHT_GRAY);
uint8_t day, tp1, tp2, tp3;
char *time_input, *time;
cprintf("Gib den aktuellen Tag des Events und Uhrzeit ein\r\n"
- "(Format DHHMMSS):\r\n");
+ "Format DHHMMSS, 0-indexiert, z.B. 0174259 für \"erster Tag um "
+ "17:42:59\":\r\n");
time_input = get_input();
part[0] = time_input[0];
day = atoi(part);
char *c;
char *time;
- init_globals();
+ printing = 1;
+ /* initialize daytime global, start the CIA TOD */
+ set_time(0, 0, 0, 0);
+ kasse_menu = MENU_UNDEFINED;
videomode(VIDEOMODE_80x25);