导航:首页 > 操作系统 > 游戏主机单片机

游戏主机单片机

发布时间:2023-08-17 19:23:57

A. 基于单片机的猜数游戏机设计

本来想给你写完的,结果有点事情把我的时间占用了,只好把这个写了一大半的程序给你,你自己加文件排名的那一部分。
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int proct_random();
void store_number(int X);

#define length 4

int guess[length];
int x[length];

void main(void)
{
int i,j,correct,half_correct,RANDOM,GUESS,time;
time=0;
RANDOM=proct_random();
printf("%d\n",RANDOM);
printf("Please input your guessed four-digit number:\n");
while(1)
{
correct=0;
half_correct=0;

scanf("%d",&GUESS);
time++;
store_number(GUESS);

for(i=0;i<4;i++)
{
if(guess[i]==x[i])
{
correct++;
}
for(j=0;j<4;j++)
{
if(i!=j)
{
if(guess[i]==x[j])
{
half_correct++;
}
}
}
}

printf("%d %d %d\n",correct,half_correct,time);
if(correct==4)
{
printf("congratulations\n");
break;
}
}
}

int proct_random(void)
{
int i,random;

srand((unsigned)time(NULL));
for(i=0;i<4;i++)
{
x[i]=rand()%10;
}
random=x[0]*1000+x[1]*100+x[2]*10+x[3];
return random;
}

void store_number(int X)
{

guess[0]=X/1000;
guess[1]=X/100-guess[0]*10;
guess[2]=X/10-guess[1]*10-guess[0]*100;
guess[3]=X%10;
}

B. 51单片机怎么做做游戏机

要用51单片机做做游戏机,只能做些简单的游戏机,例如,用8X8点阵模块做个贪吃蛇,用12864点阵屏做个更好些的贪吃蛇,俄罗斯方块等。像手机上玩的游戏就做不了的,速度不够,手机用的显示屏又不好驱动。

C. 电脑常识:以前玩的那种游戏机,什么小霸王之类的,是属于电脑吧单片机

不是的,其实就是专门的游戏机,因为小霸王实际上是完全山寨当时任天堂的FC,但是当时是100%系统也完全复制了,就是一样的

D. 51单片机可以做8位FC游戏机吗

非常勉强,网上好像有驱动彩屏的俄罗斯方块,开发fc这样的游戏起码也要用stm32或者树莓派吧,不过51做个打地鼠机还是不错的

E. 想用单片机做一个掌上游戏机,都需要什么外围芯片和设备,用c语言编程行吗

既然是游戏机就需要显示屏和按键,单片机如果不够快的话要用专门的芯片处理显示屏和按键,够快就不需要额外芯片了。C语言可以啊,LINUX都是用C写出来的,不用担心。

F. 任天堂FC游戏机是不是单片机做的

不是。
FC里面用的处理芯片——2A03虽然是8位的,但是2A03算是CPU,相当于现在手机电脑里的处理器,自己是没有io口的,也没有内置的rom ram,需要外接。

G. 我打算用单片机和一块12864屏幕做一个简单的游戏机 在屏幕显示的方面要掌握哪些知识呢

12864液晶是单色的,一点占一位数据,你按照所选12864的手册写点就ok了,我做了一个带字库的图像显示程序,可以实现一幅图片的上下左右移动,你可以参考试试。
#include<reg51.h>
#include <math.h>
#include "stdio.h"
void send_com(unsigned char cmd);
void send_data(unsigned char dat);
void print(unsigned char x,unsigned char y,char* str);
#define DATA P0 //P2接数据口
#define uint unsigned int
#define uchar unsigned char

sfr WATCH_DOG=0xc1;
sfr P4=0xc0;
sfr P4SW=0xbb;
sbit RS=P3^7;
sbit RW=P3^6;
sbit P21=P2^1;
sbit P20=P2^0;
sbit E=P4^5;
sbit SPISS=P4^0;
uchar gun[16];
uchar xdata pictotal[1024];
uchar code LCD_picture1[]=
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0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0x00,0x0F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xFF
};
void delay(uint i)
{
char a;
while(i--)
{
for(a=0;a<10;a++);
}
}
void delay1(uint i)
{
while(i--);
}
//测忙碌子程序
//RS=0,RW=1,E=H,D0-D7=状态字
void chek_busy(void)
{ unsigned char temp1;//状态信息(判断是否忙)
P2=0x13;
P20=0;
P21=1;
DATA=0xFF;
RS = 0;
delay1(10);
RW = 1;
delay1(10);
do{
E = 1;
P21=0;
delay1(10);
temp1 = DATA;
E = 0;
delay1(10);
} while(temp1&0x80);//??????
RS = 0;
delay1(10);
RW = 0;
P20=1;
delay1(10);
P2=0x13;
}
/*************读数据************/
read_12864()
{
uchar shuju;
P20=0;
P21=1;
DATA=0xff;
RS=1;
delay1(10);
RW=1;
delay1(10);
E=1;
P21=0;
delay1(10);
shuju=DATA;
E=0;
delay1(10);
P2=0x13;
return(shuju);
}
//写命令子程序
void send_com(unsigned char cmd)/*写命令*/
{
chek_busy();
P2=0x13;
delay1(10);
P20=0;
RS = 0;
delay1(10);
RW = 0;
delay1(10);
P21=1;
E = 1;
delay1(10);
DATA = cmd;
E = 0;
P20=1;
delay1(10);
P2=0x13;
}

//写数据子程序
void send_data(unsigned char dat)
{
chek_busy();
P2=0x13;
P20=0;
RS = 1;
delay1(10);
RW = 0;
delay1(10);
P21=1;
E = 1;
delay1(10);
DATA = dat;
E = 0;
P20=1;
delay1(10);
P2=0x13;
}

// 设置字符串显示位置 xpos(0~7),ypos(1~4)
void set_xy(unsigned char xpos,unsigned char ypos)
{
switch(ypos)
{
case 1:
send_com(0x80|xpos);break;
case 2:
send_com(0x90|xpos);break;
case 3:
send_com(0x88|xpos);break;
case 4:
send_com(0x98|xpos);break;
default:break;
}
}

// 在指定位置显示字符串
void print(unsigned char x,unsigned char y,char* str)
{
unsigned char lcd_temp;
set_xy(x,y);
lcd_temp=*str;
while(lcd_temp != 0x00)
{
send_data(lcd_temp);
lcd_temp=*(++str);
}
}

// 显示图片
void disppicture(uchar code *adder)
{
uint i,j;
for(i=0;i<32;i++)
{
send_com(0x80 + i);
send_com(0x80);
for(j=0;j<16;j++)
{
send_data(~*adder);
adder++;
}
}

for(i=0;i<32;i++)
{
send_com(0x80 + i);
send_com(0x88);
for(j=0;j<16;j++)
{
send_data(~*adder);
adder++;
}
}
}
// 反白函数
void con_disp(uchar data1,uchar data2,uchar x0,uchar y0,uchar xl,uchar yl)
//dara1 data2为0x00或0xff,x0为横起始坐标(0~7),y0为纵起始坐标(0~63),x1为长度(1~8),y1为宽度(1~64)。
{
uchar i,j,k;
if(y0<32)
{
for(j=0;j<yl;j++)
{
for(i=0;i<xl;i++)
{
send_com(0x34);// 扩展功能
send_com(0x80+y0+j);// 写Y坐标
send_com(0x80+x0+i);// 写X坐标
send_com(0x30);// 普通功能
send_data(data1);
send_data(data2);
}
}
if((y0+yl)>32)
{
k=y0+yl-32;
yl=k;
y0=0;
for(j=0;j<yl;j++)
{
for(i=0;i<xl;i++)
{
send_com(0x34);// 扩展功能
send_com(0x80+y0+j);// 写Y坐标
send_com(0x88+x0+i);// 写X坐标
send_com(0x30);// 普通功能
send_data(data1);
send_data(data2);
}
}
}
}
else
{
for(j=0;j<yl;j++)
{
for(i=0;i<xl;i++)
{
send_com(0x34);// 扩展功能
send_com(0x80+y0-32+j);// 写Y坐标
send_com(0x88+x0+i);// 写X坐标
send_com(0x30);// 普通功能
send_data(data1);
send_data(data2);
}
}
}
send_com(0x36);// 开绘图显示
}
// 画任意点
void dian( unsigned char X, unsigned char Y, unsigned char Color )
{
unsigned char Row , Tier , Tier_bit ;
unsigned char ReadOldH, ReadOldL ;
send_com( 0x34 ) ;
send_com( 0x36 ) ;
Tier = X >> 4 ;
Tier_bit = X & 0x0f ;
if( Y < 32 )
{
Row = Y ;
}
else
{
Row = Y - 32 ;
Tier += 8 ;
}
send_com( Row + 0x80 ) ;
send_com( Tier + 0x80 ) ;
read_12864() ;
ReadOldH = read_12864() ;
ReadOldL = read_12864() ;
send_com( Row + 0x80 ) ;
send_com( Tier + 0x80 ) ;
if( Tier_bit < 8 )
{
switch( Color)
{
case 0 : ReadOldH &=( ~( 0x01 << ( 7 - Tier_bit ))) ; break ;
case 1 : ReadOldH |= ( 0x01 << ( 7 - Tier_bit )) ; break ;
case 2 : ReadOldH ^= ( 0x01 << ( 7 - Tier_bit )) ; break ;
default : break ;
}
send_data( ReadOldH ) ;
send_data( ReadOldL ) ;
}
else
{
switch(Color)
{
case 0 : ReadOldL &= (~( 0x01 << ( 15 - Tier_bit ))) ; break ;
case 1 : ReadOldL |= ( 0x01 << ( 15 - Tier_bit )) ; break ;
case 2 : ReadOldL ^= ( 0x01 << ( 15 - Tier_bit )) ; break ;
default : break ;
}
send_data( ReadOldH ) ;
send_data( ReadOldL ) ;
}
send_com( 0x30 );
}

//画水平线
void linex( unsigned char X0, unsigned char X1, unsigned char Y, unsigned char Color )
{ unsigned char Temp ;
if( X0 > X1 )
{
Temp = X1 ;
X1 = X0 ;
X0 = Temp ;
}
for( ; X0 <= X1 ; X0++ )
dian( X0, Y, Color ) ;
}

//画垂直线
void liney( unsigned char X, unsigned char Y0, unsigned char Y1, unsigned char Color )
{
unsigned char Temp ;
if( Y0 > Y1 )
{
Temp = Y1 ;
Y1 = Y0 ;
Y0 = Temp ;
}
for(; Y0 <= Y1 ; Y0++)
dian( X, Y0, Color) ;
}
//画任意两点间线段
void line( unsigned char StartX, unsigned char StartY, unsigned char EndX, unsigned char EndY, unsigned char Color )
{
int t, distance;
int x = 0 , y = 0 , delta_x, delta_y ;
char incx, incy ;
delta_x = EndX - StartX ;
delta_y = EndY - StartY ;
if( delta_x > 0 )
{
incx = 1;
}
else if( delta_x == 0 )
{
liney( StartX, StartY, EndY, Color ) ;
return ;
}
else
{
incx = -1 ;
}
if( delta_y > 0 )
{
incy = 1 ;
}
else if(delta_y == 0 )
{
linex( StartX, EndX, StartY, Color ) ;
return ;
}
else
{
incy = -1 ;
}
delta_x = abs( delta_x );
delta_y = abs( delta_y );
if( delta_x > delta_y )
{
distance = delta_x ;
}
else
{
distance = delta_y ;
}
dian( StartX, StartY, Color ) ;

for( t = 0 ; t <= distance+1 ; t++ )
{
dian( StartX, StartY, Color ) ;
x += delta_x ;
y += delta_y ;
if( x > distance )
{
x -= distance ;
StartX += incx ;
}
if( y > distance )
{
y -= distance ;
StartY += incy ;
}
}
}

