Code listing

 

#include <Mega163.h>

#include <delay.h>

#include <string.h>

#include <stdlib.h>

// Keypad constants

#define CHECKKEY   30

#define MAXKEYS     12

 

// LCD Controls (PORTB)

// Pin 0 - reset

// Pin 1 - RD

// Pin 2 - WR

// Pin 3 - nc

// Pin 4 - nc

// Pin 5 - nc

// Pin 6 - A0

// Pin 7 - nc

// http://www.seiko-usa-ecd.com/lcd/products/graphic_mods/pdf/sed1335f.pdf

#define LCDreset        0x00    // 00000000 Reset the Display

#define LCDnop          0x47    // 01000111 No operation

#define CmdSetup        0x47    // 01000111 Set A0 high

#define CmdWrite        0x43    // 01000011 Set WR low

#define DataSetup       0x07    // 00000111 Set A0 low

#define DataWrite       0x03    // 00000011 Set WR low

#define StatusRead      0x05    // 00000101 Set RD low, A0 low

#define DataRead        0x45    // 01000101 Set RD low, A0 high

 

 

// LCD Commands (PORTC)

#define SystemSet        0x40    // Initialize system

#define SleepIn             0x53    // Enter standby mode

#define DispOFF          0x58    // Display Off

#define DispON           0x59    // Display On

#define Scroll               0x44    // Initialize Address & Regions

#define CSRForm        0x5D    // Set cursor type

#define CharAddr         0x5C    // Set address of character RAM

#define CSRRight         0x4C    // Cursor direction = right

#define CSRLeft           0x4D    // Cursor direction = left

#define CSRUp            0x4E    // Cursor direction = up

#define CSRDown       0x4F    // Cursor direction = down

#define HorzScroll        0x5A    // Set horz scroll position

#define Overlay            0x5B    // Set Display Format

#define CSRW             0x46    // Set cursor address

#define CSRR              0x47    // Read cursor address

#define MWRITE         0x42    // Write to display memory

#define MREAD          0x43    // Read from display memory

 

// State Constants

#define INIT                            0

#define NAME                         1

#define ROLL                          2

#define OWNED                     3

#define UNOWNED                4

#define MORTGAGED            5

#define SELL                           6

#define JA                                7

#define BURSAR                     8

#define TUITION                    9

#define BUYH1                       10

#define BUYH2                       11

#define BUYH3                       12

#define SELLH1                      13

#define SELLH2                      14

#define SELLH3                      15

#define SELLP1                       16

#define SELLP2                       17

#define SELLP3                       18

#define UNMORT1                 19

#define UNMORT2                 20

#define UNMORT3                 21

 

void initialize(void);

 

// Keypad input

void checkkey(void);

 

// LCD drivers

void WriteData(unsigned char CommandCode);

void lcdinit(void);

void clearLCD(void);

void WriteCommand(unsigned char CommandCode);

void WriteString(char *input);

void DrawXY(int x, int y);

void MoveCursor(int addr);

void DrawGB(void);

void DrawMenu(void);

void clearSB(void);

void DrawCard(char i);

void DrawPattern(char i);

void clearMB(void);

void WriteStringSB(char line, char *input);

void DrawCar(int x, int y);

void DrawTower(int x, int y);

void DrawQuestion(int bx, int by);

void DrawWave(int bx, int by);

void DrawPattern1(int bx, int by);

void DrawPattern2(int bx, int by);

void DrawPattern3(int bx, int by);

void DrawPattern4(int bx, int by);

void DrawPattern5(int bx, int by);

void DrawPattern6(int bx, int by);

void DrawPattern7(int bx, int by);

void DrawPattern8(int bx, int by);

void DrawPattern3a(int bx, int by);

void DrawPattern4a(int bx, int by);

 

// Property routines

void GetName(char i);

 

// Game routine

void GameInit(void);

void StateMachine(void);

void nextplayer(void);

void UpdateTop(void);

char RollDice(void);

int GetRent(char i);

 

typedef struct {

            char name[10];

            int cash;

            int asset;

            char location;

            char roll;

            int rentpaid;

            int rentdue;

} Player;

 

unsigned char reload;                // timer0 reload to set 1 mSec

unsigned int checkkey_t;

unsigned char keyblock, butnum, key;

unsigned char strbuffer[18];

