Skip to content
Snippets Groups Projects
Commit 0ea393a8 authored by xiangli's avatar xiangli
Browse files

2333

parent 0c621dc2
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
#include "malloc.h"
#include "terminal.h"
#include "keyboard_handler.h"
#include "systemcall.h"
int start_2048()
{
......@@ -9,8 +10,10 @@ int start_2048()
int rows, cols;
char buf[200];
clear();
printf("2048: Enter dimensions (rowscolumns), for example: 4 4\n");
printf("max 9 rows and 9 columns:\n");
while (1) {
terminal_read(0, buf, 10);
if (buf[0] > 48 && buf[0] < 58 && buf[2] > 48 && buf[2] < 58) {
......
......@@ -24,8 +24,8 @@
#define SOUND_PORT_CMD 0x43
#define SOUND_IO_PORT 0x61
int freq[64] = {130, 195, 261, 311, 391, 311, 261, 195, 130, 195, 261, 311, 97, 146, 195, 233, 103, 155, 207, 261, 311, 261, 207, 155, 103, 155, 261, 311, 207, 349, 207, 391, 195, 174, 233, 293, 174, 233, 293, 349, 155, 233, 311, 349, 97, 146, 195, 233, 174, 155, 207, 311, 207, 155, 164, 207, 155, 261, 311, 466, 155, 415, 207, 391};
int dur[64] = {400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 200, 200, 400, 400, 400, 400, 400};
int freq[256] = {130, 130, 130, 130, 195, 195, 195, 195, 261, 261, 261, 261, 311, 311, 311, 311, 391, 391, 391, 391, 311, 311, 311, 311, 261, 261, 261, 261, 195, 195, 195, 195, 130, 130, 130, 130, 195, 195, 195, 195, 261, 261, 261, 261, 311, 311, 311, 311, 97, 97, 97, 97, 146, 146, 146, 146, 195, 195, 195, 195, 233, 233, 233, 233, 103, 103, 103, 103, 155, 155, 155, 155, 207, 207, 207, 207, 261, 261, 261, 261, 311, 311, 311, 311, 261, 261, 261, 261, 207, 207, 207, 207, 155, 155, 155, 155, 103, 103, 103, 103, 155, 155, 155, 155, 261, 261, 261, 261, 311, 311, 311, 311, 207, 207, 207, 207, 349, 349, 349, 349, 207, 207, 207, 207, 391, 391, 391, 391, 349, 116, 349, 116, 174, 174, 174, 174, 233, 233, 233, 233, 293, 293, 293, 293, 174, 174, 174, 174, 233, 233, 233, 233, 293, 293, 293, 293, 349, 349, 349, 349, 155, 155, 155, 155, 233, 233, 233, 233, 311, 311, 311, 311, 349, 349, 349, 349, 97, 97, 97, 97, 146, 146, 146, 146, 195, 195, 195, 195, 233, 233, 233, 233, 293, 103, 293, 103, 155, 155, 155, 155, 207, 207, 207, 207, 311, 311, 311, 311, 207, 207, 207, 207, 155, 155, 155, 155, 261, 103, 261, 103, 207, 207, 207, 207, 155, 155, 155, 155, 261, 261, 261, 261, 311, 311, 311, 311, 466, 466, 466, 466, 155, 155, 155, 155, 415, 415, 415, 415, 207, 207, 207, 207, 391, 391, 391, 391};
int dur[256] = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 50, 50, 50, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 50, 50, 50, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 50, 50, 50, 50, 100, 100, 100, 100, 100, 100, 100, 100, 50, 50, 50, 50, 50, 50, 50, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100};
typedef int32_t func();
......@@ -85,7 +85,7 @@ void song()
{
int i;
for(i=0; i<64; i++)
for(i=0; i<256; i++)
{
sing_song(freq[i], dur[i]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment