X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=ROM2%2Fmain_basic.c;h=888932e5908dd182150a342a38d2f7c00764b97d;hb=8209e6e9a79982684e617d386505952a338b15f2;hp=b2923bc11c8caaadef347e31755d20d0b9fd4bab;hpb=c34cbe163ce52f1d8fc553993701054f4942152f;p=uccvend-snackrom.git diff --git a/ROM2/main_basic.c b/ROM2/main_basic.c index b2923bc..888932e 100644 --- a/ROM2/main_basic.c +++ b/ROM2/main_basic.c @@ -123,18 +123,14 @@ void ping_pong() { /* make sure it's really a ping */ if (sci_rx_buf[1] != 'I' || sci_rx_buf[2] != 'N' || - sci_rx_buf[3] != 'G') { + sci_rx_buf[3] != 'G' || + sci_rx_buf[4] != '\0') { send_nack(); return; } /* respond with ack & pong */ wait_for_tx_free(); - sci_tx_buf[0] = 'P'; - sci_tx_buf[1] = 'O'; - sci_tx_buf[2] = 'N'; - sci_tx_buf[3] = 'G'; - sci_tx_buf[4] = '\n'; - sci_tx_buf[5] = 0; + my_strncpy(sci_tx_buf, "PONG\n", BUFFER_LEN); send_packet(); } @@ -155,7 +151,7 @@ int main() { _io_ports[M6811_PORTA] = 0xc0; /* display on. talking to serial port */ _io_ports[M6811_DDRA] = 0xfc; _io_ports[M6811_DDRD] = 0x3e; - _io_ports[M6811_SPCR] = 0x12; + _io_ports[M6811_SPCR] = M6811_MSTR | M6811_SPR1; set_misc_output(0x00); display_init(); @@ -163,6 +159,9 @@ int main() { unlock(); /* enable interrupts */ + delay(1000); + set_msg(" CRUEL "); + //comm_init(); //coinmech_init(); sci_init(); @@ -172,15 +171,14 @@ int main() { delay(1000); - set_msg(" CRUEL "); - - delay(1000); - set_msg(" WORLD "); delay(1000); chime_start(); + my_strncpy(sci_tx_buf, "5N4X0RZRUS\n", BUFFER_LEN); + send_packet(); + cur_motor[0] = 0xff; while(1) { if (cur_motor[0] == 0xff) { /* signal to say redraw screen */ @@ -192,11 +190,7 @@ int main() { last_door_open = door_open(); send_door_msg(last_door_open); chime_start(); - if (last_door_open) { - set_msg("DOOR OPEND"); - } else { - set_msg("DOOR CLOSE"); - } + set_msg(last_door_open?"DOOR OPEN ":"DOOR CLOSE"); } if (sci_have_packet) {