unsigned char pixelbuffer;

unsigned char numplayer;

unsigned char currentplayer;

unsigned char State[4];

unsigned char Rolled[2];

unsigned char laststate;

unsigned char houseindex;

unsigned char chance, campusevent;

 

Player player[4];

 

flash unsigned char keytbl[MAXKEYS]={0xd7, 0xee, 0xde, 0xbe, 0xed, 0xdd, 0xbd, 0xeb, 0xdb, 0xbb, 0xe7, 0xb7};

flash unsigned char rent[40]={0, 2, 0, 4, 200, 0, 6, 0, 6, 8, 0, 10, 0, 10, 12, 0, 14, 0, 14, 16, 0, 18, 0, 18, 20, 0, 22, 22, 0, 24, 0, 26, 26, 0, 28, 0, 0, 35, 75, 50};

flash unsigned char house1[40]={0, 10, 0, 20, 0, 0, 30, 0, 30, 40, 0, 50, 0, 50, 60, 0, 70, 0, 70, 80, 0, 90, 0, 90, 100, 0, 110, 110, 0, 120, 0, 130, 130, 0, 150, 0, 0, 175, 0, 200};

flash unsigned char house2[40]={0, 30, 0, 60, 0, 0, 90, 0, 90, 100, 0, 150, 0, 150, 180, 0, 200, 0, 200, 220, 0, 250, 0, 250, 300, 0, 330, 330, 0, 360, 0, 390, 390, 0, 450, 0, 0, 500, 0, 600};

flash unsigned int house3[40]={0, 90, 0, 180, 0, 0, 270, 0, 270, 300, 0, 450, 0, 450, 500, 0, 550, 0, 550, 600, 0, 700, 0, 700, 750, 0, 800, 800, 0, 850, 0, 900, 900, 0, 1000, 0, 0, 1100, 0, 1400};

flash unsigned int house4[40]={0, 160, 0, 320, 0, 0, 400, 0, 400, 450, 0, 625, 0, 625, 700, 0, 750, 0, 750, 800, 0, 875, 0, 875, 925, 0, 975, 975, 0, 1025, 0, 1100, 1100, 0, 1200, 0, 0, 1300, 0, 1700};

flash unsigned int hotel[40]={0, 250, 0, 450, 0, 0, 550, 0, 550, 600, 0, 750, 0, 750, 900, 0, 950, 0, 950, 1000, 0, 1050, 0, 1050, 1100, 0, 1150, 1150, 0, 1200, 0, 1275, 1275, 0, 1400, 0, 0, 1500, 0, 2000};

flash unsigned char mortgage[40]={0, 30, 0, 30, 0, 100, 50, 0, 50, 60, 0, 70, 75, 70, 80, 100, 90, 0, 90, 100, 0, 110, 0, 110, 120, 100, 130, 130, 75, 140, 0, 150, 150, 0, 160, 100, 0, 175, 0, 200};

flash unsigned char housecost[40]={0, 50, 0, 50, 0, 0, 50, 0, 50, 50, 0, 100, 0, 100, 100, 0, 100, 0, 100, 100, 0, 150, 0, 150, 150, 0, 150, 150, 0, 150, 0, 200, 200, 0, 200, 0, 0, 200, 0, 200};

flash unsigned char buybuild[40]={0, 2, 0, 2, 0, 1, 2, 0, 2, 2, 0, 2, 1, 2, 2, 1, 2, 0, 2, 2, 0, 2, 0, 2, 2, 1, 2, 2, 1, 2, 0, 2, 2, 0, 2, 1, 0, 2, 0, 2};

flash unsigned char pattern[40]={0, 1, 0, 1, 0, 0, 2, 0, 2, 2, 0, 3, 0, 3, 3, 0, 4, 0, 4, 4, 0, 5, 0, 5, 5, 0, 6, 6, 0, 6, 0, 7, 7, 0, 7, 0, 0, 8, 0, 8};

 

unsigned char building[40];

unsigned char owner[40];

//flash unsigned char cost[40]={0, 60, 0, 60, 0, 200, 100, 0, 100, 120, 0, 140, 150, 140, 160, 200, 180, 0, 180, 200, 0, 220, 0, 220, 240, 200, 260, 260, 150, 280, 0, 300, 300, 0, 320, 200, 0, 350, 0, 400};

