home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
GAMES
/
BLACKJAC.ARC
/
CARDS80.C
< prev
next >
Wrap
Text File
|
1988-08-07
|
2KB
|
105 lines
/*
This program illustrates the assembly language subroutines for the
display of playing cards on the 80 * 24 screen.
card no :-
1 - 13 = spades,
14 - 26 = clubs,
27 - 39 = diamonds,
40 - 52 = hearts.
53 = joker.
54 = back of card.
ace = 1, jack = 11, queen = 12, king = 13.
function prototypes.
*/
int open (char *, int);
int read (int, char *, int);
char *malloc (int);
void copy_bytes (char *, int, int);
void draw_border (int, int, int, int);
int card_no;
int x_card; /* x at top left corner of card. */
int y_card; /* y at top left corner of card. */
/* note :- top of screen = 0. */
/* left of screen = 0. */
int j;
char message [80];
/*
Procedure to read the file CARDS.FON and set up the PCG characters
used to display the cards.
*/
void get_pcg()
{
char *pcgdat;
int pcg_file;
int result;
pcg_file = open ("CARDS.FON",0);
/*
An array of bytes is obtained from free memory and is returned when
the data has been placed into the PCG memory.
Note that it is not possible to read the data directly into PCG memory
because the BIOS changes the memory banks and the PCG memory is not
found at $F800.
*/
pcgdat = malloc (2048); /* get some memory */
result = read (pcg_file, pcgdat, 2048); /* read 2048 bytes */
copy_bytes (pcgdat, 0xF800, 2048);
close (pcg_file);
free (pcgdat); /* Return memory */
}
main()
{
char clear= 0x1A;
get_pcg();
putchar (clear);
j = 1;
while (j != 0)
{
x_card = 2;
y_card = 1;
printf (" Card No : ");
scanf ("%d",&j);
printf (" Message : ");
cgets (message);
card_no = j;
draw_border (0, 0, 80, 24);
for (j = 1; j <= 16; j++)
{
show_card (card_no, x_card, y_card);
card_no++;
x_card += 9;
if (j == 8)
{
x_card = 2;
y_card = 8;
}
}
put_string (2, 18, &message);
scanf ("%d",&j);
putchar (clear);
}
}