From 84d9b234f38e34e5a72faed1badf2044191db18a Mon Sep 17 00:00:00 2001 From: Bernard Blackham Date: Sun, 10 Aug 2003 07:56:20 +0000 Subject: [PATCH] Compile fixes --- ROM2/coinmech.c | 14 ++++++++------ ROM2/helpers.c | 2 +- ROM2/main.c | 15 +++++++++------ ROM2/server.h | 2 ++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/ROM2/coinmech.c b/ROM2/coinmech.c index a5a38e0..4701ada 100644 --- a/ROM2/coinmech.c +++ b/ROM2/coinmech.c @@ -4,7 +4,6 @@ u8 last_byte; - u8 parity_test(u8 c) { u8 parity = 0; for (parity = 0; c; c = c>>1) { @@ -33,10 +32,10 @@ void send_byte(u8 c) { last_byte = c; while (!(_io_ports[M6811_SCSR] & M6811_TDRE)); /* wait for TD register empty */ - if (parity_of(c)) - bset(&_io_ports[M6811_SCCR1], M6811_T8); + if (parity_test(c)) + bset((void*)&_io_ports[M6811_SCCR1], M6811_T8); else - bclr(&_io_ports[M6811_SCCR1], M6811_T8); + bclr((void*)&_io_ports[M6811_SCCR1], M6811_T8); } void ask_for_retrans() { @@ -60,7 +59,7 @@ void sci_interrupt() { } /* all bytes must have the correct ID in the 3 MSBs */ - if (in & 0xe0 != COINMECH_ID) return; + if ((in & 0xe0) != COINMECH_ID) return; /* we have a good packet */ if (in == 0x3f) { @@ -69,10 +68,13 @@ void sci_interrupt() { return; } - if (packet_pos != 0 && !IS_CTRL(x&0x10)) { + if (packet_pos != 0 && !IS_CTRL(in&0x10)) { switch (in & 0x0f) { } } else { } } + +void coin_eat() { +} diff --git a/ROM2/helpers.c b/ROM2/helpers.c index 74cb40b..0ef21cb 100644 --- a/ROM2/helpers.c +++ b/ROM2/helpers.c @@ -14,7 +14,7 @@ void print_amount(u16 amt) { /* take amt and show it on screen with a $ sign */ char str[10] = {' ', '$', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}; u8 pos; - for (pos = 7; amt; pos--, amt/=10); + for (pos = 7; amt; pos--, amt/=10) { str[pos] = amt%10 + '0'; } set_msg(str, WRAP_NONE); diff --git a/ROM2/main.c b/ROM2/main.c index 0026edc..61de403 100644 --- a/ROM2/main.c +++ b/ROM2/main.c @@ -2,6 +2,7 @@ #include "keypad.h" #include "chime.h" #include "server.h" +#include "coinmech.h" #include "vend.h" u16 uid; @@ -9,6 +10,7 @@ u16 pin; u8 selection; u16 scroll_timer; +u16 coin_value; bool uid_enter() { u8 uidpos; @@ -98,18 +100,19 @@ void selection_menu() { switch (last_key) { case KEY_RESET: scroll_msg("PRESS COIN REFUND"); - goto reset; + while (coin_value); + break; case KEY_0: switch (server_credit_account(uid, pin, coin_value)) { case CREDIT_OK: coin_eat(); - set_msg(" SUCCESS! "); + set_msg(" SUCCESS! ", WRAP_NONE); delay(1000); break; case CREDIT_FAIL: - coin_refund(); - set_msg(" FAILED! "); - delay(1000); + set_msg(" FAILED! " "PRESS COIN" " REFUND ", + WRAP_ALTERNATE); + while (coin_value); break; } break; @@ -130,7 +133,7 @@ void selection_menu() { break; default: selection = selection * 10 + (last_key%10); - make_request(uid, pin, selection); + make_request(selection); selection = 0; } } diff --git a/ROM2/server.h b/ROM2/server.h index 1a3619b..7b118cb 100644 --- a/ROM2/server.h +++ b/ROM2/server.h @@ -16,5 +16,7 @@ #define REQUEST_INVAL -4 /* no such item */ u8 server_authenticate(u16 uid, u16 pin); +u8 server_request(u16 uid, u16 pin, u8 item); +u8 server_credit_account(u16 uid, u16 pin, u16 amt); #endif /* _SERVER_H_ */ -- 2.20.1