// cost is exactly 2 times mortgage price

 

 

//*************************************************************

interrupt [TIM0_OVF] void timer0_overflow(void)

{

            TCNT0 = reload;

 

            // Decrement the times if they are not already zero

            if (checkkey_t > 0) --checkkey_t;

}

 

//*************************************************************

void main(void)

{

            initialize();

    GameInit();

 

            while (1)

            {

                        if (checkkey_t == 0) checkkey();

            }

}

 

//*************************************************************

// Keypad routines

//*************************************************************

void checkkey(void)

{

            checkkey_t = CHECKKEY;

 

            DDRD = 0x0f; // set upper nibble input

            PORTD = 0xf0;

            delay_us(5);

            key = PIND;

 

            DDRD = 0xf0;    // set lower nibble input

            PORTD = 0x0f;

            delay_us(5);

            key = key | PIND;

 

            if (keyblock == 0)

            {

                        if (key != 0xff)

                        {

                                    for (butnum=0; butnum<MAXKEYS; butnum++)

                                    {

                                                if (keytbl[butnum] == key)        break;

                                    }

                                    // convert from butnum to actual character

                                    if (butnum != MAXKEYS)

                                    {

                                                WriteCommand(MWRITE);

                                                WriteData(butnum+48);

                                                StateMachine();

                                                DrawMenu();

                                    }

                                    keyblock = 1;

                        }

            }

            else

            {

                        if (key == 0xff)

                        {

                                    keyblock = 0;

                        }

            }

}

 

//*************************************************************

// LCD routines, from previous project Graphic Calculator

//*************************************************************

// WriteCommand() :  Sends Command to LCD controller

 

void WriteCommand(unsigned char CommandCode) {

  PORTC = CommandCode;

  PORTB = CmdSetup;

  PORTB = CmdWrite;

  PORTB = CmdSetup;

} // end WriteCommand

 

//*************************************************************

// WriteData() :  Sends parameters or data to LCD controller

 

void WriteData(unsigned char CommandCode) {

  PORTC = CommandCode;

  PORTB = DataSetup;

  PORTB = DataWrite;

  PORTB = DataSetup;

} // end WriteData

 

 

//*************************************************************

// Writestring(s) //write string whereever cursor was at

 

void WriteString(char *input){

            char i=0;

            WriteCommand(MWRITE);

            while (input[i]!=0)

            {

                        WriteData(input[i]);

                        i++;

            }

} // end WriteString

 

//*************************************************************

// WriteStringSB(i,s)     //write string to line i of sidebox

 

void WriteStringSB(char line, char *input){

            MoveCursor((int)line*40+25);

            WriteString(input);

} // end WriteString

 

//*************************************************************

// lcdinit() initializes LCD

void lcdinit(void)

{

            // set I/O port directions

            DDRC = 0xff;       //set PORTD to outputs

            PORTB = LCDnop;    //issues nothing to the LCD for about 6 ms.

            delay_ms(2);

 

            PORTB = LCDreset;

            delay_ms(2);

 

            PORTB = LCDnop;

            delay_ms(2);

 

            WriteCommand(SystemSet);     //Set LCD system

            WriteData(0x30);

            WriteData(0x87);

            WriteData(0x07);

            WriteData(0x27);

            WriteData(0x2F);

            WriteData(0xC7);

            WriteData(0x28);

            WriteData(0x00);

 

            WriteCommand(Overlay);

            WriteData(0x00);

 

            WriteCommand(Scroll);

            WriteData(0x00);

            WriteData(0x00);

            WriteData(0xC8);

            WriteData(0xE8);

            WriteData(0x03);

            WriteData(0xC8);

 

            WriteCommand(CSRForm);

            WriteData(0x04);

            WriteData(0x86);

 

            WriteCommand(CSRRight);

 

            WriteCommand(HorzScroll);

            WriteData(0x00);

 

            WriteCommand(DispON);

            WriteData(0x16);

 

            clearLCD();                    //completely clears LCD

} // end lcdinit

 

//*************************************************************

// clearLCD() clears both layers of LCD

 

void clearLCD(void)

