buttons.c
来自「An complete pmp solution for mattel juic」· C语言 代码 · 共 133 行
C
133 行
#include "s3c44b0x.h"
#include "system.h"
#include "stdint.h"
/* Determined with OCD Commander, can be compared directly to Port G Data */
#define JB_PLAY 0x9D
#define JB_RETURN 0x9E
#define JB_STAR 0x8F
#define JB_FORWARD 0x9B
#define JB_REVERSE 0x97
#define JB_ATREST 0x9F /* Not buttons being pressed */
#define VD0 0
#define VD1 1
#define VD2 2
#define VD3 3
#define VD4 7
#define VD5 6
#define VD6 5
#define VD7 4
#define DISPOFF 8
#define LCDOFF 13
#define PORT_VD03 *pdatd
#define PORT_VD47 *pdatc
#define PORT_DAT *pdatd
#define VCLK 4
#define VLINE 5
#define VM 6
#define VFRAME 7
int main(void) {
cpu_init();
PORT_VD47 |= (1 << LCDOFF);
PORT_VD47 |= (1 << DISPOFF);
lcd_init();
clear_lcd();
draw_string("Juicebox Hack v0.1.1", 73, 80, 0xFF);
draw_string("Press play to color demo", 59, 90, 0xFF);
while (1) {
if (*pdatg==JB_PLAY)
{
flood_fill (0,0,10,10, 0x00);
flood_fill (10,0,20,10, 0x01);
flood_fill (20,0,30,10, 0x02);
flood_fill (30,0,40,10, 0x03);
flood_fill (0, 10,10,20, 0x00);
flood_fill (10,10,20,20, 0x04);
flood_fill (20,10,30,20, 0x08);
flood_fill (30,10,40,20, 0x0C);
flood_fill (40,10,50,20, 0x10);
flood_fill (50,10,60,20, 0x14);
flood_fill (60,10,70,20, 0x18);
flood_fill (70,10,80,20, 0x1C);
flood_fill (0, 20,10,30, 0x00);
flood_fill (10,20,20,30, 0x20);
flood_fill (20,20,30,30, 0x40);
flood_fill (30,20,40,30, 0x60);
flood_fill (40,20,50,30, 0x80);
flood_fill (50,20,60,30, 0xA0);
flood_fill (60,20,70,30, 0xC0);
flood_fill (70,20,80,30, 0xE0);
}}
/* while(1)
{
iz++; if (iz>4) iz = 0;
ix+= 10;
iy+= 11;
if(ix>160) ix -= 160;
if(iy>160) iy -= 160;
draw_string("O", ix, iy, color_lookup[iz]);
//set_pixel (ix, iy, 0x0F);
}/**/
/* iis_init();
while (1)
{
*iisfif = 0x00;
*iisfif = 0x02;
*iisfif = 0x04;
*iisfif = 0x08;
*iisfif = 0x2F;
*iisfif = 0x40;
*iisfif = 0x80;
*iisfif = 0xF0;
delay16();
}
/*while (1) {
*iisfif = 0x00;
*iisfif = 0x02;
*iisfif = 0x04;
*iisfif = 0x08;
*iisfif = 0x2F;
*iisfif = 0x40;
*iisfif = 0x80;
*iisfif = 0xF0;
switch ((*pdatg)) {
case JB_PLAY:
clear_lcd();
draw_string("Play button.", 10, 10, color_lookup[1]);
break;
case JB_RETURN:
clear_lcd();
draw_string("Return button.", 10, 10, color_lookup[2]);
break;
case JB_STAR:
clear_lcd();
draw_string("Star button.", 10, 10, color_lookup[3]);
break;
case JB_REVERSE:
clear_lcd();
draw_string("Reverse button.", 10, 10, color_lookup[4]);
break;
case JB_FORWARD:
clear_lcd();
draw_string("Forward button.", 10, 10, color_lookup[5]);
break;
default:
break;
}
delay_ms(1);
}
/**/
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?