void readpic()
{
uchar i,j;
uint k;
k=0;
send_com( 0x34 );
send_com( 0x36 );
for(i=0;i<32;i++){
for(j=0;j<8;j++){
send_com( i + 0x80 ) ;
send_com( j + 0x80 ) ;
read_12864() ;
pictotal[k] = read_12864() ;
pictotal[k+1] = read_12864() ;
k+=2;
}
}
for(i=0;i<32;i++){
for(j=0;j<8;j++){
send_com( i + 0x80 ) ;
send_com( j + 0x88 ) ;
read_12864() ;
pictotal[k] = read_12864() ;
pictotal[k+1] = read_12864() ;
k+=2;
}
}
}
//LCD字库初始化函数
void lcd_str(void)
{
delay(4000);
send_com(0x30);
delay(1000);
send_com(0x0C);
delay(1000);
send_com(0x01);
delay(1000);
send_com(0x06);
}
//LCD图片(扩展)初始化函数
void lcd_pic(void)
{
send_com(0x36);
delay(1000);
send_com(0x36);
delay(1000);
send_com(0x3E);
delay(1000);
send_com(0x01);
}
//——————清整个GDRAM空间—————————-
void clr_pic()
{
unsigned char x,y ;
for(y=0;y<64;y++)
for(x=0;x<16;x++)
{
send_com(0x34);
send_com(y+0x80);
send_com(x+0x80);
send_com(0x30);
send_data(0x00);
send_data(0x00);
}
}
void drawx(uchar y)
{
if(y<32){
send_com(0x80 + y);
send_com(0x80);
}
if(y>=32){
send_com(0x80 + y - 32);
send_com(0x88);
}
}
//左滚动一行
void rotl16()
{
uchar i,ch0,ch1,ch;
ch0=gun[0];
ch=(ch0&0x80)>>7;

for(i=0;i<15;i++){
gun[i]=gun[i]<<1;
gun[i]=gun[i]|((gun[i+1]&0x80)>>7);
}
gun[15]=(gun[15]<<1)|ch;

}
//右滚动一行
void rotr16()
{
uchar i,ch0,ch1,ch;
ch0=gun[15];
ch=(ch0&0x01)<<7;

for(i=15;i>0;i--){
gun[i]=gun[i]>>1;
gun[i]=gun[i]|((gun[i-1]&0x01)<<7);
}
gun[0]=(gun[0]>>1)|ch;

}
/**************主函数****************************/
void main()
{
uchar x,y,i,n;
uint k;
P4SW=0x70;
lcd_pic();
disppicture(LCD_picture1);
readpic();
lcd_pic();
while(1)
{

for(i=0;i<64;i++){ //下滚动
k=0;
for(x=i;x<64;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
send_data(gun[y]);
}
}
for(x=0;x<i;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
send_data(gun[y]);
}
}
}
lcd_pic();

for(i=63;i>0;i--){ //上滚动
k=0;
for(x=i;x<64;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
send_data(gun[y]);
}
}
for(x=0;x<i;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
send_data(gun[y]);
}
}
}

for(i=0;i<128;i++){ //左滚动
k=0;
for(x=0;x<64;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
}
rotl16();
k-=16;
for(y=0;y<16;y++)
{
pictotal[k]=gun[y];
send_data(gun[y]);
k++;
}
}
}
for(i=0;i<128;i++){ //右滚动
k=0;
for(x=0;x<64;x++){
drawx(x);
for(y=0;y<16;y++)
{
gun[y]=pictotal[k];
k++;
}
rotr16();
k-=16;
for(y=0;y<16;y++)
{
pictotal[k]=gun[y];
send_data(gun[y]);
k++;
}
}
}

}}

H. 主题:单片机 小霸王游戏机和JAVA虚拟机本质一样吗小霸王游戏卡里的内容可以是JAVA程序吗谢谢

不一样 单片机 小霸王游戏机 是硬件 JAVA虚拟机是软件
小霸王游戏卡不能是JAVA程序 因为游戏卡相当于软盘一样的东西

阅读全文

与游戏主机单片机相关的资料

热点内容
亿赛通加密软件好用吗 浏览:576
为什么光遇排队服务器忙 浏览:823
哪个app能把手p瘦 浏览:251
java中的date类型 浏览:429
面向程序员的范畴论 浏览:55
如何查询服务器所有电脑名 浏览:900
shell命令jar 浏览:301
有什么做手帐app 浏览:156
phpjquery源码 浏览:886
大话西游手游源码 浏览:655
javaudp代码 浏览:660
linuxu盘启动win7 浏览:990
如何启用交换机dhcp服务器 浏览:237
三田汽车压缩机好吗 浏览:294
马蜂窝app偏向什么客户 浏览:366
php简单的登录注册 浏览:554
我们接到上级命令 浏览:349
php本周星期一 浏览:65
裘锡圭pdf 浏览:726
android模拟器调试 浏览:135