{

            unsigned short i;

 

            MoveCursor(0);   //set cursor to the beginning of the character layer

 

            WriteCommand(MWRITE);

            for (i=0; i<1000; i++) {

                        WriteData(0x20);    // write " " to character memory

            }

 

            MoveCursor(1000);   //set cursor to the beginning of the grpahics layer

 

            WriteCommand(MWRITE);

            for (i=0; i<8000; i++) {

                        WriteData(0x00);    // erase graphics memory

            }

} // end clearLCD

 

//*************************************************************

// clearSB() clears text layer of sidebox starting 5th row

 

void clearSB(void)

{

            unsigned char i, j;

            int address;

 

            address = 184;

            for (i=0; i<21; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        for (j=0; j<16; j++) {

                                    WriteData(0x20);    // write " " to character memory

                        }

                        address = address+40;

            }

} // end clearLCD

 

//*************************************************************

// clearSB() clears text layer of middlebox

 

void clearMB(void)

{

            unsigned char i, j;

            int address;

 

            address = 163;

            for (i=0; i<18; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        for (j=0; j<18; j++) {

                                    WriteData(0x20);    // write " " to character memory

                        }

                        address = address+40;

            }

} // end clearLCD

 

//*************************************************************

// DrawXY(x,y) turn on pixel at (x,y) in graphic layer

 

void DrawXY(int x,int y) {

            int address;

            address = 1000 + y*40 + (int)(x>>3);    //graphics starting address is 1000

            MoveCursor(address);                    //since each horizontal lines takes up 40 bytes,

                                                                                                                                    //we should add y*40 to the base address

                                                                                                                                    //then we add x/8 to the address to do the horizontal offset

            WriteCommand(MREAD);                    //Set LCD to be ready to be read

 

            DDRC = 0x00;                              //set PORTD to be inputs

            PORTC=0x00;                               //turn off all pull ups

            PORTB = DataRead;                         //send to LCD to do a data read

            delay_ms(10);                             //wait some time for everything to set(if this delay is too short, flickering increases)

            pixelbuffer = PIND;                       //read in the old data

            PORTB = LCDnop;                           //signal the LCD to stop reading

            delay_ms(2);                              //wait for LCD to stop and set PORTD back to outputs

            DDRC = 0xFF;

            pixelbuffer = pixelbuffer | (0x80>>(x%8));  //OR pixelbuffer with the byte you want to write, 0x80>>(x%8) is where we want to illuminate in that byte

 

            MoveCursor(address);                                                             //set the cursor back to where we were going to write to

            WriteCommand(MWRITE);

            WriteData(pixelbuffer);                                                             //write the pixel buffer which contained old and new pixel information

}

 

//*************************************************************

// MoveCursor(addr) moves cursor to specified address

 

void MoveCursor(int addr) {

            WriteCommand(CSRW);

            WriteData(addr);

            WriteData(addr>>8);

}

 

//*************************************************************

// DrawGB() draws out our basic gameboard on LCD

 

void DrawGB(void)

{

            unsigned char i, j;

            int address;

 

            // Draw Game Board (Graphics)

            address = 1000+40*8+2;

            // draw vertical line for left boxes

            for (i=0; i<191; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        WriteData(0x02);

                        address = address+40;

            }

 

            address = 1000+40*8+20;

            // draw vertical line for right boxes

            for (i=0; i<191; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        WriteData(0x02);

                        address = address+40;

            }

 

            address = 1000+24;

            // draw vertical line for right border

            for (i=0; i<200; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        WriteData(0x80);

                        address = address+40;

            }

 

            address = 1000+40*8+4;

            // draw vertical line for top boxes

            for (i=0; i<23; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        for (j=0; j<8; j++) {

                                    // one pixel thick line

                                    WriteData(0x02);

                                    WriteData(0x00);

                        }

                        address = address+40;

            }

 

            address = 1000+40*176+4;

            // draw vertical line for bottom boxes

            for (i=0; i<23; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        for (j=0; j<8; j++) {

                                    // one pixel thick line

                                    WriteData(0x02);

                                    WriteData(0x00);

                        }

                        address = address+40;

            }

 

            address = 1000+40*7;             // 8 pixels down

            MoveCursor(address);

            WriteCommand(MWRITE);

            // draw line across

            for (i=0; i<24; i++) {

                        WriteData(0xff);

            }

 

            address = 1000+40*31;                       // 32 pixels down

            MoveCursor(address);

            WriteCommand(MWRITE);

            // draw line across

            for (i=0; i<24; i++) {

                        WriteData(0xff);

            }

 

            address = 1000+40*175;                     // 176 pixels down

            MoveCursor(address);

            WriteCommand(MWRITE);

            // draw line across

            for (i=0; i<24; i++) {

                        WriteData(0xff);

            }

 

            address = 1000+40*47;

            // draw horizontal line for left boxes

            for (i=0; i<8; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        // 22 pixels across

                        WriteData(0xff);

                        WriteData(0xff);

                        WriteData(0xfe);

                        // move cursor to next box

                        address = address + (40*16);

            }

 

            address = 1000+40*47+20;

            // draw horizontal line for right boxes

            for (i=0; i<8; i++) {

                        MoveCursor(address);

                        WriteCommand(MWRITE);

                        // 25 pixels across

                        WriteData(0x03);

                        WriteData(0xff);

                        WriteData(0xff);

                        WriteData(0xff);

                        // move cursor to next box

                        address = address + (40*16);

            }

 

            // Draw Game Board (Text)

            MoveCursor(5);

            strcpyf(strbuffer, "CORNELL ");

            WriteString(strbuffer);

            strcpyf(strbuffer, "MONOPOLY");

            WriteString(strbuffer);

 

            // Top boxes

            MoveCursor(62);

            WriteCommand(MWRITE);

            WriteData('G');

            WriteData('O');

 

            MoveCursor(83);

            strcpyf(strbuffer, "MG??MLGSTCKR");

            WriteString(strbuffer);

            strcpyf(strbuffer, "OLWPUL TO");

            WriteString(strbuffer);

 

            MoveCursor(121);

            strcpyf(strbuffer, "FP22  22242026");

            WriteString(strbuffer);

            strcpyf(strbuffer, "261528 JA");

            WriteString(strbuffer);

 

            // Bottom boxes

            MoveCursor(881);

            WriteCommand(MWRITE);

            WriteData('J');

            WriteData('A');

 

            MoveCursor(923);

            strcpyf(strbuffer, "BNBY??LNTC$?");

            WriteString(strbuffer);

            strcpyf(strbuffer, "HNCEBT");

            WriteString(strbuffer);

            WriteData(0x7f);

            WriteData('P');

            WriteData('D');

 

            MoveCursor(963);

            strcpyf(strbuffer, "1210  1020%?");

            WriteString(strbuffer);

            strcpyf(strbuffer, " 6=D 6$20");

            WriteString(strbuffer);

 

            // Left boxes

            MoveCursor(160);

            WriteCommand(MWRITE);

            WriteData('R');

            WriteData('F');

            MoveCursor(200);

            WriteCommand(MWRITE);

            WriteData('2');

            WriteData('0');

 

            MoveCursor(240);

            WriteCommand(MWRITE);

            WriteData('C');

            WriteData('L');

            MoveCursor(280);

            WriteCommand(MWRITE);

            WriteData('1');

            WriteData('8');

           

            MoveCursor(320);

            WriteCommand(MWRITE);

            WriteData('C');

            WriteData('E');

            MoveCursor(360);

            WriteCommand(MWRITE);

            WriteData('=');

            WriteData('D');

 

            MoveCursor(400);

            WriteCommand(MWRITE);

            WriteData('B');

            WriteData('R');

            MoveCursor(440);

            WriteCommand(MWRITE);

            WriteData('1');

            WriteData('8');

 

            MoveCursor(480);

            WriteCommand(MWRITE);

            WriteData('T');

            WriteData('C');

            MoveCursor(520);

            WriteCommand(MWRITE);

            WriteData('2');

            WriteData('0');

 

            MoveCursor(560);

            WriteCommand(MWRITE);

            WriteData('B');

            WriteData('B');

            MoveCursor(600);

            WriteCommand(MWRITE);

            WriteData('1');

            WriteData('6');

 

            MoveCursor(640);

            WriteCommand(MWRITE);

            WriteData('D');

            WriteData('C');

            MoveCursor(680);

            WriteCommand(MWRITE);

            WriteData('1');

            WriteData('4');

 

            MoveCursor(720);

            WriteCommand(MWRITE);

            WriteData('C');

            WriteData('I');

            WriteData('T');

            MoveCursor(760);

            WriteCommand(MWRITE);

            WriteData('1');

            WriteData('5');

 

            MoveCursor(800);

            WriteCommand(MWRITE);

            WriteData('S');

            WriteData('M');

            MoveCursor(840);

            WriteCommand(MWRITE);

            WriteData('1');

            WriteData('4');

 

            // Right boxes

            MoveCursor(182);

            WriteCommand(MWRITE);

            WriteData('H');

            WriteData('O');

            MoveCursor(222);

            WriteCommand(MWRITE);

            WriteData('3');

            WriteData('0');

 

            MoveCursor(262);

            WriteCommand(MWRITE);

            WriteData('O');

            WriteData('P');

            MoveCursor(302);

            WriteCommand(MWRITE);

            WriteData('3');

            WriteData('0');

           

            MoveCursor(342);

            WriteCommand(MWRITE);

            WriteData('C');

            WriteData('E');

            MoveCursor(382);

            WriteCommand(MWRITE);

            WriteData('=');

            WriteData('D');

 

            MoveCursor(422);

            WriteCommand(MWRITE);

            WriteData('P');

            WriteData('H');

            MoveCursor(462);

            WriteCommand(MWRITE);

            WriteData('3');

            WriteData('2');

 

            MoveCursor(502);

            WriteCommand(MWRITE);

            WriteData('T');

            WriteData('C');

            MoveCursor(542);

            WriteCommand(MWRITE);

            WriteData('2');

            WriteData('0');

   

MoveCursor(582);

            WriteCommand(MWRITE);

            WriteData('?');

            MoveCursor(622);

            WriteCommand(MWRITE);

            WriteData('?');

           

            MoveCursor(662);

            WriteCommand(MWRITE);

            WriteData('R');

            WriteData('H');

            MoveCursor(702);

            WriteCommand(MWRITE);

            WriteData('3');

            WriteData('5');

           

            MoveCursor(742);

            WriteCommand(MWRITE);

            WriteData('$');

            WriteData('$');

            MoveCursor(782);

            WriteCommand(MWRITE);

            WriteData('=');

            WriteData('(');

 

            MoveCursor(822);

            WriteCommand(MWRITE);

            WriteData('D');

            WriteData('F');

            MoveCursor(862);

            WriteCommand(MWRITE);

            WriteData('4');

            WriteData('0');

/*

            DrawCar(1,10);

            DrawTower(0,65);

            DrawTower(177,65);

            DrawTower(137,185);

            DrawQuestion(43,16);

            DrawQuestion(59,184);

            DrawQuestion(180,112);

            DrawWave(136,17);

 

            DrawPattern1(152,176);

            DrawPattern1(120,176);

            DrawPattern2(72,176);

            DrawPattern2(40,176);

            DrawPattern2(24,176);

            DrawPattern3(18,160);

            DrawPattern3(18,128);

            DrawPattern3(18,112);

            DrawPattern4(18,80);

            DrawPattern4(18,48);

            DrawPattern4(18,32);

            DrawPattern5(24,8);

            DrawPattern5(56,8);

            DrawPattern5(72,8);

            DrawPattern6(104,8);

            DrawPattern6(120,8);

            DrawPattern6(152,8);

            DrawPattern7(168,80);

            DrawPattern7(168,48);

            DrawPattern7(168,32);

            DrawPattern8(168,128);

            DrawPattern8(168,160);

*/

}

 

//*************************************************************

// DrawMenu() draw on side menu depending on State

 

void DrawMenu(void)

{

            switch (State[currentplayer]) {

 

                        case INIT:        strcpyf(strbuffer, "# of Player");

                                                            WriteStringSB(5, strbuffer);

                                                            strcpyf(strbuffer, "(2 - 4)");

                                                            WriteStringSB(7, strbuffer);

                                                            MoveCursor(385);

                                                            break;

 

                        case NAME:    clearMB();

                                                            clearSB();

                                                            strcpyf(strbuffer, "Enter Name ");

                                                            WriteStringSB(5, strbuffer);

                                                            WriteData(currentplayer+49);

                                                            strcpyf(strbuffer, "(9 char max)");

                                                            WriteStringSB(7, strbuffer);

                                                            MoveCursor(385);

                                                            break;

 

                        case ROLL:      DrawCard(player[currentplayer].location);

                                                            clearSB();