From 0ea393a8d229f9b3f291fa6752111eb0f813739c Mon Sep 17 00:00:00 2001 From: xiangli <lixiangwd@gmail.com> Date: Wed, 11 May 2016 10:21:39 -0500 Subject: [PATCH] 2333 --- student-distrib/2048.c | 3 +++ student-distrib/systemcall.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/student-distrib/2048.c b/student-distrib/2048.c index 6ec0842..cfdef8f 100644 --- a/student-distrib/2048.c +++ b/student-distrib/2048.c @@ -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) { diff --git a/student-distrib/systemcall.c b/student-distrib/systemcall.c index 5f1f212..f6a39ed 100644 --- a/student-distrib/systemcall.c +++ b/student-distrib/systemcall.c @@ -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]); } -- GitLab