Skip to content
Snippets Groups Projects
Commit 8b829a80 authored by Tom Feng's avatar Tom Feng
Browse files

sort of working

parent a3dd0e9f
No related branches found
No related tags found
1 merge request!16Withtime
......@@ -37,8 +37,8 @@ int MoveCursor(Buffer *Buf,char Direction, int Num);
int CursorPOS(Buffer *Buf, int x, int y);
void DrawLine_H(const char Element, const int Length);
void DrawLine_V(const char Element, const int Length);
void DrawPanel();
void DrawLine_V(Buffer *Buf,const char Element, const int Length);
void DrawPanel(Buffer *Buf);
void DrawClock(Buffer** BufferList, Clock* MyClock, CursorPos* InCursor);
int InteractiveInput(Buffer* BufList[],CursorPos* InCursor);
#endif
......@@ -39,92 +39,91 @@ bss 0x0000000000000000 0x0
*(.bss)
0x0000000000000000 _BssEnd = .
text 0x0000000000000000 0x3634
text 0x0000000000000000 0x3588
*(.text)
.text 0x0000000000000000 0x41c startup.o
0x000000000000012c InitializeTrainAndTrack
0x000000000000022c main
.text 0x0000000000000000 0x434 startup.o
0x0000000000000144 InitializeTrainAndTrack
0x0000000000000244 main
0x0000000000000000 initialize
0x00000000000000cc runloop
.text 0x000000000000041c 0xc38 ../lib/libmycanvas.a(mycanvas.o)
0x00000000000009ac DrawLine_H
0x00000000000005a8 ClearLine
0x0000000000000d44 DrawPanel
0x0000000000000a08 DrawLine_V
0x00000000000004f4 ClearScreen
0x0000000000000484 GetPowerD
0x0000000000000aac DrawClock
0x000000000000041c Exponent
0x000000000000065c MoveCursor
0x0000000000000790 CursorPOS
0x0000000000000ec4 InteractiveInput
.text 0x0000000000001054 0xfc ../lib/libmyclock.a(myclock.o)
0x0000000000001054 InitClockCount
0x00000000000010c8 UpdateClock
.text 0x0000000000001150 0x458 ../lib/libcmd.a(cmd.o)
0x0000000000001150 FeedCommand
0x00000000000014b4 SetTrainSpeed
.text 0x00000000000015a8 0x4f4 ../lib/libmyio.a(myio.o)
0x000000000000185c OutPutFromBuffer
0x0000000000001738 PutToBuffer
0x00000000000015a8 mygetc
0x0000000000001774 PutStrToBuffer
0x0000000000001964 OutPutStrFromBuffer
0x000000000000166c myputc
.text 0x0000000000001a9c 0xaf8 ../lib/libbuffer.a(buffer.o)
0x0000000000001b44 BufferReady
0x0000000000001a9c ASCII2NUM
0x000000000000200c BufferGet
0x00000000000020fc BufferGetStrSize
0x0000000000001db0 BufferFILO
0x0000000000001d04 BufferPopStart
0x0000000000001f58 BufferShrinkFIFO
0x0000000000001e38 BufferPopLast
0x0000000000001ba0 FeedBuffer
0x0000000000001c78 BufferFIFO
0x0000000000002380 BufferPopIfSpace
0x00000000000021e8 BufferGetStr
0x0000000000001ef0 ClearBuffer
0x000000000000243c BufferGetNumber
0x00000000000022e4 BufferPopIfTerminate
.text 0x0000000000002594 0xc54 ../lib/libbwio.a(bwio.o)
0x000000000000290c bwputr
0x0000000000002e78 bwi2a
0x0000000000002594 bwsetfifo
0x0000000000002768 bwputc
0x0000000000002bc8 bwa2d
0x000000000000265c bwsetspeed
0x000000000000282c c2x
0x0000000000002c70 bwa2i
0x0000000000002b10 bwgetc
0x0000000000002d34 bwui2a
0x0000000000002edc bwformat
0x0000000000002a08 bwputw
0x00000000000031b0 bwprintf
0x000000000000288c bwputx
0x000000000000298c bwputstr
.text 0x00000000000031e8 0x110 /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_udivsi3.o)
0x00000000000031e8 __udivsi3
0x00000000000032e0 __aeabi_uidivmod
.text 0x00000000000032f8 0x140 /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_divsi3.o)
0x00000000000032f8 __divsi3
0x0000000000003420 __aeabi_idivmod
.text 0x0000000000003438 0xcc /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_umodsi3.o)
0x0000000000003438 __umodsi3
.text 0x0000000000003504 0xe4 /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_modsi3.o)
0x0000000000003504 __modsi3
.text 0x00000000000035e8 0x4 /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_dvmd_tls.o)
0x00000000000035e8 __aeabi_ldiv0
0x00000000000035e8 __div0
0x00000000000035e8 __aeabi_idiv0
.text 0x0000000000000434 0xb94 ../lib/libmycanvas.a(mycanvas.o)
0x0000000000000a00 DrawLine_H
0x00000000000005c0 ClearLine
0x0000000000000d88 DrawPanel
0x0000000000000a60 DrawLine_V
0x000000000000050c ClearScreen
0x000000000000049c GetPowerD
0x0000000000000af0 DrawClock
0x0000000000000434 Exponent
0x0000000000000674 MoveCursor
0x00000000000007e4 CursorPOS
0x0000000000000e38 InteractiveInput
.text 0x0000000000000fc8 0xf8 ../lib/libmyclock.a(myclock.o)
0x0000000000000fc8 InitClockCount
0x000000000000103c UpdateClock
.text 0x00000000000010c0 0x458 ../lib/libcmd.a(cmd.o)
0x00000000000010c0 FeedCommand
0x0000000000001424 SetTrainSpeed
.text 0x0000000000001518 0x4f4 ../lib/libmyio.a(myio.o)
0x00000000000017cc OutPutFromBuffer
0x00000000000016a8 PutToBuffer
0x0000000000001518 mygetc
0x00000000000016e4 PutStrToBuffer
0x00000000000018d4 OutPutStrFromBuffer
0x00000000000015dc myputc
.text 0x0000000000001a0c 0xaf8 ../lib/libbuffer.a(buffer.o)
0x0000000000001ab4 BufferReady
0x0000000000001a0c ASCII2NUM
0x0000000000001f7c BufferGet
0x000000000000206c BufferGetStrSize
0x0000000000001d20 BufferFILO
0x0000000000001c74 BufferPopStart
0x0000000000001ec8 BufferShrinkFIFO
0x0000000000001da8 BufferPopLast
0x0000000000001b10 FeedBuffer
0x0000000000001be8 BufferFIFO
0x00000000000022f0 BufferPopIfSpace
0x0000000000002158 BufferGetStr
0x0000000000001e60 ClearBuffer
0x00000000000023ac BufferGetNumber
0x0000000000002254 BufferPopIfTerminate
.text 0x0000000000002504 0xc54 ../lib/libbwio.a(bwio.o)
0x000000000000287c bwputr
0x0000000000002de8 bwi2a
0x0000000000002504 bwsetfifo
0x00000000000026d8 bwputc
0x0000000000002b38 bwa2d
0x00000000000025cc bwsetspeed
0x000000000000279c c2x
0x0000000000002be0 bwa2i
0x0000000000002a80 bwgetc
0x0000000000002ca4 bwui2a
0x0000000000002e4c bwformat
0x0000000000002978 bwputw
0x0000000000003120 bwprintf
0x00000000000027fc bwputx
0x00000000000028fc bwputstr
.text 0x0000000000003158 0x110 /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_udivsi3.o)
0x0000000000003158 __udivsi3
0x0000000000003250 __aeabi_uidivmod
.text 0x0000000000003268 0x140 /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_divsi3.o)
0x0000000000003268 __divsi3
0x0000000000003390 __aeabi_idivmod
.text 0x00000000000033a8 0xcc /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_umodsi3.o)
0x00000000000033a8 __umodsi3
.text 0x0000000000003474 0xe4 /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_modsi3.o)
0x0000000000003474 __modsi3
.text 0x0000000000003558 0x4 /u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a(_dvmd_tls.o)
0x0000000000003558 __aeabi_ldiv0
0x0000000000003558 __div0
0x0000000000003558 __aeabi_idiv0
*(.got)
.got 0x00000000000035ec 0x8 startup.o
.got 0x000000000000355c 0x8 startup.o
*(.got.plt)
.got.plt 0x00000000000035f4 0xc startup.o
0x00000000000035f4 _GLOBAL_OFFSET_TABLE_
.got.plt 0x0000000000003564 0xc startup.o
0x0000000000003564 _GLOBAL_OFFSET_TABLE_
*(.rodata)
.rodata 0x0000000000003600 0x18 startup.o
.rodata 0x0000000000003618 0x1c ../lib/libmycanvas.a(mycanvas.o)
.rodata 0x0000000000003570 0x18 startup.o
*(.glue_7)
*(.glue_7t)
......
......@@ -56,17 +56,21 @@ int MoveCursor(Buffer* Buf, char Direction, int Num){
if(BufferReady(Buf)){
int Power = GetPowerD(Num);
int i = 0;
int cpy = Num;
int tens;
char c;
if((4+Power) > (Buf->Size - Buf->Length)) return BUFF_CANTFIT;
PutToBuffer(ESC_CANVAS,Buf);
PutToBuffer('[',Buf);
for(;i<Power;i++){
c = '0'+ (Num / Exponent(10, Power - i));
PutToBuffer(c, Buf);
for(i = 0; i<=Power; i++){
tens = Exponent(10,Power-i);
c = '0' +(cpy/tens);
cpy -= tens;
PutToBuffer(c,Buf);
}
return PutToBuffer(Direction,Buf);
//PutToBuffer(0,Buf);
//OutPutStrFromBuffer(COM2, Buf);
PutToBuffer(Direction,Buf);
PutToBuffer(0,Buf);
return OutPutStrFromBuffer(COM2, Buf);
}else return BUFF_NOTREADY;
}
......@@ -104,18 +108,18 @@ int CursorPOS(Buffer *Buf, int x, int y){
void DrawLine_H(const char Element, const int Length)
{
int i = 0;
for(; i<Length; i++){
bwputc(COM2,Element);
for(; i<Length; ){
i += myputc(COM2,Element);
}
}
void DrawLine_V(const char Element, const int Length)
void DrawLine_V(Buffer *Buf,const char Element, const int Length)
{
int i = 0;
for(; i<Length; i++){
bwputc(COM2,Element);
MOVE_LEFT(1);
MOVE_DOWN(1);
i += myputc(COM2,Element);
MoveCursor(Buf,LEFT,1);
MoveCursor(Buf,DOWN,1);
}
}
......@@ -160,24 +164,24 @@ void DrawClock(Buffer** BufferList, Clock *MyClock,CursorPos* InCursor){
}
}
void DrawPanel()
void DrawPanel(Buffer *Buf)
{
CURSOR_POS(1,1);
//DrawLine_H('#',80);
CURSOR_POS(2,60);
DrawLine_V('|', 20);
CURSOR_POS(32,1);
//DrawLine_H('#', 79);
CURSOR_POS(2,80);
DrawLine_V('#', 25);
CURSOR_POS(2,1);
DrawLine_V('#', 25);
CURSOR_POS(23,3);
DrawLine_V('>', 3);
CURSOR_POS(23,4);
DrawLine_V('>', 3);
CURSOR_POS(26,1);
CursorPOS(Buf,1,1);
DrawLine_H('#',80);
CursorPOS(Buf,2,60);
//DrawLine_V(Buf,'|', 20);
CursorPOS(Buf,32,1);
//DrawLine_H('#', 79);
CursorPOS(Buf,2,80);
//DrawLine_V(Buf,'#', 25);
CursorPOS(Buf,2,1);
//DrawLine_V(Buf,'#', 25);
CursorPOS(Buf,23,3);
//DrawLine_V(Buf,'>', 3);
CursorPOS(Buf,23,4);
//DrawLine_V(Buf,'>', 3);
CursorPOS(Buf,26,1);
DrawLine_H('#', 79);
}
int InteractiveInput(Buffer* BuffList[], CursorPos* InCursor){
......
......@@ -17,7 +17,7 @@ void InitClockCount(Clock *MyClock)
void UpdateClock(Clock *MyClock)
{
unsigned int *ValRegister = *((unsigned int *)(TIMER3_BASE+VAL_OFFSET)) ;
unsigned int *ValRegister = (unsigned int *)(TIMER3_BASE+VAL_OFFSET);
unsigned int CurrentTimerValue = *ValRegister;
if(CurrentTimerValue > MyClock->LastTimerValue){
......
......@@ -27,8 +27,8 @@ int runloop(Buffer** BuffList, CursorPos *InputPos,Clock* MyClock)
int IOCode;
//Clock *MyClock = ClockList[0];
while(1){
//UpdateClock(MyClock);
//DrawClock(BuffList, MyClock, InputPos);
UpdateClock(MyClock);
DrawClock(BuffList, MyClock, InputPos);
//bwprintf(COM2, 'ClockDraw');
IOCode = InteractiveInput(BuffList, InputPos);
//bwprintf(COM2, "IOCode:%d\n\r",IOCode);
......@@ -117,11 +117,11 @@ int main(){
CursorPos InputPos = {15,2,1};
CursorPos InputPos = {23,5,1};
// CLEAR_SCREEN;
ClearScreen(BuffList[3]);
//CursorPOS(BuffList[3],15,13);
// DrawPanel();
//DrawPanel(&TermOutputBuf);
return runloop(BuffList, &InputPos, &MyClock);
//return testloop(&Test);
......
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