From ce30c6d4cf3f11a10b77ace1e0489c8735b9f8c1 Mon Sep 17 00:00:00 2001
From: "[NTU]" <nick@ucc.gu.uwa.edu.au>
Date: Mon, 6 Aug 2018 22:00:02 +0800
Subject: [PATCH] add credit, add 013 debug timer message on keypress

---
 ROM2/main_basic.c | 18 +++++++++++++++++-
 ROM2/src2asm.pl   |  2 +-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/ROM2/main_basic.c b/ROM2/main_basic.c
index 8414357..0f9d3ea 100644
--- a/ROM2/main_basic.c
+++ b/ROM2/main_basic.c
@@ -175,6 +175,20 @@ void send_keypress(u8 key) {
 	send_string(" key." CRLF);
 }
 
+void send_timer() {
+	/* send a packet of the form KX with X being the key, or R for reset */
+	unsigned int t=get_timer_counter();
+
+	send_string("013 ");
+	sci_tx_buf[0] = '0'+(t/10000)%10;
+	sci_tx_buf[1] = '0'+(t/1000)%10;
+	sci_tx_buf[2] = '0'+(t/100)%10;
+	sci_tx_buf[3] = '0'+(t/10)%10;
+	sci_tx_buf[4] = '0'+t%10;
+	sci_tx_buf[5] = 0;
+	send_buffer(1);
+}
+
 void send_door_msg(bool open) {
 	if (is_standalone()) return;
 	sci_tx_buf[0] = '4';
@@ -359,9 +373,10 @@ void about() {
 		" Revision: " VERSION_STRING "  Built: " DATEBUILT_STRING CRLF "" CRLF CRLF
 		"   This snack machine was brought to you by " CRLF
 		"    Bernard Blackham" CRLF
-		"    Mark Tearle" CRLF
 		"    Harry McNally" CRLF
+		"    Mark Tearle" CRLF
 		"    Michal Gornisiewicz" CRLF
+		"    Nick Bannon" CRLF
 		"    and others." CRLF
 		"" CRLF
 		" Another UCC project in action.      http://www.ucc.asn.au/" CRLF
@@ -701,6 +716,7 @@ int main() {
 				}
 			} else
 				send_keypress(last_key);
+				send_timer();
 		}
 
 		/*
diff --git a/ROM2/src2asm.pl b/ROM2/src2asm.pl
index 2d108b2..7b73f53 100644
--- a/ROM2/src2asm.pl
+++ b/ROM2/src2asm.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 # keep the format of this next line the same to match regex in check-romsrc.pl
-$origin = 0x9d00;
+$origin = 0x9d80;
 $hole_start = 0xb600;
 $hole_size = 0x0200;
 
-- 
GitLab