adapt VIACLOCK to Replica-1
This commit is contained in:
parent
4631eda4c7
commit
f83bda47df
|
@ -1,3 +1,8 @@
|
||||||
rem @call ..\..\tools\build viatimer
|
@call ..\..\tools\build viatimer
|
||||||
@call ..\..\tools\build viaclock
|
@call ..\..\tools\build viaclock
|
||||||
|
|
||||||
|
copy out\viatimer.bin ..\..\..\apple1-emu\software\sdcard_image\PLAB\VIATIMER#060280 /y
|
||||||
|
copy out\viaclock.bin ..\..\..\apple1-emu\software\sdcard_image\PLAB\VIACLOCK#060280 /y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
|
|
||||||
#include "..\..\lib\c64font.h"
|
#include "..\..\lib\c64font.h"
|
||||||
|
|
||||||
const word ONE_TICK = 16666; // timer constant for 1/60 second
|
// const word ONE_TICK = 15996; // timer constant for 1/60 second calculated as 14318180/14*61/65/60
|
||||||
|
|
||||||
|
word ONE_TICK;
|
||||||
|
|
||||||
void enable_timer_interrupt() {
|
void enable_timer_interrupt() {
|
||||||
|
|
||||||
|
@ -32,6 +34,7 @@ void disable_timer_interrupt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
byte last_min = 0xFF;
|
byte last_min = 0xFF;
|
||||||
|
byte last_sec = 0xFF;
|
||||||
|
|
||||||
void print_digit_scanline(byte c, byte y) {
|
void print_digit_scanline(byte c, byte y) {
|
||||||
word index = ((word) c-32) * 8 + (word) y;
|
word index = ((word) c-32) * 8 + (word) y;
|
||||||
|
@ -54,15 +57,34 @@ void print_clock() {
|
||||||
c1 = divr8u(_hours, 10, 0); c2 = rem8u;
|
c1 = divr8u(_hours, 10, 0); c2 = rem8u;
|
||||||
c3 = divr8u(_minutes, 10, 0); c4 = rem8u;
|
c3 = divr8u(_minutes, 10, 0); c4 = rem8u;
|
||||||
|
|
||||||
woz_puts("\r\r\r\r\r\r\r\r");
|
for(byte t=0;t<24;t++) woz_putc('\r');
|
||||||
for(byte t=0;t<8;t++) {
|
for(byte t=0;t<8;t++) {
|
||||||
print_digit_scanline(c1+'0',t);
|
print_digit_scanline(c1+'0',t);
|
||||||
print_digit_scanline(c2+'0',t);
|
print_digit_scanline(c2+'0',t);
|
||||||
print_digit_scanline( ':',t);
|
print_digit_scanline( ':',t);
|
||||||
print_digit_scanline(c3+'0',t);
|
print_digit_scanline(c3+'0',t);
|
||||||
print_digit_scanline(c4+'0',t);
|
print_digit_scanline(c4+'0',t);
|
||||||
}
|
}
|
||||||
woz_puts("\r\r\r\r\r\r\r\r");
|
for(byte t=0;t<4;t++) woz_putc('\r');
|
||||||
|
last_sec = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(last_sec < _seconds) {
|
||||||
|
//if(last_sec > 20) woz_putc('>');
|
||||||
|
/*
|
||||||
|
if(last_sec < 10) { woz_puts("...10 "); last_sec = 10; }
|
||||||
|
else if(last_sec < 20) { woz_puts("...20 "); last_sec = 20; }
|
||||||
|
else if(last_sec < 30) { woz_puts("...30 "); last_sec = 30; }
|
||||||
|
else if(last_sec < 40) { woz_puts("...40 "); last_sec = 40; }
|
||||||
|
else if(last_sec < 50) { woz_puts("...50 "); last_sec = 50; }
|
||||||
|
*/
|
||||||
|
|
||||||
|
c1 = divr8u(last_sec, 10, 0); c2 = rem8u;
|
||||||
|
woz_putc(' ');
|
||||||
|
woz_putc(c1+'0');
|
||||||
|
woz_putc(c2+'0');
|
||||||
|
woz_putc(' ');
|
||||||
|
last_sec++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,19 +94,52 @@ void bye() {
|
||||||
woz_mon();
|
woz_mon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void detect_machine_type() {
|
||||||
|
|
||||||
|
// detect if VIA 6522 is present
|
||||||
|
*VIA_DDRB = 0xA5;
|
||||||
|
if(*VIA_DDRB != 0xA5) {
|
||||||
|
woz_puts("\r\rSORRY, THIS PROGRAM NEEDS A VIA 6522 \rMAPPED AT ADDRESS $A000\r\r");
|
||||||
|
bye();
|
||||||
|
}
|
||||||
|
|
||||||
|
// detect if genuine apple1 or replica-1
|
||||||
|
|
||||||
|
woz_puts("\r\rRUNNING ON ");
|
||||||
|
|
||||||
|
const word *ptr1 = (word *) 0xF000;
|
||||||
|
const word *ptr2 = (word *) 0xFF00;
|
||||||
|
|
||||||
|
if(*ptr1 == *ptr2) {
|
||||||
|
// genuine Apple1
|
||||||
|
ONE_TICK = 15996; // timer constant for 1/60 second calculated as 14318180/14*61/65/60
|
||||||
|
woz_puts("GENUINE APPLE1");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Replica-1
|
||||||
|
ONE_TICK = 17045; // timer constant for 1/60 second calculated as 14318180/14/60
|
||||||
|
woz_puts("APPLE1 REPLICA-1");
|
||||||
|
}
|
||||||
|
|
||||||
|
woz_puts("\r\r");
|
||||||
|
}
|
||||||
|
|
||||||
byte *const KEYBUF = (byte *) 0x0200; // use the same keyboard buffer as in WOZ monitor
|
byte *const KEYBUF = (byte *) 0x0200; // use the same keyboard buffer as in WOZ monitor
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
enable_timer_interrupt();
|
woz_puts("\r\r*** APPLE-1 CLOCK ***\r\r");
|
||||||
|
|
||||||
woz_puts("\r\r*** APPLE1 CLOCK ***\r\r");
|
detect_machine_type();
|
||||||
|
|
||||||
woz_puts("\r\rREQUIRES A VIA 6522 AT $A000\r\r");
|
woz_puts("\rWHAT TIME IS IT ?\r");
|
||||||
|
|
||||||
woz_puts("\rWHAT TIME IS IT (HOURS ) "); apple1_input_line_prompt(KEYBUF, 2);
|
woz_puts("\r(HOURS ) "); apple1_input_line_prompt(KEYBUF, 2);
|
||||||
_hours = (byte) atoi(KEYBUF);
|
_hours = (byte) atoi(KEYBUF);
|
||||||
woz_puts("\rWHAT TIME IS IT (MINUTES) "); apple1_input_line_prompt(KEYBUF, 2);
|
woz_puts("\r(MINUTES) "); apple1_input_line_prompt(KEYBUF, 2);
|
||||||
_minutes = (byte) atoi(KEYBUF);
|
_minutes = (byte) atoi(KEYBUF);
|
||||||
|
_seconds = 0;
|
||||||
|
|
||||||
|
enable_timer_interrupt();
|
||||||
|
|
||||||
woz_putc('\r');
|
woz_putc('\r');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue