From 28d46cbfb397436c7a7d9160f09ed53d1c669b83 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Fri, 22 Sep 2023 09:44:23 +0200 Subject: [PATCH] update .clang-format and format all the code --- .clang-format | 71 +- src/debugger.c | 1322 ++++++++++---------- src/emu_actions.c | 126 +- src/emu_emulate.c | 325 ++--- src/emu_init.c | 105 +- src/emu_memory.c | 255 ++-- src/emu_register.c | 104 +- src/emu_serial.c | 102 +- src/emu_timer.c | 36 +- src/emulator_inner.h | 15 +- src/main.c | 14 +- src/romio.c | 29 +- src/romio.h | 3 +- src/runtime_options.c | 208 ++-- src/tools/checkrom.c | 11 +- src/tools/dump2rom.c | 26 +- src/tools/mkcard.c | 14 +- src/ui.c | 268 ++--- src/ui_inner.h | 466 +++----- src/ui_sdl.c | 1624 +++++++------------------ src/ui_text.c | 420 +++---- src/ui_x11.c | 2646 ++++++++++++----------------------------- 22 files changed, 2956 insertions(+), 5234 deletions(-) diff --git a/.clang-format b/.clang-format index 9bb1e81..126882a 100644 --- a/.clang-format +++ b/.clang-format @@ -1,18 +1,59 @@ --- -IndentCaseLabels: 'true' -IndentPPDirectives: None -IndentWidth: '4' -PointerAlignment: Left -SortIncludes: 'false' -SpaceAfterTemplateKeyword: 'false' -SpaceBeforeAssignmentOperators: 'true' -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: 'true' -SpaceInEmptyParentheses: 'false' -SpacesInAngles: 'true' -SpacesInCStyleCastParentheses: 'true' -SpacesInContainerLiterals: 'true' -SpacesInParentheses: 'true' -SpacesInSquareBrackets: 'true' +Language: Cpp +ColumnLimit: 140 +IndentWidth: 4 +PPIndentWidth: 2 +UseTab: Never +AlignArrayOfStructures: Left + +IndentCaseBlocks: true +IndentCaseLabels: true +IndentGotoLabels: false +IndentPPDirectives: AfterHash +IndentWrappedFunctionNames: true + +InsertBraces: false +InsertNewlineAtEOF: true + +MaxEmptyLinesToKeep: 1 + +PointerAlignment: Left +ReferenceAlignment: Left +QualifierAlignment: Left + +SortIncludes: false + +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesInAngles: true +SpacesInCStyleCastParentheses: true +SpacesInContainerLiterals: true +SpacesInParentheses: true +SpacesInSquareBrackets: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false + +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterExternBlock: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true ... diff --git a/src/debugger.c b/src/debugger.c index 4b8800f..ebb7abb 100644 --- a/src/debugger.c +++ b/src/debugger.c @@ -124,74 +124,64 @@ static char* opcode_0_tbl[ 32 ] = { /* * HP Mnemonics */ - ( char* )"RTNSXM", ( char* )"RTN", ( char* )"RTNSC", ( char* )"RTNCC", - ( char* )"SETHEX", ( char* )"SETDEC", ( char* )"RSTK=C", ( char* )"C=RSTK", - ( char* )"CLRST", ( char* )"C=ST", ( char* )"ST=C", ( char* )"CSTEX", - ( char* )"P=P+1", ( char* )"P=P-1", ( char* )"(NULL)", ( char* )"RTI", + ( char* )"RTNSXM", ( char* )"RTN", ( char* )"RTNSC", ( char* )"RTNCC", ( char* )"SETHEX", ( char* )"SETDEC", ( char* )"RSTK=C", + ( char* )"C=RSTK", ( char* )"CLRST", ( char* )"C=ST", ( char* )"ST=C", ( char* )"CSTEX", ( char* )"P=P+1", ( char* )"P=P-1", + ( char* )"(NULL)", ( char* )"RTI", /* * Class Mnemonics */ - ( char* )"rtnsxm", ( char* )"rtn", ( char* )"rtnsc", ( char* )"rtncc", - ( char* )"sethex", ( char* )"setdec", ( char* )"push", ( char* )"pop", - ( char* )"clr.3 st", ( char* )"move.3 st, c", ( char* )"move.3 c, st", - ( char* )"exg.3 c, st", ( char* )"inc.1 p", ( char* )"dec.1 p", - ( char* )"(null)", ( char* )"rti" }; + ( char* )"rtnsxm", ( char* )"rtn", ( char* )"rtnsc", ( char* )"rtncc", ( char* )"sethex", ( char* )"setdec", ( char* )"push", + ( char* )"pop", ( char* )"clr.3 st", ( char* )"move.3 st, c", ( char* )"move.3 c, st", ( char* )"exg.3 c, st", + ( char* )"inc.1 p", ( char* )"dec.1 p", ( char* )"(null)", ( char* )"rti" }; static char* op_str_0[ 16 ] = { /* * HP Mnemonics */ - ( char* )"A=A%cB", ( char* )"B=B%cC", ( char* )"C=C%cA", ( char* )"D=D%cC", - ( char* )"B=B%cA", ( char* )"C=C%cB", ( char* )"A=A%cC", ( char* )"C=C%cD", + ( char* )"A=A%cB", ( char* )"B=B%cC", ( char* )"C=C%cA", ( char* )"D=D%cC", ( char* )"B=B%cA", ( char* )"C=C%cB", ( char* )"A=A%cC", + ( char* )"C=C%cD", /* * Class Mnemonics */ - ( char* )"b, a", ( char* )"c, b", ( char* )"a, c", ( char* )"c, d", - ( char* )"a, b", ( char* )"b, c", ( char* )"c, a", ( char* )"d, c" }; + ( char* )"b, a", ( char* )"c, b", ( char* )"a, c", ( char* )"c, d", ( char* )"a, b", ( char* )"b, c", ( char* )"c, a", + ( char* )"d, c" }; static char* op_str_1[ 16 ] = { /* * HP Mnemonics */ - ( char* )"DAT0=A", ( char* )"DAT1=A", ( char* )"A=DAT0", ( char* )"A=DAT1", - ( char* )"DAT0=C", ( char* )"DAT1=C", ( char* )"C=DAT0", ( char* )"C=DAT1", + ( char* )"DAT0=A", ( char* )"DAT1=A", ( char* )"A=DAT0", ( char* )"A=DAT1", ( char* )"DAT0=C", ( char* )"DAT1=C", ( char* )"C=DAT0", + ( char* )"C=DAT1", /* * Class Mnemonics */ - ( char* )"a, (d0)", ( char* )"a, (d1)", ( char* )"(d0), a", - ( char* )"(d1), a", ( char* )"c, (d0)", ( char* )"c, (d1)", + ( char* )"a, (d0)", ( char* )"a, (d1)", ( char* )"(d0), a", ( char* )"(d1), a", ( char* )"c, (d0)", ( char* )"c, (d1)", ( char* )"(d0), c", ( char* )"(d1), c" }; static char* in_str_80[ 32 ] = { /* * HP Mnemonics */ - ( char* )"OUT=CS", ( char* )"OUT=C", ( char* )"A=IN", ( char* )"C=IN", - ( char* )"UNCNFG", ( char* )"CONFIG", ( char* )"C=ID", ( char* )"SHUTDN", - NULL, ( char* )"C+P+1", ( char* )"RESET", ( char* )"BUSCC", NULL, NULL, - ( char* )"SREQ?", NULL, + ( char* )"OUT=CS", ( char* )"OUT=C", ( char* )"A=IN", ( char* )"C=IN", ( char* )"UNCNFG", ( char* )"CONFIG", ( char* )"C=ID", + ( char* )"SHUTDN", NULL, ( char* )"C+P+1", ( char* )"RESET", ( char* )"BUSCC", NULL, NULL, ( char* )"SREQ?", NULL, /* * Class Mnemonics */ - ( char* )"move.s c, out", ( char* )"move.3 c, out", - ( char* )"move.4 in, a", ( char* )"move.4 in, c", ( char* )"uncnfg", - ( char* )"config", ( char* )"c=id", ( char* )"shutdn", NULL, - ( char* )"add.a p+1, c", ( char* )"reset", ( char* )"buscc", NULL, NULL, + ( char* )"move.s c, out", ( char* )"move.3 c, out", ( char* )"move.4 in, a", ( char* )"move.4 in, c", ( char* )"uncnfg", + ( char* )"config", ( char* )"c=id", ( char* )"shutdn", NULL, ( char* )"add.a p+1, c", ( char* )"reset", ( char* )"buscc", NULL, NULL, ( char* )"sreq?", NULL }; static char* in_str_808[ 32 ] = { /* * HP Mnemonics */ - ( char* )"INTON", NULL, NULL, ( char* )"BUSCB", NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, ( char* )"PC=(A)", ( char* )"BUSCD", + ( char* )"INTON", NULL, NULL, ( char* )"BUSCB", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ( char* )"PC=(A)", ( char* )"BUSCD", ( char* )"PC=(C)", ( char* )"INTOFF", /* * Class Mnemonics */ - ( char* )"inton", NULL, NULL, ( char* )"buscb", NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, ( char* )"jmp (a)", ( char* )"buscd", - ( char* )"jmp (c)", ( char* )"intoff" }; + ( char* )"inton", NULL, NULL, ( char* )"buscb", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ( char* )"jmp (a)", + ( char* )"buscd", ( char* )"jmp (c)", ( char* )"intoff" }; static char* op_str_81[ 8 ] = { /* @@ -255,41 +245,37 @@ static char* in_str_9[ 16 ] = { /* * HP Mnemonics */ - ( char* )"=", ( char* )"#", ( char* )"=", ( char* )"#", ( char* )">", - ( char* )"<", ( char* )">=", ( char* )"<=", + ( char* )"=", ( char* )"#", ( char* )"=", ( char* )"#", ( char* )">", ( char* )"<", ( char* )">=", ( char* )"<=", /* * Class Mnemonics */ - ( char* )"eq", ( char* )"ne", ( char* )"eq", ( char* )"ne", ( char* )"gt", - ( char* )"lt", ( char* )"ge", ( char* )"le" }; + ( char* )"eq", ( char* )"ne", ( char* )"eq", ( char* )"ne", ( char* )"gt", ( char* )"lt", ( char* )"ge", ( char* )"le" }; static char* op_str_9[ 16 ] = { /* * HP Mnemonics */ - ( char* )"?A%sB", ( char* )"?B%sC", ( char* )"?C%sA", ( char* )"?D%sC", - ( char* )"?A%s0", ( char* )"?B%s0", ( char* )"?C%s0", ( char* )"?D%s0", + ( char* )"?A%sB", ( char* )"?B%sC", ( char* )"?C%sA", ( char* )"?D%sC", ( char* )"?A%s0", ( char* )"?B%s0", ( char* )"?C%s0", + ( char* )"?D%s0", /* * Class Mnemonics */ - ( char* )"a, b", ( char* )"b, c", ( char* )"c, a", ( char* )"d, c", - ( char* )"a, 0", ( char* )"b, 0", ( char* )"c, 0", ( char* )"d, 0" }; + ( char* )"a, b", ( char* )"b, c", ( char* )"c, a", ( char* )"d, c", ( char* )"a, 0", ( char* )"b, 0", ( char* )"c, 0", + ( char* )"d, 0" }; static char* op_str_af[ 32 ] = { /* * HP Mnemonics */ - ( char* )"A=A%sB", ( char* )"B=B%sC", ( char* )"C=C%sA", ( char* )"D=D%sC", - ( char* )"A=A%sA", ( char* )"B=B%sB", ( char* )"C=C%sC", ( char* )"D=D%sD", - ( char* )"B=B%sA", ( char* )"C=C%sB", ( char* )"A=A%sC", ( char* )"C=C%sD", - ( char* )"A=B%sA", ( char* )"B=C%sB", ( char* )"C=A%sC", ( char* )"D=C%sD", + ( char* )"A=A%sB", ( char* )"B=B%sC", ( char* )"C=C%sA", ( char* )"D=D%sC", ( char* )"A=A%sA", ( char* )"B=B%sB", ( char* )"C=C%sC", + ( char* )"D=D%sD", ( char* )"B=B%sA", ( char* )"C=C%sB", ( char* )"A=A%sC", ( char* )"C=C%sD", ( char* )"A=B%sA", ( char* )"B=C%sB", + ( char* )"C=A%sC", ( char* )"D=C%sD", /* * Class Mnemonics */ - ( char* )"b, a", ( char* )"c, b", ( char* )"a, c", ( char* )"c, d", - ( char* )"a, a", ( char* )"b, b", ( char* )"c, c", ( char* )"d, d", - ( char* )"a, b", ( char* )"b, c", ( char* )"c, a", ( char* )"d, c", - ( char* )"b, a", ( char* )"c, b", ( char* )"a, c", ( char* )"c, d" }; + ( char* )"b, a", ( char* )"c, b", ( char* )"a, c", ( char* )"c, d", ( char* )"a, a", ( char* )"b, b", ( char* )"c, c", ( char* )"d, d", + ( char* )"a, b", ( char* )"b, c", ( char* )"c, a", ( char* )"d, c", ( char* )"b, a", ( char* )"c, b", ( char* )"a, c", + ( char* )"c, d" }; static char hp_reg_1_af[] = "ABCDABCDBCACABAC"; static char hp_reg_2_af[] = "0000BCACABCDBCCD"; @@ -374,270 +360,274 @@ typedef struct trans_tbl_t { char* trans; } trans_tbl_t; -static trans_tbl_t hp48_trans_tbl[ 256 ] = { { 0, ( char* )"\\0" }, - { 1, ( char* )"\\001" }, - { 2, ( char* )"\\002" }, - { 3, ( char* )"\\003" }, - { 4, ( char* )"\\004" }, - { 5, ( char* )"\\005" }, - { 6, ( char* )"\\006" }, - { 7, ( char* )"\\007" }, - { 8, ( char* )"\\b" }, - { 9, ( char* )"\\t" }, - { 10, ( char* )"\\n" }, - { 11, ( char* )"\\011" }, - { 12, ( char* )"\\f" }, - { 13, ( char* )"\\r" }, - { 14, ( char* )"\\014" }, - { 15, ( char* )"\\015" }, - { 16, ( char* )"\\016" }, - { 17, ( char* )"\\017" }, - { 18, ( char* )"\\018" }, - { 19, ( char* )"\\019" }, - { 20, ( char* )"\\020" }, - { 21, ( char* )"\\021" }, - { 22, ( char* )"\\022" }, - { 23, ( char* )"\\023" }, - { 24, ( char* )"\\024" }, - { 25, ( char* )"\\025" }, - { 26, ( char* )"\\026" }, - { 27, ( char* )"\\027" }, - { 28, ( char* )"\\028" }, - { 29, ( char* )"\\029" }, - { 30, ( char* )"\\030" }, - { 31, ( char* )"\\031" }, - { ' ', 0 }, - { '!', 0 }, - { '"', 0 }, - { '#', 0 }, - { '$', 0 }, - { '%', 0 }, - { '&', 0 }, - { '\'', 0 }, - { '(', 0 }, - { ')', 0 }, - { '*', 0 }, - { '+', 0 }, - { ',', 0 }, - { '-', 0 }, - { '.', 0 }, - { '/', 0 }, - { '0', 0 }, - { '1', 0 }, - { '2', 0 }, - { '3', 0 }, - { '4', 0 }, - { '5', 0 }, - { '6', 0 }, - { '7', 0 }, - { '8', 0 }, - { '9', 0 }, - { ':', 0 }, - { ';', 0 }, - { '<', 0 }, - { '=', 0 }, - { '>', 0 }, - { '?', 0 }, - { '@', 0 }, - { 'A', 0 }, - { 'B', 0 }, - { 'C', 0 }, - { 'D', 0 }, - { 'E', 0 }, - { 'F', 0 }, - { 'G', 0 }, - { 'H', 0 }, - { 'I', 0 }, - { 'J', 0 }, - { 'K', 0 }, - { 'L', 0 }, - { 'M', 0 }, - { 'N', 0 }, - { 'O', 0 }, - { 'P', 0 }, - { 'Q', 0 }, - { 'R', 0 }, - { 'S', 0 }, - { 'T', 0 }, - { 'U', 0 }, - { 'V', 0 }, - { 'W', 0 }, - { 'X', 0 }, - { 'Y', 0 }, - { 'Z', 0 }, - { '[', 0 }, - { '\\', 0 }, - { ']', 0 }, - { '^', 0 }, - { '_', 0 }, - { '`', 0 }, - { 'a', 0 }, - { 'b', 0 }, - { 'c', 0 }, - { 'd', 0 }, - { 'e', 0 }, - { 'f', 0 }, - { 'g', 0 }, - { 'h', 0 }, - { 'i', 0 }, - { 'j', 0 }, - { 'k', 0 }, - { 'l', 0 }, - { 'm', 0 }, - { 'n', 0 }, - { 'o', 0 }, - { 'p', 0 }, - { 'q', 0 }, - { 'r', 0 }, - { 's', 0 }, - { 't', 0 }, - { 'u', 0 }, - { 'v', 0 }, - { 'w', 0 }, - { 'x', 0 }, - { 'y', 0 }, - { 'z', 0 }, - { '{', 0 }, - { '|', 0 }, - { '}', 0 }, - { '~', 0 }, - { 127, ( char* )"\\127" }, - { 128, ( char* )"\\<)" }, - { 129, ( char* )"\\x-" }, - { 130, ( char* )"\\.V" }, - { 131, ( char* )"\\v/" }, - { 132, ( char* )"\\.S" }, - { 133, ( char* )"\\GS" }, - { 134, ( char* )"\\|>" }, - { 135, ( char* )"\\pi" }, - { 136, ( char* )"\\.d" }, - { 137, ( char* )"\\<=" }, - { 138, ( char* )"\\>=" }, - { 139, ( char* )"\\=/" }, - { 140, ( char* )"\\Ga" }, - { 141, ( char* )"\\->" }, - { 142, ( char* )"\\<-" }, - { 143, ( char* )"\\|v" }, - { 144, ( char* )"\\|^" }, - { 145, ( char* )"\\Gg" }, - { 146, ( char* )"\\Gd" }, - { 147, ( char* )"\\Ge" }, - { 148, ( char* )"\\Gn" }, - { 149, ( char* )"\\Gh" }, - { 150, ( char* )"\\Gl" }, - { 151, ( char* )"\\Gr" }, - { 152, ( char* )"\\Gs" }, - { 153, ( char* )"\\Gt" }, - { 154, ( char* )"\\Gw" }, - { 155, ( char* )"\\GD" }, - { 156, ( char* )"\\PI" }, - { 157, ( char* )"\\GW" }, - { 158, ( char* )"\\[]" }, - { 159, ( char* )"\\oo" }, - { 160, ( char* )"\\160" }, - { 161, ( char* )"\\161" }, - { 162, ( char* )"\\162" }, - { 163, ( char* )"\\163" }, - { 164, ( char* )"\\164" }, - { 165, ( char* )"\\165" }, - { 166, ( char* )"\\166" }, - { 167, ( char* )"\\167" }, - { 168, ( char* )"\\168" }, - { 169, ( char* )"\\169" }, - { 170, ( char* )"\\170" }, - { 171, ( char* )"\\<<" }, - { 172, ( char* )"\\172" }, - { 173, ( char* )"\\173" }, - { 174, ( char* )"\\174" }, - { 175, ( char* )"\\175" }, - { 176, ( char* )"\\^o" }, - { 177, ( char* )"\\177" }, - { 178, ( char* )"\\178" }, - { 179, ( char* )"\\179" }, - { 180, ( char* )"\\180" }, - { 181, ( char* )"\\Gm" }, - { 182, ( char* )"\\182" }, - { 183, ( char* )"\\183" }, - { 184, ( char* )"\\184" }, - { 185, ( char* )"\\185" }, - { 186, ( char* )"\\186" }, - { 187, ( char* )"\\>>" }, - { 188, ( char* )"\\188" }, - { 189, ( char* )"\\189" }, - { 190, ( char* )"\\190" }, - { 191, ( char* )"\\191" }, - { 192, ( char* )"\\192" }, - { 193, ( char* )"\\193" }, - { 194, ( char* )"\\194" }, - { 195, ( char* )"\\195" }, - { 196, ( char* )"\\196" }, - { 197, ( char* )"\\197" }, - { 198, ( char* )"\\198" }, - { 199, ( char* )"\\199" }, - { 200, ( char* )"\\200" }, - { 201, ( char* )"\\201" }, - { 202, ( char* )"\\202" }, - { 203, ( char* )"\\203" }, - { 204, ( char* )"\\204" }, - { 205, ( char* )"\\205" }, - { 206, ( char* )"\\206" }, - { 207, ( char* )"\\207" }, - { 208, ( char* )"\\208" }, - { 209, ( char* )"\\209" }, - { 210, ( char* )"\\210" }, - { 211, ( char* )"\\211" }, - { 212, ( char* )"\\212" }, - { 213, ( char* )"\\213" }, - { 214, ( char* )"\\214" }, - { 215, ( char* )"\\.x" }, - { 216, ( char* )"\\O/" }, - { 217, ( char* )"\\217" }, - { 218, ( char* )"\\218" }, - { 219, ( char* )"\\219" }, - { 220, ( char* )"\\220" }, - { 221, ( char* )"\\221" }, - { 222, ( char* )"\\222" }, - { 223, ( char* )"\\223" }, - { 224, ( char* )"\\224" }, - { 225, ( char* )"\\225" }, - { 226, ( char* )"\\226" }, - { 227, ( char* )"\\227" }, - { 228, ( char* )"\\228" }, - { 229, ( char* )"\\229" }, - { 230, ( char* )"\\230" }, - { 231, ( char* )"\\231" }, - { 232, ( char* )"\\232" }, - { 233, ( char* )"\\233" }, - { 234, ( char* )"\\234" }, - { 235, ( char* )"\\235" }, - { 236, ( char* )"\\236" }, - { 237, ( char* )"\\237" }, - { 238, ( char* )"\\238" }, - { 239, ( char* )"\\239" }, - { 240, ( char* )"\\240" }, - { 241, ( char* )"\\241" }, - { 242, ( char* )"\\242" }, - { 243, ( char* )"\\243" }, - { 244, ( char* )"\\244" }, - { 245, ( char* )"\\245" }, - { 246, ( char* )"\\246" }, - { 247, ( char* )"\\:-" }, - { 248, ( char* )"\\248" }, - { 249, ( char* )"\\249" }, - { 250, ( char* )"\\250" }, - { 251, ( char* )"\\251" }, - { 252, ( char* )"\\252" }, - { 253, ( char* )"\\253" }, - { 254, ( char* )"\\254" }, - { 255, ( char* )"\\255" } }; +static trans_tbl_t hp48_trans_tbl[ 256 ] = { + {0, ( char* )"\\0" }, + { 1, ( char* )"\\001"}, + { 2, ( char* )"\\002"}, + { 3, ( char* )"\\003"}, + { 4, ( char* )"\\004"}, + { 5, ( char* )"\\005"}, + { 6, ( char* )"\\006"}, + { 7, ( char* )"\\007"}, + { 8, ( char* )"\\b" }, + { 9, ( char* )"\\t" }, + { 10, ( char* )"\\n" }, + { 11, ( char* )"\\011"}, + { 12, ( char* )"\\f" }, + { 13, ( char* )"\\r" }, + { 14, ( char* )"\\014"}, + { 15, ( char* )"\\015"}, + { 16, ( char* )"\\016"}, + { 17, ( char* )"\\017"}, + { 18, ( char* )"\\018"}, + { 19, ( char* )"\\019"}, + { 20, ( char* )"\\020"}, + { 21, ( char* )"\\021"}, + { 22, ( char* )"\\022"}, + { 23, ( char* )"\\023"}, + { 24, ( char* )"\\024"}, + { 25, ( char* )"\\025"}, + { 26, ( char* )"\\026"}, + { 27, ( char* )"\\027"}, + { 28, ( char* )"\\028"}, + { 29, ( char* )"\\029"}, + { 30, ( char* )"\\030"}, + { 31, ( char* )"\\031"}, + { ' ', 0 }, + { '!', 0 }, + { '"', 0 }, + { '#', 0 }, + { '$', 0 }, + { '%', 0 }, + { '&', 0 }, + { '\'', 0 }, + { '(', 0 }, + { ')', 0 }, + { '*', 0 }, + { '+', 0 }, + { ',', 0 }, + { '-', 0 }, + { '.', 0 }, + { '/', 0 }, + { '0', 0 }, + { '1', 0 }, + { '2', 0 }, + { '3', 0 }, + { '4', 0 }, + { '5', 0 }, + { '6', 0 }, + { '7', 0 }, + { '8', 0 }, + { '9', 0 }, + { ':', 0 }, + { ';', 0 }, + { '<', 0 }, + { '=', 0 }, + { '>', 0 }, + { '?', 0 }, + { '@', 0 }, + { 'A', 0 }, + { 'B', 0 }, + { 'C', 0 }, + { 'D', 0 }, + { 'E', 0 }, + { 'F', 0 }, + { 'G', 0 }, + { 'H', 0 }, + { 'I', 0 }, + { 'J', 0 }, + { 'K', 0 }, + { 'L', 0 }, + { 'M', 0 }, + { 'N', 0 }, + { 'O', 0 }, + { 'P', 0 }, + { 'Q', 0 }, + { 'R', 0 }, + { 'S', 0 }, + { 'T', 0 }, + { 'U', 0 }, + { 'V', 0 }, + { 'W', 0 }, + { 'X', 0 }, + { 'Y', 0 }, + { 'Z', 0 }, + { '[', 0 }, + { '\\', 0 }, + { ']', 0 }, + { '^', 0 }, + { '_', 0 }, + { '`', 0 }, + { 'a', 0 }, + { 'b', 0 }, + { 'c', 0 }, + { 'd', 0 }, + { 'e', 0 }, + { 'f', 0 }, + { 'g', 0 }, + { 'h', 0 }, + { 'i', 0 }, + { 'j', 0 }, + { 'k', 0 }, + { 'l', 0 }, + { 'm', 0 }, + { 'n', 0 }, + { 'o', 0 }, + { 'p', 0 }, + { 'q', 0 }, + { 'r', 0 }, + { 's', 0 }, + { 't', 0 }, + { 'u', 0 }, + { 'v', 0 }, + { 'w', 0 }, + { 'x', 0 }, + { 'y', 0 }, + { 'z', 0 }, + { '{', 0 }, + { '|', 0 }, + { '}', 0 }, + { '~', 0 }, + { 127, ( char* )"\\127"}, + { 128, ( char* )"\\<)" }, + { 129, ( char* )"\\x-" }, + { 130, ( char* )"\\.V" }, + { 131, ( char* )"\\v/" }, + { 132, ( char* )"\\.S" }, + { 133, ( char* )"\\GS" }, + { 134, ( char* )"\\|>" }, + { 135, ( char* )"\\pi" }, + { 136, ( char* )"\\.d" }, + { 137, ( char* )"\\<=" }, + { 138, ( char* )"\\>=" }, + { 139, ( char* )"\\=/" }, + { 140, ( char* )"\\Ga" }, + { 141, ( char* )"\\->" }, + { 142, ( char* )"\\<-" }, + { 143, ( char* )"\\|v" }, + { 144, ( char* )"\\|^" }, + { 145, ( char* )"\\Gg" }, + { 146, ( char* )"\\Gd" }, + { 147, ( char* )"\\Ge" }, + { 148, ( char* )"\\Gn" }, + { 149, ( char* )"\\Gh" }, + { 150, ( char* )"\\Gl" }, + { 151, ( char* )"\\Gr" }, + { 152, ( char* )"\\Gs" }, + { 153, ( char* )"\\Gt" }, + { 154, ( char* )"\\Gw" }, + { 155, ( char* )"\\GD" }, + { 156, ( char* )"\\PI" }, + { 157, ( char* )"\\GW" }, + { 158, ( char* )"\\[]" }, + { 159, ( char* )"\\oo" }, + { 160, ( char* )"\\160"}, + { 161, ( char* )"\\161"}, + { 162, ( char* )"\\162"}, + { 163, ( char* )"\\163"}, + { 164, ( char* )"\\164"}, + { 165, ( char* )"\\165"}, + { 166, ( char* )"\\166"}, + { 167, ( char* )"\\167"}, + { 168, ( char* )"\\168"}, + { 169, ( char* )"\\169"}, + { 170, ( char* )"\\170"}, + { 171, ( char* )"\\<<" }, + { 172, ( char* )"\\172"}, + { 173, ( char* )"\\173"}, + { 174, ( char* )"\\174"}, + { 175, ( char* )"\\175"}, + { 176, ( char* )"\\^o" }, + { 177, ( char* )"\\177"}, + { 178, ( char* )"\\178"}, + { 179, ( char* )"\\179"}, + { 180, ( char* )"\\180"}, + { 181, ( char* )"\\Gm" }, + { 182, ( char* )"\\182"}, + { 183, ( char* )"\\183"}, + { 184, ( char* )"\\184"}, + { 185, ( char* )"\\185"}, + { 186, ( char* )"\\186"}, + { 187, ( char* )"\\>>" }, + { 188, ( char* )"\\188"}, + { 189, ( char* )"\\189"}, + { 190, ( char* )"\\190"}, + { 191, ( char* )"\\191"}, + { 192, ( char* )"\\192"}, + { 193, ( char* )"\\193"}, + { 194, ( char* )"\\194"}, + { 195, ( char* )"\\195"}, + { 196, ( char* )"\\196"}, + { 197, ( char* )"\\197"}, + { 198, ( char* )"\\198"}, + { 199, ( char* )"\\199"}, + { 200, ( char* )"\\200"}, + { 201, ( char* )"\\201"}, + { 202, ( char* )"\\202"}, + { 203, ( char* )"\\203"}, + { 204, ( char* )"\\204"}, + { 205, ( char* )"\\205"}, + { 206, ( char* )"\\206"}, + { 207, ( char* )"\\207"}, + { 208, ( char* )"\\208"}, + { 209, ( char* )"\\209"}, + { 210, ( char* )"\\210"}, + { 211, ( char* )"\\211"}, + { 212, ( char* )"\\212"}, + { 213, ( char* )"\\213"}, + { 214, ( char* )"\\214"}, + { 215, ( char* )"\\.x" }, + { 216, ( char* )"\\O/" }, + { 217, ( char* )"\\217"}, + { 218, ( char* )"\\218"}, + { 219, ( char* )"\\219"}, + { 220, ( char* )"\\220"}, + { 221, ( char* )"\\221"}, + { 222, ( char* )"\\222"}, + { 223, ( char* )"\\223"}, + { 224, ( char* )"\\224"}, + { 225, ( char* )"\\225"}, + { 226, ( char* )"\\226"}, + { 227, ( char* )"\\227"}, + { 228, ( char* )"\\228"}, + { 229, ( char* )"\\229"}, + { 230, ( char* )"\\230"}, + { 231, ( char* )"\\231"}, + { 232, ( char* )"\\232"}, + { 233, ( char* )"\\233"}, + { 234, ( char* )"\\234"}, + { 235, ( char* )"\\235"}, + { 236, ( char* )"\\236"}, + { 237, ( char* )"\\237"}, + { 238, ( char* )"\\238"}, + { 239, ( char* )"\\239"}, + { 240, ( char* )"\\240"}, + { 241, ( char* )"\\241"}, + { 242, ( char* )"\\242"}, + { 243, ( char* )"\\243"}, + { 244, ( char* )"\\244"}, + { 245, ( char* )"\\245"}, + { 246, ( char* )"\\246"}, + { 247, ( char* )"\\:-" }, + { 248, ( char* )"\\248"}, + { 249, ( char* )"\\249"}, + { 250, ( char* )"\\250"}, + { 251, ( char* )"\\251"}, + { 252, ( char* )"\\252"}, + { 253, ( char* )"\\253"}, + { 254, ( char* )"\\254"}, + { 255, ( char* )"\\255"} +}; -static char* append_str( char* buf, const char* str ) { +static char* append_str( char* buf, const char* str ) +{ while ( ( *buf = *str++ ) ) buf++; return buf; } -static char* append_tab( char* buf ) { +static char* append_tab( char* buf ) +{ int n; char* p; @@ -649,7 +639,8 @@ static char* append_tab( char* buf ) { return p; } -static int read_int( word_20* addr, int n ) { +static int read_int( word_20* addr, int n ) +{ int i, t; for ( i = 0, t = 0; i < n; i++ ) @@ -657,7 +648,8 @@ static int read_int( word_20* addr, int n ) { return t; } -static char* append_tab_16( char* buf ) { +static char* append_tab_16( char* buf ) +{ int n; char* p; @@ -669,12 +661,14 @@ static char* append_tab_16( char* buf ) { return p; } -static char* append_field( char* buf, word_4 fn ) { +static char* append_field( char* buf, word_4 fn ) +{ buf = append_str( buf, field_tbl[ fn + 16 * disassembler_mode ] ); return buf; } -static char* append_imm_nibble( char* buf, word_20* addr, int n ) { +static char* append_imm_nibble( char* buf, word_20* addr, int n ) +{ int i; char t[ 16 ]; @@ -697,7 +691,8 @@ static char* append_imm_nibble( char* buf, word_20* addr, int n ) { return buf; } -static char* append_addr( char* buf, word_20 addr ) { +static char* append_addr( char* buf, word_20 addr ) +{ int shift; long mask; @@ -710,8 +705,8 @@ static char* append_addr( char* buf, word_20 addr ) { return buf; } -static char* append_r_addr( char* buf, word_20* pc, long disp, int n, - int offset ) { +static char* append_r_addr( char* buf, word_20* pc, long disp, int n, int offset ) +{ long sign; sign = 1 << ( n * 4 - 1 ); @@ -747,7 +742,8 @@ static char* append_r_addr( char* buf, word_20* pc, long disp, int n, return buf; } -static char* append_pc_comment( char* buf, word_20 pc ) { +static char* append_pc_comment( char* buf, word_20 pc ) +{ char* p = buf; while ( strlen( buf ) < 4 * TAB_SKIP ) @@ -769,7 +765,8 @@ static char* append_pc_comment( char* buf, word_20 pc ) { return p; } -static char* append_hst_bits( char* buf, int n ) { +static char* append_hst_bits( char* buf, int n ) +{ int i; char* p = buf; @@ -805,7 +802,8 @@ static char* append_hst_bits( char* buf, int n ) { return p; } -static char* disasm_1( word_20* addr, char* out ) { +static char* disasm_1( word_20* addr, char* out ) +{ word_4 n; word_4 fn; char* p; @@ -890,10 +888,8 @@ static char* disasm_1( word_20* addr, char* out ) { p = append_str( out, buf ); break; case CLASS_MNEMONICS: - p = append_str( out, ( n & 2 ) ? ( char* )"exg." - : ( char* )"move." ); - p = append_str( p, - ( n < 8 ) ? ( char* )"a" : ( char* )"4" ); + p = append_str( out, ( n & 2 ) ? ( char* )"exg." : ( char* )"move." ); + p = append_str( p, ( n < 8 ) ? ( char* )"a" : ( char* )"4" ); p = append_tab( out ); c = ( n & 4 ) ? 'c' : 'a'; sprintf( buf, ( char* )"%c, d%d", c, ( n & 1 ) ); @@ -910,12 +906,10 @@ static char* disasm_1( word_20* addr, char* out ) { fn = read_nibble( ( *addr )++ ); switch ( disassembler_mode ) { case HP_MNEMONICS: - p = append_str( - out, op_str_1[ ( fn & 7 ) + 8 * disassembler_mode ] ); + p = append_str( out, op_str_1[ ( fn & 7 ) + 8 * disassembler_mode ] ); p = append_tab( out ); if ( n == 4 ) { - p = append_str( p, ( fn < 8 ) ? ( char* )"A" - : ( char* )"B" ); + p = append_str( p, ( fn < 8 ) ? ( char* )"A" : ( char* )"B" ); } else { n = read_nibble( ( *addr )++ ); if ( fn < 8 ) { @@ -930,8 +924,7 @@ static char* disasm_1( word_20* addr, char* out ) { p = append_str( out, ( char* )"move" ); if ( n == 4 ) { p = append_str( p, ( char* )"." ); - p = append_str( p, ( fn < 8 ) ? ( char* )"a" - : ( char* )"b" ); + p = append_str( p, ( fn < 8 ) ? ( char* )"a" : ( char* )"b" ); } else { n = read_nibble( ( *addr )++ ); if ( fn < 8 ) { @@ -942,8 +935,7 @@ static char* disasm_1( word_20* addr, char* out ) { } } p = append_tab( out ); - p = append_str( - p, op_str_1[ ( fn & 7 ) + 8 * disassembler_mode ] ); + p = append_str( p, op_str_1[ ( fn & 7 ) + 8 * disassembler_mode ] ); break; default: p = append_str( out, ( char* )"Unknown disassembler mode" ); @@ -1040,7 +1032,8 @@ static char* disasm_1( word_20* addr, char* out ) { return p; } -static char* disasm_8( word_20* addr, char* out ) { +static char* disasm_8( word_20* addr, char* out ) +{ word_4 n; word_4 fn; char* p = out; @@ -1052,17 +1045,14 @@ static char* disasm_8( word_20* addr, char* out ) { switch ( fn ) { case 0: n = read_nibble( ( *addr )++ ); - if ( NULL != - ( p = ( char* )in_str_80[ n + 16 * disassembler_mode ] ) ) { + if ( NULL != ( p = ( char* )in_str_80[ n + 16 * disassembler_mode ] ) ) { p = append_str( out, p ); return p; } switch ( n ) { case 8: fn = read_nibble( ( *addr )++ ); - if ( NULL != - ( p = ( char* ) - in_str_808[ fn + 16 * disassembler_mode ] ) ) { + if ( NULL != ( p = ( char* )in_str_808[ fn + 16 * disassembler_mode ] ) ) { p = append_str( out, p ); return p; } @@ -1078,9 +1068,8 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_str( out, ( char* )"rsi" ); break; default: - p = append_str( - out, ( char* )"Unknown " - "disassembler mode" ); + p = append_str( out, ( char* )"Unknown " + "disassembler mode" ); break; } } @@ -1090,8 +1079,7 @@ static char* disasm_8( word_20* addr, char* out ) { switch ( disassembler_mode ) { case HP_MNEMONICS: if ( n < 5 ) { - sprintf( buf, ( char* )"LA(%d)", - n + 1 ); + sprintf( buf, ( char* )"LA(%d)", n + 1 ); } else { sprintf( buf, ( char* )"LAHEX" ); } @@ -1108,9 +1096,7 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_str( p, buf ); break; default: - p = append_str( - out, - ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1122,27 +1108,19 @@ static char* disasm_8( word_20* addr, char* out ) { switch ( disassembler_mode ) { case HP_MNEMONICS: - sprintf( buf, ( char* )"%cBIT=%d", - ( fn & 8 ) ? 'C' : 'A', - ( fn & 1 ) ? 1 : 0 ); + sprintf( buf, ( char* )"%cBIT=%d", ( fn & 8 ) ? 'C' : 'A', ( fn & 1 ) ? 1 : 0 ); p = append_str( out, buf ); p = append_tab( out ); p = append_imm_nibble( p, addr, 1 ); break; case CLASS_MNEMONICS: - p = append_str( - out, ( fn & 1 ) ? ( char* )"bset" - : ( char* )"bclr" ); + p = append_str( out, ( fn & 1 ) ? ( char* )"bset" : ( char* )"bclr" ); p = append_tab( out ); p = append_imm_nibble( p, addr, 1 ); - p = append_str( p, ( fn & 8 ) - ? ( char* )", c" - : ( char* )", a" ); + p = append_str( p, ( fn & 8 ) ? ( char* )", c" : ( char* )", a" ); break; default: - p = append_str( - out, - ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1159,43 +1137,33 @@ static char* disasm_8( word_20* addr, char* out ) { switch ( disassembler_mode ) { case HP_MNEMONICS: c = ( char )( ( fn < 0xa ) ? 'A' : 'C' ); - sprintf( buf, ( char* )"?%cBIT=%d", c, - ( fn & 1 ) ? 1 : 0 ); + sprintf( buf, ( char* )"?%cBIT=%d", c, ( fn & 1 ) ? 1 : 0 ); p = append_str( out, buf ); p = append_tab( out ); sprintf( buf, ( char* )"%d", n ); p = append_str( p, buf ); if ( disp != 0 ) { - p = append_str( - p, ( char* )", GOYES (char*)" ); + p = append_str( p, ( char* )", GOYES (char*)" ); p = append_r_addr( p, &pc, disp, 2, 5 ); p = append_pc_comment( out, pc ); } else - p = append_str( p, - ( char* )", RTNYES" ); + p = append_str( p, ( char* )", RTNYES" ); break; case CLASS_MNEMONICS: c = ( char )( ( fn < 0xa ) ? 'a' : 'c' ); - p = append_str( out, ( disp == 0 ) - ? ( char* )"rt" - : ( char* )"b" ); - p = append_str( p, ( fn & 1 ) - ? ( char* )"bs" - : ( char* )"bc" ); + p = append_str( out, ( disp == 0 ) ? ( char* )"rt" : ( char* )"b" ); + p = append_str( p, ( fn & 1 ) ? ( char* )"bs" : ( char* )"bc" ); p = append_tab( out ); sprintf( buf, ( char* )"#%d, %c", n, c ); p = append_str( p, buf ); if ( disp != 0 ) { - p = append_str( p, - ( char* )", (char*)" ); + p = append_str( p, ( char* )", (char*)" ); p = append_r_addr( p, &pc, disp, 2, 5 ); p = append_pc_comment( out, pc ); } break; default: - p = append_str( - out, - ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1211,10 +1179,7 @@ static char* disasm_8( word_20* addr, char* out ) { fn = read_nibble( ( *addr )++ ); switch ( disassembler_mode ) { case HP_MNEMONICS: - sprintf( buf, - ( n == 0xf ) ? ( char* )"%c%cEX" - : ( char* )"%c=%c", - ( n == 0xd ) ? 'P' : 'C', + sprintf( buf, ( n == 0xf ) ? ( char* )"%c%cEX" : ( char* )"%c=%c", ( n == 0xd ) ? 'P' : 'C', ( n == 0xd ) ? 'C' : 'P' ); p = append_str( out, buf ); p = append_tab( out ); @@ -1222,19 +1187,13 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_str( p, buf ); break; case CLASS_MNEMONICS: - p = append_str( out, ( n == 0xf ) - ? ( char* )"exg.1" - : ( char* )"move.1" ); + p = append_str( out, ( n == 0xf ) ? ( char* )"exg.1" : ( char* )"move.1" ); p = append_tab( out ); - sprintf( buf, - ( n == 0xd ) ? ( char* )"p, c.%d" - : ( char* )"c.%d, p", - fn ); + sprintf( buf, ( n == 0xd ) ? ( char* )"p, c.%d" : ( char* )"c.%d, p", fn ); p = append_str( p, buf ); break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1252,22 +1211,17 @@ static char* disasm_8( word_20* addr, char* out ) { case 3: switch ( disassembler_mode ) { case HP_MNEMONICS: - sprintf( buf, ( char* )"%sSLC", - op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + sprintf( buf, ( char* )"%sSLC", op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); p = append_str( out, buf ); break; case CLASS_MNEMONICS: p = append_str( out, ( char* )"rol.w" ); p = append_tab( out ); p = append_str( p, ( char* )"#4, (char*)" ); - p = append_str( - p, op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + p = append_str( p, op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1278,22 +1232,17 @@ static char* disasm_8( word_20* addr, char* out ) { case 7: switch ( disassembler_mode ) { case HP_MNEMONICS: - sprintf( buf, ( char* )"%sSRC", - op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + sprintf( buf, ( char* )"%sSRC", op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); p = append_str( out, buf ); break; case CLASS_MNEMONICS: p = append_str( out, ( char* )"ror.w" ); p = append_tab( out ); p = append_str( p, ( char* )"#4, (char*)" ); - p = append_str( - p, op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + p = append_str( p, op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1303,11 +1252,8 @@ static char* disasm_8( word_20* addr, char* out ) { n = read_nibble( ( *addr )++ ); switch ( disassembler_mode ) { case HP_MNEMONICS: - sprintf( - buf, ( char* )"%s=%s%cCON", - op_str_81[ ( n & 3 ) + 4 * disassembler_mode ], - op_str_81[ ( n & 3 ) + 4 * disassembler_mode ], - ( n < 8 ) ? '+' : '-' ); + sprintf( buf, ( char* )"%s=%s%cCON", op_str_81[ ( n & 3 ) + 4 * disassembler_mode ], + op_str_81[ ( n & 3 ) + 4 * disassembler_mode ], ( n < 8 ) ? '+' : '-' ); p = append_str( out, buf ); p = append_tab( out ); p = append_field( p, fn ); @@ -1316,20 +1262,16 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_str( p, buf ); break; case CLASS_MNEMONICS: - p = append_str( out, ( n < 8 ) ? ( char* )"add" - : ( char* )"sub" ); + p = append_str( out, ( n < 8 ) ? ( char* )"add" : ( char* )"sub" ); p = append_field( p, fn ); p = append_tab( out ); fn = read_nibble( ( *addr )++ ); sprintf( buf, ( char* )"#%d, (char*)", fn + 1 ); p = append_str( p, buf ); - p = append_str( - p, op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + p = append_str( p, op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1337,9 +1279,7 @@ static char* disasm_8( word_20* addr, char* out ) { case 9: switch ( disassembler_mode ) { case HP_MNEMONICS: - sprintf( buf, ( char* )"%sSRB.F", - op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + sprintf( buf, ( char* )"%sSRB.F", op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); p = append_str( out, buf ); p = append_tab( out ); p = append_field( p, read_nibble( ( *addr )++ ) ); @@ -1349,13 +1289,10 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_field( p, read_nibble( ( *addr )++ ) ); p = append_tab( out ); p = append_str( p, ( char* )"#1, (char*)" ); - p = append_str( - p, op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + p = append_str( p, op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1371,46 +1308,35 @@ static char* disasm_8( word_20* addr, char* out ) { switch ( disassembler_mode ) { case HP_MNEMONICS: if ( n == 2 ) { - sprintf( buf, ( char* )"%cR%dEX.F", - ( ( int )c < 8 ) ? 'A' : 'C', - ( int )c & 7 ); + sprintf( buf, ( char* )"%cR%dEX.F", ( ( int )c < 8 ) ? 'A' : 'C', ( int )c & 7 ); } else if ( n == 1 ) { - sprintf( buf, ( char* )"%c=R%d.F", - ( ( int )c < 8 ) ? 'A' : 'C', - ( int )c & 7 ); + sprintf( buf, ( char* )"%c=R%d.F", ( ( int )c < 8 ) ? 'A' : 'C', ( int )c & 7 ); } else { - sprintf( buf, ( char* )"R%d=%c.F", ( int )c & 7, - ( ( int )c < 8 ) ? 'A' : 'C' ); + sprintf( buf, ( char* )"R%d=%c.F", ( int )c & 7, ( ( int )c < 8 ) ? 'A' : 'C' ); } p = append_str( out, buf ); p = append_tab( out ); p = append_field( p, fn ); break; case CLASS_MNEMONICS: - p = append_str( out, ( n == 2 ) ? ( char* )"exg" - : ( char* )"move" ); + p = append_str( out, ( n == 2 ) ? ( char* )"exg" : ( char* )"move" ); p = append_field( p, fn ); p = append_tab( out ); if ( n == 1 ) { sprintf( buf, ( char* )"r%d", ( int )c & 7 ); p = append_str( p, buf ); } else - p = append_str( p, ( ( int )c < 8 ) - ? ( char* )"a" - : ( char* )"c" ); + p = append_str( p, ( ( int )c < 8 ) ? ( char* )"a" : ( char* )"c" ); p = append_str( p, ( char* )", (char*)" ); if ( n == 1 ) - p = append_str( p, ( ( int )c < 8 ) - ? ( char* )"a" - : ( char* )"c" ); + p = append_str( p, ( ( int )c < 8 ) ? ( char* )"a" : ( char* )"c" ); else { sprintf( buf, ( char* )"r%d", ( int )c & 7 ); p = append_str( p, buf ); } break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1420,8 +1346,7 @@ static char* disasm_8( word_20* addr, char* out ) { if ( ( n < 2 ) || ( n > 7 ) ) break; - p = append_str( out, - in_str_81b[ n + 16 * disassembler_mode ] ); + p = append_str( out, in_str_81b[ n + 16 * disassembler_mode ] ); break; case 0xc: @@ -1430,22 +1355,17 @@ static char* disasm_8( word_20* addr, char* out ) { case 0xf: switch ( disassembler_mode ) { case HP_MNEMONICS: - sprintf( buf, ( char* )"%sSRB", - op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + sprintf( buf, ( char* )"%sSRB", op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); p = append_str( out, buf ); break; case CLASS_MNEMONICS: p = append_str( out, ( char* )"lsr.w" ); p = append_tab( out ); p = append_str( p, ( char* )"#1, (char*)" ); - p = append_str( - p, op_str_81[ ( n & 3 ) + - 4 * disassembler_mode ] ); + p = append_str( p, op_str_81[ ( n & 3 ) + 4 * disassembler_mode ] ); break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); break; } break; @@ -1497,8 +1417,7 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_str( p, ( char* )"RTNYES" ); break; case CLASS_MNEMONICS: - p = append_str( out, ( disp == 0 ) ? ( char* )"rt" - : ( char* )"b" ); + p = append_str( out, ( disp == 0 ) ? ( char* )"rt" : ( char* )"b" ); p = append_str( p, ( char* )"eq.1" ); p = append_tab( out ); sprintf( buf, ( char* )"#%d, hst", n ); @@ -1526,8 +1445,7 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_imm_nibble( p, addr, 1 ); break; case CLASS_MNEMONICS: - p = append_str( out, ( fn == 4 ) ? ( char* )"bclr" - : ( char* )"bset" ); + p = append_str( out, ( fn == 4 ) ? ( char* )"bclr" : ( char* )"bset" ); p = append_tab( out ); p = append_imm_nibble( p, addr, 1 ); p = append_str( p, ( char* )", st" ); @@ -1558,10 +1476,8 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_str( p, ( char* )", RTNYES" ); break; case CLASS_MNEMONICS: - p = append_str( out, ( disp == 0 ) ? ( char* )"rt" - : ( char* )"b" ); - p = append_str( p, ( fn == 6 ) ? ( char* )"bc" - : ( char* )"bs" ); + p = append_str( out, ( disp == 0 ) ? ( char* )"rt" : ( char* )"b" ); + p = append_str( p, ( fn == 6 ) ? ( char* )"bc" : ( char* )"bs" ); p = append_tab( out ); sprintf( buf, ( char* )"#%d, st", n ); p = append_str( p, buf ); @@ -1597,10 +1513,8 @@ static char* disasm_8( word_20* addr, char* out ) { p = append_str( p, ( char* )", RTNYES" ); break; case CLASS_MNEMONICS: - p = append_str( out, ( disp == 0 ) ? ( char* )"rt" - : ( char* )"b" ); - p = append_str( p, ( fn == 8 ) ? ( char* )"ne.1" - : ( char* )"eq.1" ); + p = append_str( out, ( disp == 0 ) ? ( char* )"rt" : ( char* )"b" ); + p = append_str( p, ( fn == 8 ) ? ( char* )"ne.1" : ( char* )"eq.1" ); p = append_tab( out ); sprintf( buf, ( char* )"#%d, p", n ); p = append_str( p, buf ); @@ -1624,15 +1538,13 @@ static char* disasm_8( word_20* addr, char* out ) { disp = read_int( addr, 4 ); switch ( disassembler_mode ) { case HP_MNEMONICS: - p = append_str( out, ( fn == 0xc ) ? ( char* )"GOLONG" - : ( char* )"GOSUBL" ); + p = append_str( out, ( fn == 0xc ) ? ( char* )"GOLONG" : ( char* )"GOSUBL" ); p = append_tab( out ); p = append_r_addr( p, &pc, disp, 4, ( fn == 0xc ) ? 2 : 6 ); p = append_pc_comment( out, pc ); break; case CLASS_MNEMONICS: - p = append_str( out, ( fn == 0xc ) ? ( char* )"bra.4" - : ( char* )"bsr.4" ); + p = append_str( out, ( fn == 0xc ) ? ( char* )"bra.4" : ( char* )"bsr.4" ); p = append_tab( out ); p = append_r_addr( p, &pc, disp, 4, ( fn == 0xc ) ? 2 : 6 ); p = append_pc_comment( out, pc ); @@ -1648,14 +1560,12 @@ static char* disasm_8( word_20* addr, char* out ) { pc = read_int( addr, 5 ); switch ( disassembler_mode ) { case HP_MNEMONICS: - p = append_str( out, ( fn == 0xc ) ? ( char* )"GOVLNG" - : ( char* )"GOSBVL" ); + p = append_str( out, ( fn == 0xc ) ? ( char* )"GOVLNG" : ( char* )"GOSBVL" ); p = append_tab( out ); p = append_addr( p, pc ); break; case CLASS_MNEMONICS: - p = append_str( out, ( fn == 0xc ) ? ( char* )"jmp" - : ( char* )"jsr" ); + p = append_str( out, ( fn == 0xc ) ? ( char* )"jmp" : ( char* )"jsr" ); p = append_tab( out ); p = append_addr( p, pc ); break; @@ -1671,7 +1581,8 @@ static char* disasm_8( word_20* addr, char* out ) { return p; } -static word_20 disassemble( word_20 addr, char* out ) { +static word_20 disassemble( word_20 addr, char* out ) +{ word_4 n; word_4 fn; char* p = out; @@ -1682,27 +1593,23 @@ static word_20 disassemble( word_20 addr, char* out ) { switch ( n = read_nibble( addr++ ) ) { case 0: if ( ( n = read_nibble( addr++ ) ) != 0xe ) { - p = append_str( out, - opcode_0_tbl[ n + 16 * disassembler_mode ] ); + p = append_str( out, opcode_0_tbl[ n + 16 * disassembler_mode ] ); break; } fn = read_nibble( addr++ ); n = read_nibble( addr++ ); switch ( disassembler_mode ) { case HP_MNEMONICS: - sprintf( buf, op_str_0[ ( n & 7 ) + 8 * HP_MNEMONICS ], - ( n < 8 ) ? '&' : '!' ); + sprintf( buf, op_str_0[ ( n & 7 ) + 8 * HP_MNEMONICS ], ( n < 8 ) ? '&' : '!' ); p = append_str( out, buf ); p = append_tab( out ); p = append_field( p, fn ); break; case CLASS_MNEMONICS: - p = append_str( out, ( n < 8 ) ? ( char* )"and" - : ( char* )"or" ); + p = append_str( out, ( n < 8 ) ? ( char* )"and" : ( char* )"or" ); p = append_field( p, fn ); p = append_tab( out ); - p = append_str( - p, op_str_0[ ( n & 7 ) + 8 * CLASS_MNEMONICS ] ); + p = append_str( p, op_str_0[ ( n & 7 ) + 8 * CLASS_MNEMONICS ] ); break; default: p = append_str( out, ( char* )"Unknown disassembler mode" ); @@ -1768,10 +1675,7 @@ static word_20 disassemble( word_20 addr, char* out ) { p = append_str( out, ( char* )"NOP3" ); break; } - sprintf( buf, - ( disp == 0 ) ? ( char* )"RTN%sC" - : ( char* )"GO%sC", - ( n == 4 ) ? ( char* )"" : ( char* )"N" ); + sprintf( buf, ( disp == 0 ) ? ( char* )"RTN%sC" : ( char* )"GO%sC", ( n == 4 ) ? ( char* )"" : ( char* )"N" ); p = append_str( out, buf ); if ( disp != 0 ) { p = append_tab( out ); @@ -1785,10 +1689,8 @@ static word_20 disassemble( word_20 addr, char* out ) { p = append_str( out, ( char* )"nop3" ); break; } - p = append_str( out, ( disp == 0 ) ? ( char* )"rtc" - : ( char* )"bc" ); - p = append_str( p, - ( n == 4 ) ? ( char* )"s" : ( char* )"c" ); + p = append_str( out, ( disp == 0 ) ? ( char* )"rtc" : ( char* )"bc" ); + p = append_str( p, ( n == 4 ) ? ( char* )"s" : ( char* )"c" ); if ( disp != 0 ) { p = append_tab( out ); p = append_r_addr( p, &pc, disp, 2, 1 ); @@ -1891,21 +1793,15 @@ static word_20 disassemble( word_20 addr, char* out ) { switch ( disassembler_mode ) { case HP_MNEMONICS: if ( ( c == 0 ) && ( n >= 8 ) ) - sprintf( buf, - op_str_9[ ( n & 3 ) + 8 * HP_MNEMONICS + 4 ], - in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c + - 8 * HP_MNEMONICS ] ); + sprintf( buf, op_str_9[ ( n & 3 ) + 8 * HP_MNEMONICS + 4 ], + in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c + 8 * HP_MNEMONICS ] ); else - sprintf( buf, op_str_9[ ( n & 3 ) + 8 * HP_MNEMONICS ], - in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c + - 8 * HP_MNEMONICS ] ); + sprintf( buf, op_str_9[ ( n & 3 ) + 8 * HP_MNEMONICS ], in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c + 8 * HP_MNEMONICS ] ); p = append_str( out, buf ); p = append_tab( out ); p = append_field( p, fn ); p = append_str( p, ( char* )", (char*)" ); - p = append_str( p, ( disp == 0 ) - ? ( char* )"RTNYES" - : ( char* )"GOYES (char*)" ); + p = append_str( p, ( disp == 0 ) ? ( char* )"RTNYES" : ( char* )"GOYES (char*)" ); if ( disp != 0 ) { p = append_r_addr( p, &pc, disp, 2, 3 ); p = append_pc_comment( out, pc ); @@ -1913,19 +1809,14 @@ static word_20 disassemble( word_20 addr, char* out ) { break; case CLASS_MNEMONICS: - p = append_str( out, ( disp == 0 ) ? ( char* )"rt" - : ( char* )"b" ); - p = append_str( p, in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c + - 8 * CLASS_MNEMONICS ] ); + p = append_str( out, ( disp == 0 ) ? ( char* )"rt" : ( char* )"b" ); + p = append_str( p, in_str_9[ ( ( n >> 2 ) & 3 ) + 4 * c + 8 * CLASS_MNEMONICS ] ); p = append_field( p, fn ); p = append_tab( out ); if ( ( c == 0 ) && ( n >= 8 ) ) - p = append_str( - p, - op_str_9[ ( n & 3 ) + 8 * CLASS_MNEMONICS + 4 ] ); + p = append_str( p, op_str_9[ ( n & 3 ) + 8 * CLASS_MNEMONICS + 4 ] ); else - p = append_str( - p, op_str_9[ ( n & 3 ) + 8 * CLASS_MNEMONICS ] ); + p = append_str( p, op_str_9[ ( n & 3 ) + 8 * CLASS_MNEMONICS ] ); if ( disp != 0 ) { p = append_str( p, ( char* )", (char*)" ); p = append_r_addr( p, &pc, disp, 2, 3 ); @@ -2023,8 +1914,7 @@ static word_20 disassemble( word_20 addr, char* out ) { break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); return addr; } break; @@ -2085,8 +1975,7 @@ static word_20 disassemble( word_20 addr, char* out ) { break; default: - p = append_str( - out, ( char* )"Unknown disassembler mode" ); + p = append_str( out, ( char* )"Unknown disassembler mode" ); return addr; } break; @@ -2118,8 +2007,7 @@ static word_20 disassemble( word_20 addr, char* out ) { sprintf( buf, ( char* )"%c", ( n & 3 ) + 'a' ); p = append_str( p, buf ); } else { - p = append_str( p, - op_str_af[ n + 16 * CLASS_MNEMONICS ] ); + p = append_str( p, op_str_af[ n + 16 * CLASS_MNEMONICS ] ); } break; @@ -2134,7 +2022,8 @@ static word_20 disassemble( word_20 addr, char* out ) { return addr; } -static char* skip_ob( word_20* addr, char* string ) { +static char* skip_ob( word_20* addr, char* string ) +{ word_20 size, type; char* p = string; struct objfunc* op; @@ -2157,7 +2046,8 @@ static char* skip_ob( word_20* addr, char* string ) { return p; } -static long hxs2real( long hxs ) { +static long hxs2real( long hxs ) +{ int n = 0, c = 1; while ( hxs ) { @@ -2168,7 +2058,8 @@ static long hxs2real( long hxs ) { return n; } -static char* dec_bin_int( word_20* addr, char* string ) { +static char* dec_bin_int( word_20* addr, char* string ) +{ char* p = string; word_20 n = 0; @@ -2179,7 +2070,8 @@ static char* dec_bin_int( word_20* addr, char* string ) { return p; } -static char* real_number( word_20* addr, char* string, int ml, int xl ) { +static char* real_number( word_20* addr, char* string, int ml, int xl ) +{ hp_real r; long re, xs; int i; @@ -2278,15 +2170,12 @@ static char* real_number( word_20* addr, char* string, int ml, int xl ) { return p; } -static char* dec_real( word_20* addr, char* string ) { - return real_number( addr, string, 11, 3 ); -} +static char* dec_real( word_20* addr, char* string ) { return real_number( addr, string, 11, 3 ); } -static char* dec_long_real( word_20* addr, char* string ) { - return real_number( addr, string, 14, 5 ); -} +static char* dec_long_real( word_20* addr, char* string ) { return real_number( addr, string, 14, 5 ); } -static char* dec_complex( word_20* addr, char* string ) { +static char* dec_complex( word_20* addr, char* string ) +{ char* p = string; *p++ = '('; @@ -2298,7 +2187,8 @@ static char* dec_complex( word_20* addr, char* string ) { return p; } -static char* dec_long_complex( word_20* addr, char* string ) { +static char* dec_long_complex( word_20* addr, char* string ) +{ char* p = string; *p++ = '('; @@ -2310,7 +2200,8 @@ static char* dec_long_complex( word_20* addr, char* string ) { return p; } -static char* dec_string( word_20* addr, char* string ) { +static char* dec_string( word_20* addr, char* string ) +{ word_20 len; unsigned char c; char* p = string; @@ -2347,7 +2238,8 @@ static char* dec_string( word_20* addr, char* string ) { return p; } -static char* dec_hex_string( word_20* addr, char* string ) { +static char* dec_hex_string( word_20* addr, char* string ) +{ int len, lead, i, n; static char hex[] = "0123456789ABCDEF"; char* p = string; @@ -2402,7 +2294,8 @@ static char* dec_hex_string( word_20* addr, char* string ) { return p; } -static char* xlib_name( int lib, int command, char* string ) { +static char* xlib_name( int lib, int command, char* string ) +{ int n, len; int i, lib_n = 0; unsigned char c; @@ -2560,7 +2453,8 @@ static char* xlib_name( int lib, int command, char* string ) { return p; } -static short check_xlib( word_20 addr, char* string ) { +static short check_xlib( word_20 addr, char* string ) +{ int n, lib, command; word_20 romptab; word_20 offset, link_end; @@ -2701,7 +2595,8 @@ static short check_xlib( word_20 addr, char* string ) { return 0; } -static char* dec_rpl_obj( word_20* addr, char* string ) { +static char* dec_rpl_obj( word_20* addr, char* string ) +{ word_20 prolog = 0; word_20 prolog_2; char* p = string; @@ -2739,7 +2634,8 @@ static char* dec_rpl_obj( word_20* addr, char* string ) { return p; } -static char* dec_list( word_20* addr, char* string ) { +static char* dec_list( word_20* addr, char* string ) +{ word_20 semi; char* p = string; @@ -2762,7 +2658,8 @@ static char* dec_list( word_20* addr, char* string ) { return p; } -static char* dec_symb( word_20* addr, char* string ) { +static char* dec_symb( word_20* addr, char* string ) +{ word_20 semi; char* p = string; @@ -2783,7 +2680,8 @@ static char* dec_symb( word_20* addr, char* string ) { return p; } -static char* dec_unit( word_20* addr, char* string ) { +static char* dec_unit( word_20* addr, char* string ) +{ word_20 semi; char* p = string; @@ -2800,7 +2698,8 @@ static char* dec_unit( word_20* addr, char* string ) { return p; } -static char* dec_unit_op( word_20* addr, char* string ) { +static char* dec_unit_op( word_20* addr, char* string ) +{ word_20 op; char* p = string; @@ -2828,7 +2727,8 @@ static char* dec_unit_op( word_20* addr, char* string ) { return p; } -static char* dec_library( word_20* addr, char* string ) { +static char* dec_library( word_20* addr, char* string ) +{ word_20 libsize, libidsize; /* word_20 hashoff, mesgoff, linkoff, cfgoff; @@ -2860,7 +2760,8 @@ static char* dec_library( word_20* addr, char* string ) { return p; } -static char* dec_library_data( word_20* addr, char* string ) { +static char* dec_library_data( word_20* addr, char* string ) +{ word_20 size; char* p = string; @@ -2875,7 +2776,8 @@ static char* dec_library_data( word_20* addr, char* string ) { return p; } -static char* dec_acptr( word_20* addr, char* string ) { +static char* dec_acptr( word_20* addr, char* string ) +{ word_20 size; char* p = string; int i; @@ -2902,7 +2804,8 @@ static char* dec_acptr( word_20* addr, char* string ) { return p; } -static char* dec_prog( word_20* addr, char* string ) { +static char* dec_prog( word_20* addr, char* string ) +{ word_20 semi; char* p = string; @@ -2919,7 +2822,8 @@ static char* dec_prog( word_20* addr, char* string ) { return p; } -static char* dec_code( word_20* addr, char* string ) { +static char* dec_code( word_20* addr, char* string ) +{ char* p = string; word_20 n, len; @@ -2939,7 +2843,8 @@ static char* dec_code( word_20* addr, char* string ) { return p; } -static char* dec_local_ident( word_20* addr, char* string ) { +static char* dec_local_ident( word_20* addr, char* string ) +{ int len, i, n; char* p = string; unsigned char c; @@ -2971,7 +2876,8 @@ static char* dec_local_ident( word_20* addr, char* string ) { return p; } -static char* dec_global_ident( word_20* addr, char* string ) { +static char* dec_global_ident( word_20* addr, char* string ) +{ int len, i, n; char* p = string; unsigned char c; @@ -3003,7 +2909,8 @@ static char* dec_global_ident( word_20* addr, char* string ) { return p; } -static char* dec_xlib_name( word_20* addr, char* string ) { +static char* dec_xlib_name( word_20* addr, char* string ) +{ int lib, command; lib = read_nibbles( *addr, 3 ); @@ -3014,7 +2921,8 @@ static char* dec_xlib_name( word_20* addr, char* string ) { return xlib_name( lib, command, string ); } -static char* any_array( word_20* addr, char* string, short lnk_flag ) { +static char* any_array( word_20* addr, char* string, short lnk_flag ) +{ word_20 len, type, dim; word_20 *dim_lens, *dims; word_20 array_addr, elem_addr; @@ -3099,15 +3007,12 @@ static char* any_array( word_20* addr, char* string, short lnk_flag ) { return p; } -static char* dec_array( word_20* addr, char* string ) { - return any_array( addr, string, 0 ); -} +static char* dec_array( word_20* addr, char* string ) { return any_array( addr, string, 0 ); } -static char* dec_lnk_array( word_20* addr, char* string ) { - return any_array( addr, string, 1 ); -} +static char* dec_lnk_array( word_20* addr, char* string ) { return any_array( addr, string, 1 ); } -static char* dec_char( word_20* addr, char* string ) { +static char* dec_char( word_20* addr, char* string ) +{ char* p = string; unsigned char c; @@ -3127,42 +3032,44 @@ static char* dec_char( word_20* addr, char* string ) { } objfunc_t objects[] = { - { ( char* )"System Binary", 0, DOBINT, dec_bin_int }, - { ( char* )"Real", 0, DOREAL, dec_real }, - { ( char* )"Long Real", 0, DOEREL, dec_long_real }, - { ( char* )"Complex", 0, DOCMP, dec_complex }, - { ( char* )"Long Complex", 0, DOECMP, dec_long_complex }, - { ( char* )"Character", 0, DOCHAR, dec_char }, - { ( char* )"Array", 0, DOARRY, dec_array }, - { ( char* )"Linked Array", 0, DOLNKARRY, dec_lnk_array }, - { ( char* )"String", 2, DOCSTR, dec_string }, - { ( char* )"Hex String", 1, DOHSTR, dec_hex_string }, - { ( char* )"List", 0, DOLIST, dec_list }, - { ( char* )"Directory", 0, DORRP, skip_ob }, - { ( char* )"Symbolic", 0, DOSYMB, dec_symb }, - { ( char* )"Unit", 0, DOEXT, dec_unit }, - { ( char* )"Tagged", 0, DOTAG, skip_ob }, - { ( char* )"Graphic", 0, DOGROB, skip_ob }, - { ( char* )"Library", 0, DOLIB, dec_library }, - { ( char* )"Backup", 0, DOBAK, skip_ob }, - { ( char* )"Library Data", 0, DOEXT0, dec_library_data }, - { ( char* )"ACPTR", 0, DOACPTR, dec_acptr }, - { ( char* )"External 2", 0, DOEXT2, skip_ob }, - { ( char* )"External 3", 0, DOEXT3, skip_ob }, - { ( char* )"External 4", 0, DOEXT4, skip_ob }, - { ( char* )"Program", 0, DOCOL, dec_prog }, - { ( char* )"Code", 1, DOCODE, dec_code }, - { ( char* )"Global Ident", 0, DOIDNT, dec_global_ident }, - { ( char* )"Local Ident", 0, DOLAM, dec_local_ident }, - { ( char* )"XLib Name", 0, DOROMP, dec_xlib_name }, - { ( char* )"*", 0, UM_MUL, dec_unit_op }, - { ( char* )"/", 0, UM_DIV, dec_unit_op }, - { ( char* )"^", 0, UM_POW, dec_unit_op }, - { ( char* )" (char*)", 0, UM_PRE, dec_unit_op }, - { ( char* )"_", 0, UM_END, dec_unit_op }, - { 0, 0, 0, 0 } }; + {( char* )"System Binary", 0, DOBINT, dec_bin_int }, + { ( char* )"Real", 0, DOREAL, dec_real }, + { ( char* )"Long Real", 0, DOEREL, dec_long_real }, + { ( char* )"Complex", 0, DOCMP, dec_complex }, + { ( char* )"Long Complex", 0, DOECMP, dec_long_complex}, + { ( char* )"Character", 0, DOCHAR, dec_char }, + { ( char* )"Array", 0, DOARRY, dec_array }, + { ( char* )"Linked Array", 0, DOLNKARRY, dec_lnk_array }, + { ( char* )"String", 2, DOCSTR, dec_string }, + { ( char* )"Hex String", 1, DOHSTR, dec_hex_string }, + { ( char* )"List", 0, DOLIST, dec_list }, + { ( char* )"Directory", 0, DORRP, skip_ob }, + { ( char* )"Symbolic", 0, DOSYMB, dec_symb }, + { ( char* )"Unit", 0, DOEXT, dec_unit }, + { ( char* )"Tagged", 0, DOTAG, skip_ob }, + { ( char* )"Graphic", 0, DOGROB, skip_ob }, + { ( char* )"Library", 0, DOLIB, dec_library }, + { ( char* )"Backup", 0, DOBAK, skip_ob }, + { ( char* )"Library Data", 0, DOEXT0, dec_library_data}, + { ( char* )"ACPTR", 0, DOACPTR, dec_acptr }, + { ( char* )"External 2", 0, DOEXT2, skip_ob }, + { ( char* )"External 3", 0, DOEXT3, skip_ob }, + { ( char* )"External 4", 0, DOEXT4, skip_ob }, + { ( char* )"Program", 0, DOCOL, dec_prog }, + { ( char* )"Code", 1, DOCODE, dec_code }, + { ( char* )"Global Ident", 0, DOIDNT, dec_global_ident}, + { ( char* )"Local Ident", 0, DOLAM, dec_local_ident }, + { ( char* )"XLib Name", 0, DOROMP, dec_xlib_name }, + { ( char* )"*", 0, UM_MUL, dec_unit_op }, + { ( char* )"/", 0, UM_DIV, dec_unit_op }, + { ( char* )"^", 0, UM_POW, dec_unit_op }, + { ( char* )" (char*)", 0, UM_PRE, dec_unit_op }, + { ( char* )"_", 0, UM_END, dec_unit_op }, + { 0, 0, 0, 0 } +}; -static char* decode_rpl_obj( word_20 addr, char* buf ) { +static char* decode_rpl_obj( word_20 addr, char* buf ) +{ word_20 prolog = 0; int len; char* p = buf; @@ -3249,65 +3156,58 @@ struct cmd { } cmd_tbl[] = { - { "break", cmd_break, - "break [address] Set breakpoint at `address\' or show " - "breakpoints" }, - { "b", cmd_break, 0 }, + {"break", cmd_break, + "break [address] Set breakpoint at `address\' or show " + "breakpoints" }, + { "b", cmd_break, 0 }, - { "cont", cmd_continue, "cont Continue execution" }, - { "c", cmd_continue, 0 }, + { "cont", cmd_continue, "cont Continue execution" }, + { "c", cmd_continue, 0 }, { "delete", cmd_delete, - "delete [all | n] Delete breakpoint or watchpoint number " + "delete [all | n] Delete breakpoint or watchpoint number " "`n\',\n all breakpoints, or current " - "breakpoint" }, - { "d", cmd_delete, 0 }, + "breakpoint" }, + { "d", cmd_delete, 0 }, - { "exit", cmd_exit, - "exit Exit the emulator without saving" }, + { "exit", cmd_exit, "exit Exit the emulator without saving" }, - { "go", cmd_go, "go address Set PC to `address\'" }, + { "go", cmd_go, "go address Set PC to `address\'" }, - { "help", cmd_help, "help Display this information" }, - { "h", cmd_help, 0 }, - { "?", cmd_help, 0 }, + { "help", cmd_help, "help Display this information" }, + { "h", cmd_help, 0 }, + { "?", cmd_help, 0 }, - { "load", cmd_load, - "load Load emulator-state from files" }, + { "load", cmd_load, "load Load emulator-state from files" }, - { "mode", cmd_mode, - "mode [hp | class] Show or set disassembler mode" }, + { "mode", cmd_mode, "mode [hp | class] Show or set disassembler mode" }, - { "quit", cmd_quit, - "quit Exit the emulator after saving its state" }, - { "q", cmd_quit, 0 }, + { "quit", cmd_quit, "quit Exit the emulator after saving its state"}, + { "q", cmd_quit, 0 }, - { "ram", cmd_ram, "ram Show RAM layout" }, + { "ram", cmd_ram, "ram Show RAM layout" }, - { "reg", cmd_regs, - "reg [register [hexvalue]] Display or set register value" }, - { "r", cmd_regs, 0 }, + { "reg", cmd_regs, "reg [register [hexvalue]] Display or set register value" }, + { "r", cmd_regs, 0 }, - { "reset", cmd_reset, - "reset Set the HP48\'s PC to ZERO" }, + { "reset", cmd_reset, "reset Set the HP48\'s PC to ZERO" }, - { "save", cmd_save, - "save Save emulator-state to files" }, + { "save", cmd_save, "save Save emulator-state to files" }, - { "stack", cmd_stack, "stack Display RPL stack" }, + { "stack", cmd_stack, "stack Display RPL stack" }, - { "stat", cmd_stat, - "stat Display statistics for the emulator" }, + { "stat", cmd_stat, "stat Display statistics for the emulator" }, - { "step", cmd_step, - "step [n] Step one or n Instruction(s)" }, - { "s", cmd_step, 0 }, + { "step", cmd_step, "step [n] Step one or n Instruction(s)" }, + { "s", cmd_step, 0 }, - { "where", cmd_rstk, "where Show ML return stack" }, + { "where", cmd_rstk, "where Show ML return stack" }, - { 0, 0, 0 } }; + { 0, 0, 0 } +}; -static int check_breakpoint( int type, word_20 addr ) { +static int check_breakpoint( int type, word_20 addr ) +{ struct breakpoint* bp; int i, n; @@ -3323,13 +3223,11 @@ static int check_breakpoint( int type, word_20 addr ) { goto hit_it; if ( bp->flags & type && addr == bp->addr ) { - hit_it: +hit_it: if ( type == BP_READ ) { - printf( "%.5lX: Read watchpoint %d hit at %.5lX\n", saturn.PC, - i, addr ); + printf( "%.5lX: Read watchpoint %d hit at %.5lX\n", saturn.PC, i, addr ); } else if ( type == BP_WRITE ) { - printf( "%.5lX: Write watchpoint %d hit at %.5lX\n", saturn.PC, - i, addr ); + printf( "%.5lX: Write watchpoint %d hit at %.5lX\n", saturn.PC, i, addr ); } else printf( "Breakpoint %d hit at %.5lX\n", i, addr ); @@ -3339,7 +3237,8 @@ static int check_breakpoint( int type, word_20 addr ) { return 0; } -static char* read_str( char* str, int n, int fp ) { +static char* read_str( char* str, int n, int fp ) +{ int cc; int flags; @@ -3366,13 +3265,15 @@ static char* read_str( char* str, int n, int fp ) { /* not reached */ } -static inline void str_to_upper( char* arg ) { +static inline void str_to_upper( char* arg ) +{ for ( unsigned long i = 0; i < strlen( arg ); i++ ) if ( 'a' <= arg[ i ] && arg[ i ] <= 'z' ) arg[ i ] = ( char )( ( int )arg[ i ] - ( int )'a' + ( int )'A' ); } -static int decode_dec( int* num, char* arg ) { +static int decode_dec( int* num, char* arg ) +{ if ( arg == ( char* )0 ) { printf( "Command requires an argument.\n" ); return 0; @@ -3393,7 +3294,8 @@ static int decode_dec( int* num, char* arg ) { return 1; } -static int decode_20( word_20* addr, char* arg ) { +static int decode_20( word_20* addr, char* arg ) +{ if ( arg == ( char* )0 ) { printf( "Command requires an argument.\n" ); return 0; @@ -3416,7 +3318,8 @@ static int decode_20( word_20* addr, char* arg ) { return 1; } -static int decode_32( word_32* addr, char* arg ) { +static int decode_32( word_32* addr, char* arg ) +{ if ( arg == ( char* )0 ) { printf( "Command requires an argument.\n" ); return 0; @@ -3438,7 +3341,8 @@ static int decode_32( word_32* addr, char* arg ) { return 1; } -static int decode_64( word_64* addr, char* arg ) { +static int decode_64( word_64* addr, char* arg ) +{ if ( arg == ( char* )0 ) { printf( "Command requires an argument.\n" ); return 0; @@ -3460,7 +3364,8 @@ static int decode_64( word_64* addr, char* arg ) { return 1; } -static char* str_nibbles( word_20 addr, int n ) { +static char* str_nibbles( word_20 addr, int n ) +{ static char str[ 1025 ]; char* cp; int i; @@ -3479,14 +3384,14 @@ static char* str_nibbles( word_20 addr, int n ) { return str; } -static int confirm( const char* prompt ) { +static int confirm( const char* prompt ) +{ char ans[ 80 ]; printf( "%s (y or n) ", prompt ); fflush( stdout ); read_str( ans, sizeof( ans ), 0 ); - while ( ans[ 0 ] != 'y' && ans[ 0 ] != 'Y' && ans[ 0 ] != 'n' && - ans[ 0 ] != 'N' ) { + while ( ans[ 0 ] != 'y' && ans[ 0 ] != 'Y' && ans[ 0 ] != 'n' && ans[ 0 ] != 'N' ) { printf( "Please answer y or n.\n" ); printf( "%s (y or n) ", prompt ); fflush( stdout ); @@ -3500,7 +3405,8 @@ static int confirm( const char* prompt ) { } } -static void cmd_break( int argc, char** argv ) { +static void cmd_break( int argc, char** argv ) +{ int i; word_20 addr; @@ -3509,14 +3415,11 @@ static void cmd_break( int argc, char** argv ) { if ( bkpt_tbl[ i ].flags == 0 ) continue; if ( bkpt_tbl[ i ].flags == BP_EXEC ) { - printf( "Breakpoint %d at 0x%.5lX\n", i + 1, - bkpt_tbl[ i ].addr ); + printf( "Breakpoint %d at 0x%.5lX\n", i + 1, bkpt_tbl[ i ].addr ); } else if ( bkpt_tbl[ i ].flags == BP_RANGE ) { - printf( "Range watchpoint %d at 0x%.5lX - 0x%.5lX\n", i + 1, - bkpt_tbl[ i ].addr, bkpt_tbl[ i ].end_addr ); + printf( "Range watchpoint %d at 0x%.5lX - 0x%.5lX\n", i + 1, bkpt_tbl[ i ].addr, bkpt_tbl[ i ].end_addr ); } else { - printf( "Watchpoint %d at 0x%.5lX\n", i + 1, - bkpt_tbl[ i ].addr ); + printf( "Watchpoint %d at 0x%.5lX\n", i + 1, bkpt_tbl[ i ].addr ); } } } else { @@ -3528,8 +3431,7 @@ static void cmd_break( int argc, char** argv ) { if ( bkpt_tbl[ i ].flags == 0 ) { bkpt_tbl[ i ].flags = BP_EXEC; bkpt_tbl[ i ].addr = addr; - printf( "Breakpoint %d at 0x%.5lX\n", i + 1, - bkpt_tbl[ i ].addr ); + printf( "Breakpoint %d at 0x%.5lX\n", i + 1, bkpt_tbl[ i ].addr ); num_bkpts++; return; } @@ -3540,23 +3442,20 @@ static void cmd_break( int argc, char** argv ) { static void cmd_continue( int argc, char** argv ) { continue_flag = 1; } -static void cmd_delete( int argc, char** argv ) { +static void cmd_delete( int argc, char** argv ) +{ int num; if ( argc == 1 ) { for ( num = 0; num < MAX_BREAKPOINTS; num++ ) { if ( bkpt_tbl[ num ].addr == saturn.PC ) { if ( bkpt_tbl[ num ].flags == BP_EXEC ) { - printf( "Breakpoint %d at 0x%.5lX deleted.\n", num + 1, - bkpt_tbl[ num ].addr ); + printf( "Breakpoint %d at 0x%.5lX deleted.\n", num + 1, bkpt_tbl[ num ].addr ); } else if ( bkpt_tbl[ num ].flags == BP_RANGE ) { - printf( - "Range watchpoint %d at 0x%.5lX - 0x%.5lX deleted.\n", - num + 1, bkpt_tbl[ num ].addr, - bkpt_tbl[ num ].end_addr ); + printf( "Range watchpoint %d at 0x%.5lX - 0x%.5lX deleted.\n", num + 1, bkpt_tbl[ num ].addr, + bkpt_tbl[ num ].end_addr ); } else if ( bkpt_tbl[ num ].flags ) { - printf( "Watchpoint %d at 0x%.5lX deleted.\n", num + 1, - bkpt_tbl[ num ].addr ); + printf( "Watchpoint %d at 0x%.5lX deleted.\n", num + 1, bkpt_tbl[ num ].addr ); } num_bkpts--; bkpt_tbl[ num ].addr = 0; @@ -3580,16 +3479,12 @@ static void cmd_delete( int argc, char** argv ) { } num -= 1; if ( bkpt_tbl[ num ].flags == BP_EXEC ) { - printf( "Breakpoint %d at 0x%.5lX deleted.\n", num + 1, - bkpt_tbl[ num ].addr ); + printf( "Breakpoint %d at 0x%.5lX deleted.\n", num + 1, bkpt_tbl[ num ].addr ); } else if ( bkpt_tbl[ num ].flags == BP_RANGE ) { - printf( - "Range watchpoint %d at 0x%.5lX - 0x%.5lX deleted.\n", - num + 1, bkpt_tbl[ num ].addr, - bkpt_tbl[ num ].end_addr ); + printf( "Range watchpoint %d at 0x%.5lX - 0x%.5lX deleted.\n", num + 1, bkpt_tbl[ num ].addr, + bkpt_tbl[ num ].end_addr ); } else if ( bkpt_tbl[ num ].flags ) { - printf( "Watchpoint %d at 0x%.5lX deleted.\n", num + 1, - bkpt_tbl[ num ].addr ); + printf( "Watchpoint %d at 0x%.5lX deleted.\n", num + 1, bkpt_tbl[ num ].addr ); } num_bkpts--; bkpt_tbl[ num ].addr = 0; @@ -3599,14 +3494,16 @@ static void cmd_delete( int argc, char** argv ) { } } -static void cmd_exit( int argc, char** argv ) { +static void cmd_exit( int argc, char** argv ) +{ if ( confirm( "Exit the emulator WITHOUT saving its state?" ) ) { printf( "Exit.\n" ); exit( 0 ); } } -static void cmd_go( int argc, char** argv ) { +static void cmd_go( int argc, char** argv ) +{ word_20 addr; str_to_upper( argv[ 1 ] ); @@ -3616,7 +3513,8 @@ static void cmd_go( int argc, char** argv ) { } } -static void cmd_help( int argc, char** argv ) { +static void cmd_help( int argc, char** argv ) +{ int i; for ( i = 0; cmd_tbl[ i ].name; i++ ) { @@ -3626,7 +3524,8 @@ static void cmd_help( int argc, char** argv ) { } } -static void cmd_load( int argc, char** argv ) { +static void cmd_load( int argc, char** argv ) +{ saturn_t tmp_saturn; device_t tmp_device; @@ -3675,10 +3574,10 @@ static void cmd_load( int argc, char** argv ) { } } -static void cmd_mode( int argc, char** argv ) { +static void cmd_mode( int argc, char** argv ) +{ if ( argc < 2 ) { - printf( "Disassembler uses %s mnemonics.\n", - mode_name[ disassembler_mode ] ); + printf( "Disassembler uses %s mnemonics.\n", mode_name[ disassembler_mode ] ); } else { str_to_upper( argv[ 1 ] ); if ( !strcmp( "HP", argv[ 1 ] ) ) { @@ -3686,13 +3585,13 @@ static void cmd_mode( int argc, char** argv ) { } else if ( !strcmp( "CLASS", argv[ 1 ] ) ) { disassembler_mode = CLASS_MNEMONICS; } else { - printf( "Unknown disassembler mode %s. Try \"help\".\n", - argv[ 1 ] ); + printf( "Unknown disassembler mode %s. Try \"help\".\n", argv[ 1 ] ); } } } -static void cmd_quit( int argc, char** argv ) { +static void cmd_quit( int argc, char** argv ) +{ if ( confirm( "Quit the emulator and save its state?" ) ) { printf( "Exit.\n" ); exit_emulator(); @@ -3700,16 +3599,17 @@ static void cmd_quit( int argc, char** argv ) { } } -static void set_reg( word_64 val, int n, unsigned char* r ) { +static void set_reg( word_64 val, int n, unsigned char* r ) +{ int i; for ( i = 0; i < n; i++ ) { - r[ i ] = - ( unsigned char )( ( val & ( 0xf << ( 4 * i ) ) ) >> ( 4 * i ) ); + r[ i ] = ( unsigned char )( ( val & ( 0xf << ( 4 * i ) ) ) >> ( 4 * i ) ); } } -static void dump_reg( const char* reg, int n, unsigned char* r ) { +static void dump_reg( const char* reg, int n, unsigned char* r ) +{ int i; printf( "%s:\t", reg ); @@ -3719,14 +3619,16 @@ static void dump_reg( const char* reg, int n, unsigned char* r ) { printf( "\n" ); } -static void set_st( word_64 val ) { +static void set_st( word_64 val ) +{ int i; for ( i = 0; i < 16; i++ ) saturn.PSTAT[ i ] = ( val & ( 1 << i ) ) ? 1 : 0; } -static void dump_st( void ) { +static void dump_st( void ) +{ int i; int val; @@ -3750,7 +3652,8 @@ static void dump_st( void ) { } } -static void set_hst( word_64 val ) { +static void set_hst( word_64 val ) +{ saturn.XM = 0; saturn.SB = 0; saturn.SR = 0; @@ -3766,7 +3669,8 @@ static void set_hst( word_64 val ) { saturn.MP = 1; } -static void dump_hst( void ) { +static void dump_hst( void ) +{ short hst = 0; if ( saturn.XM != 0 ) hst |= 1; @@ -3776,19 +3680,16 @@ static void dump_hst( void ) { hst |= 3; if ( saturn.MP != 0 ) hst |= 4; - printf( " HST:\t%.1X (%s%s%s%s)\n", hst, saturn.MP ? "MP " : "-- ", - saturn.SR ? "SR " : "-- ", saturn.SB ? "SB " : "-- ", + printf( " HST:\t%.1X (%s%s%s%s)\n", hst, saturn.MP ? "MP " : "-- ", saturn.SR ? "SR " : "-- ", saturn.SB ? "SB " : "-- ", saturn.XM ? "XM" : "--" ); } -static const char* mctl_str_gx[] = { "MMIO ", "SysRAM ", - "Bank Switch", "Port 1 ", - "Port 2 ", "SysROM " }; +static const char* mctl_str_gx[] = { "MMIO ", "SysRAM ", "Bank Switch", "Port 1 ", "Port 2 ", "SysROM " }; -static const char* mctl_str_sx[] = { "MMIO ", "SysRAM", "Port 1", - "Port 2", "Extra ", "SysROM" }; +static const char* mctl_str_sx[] = { "MMIO ", "SysRAM", "Port 1", "Port 2", "Extra ", "SysROM" }; -static void cmd_ram( int argc, char** argv ) { +static void cmd_ram( int argc, char** argv ) +{ int i; for ( i = 0; i < 5; i++ ) { @@ -3796,20 +3697,17 @@ static void cmd_ram( int argc, char** argv ) { if ( saturn.mem_cntl[ i ].unconfigured ) printf( "unconfigured\n" ); else if ( i == 0 ) - printf( "configured to 0x%.5lx\n", - saturn.mem_cntl[ i ].config[ 0 ] ); + printf( "configured to 0x%.5lx\n", saturn.mem_cntl[ i ].config[ 0 ] ); else - printf( "configured to 0x%.5lX - 0x%.5lX\n", - saturn.mem_cntl[ i ].config[ 0 ], - ( saturn.mem_cntl[ i ].config[ 0 ] | - ~saturn.mem_cntl[ i ].config[ 1 ] ) & - 0xfffff ); + printf( "configured to 0x%.5lX - 0x%.5lX\n", saturn.mem_cntl[ i ].config[ 0 ], + ( saturn.mem_cntl[ i ].config[ 0 ] | ~saturn.mem_cntl[ i ].config[ 1 ] ) & 0xfffff ); } if ( opt_gx ) printf( "Port 2 switched to bank %d\n", saturn.bank_switch ); } -static void cmd_regs( int argc, char** argv ) { +static void cmd_regs( int argc, char** argv ) +{ int i; word_64 val; @@ -3817,8 +3715,7 @@ static void cmd_regs( int argc, char** argv ) { /* * dump all registers */ - printf( "CPU is in %s mode. Registers:\n", - saturn.hexmode == HEX ? "HEX" : "DEC" ); + printf( "CPU is in %s mode. Registers:\n", saturn.hexmode == HEX ? "HEX" : "DEC" ); dump_reg( " A", 16, saturn.A ); dump_reg( " B", 16, saturn.B ); dump_reg( " C", 16, saturn.C ); @@ -3981,7 +3878,8 @@ static void cmd_regs( int argc, char** argv ) { } } -static void cmd_save( int argc, char** argv ) { +static void cmd_save( int argc, char** argv ) +{ if ( write_files() ) { printf( "Saving done.\n" ); } else { @@ -3995,7 +3893,8 @@ struct se { struct se* se_next; }; -static void cmd_stack( int argc, char** argv ) { +static void cmd_stack( int argc, char** argv ) +{ word_20 dsktop, dskbot; word_20 sp = 0, end = 0, ent = 0; word_20 ram_base, ram_mask; @@ -4065,13 +3964,15 @@ static void cmd_stack( int argc, char** argv ) { saturn.mem_cntl[ 1 ].config[ 1 ] = ram_mask; } -static void cmd_stat( int argc, char** argv ) { +static void cmd_stat( int argc, char** argv ) +{ printf( "Instructions/s: %ld\n", saturn.i_per_s ); printf( "Timer 1 I/TICK: %d\n", saturn.t1_tick ); printf( "Timer 2 I/TICK: %d\n", saturn.t2_tick ); } -static void cmd_step( int argc, char** argv ) { +static void cmd_step( int argc, char** argv ) +{ word_20 next_instr; word_32 n; int leave; @@ -4134,14 +4035,16 @@ static void cmd_step( int argc, char** argv ) { } } -static void cmd_reset( int argc, char** argv ) { +static void cmd_reset( int argc, char** argv ) +{ if ( confirm( "Do a RESET (PC = 00000)?" ) ) { saturn.PC = 0; enter_debugger &= ~ILLEGAL_INSTRUCTION; } } -static void cmd_rstk( int argc, char** argv ) { +static void cmd_rstk( int argc, char** argv ) +{ int i, j; disassemble( saturn.PC, instr ); @@ -4158,7 +4061,8 @@ static void cmd_rstk( int argc, char** argv ) { } } -int debug( void ) { +int debug( void ) +{ t1_t2_ticks ticks; struct cmd* cmdp; char* cp; @@ -4175,8 +4079,7 @@ int debug( void ) { if ( !useDebugger ) { if ( enter_debugger & ILLEGAL_INSTRUCTION ) { if ( verbose ) - fprintf( stderr, "reset (illegal instruction at 0x%.5lX)\n", - saturn.PC ); + fprintf( stderr, "reset (illegal instruction at 0x%.5lX)\n", saturn.PC ); saturn.PC = 0; } if ( enter_debugger & USER_INTERRUPT ) @@ -4214,13 +4117,11 @@ int debug( void ) { continue_flag = 0; if ( enter_debugger & ILLEGAL_INSTRUCTION ) { - printf( "ILLEGAL INSTRUCTION at %.5lX : %s\n", saturn.PC, - str_nibbles( saturn.PC, 16 ) ); + printf( "ILLEGAL INSTRUCTION at %.5lX : %s\n", saturn.PC, str_nibbles( saturn.PC, 16 ) ); } if ( enter_debugger & TRAP_INSTRUCTION ) { - printf( "TRAP at %.5lX : %s\n", saturn.PC - 5, - str_nibbles( saturn.PC - 5, 16 ) ); + printf( "TRAP at %.5lX : %s\n", saturn.PC - 5, str_nibbles( saturn.PC - 5, 16 ) ); enter_debugger &= ~TRAP_INSTRUCTION; } @@ -4341,7 +4242,8 @@ int debug( void ) { return 0; } -void emulate_debug( void ) { +void emulate_debug( void ) +{ do { step_instruction(); diff --git a/src/emu_actions.c b/src/emu_actions.c index 7b1caff..c370666 100644 --- a/src/emu_actions.c +++ b/src/emu_actions.c @@ -22,7 +22,8 @@ int conf_bank2 = 0x00000; short conf_tab_sx[] = { 1, 2, 2, 2, 2, 0 }; short conf_tab_gx[] = { 1, 2, 2, 2, 2, 0 }; -void do_in( void ) { +void do_in( void ) +{ int i, in, out; out = 0; @@ -65,7 +66,8 @@ void set_program_stat( int n ) { saturn.PSTAT[ n ] = 1; } int get_program_stat( int n ) { return saturn.PSTAT[ n ]; } -void register_to_status( unsigned char* r ) { +void register_to_status( unsigned char* r ) +{ int i; for ( i = 0; i < 12; i++ ) { @@ -73,7 +75,8 @@ void register_to_status( unsigned char* r ) { } } -void status_to_register( unsigned char* r ) { +void status_to_register( unsigned char* r ) +{ int i; for ( i = 0; i < 12; i++ ) { @@ -85,7 +88,8 @@ void status_to_register( unsigned char* r ) { } } -void swap_register_status( unsigned char* r ) { +void swap_register_status( unsigned char* r ) +{ int i, tmp; for ( i = 0; i < 12; i++ ) { @@ -98,32 +102,24 @@ void swap_register_status( unsigned char* r ) { } } -void clear_status( void ) { +void clear_status( void ) +{ for ( int i = 0; i < 12; i++ ) saturn.PSTAT[ i ] = 0; } -void set_register_nibble( unsigned char* reg, int n, unsigned char val ) { - reg[ n ] = val; -} +void set_register_nibble( unsigned char* reg, int n, unsigned char val ) { reg[ n ] = val; } -unsigned char get_register_nibble( unsigned char* reg, int n ) { - return reg[ n ]; -} +unsigned char get_register_nibble( unsigned char* reg, int n ) { return reg[ n ]; } -void set_register_bit( unsigned char* reg, int n ) { - reg[ n / 4 ] |= ( 1 << ( n % 4 ) ); -} +void set_register_bit( unsigned char* reg, int n ) { reg[ n / 4 ] |= ( 1 << ( n % 4 ) ); } -void clear_register_bit( unsigned char* reg, int n ) { - reg[ n / 4 ] &= ~( 1 << ( n % 4 ) ); -} +void clear_register_bit( unsigned char* reg, int n ) { reg[ n / 4 ] &= ~( 1 << ( n % 4 ) ); } -int get_register_bit( unsigned char* reg, int n ) { - return ( ( int )( reg[ n / 4 ] & ( 1 << ( n % 4 ) ) ) > 0 ) ? 1 : 0; -} +int get_register_bit( unsigned char* reg, int n ) { return ( ( int )( reg[ n / 4 ] & ( 1 << ( n % 4 ) ) ) > 0 ) ? 1 : 0; } -void do_reset( void ) { +void do_reset( void ) +{ for ( int i = 0; i < 6; i++ ) { if ( opt_gx ) saturn.mem_cntl[ i ].unconfigured = conf_tab_gx[ i ]; @@ -139,7 +135,8 @@ void do_inton( void ) { saturn.kbd_ien = 1; } void do_intoff( void ) { saturn.kbd_ien = 0; } -void do_return_interupt( void ) { +void do_return_interupt( void ) +{ if ( saturn.int_pending ) { saturn.int_pending = 0; saturn.intenable = 0; @@ -155,7 +152,8 @@ void do_return_interupt( void ) { } } -void do_interupt( void ) { +void do_interupt( void ) +{ interrupt_called = 1; if ( saturn.intenable ) { push_return_addr( saturn.PC ); @@ -164,7 +162,8 @@ void do_interupt( void ) { } } -void do_kbd_int( void ) { +void do_kbd_int( void ) +{ interrupt_called = 1; if ( saturn.intenable ) { push_return_addr( saturn.PC ); @@ -174,7 +173,8 @@ void do_kbd_int( void ) { saturn.int_pending = 1; } -void do_reset_interrupt_system( void ) { +void do_reset_interrupt_system( void ) +{ saturn.kbd_ien = 1; int gen_intr = 0; for ( int i = 0; i < 9; i++ ) { @@ -187,7 +187,8 @@ void do_reset_interrupt_system( void ) { do_kbd_int(); } -void do_unconfigure( void ) { +void do_unconfigure( void ) +{ int i; unsigned int conf = 0; @@ -210,7 +211,8 @@ void do_unconfigure( void ) { } } -void do_configure( void ) { +void do_configure( void ) +{ int i; unsigned long conf = 0; @@ -222,25 +224,22 @@ void do_configure( void ) { for ( i = 0; i < 6; i++ ) { if ( saturn.mem_cntl[ i ].unconfigured ) { saturn.mem_cntl[ i ].unconfigured--; - saturn.mem_cntl[ i ].config[ saturn.mem_cntl[ i ].unconfigured ] = - conf; + saturn.mem_cntl[ i ].config[ saturn.mem_cntl[ i ].unconfigured ] = conf; break; } } } -int get_identification( void ) { +int get_identification( void ) +{ int i; - static int chip_id[] = { 0, 0, 0, 0, 0x05, 0xf6, - 0x07, 0xf8, 0x01, 0xf2, 0, 0 }; + static int chip_id[] = { 0, 0, 0, 0, 0x05, 0xf6, 0x07, 0xf8, 0x01, 0xf2, 0, 0 }; for ( i = 0; i < 6; i++ ) if ( saturn.mem_cntl[ i ].unconfigured ) break; - int id = ( i < 6 ) - ? chip_id[ 2 * i + ( 2 - saturn.mem_cntl[ i ].unconfigured ) ] - : 0; + int id = ( i < 6 ) ? chip_id[ 2 * i + ( 2 - saturn.mem_cntl[ i ].unconfigured ) ] : 0; for ( i = 0; i < 3; i++ ) { saturn.C[ i ] = id & 0x0f; @@ -250,7 +249,8 @@ int get_identification( void ) { return 0; } -void do_shutdown( void ) { +void do_shutdown( void ) +{ if ( device.display_touched ) { device.display_touched = 0; ui_refresh_LCD(); @@ -325,7 +325,8 @@ void do_shutdown( void ) { start_timer( RUN_TIMER ); } -void clear_hardware_stat( int op ) { +void clear_hardware_stat( int op ) +{ if ( op & 1 ) saturn.XM = 0; if ( op & 2 ) @@ -336,7 +337,8 @@ void clear_hardware_stat( int op ) { saturn.MP = 0; } -int is_zero_hardware_stat( int op ) { +int is_zero_hardware_stat( int op ) +{ if ( op & 1 ) if ( saturn.XM != 0 ) return 0; @@ -353,7 +355,8 @@ int is_zero_hardware_stat( int op ) { return 1; } -void push_return_addr( long addr ) { +void push_return_addr( long addr ) +{ int i; if ( ++saturn.rstkp >= NR_RSTK ) { @@ -364,13 +367,15 @@ void push_return_addr( long addr ) { saturn.rstk[ saturn.rstkp ] = addr; } -long pop_return_addr( void ) { +long pop_return_addr( void ) +{ if ( saturn.rstkp < 0 ) return 0; return saturn.rstk[ saturn.rstkp-- ]; } -void load_constant( unsigned char* reg, int n, long addr ) { +void load_constant( unsigned char* reg, int n, long addr ) +{ int p = saturn.P; for ( int i = 0; i < n; i++ ) { @@ -379,14 +384,16 @@ void load_constant( unsigned char* reg, int n, long addr ) { } } -void load_addr( word_20* dat, long addr, int n ) { +void load_addr( word_20* dat, long addr, int n ) +{ for ( int i = 0; i < n; i++ ) { *dat &= ~nibble_masks[ i ]; *dat |= read_nibble( addr + i ) << ( i * 4 ); } } -void register_to_address( unsigned char* reg, word_20* dat, int s ) { +void register_to_address( unsigned char* reg, word_20* dat, int s ) +{ int n; if ( s ) @@ -399,7 +406,8 @@ void register_to_address( unsigned char* reg, word_20* dat, int s ) { } } -long dat_to_addr( unsigned char* dat ) { +long dat_to_addr( unsigned char* dat ) +{ long addr = 0; for ( int i = 4; i >= 0; i-- ) { @@ -409,14 +417,16 @@ long dat_to_addr( unsigned char* dat ) { return addr; } -void addr_to_dat( long addr, unsigned char* dat ) { +void addr_to_dat( long addr, unsigned char* dat ) +{ for ( int i = 0; i < 5; i++ ) { dat[ i ] = ( addr & 0xf ); addr >>= 4; } } -void add_address( word_20* dat, int add ) { +void add_address( word_20* dat, int add ) +{ *dat += add; if ( *dat & ( word_20 )0xfff00000 ) { saturn.CARRY = 1; @@ -426,13 +436,12 @@ void add_address( word_20* dat, int add ) { *dat &= 0xfffff; } -static int start_fields[] = { -1, 0, 2, 0, 15, 3, 0, 0, -1, 0, - 2, 0, 15, 3, 0, 0, 0, 0, 0 }; +static int start_fields[] = { -1, 0, 2, 0, 15, 3, 0, 0, -1, 0, 2, 0, 15, 3, 0, 0, 0, 0, 0 }; -static int end_fields[] = { -1, -1, 2, 2, 15, 14, 1, 15, -1, -1, - 2, 2, 15, 14, 1, 4, 3, 2, 0 }; +static int end_fields[] = { -1, -1, 2, 2, 15, 14, 1, 15, -1, -1, 2, 2, 15, 14, 1, 4, 3, 2, 0 }; -static inline int get_start( int code ) { +static inline int get_start( int code ) +{ int s; if ( ( s = start_fields[ code ] ) == -1 ) @@ -441,7 +450,8 @@ static inline int get_start( int code ) { return s; /* FIXME: potentially return uninitialized s ? */ } -static inline int get_end( int code ) { +static inline int get_end( int code ) +{ int e; if ( ( e = end_fields[ code ] ) == -1 ) @@ -450,7 +460,8 @@ static inline int get_end( int code ) { return e; /* FIXME: potentially return uninitialized e ? */ } -void store( word_20 dat, unsigned char* reg, int code ) { +void store( word_20 dat, unsigned char* reg, int code ) +{ int s = get_start( code ); int e = get_end( code ); @@ -458,12 +469,14 @@ void store( word_20 dat, unsigned char* reg, int code ) { write_nibble( dat++, reg[ i ] ); } -void store_n( word_20 dat, unsigned char* reg, int n ) { +void store_n( word_20 dat, unsigned char* reg, int n ) +{ for ( int i = 0; i < n; i++ ) write_nibble( dat++, reg[ i ] ); } -void recall( unsigned char* reg, word_20 dat, int code ) { +void recall( unsigned char* reg, word_20 dat, int code ) +{ int s = get_start( code ); int e = get_end( code ); @@ -471,7 +484,8 @@ void recall( unsigned char* reg, word_20 dat, int code ) { reg[ i ] = read_nibble_crc( dat++ ); } -void recall_n( unsigned char* reg, word_20 dat, int n ) { +void recall_n( unsigned char* reg, word_20 dat, int n ) +{ for ( int i = 0; i < n; i++ ) reg[ i ] = read_nibble_crc( dat++ ); } diff --git a/src/emu_emulate.c b/src/emu_emulate.c index e7ada6b..7721189 100644 --- a/src/emu_emulate.c +++ b/src/emu_emulate.c @@ -3,11 +3,11 @@ #include -#include "runtime_options.h" /* throttle */ -#include "ui.h" /* ui_get_event(); ui_adjust_contrast(); ui_update_LCD(); ui_draw_annunc(); */ #include "debugger.h" /* enter_debugger, TRAP_INSTRUCTION, ILLEGAL_INSTRUCTION */ #include "emulator.h" #include "emulator_inner.h" +#include "runtime_options.h" /* throttle */ +#include "ui.h" /* ui_get_event(); ui_adjust_contrast(); ui_update_LCD(); ui_draw_annunc(); */ #define P_FIELD 0 /* unused? */ #define WP_FIELD 1 /* unused? */ @@ -70,8 +70,7 @@ unsigned long delta_t_16; unsigned long delta_i; word_64 run; -static word_20 jumpmasks[] = { 0xffffffff, 0xfffffff0, 0xffffff00, 0xfffff000, - 0xffff0000, 0xfff00000, 0xff000000, 0xf0000000 }; +static word_20 jumpmasks[] = { 0xffffffff, 0xfffffff0, 0xffffff00, 0xfffff000, 0xffff0000, 0xfff00000, 0xff000000, 0xf0000000 }; saturn_t saturn; @@ -79,7 +78,8 @@ extern int device_check; device_t device; -int decode_group_80( void ) { +int decode_group_80( void ) +{ int t, op3, op4, op5, op6; unsigned char* REG; long addr; @@ -173,8 +173,7 @@ int decode_group_80( void ) { t = 0; else t = 1; - saturn.CARRY = - ( get_register_bit( REG, op5 ) == t ) ? 1 : 0; + saturn.CARRY = ( get_register_bit( REG, op5 ) == t ) ? 1 : 0; if ( saturn.CARRY ) { saturn.PC += 5; op6 = read_nibbles( saturn.PC, 2 ); @@ -248,7 +247,8 @@ int decode_group_80( void ) { } } -int decode_group_1( void ) { +int decode_group_1( void ) +{ int op, op2, op3, op4; op2 = read_nibble( saturn.PC + 1 ); @@ -645,7 +645,8 @@ int decode_group_1( void ) { } } -static inline int decode_8_thru_f( int op1 ) { +static inline int decode_8_thru_f( int op1 ) +{ int op2, op3, op4, op5, op6; op2 = read_nibble( saturn.PC + 1 ); @@ -697,23 +698,19 @@ static inline int decode_8_thru_f( int op1 ) { switch ( op5 & 3 ) { case 0: /* A=A+CON */ saturn.PC += 6; - add_register_constant( saturn.A, op4, - op6 + 1 ); + add_register_constant( saturn.A, op4, op6 + 1 ); return 0; case 1: /* B=B+CON */ saturn.PC += 6; - add_register_constant( saturn.B, op4, - op6 + 1 ); + add_register_constant( saturn.B, op4, op6 + 1 ); return 0; case 2: /* C=C+CON */ saturn.PC += 6; - add_register_constant( saturn.C, op4, - op6 + 1 ); + add_register_constant( saturn.C, op4, op6 + 1 ); return 0; case 3: /* D=D+CON */ saturn.PC += 6; - add_register_constant( saturn.D, op4, - op6 + 1 ); + add_register_constant( saturn.D, op4, op6 + 1 ); return 0; default: return 1; @@ -722,23 +719,19 @@ static inline int decode_8_thru_f( int op1 ) { switch ( op5 & 3 ) { case 0: /* A=A-CON */ saturn.PC += 6; - sub_register_constant( saturn.A, op4, - op6 + 1 ); + sub_register_constant( saturn.A, op4, op6 + 1 ); return 0; case 1: /* B=B-CON */ saturn.PC += 6; - sub_register_constant( saturn.B, op4, - op6 + 1 ); + sub_register_constant( saturn.B, op4, op6 + 1 ); return 0; case 2: /* C=C-CON */ saturn.PC += 6; - sub_register_constant( saturn.C, op4, - op6 + 1 ); + sub_register_constant( saturn.C, op4, op6 + 1 ); return 0; case 3: /* D=D-CON */ saturn.PC += 6; - sub_register_constant( saturn.D, op4, - op6 + 1 ); + sub_register_constant( saturn.D, op4, op6 + 1 ); return 0; default: return 1; @@ -776,59 +769,49 @@ static inline int decode_8_thru_f( int op1 ) { switch ( op6 ) { case 0: /* saturn.R0=A */ saturn.PC += 6; - copy_register( saturn.R0, saturn.A, - op4 ); + copy_register( saturn.R0, saturn.A, op4 ); return 0; case 1: /* saturn.R1=A */ case 5: saturn.PC += 6; - copy_register( saturn.R1, saturn.A, - op4 ); + copy_register( saturn.R1, saturn.A, op4 ); return 0; case 2: /* saturn.R2=A */ case 6: saturn.PC += 6; - copy_register( saturn.R2, saturn.A, - op4 ); + copy_register( saturn.R2, saturn.A, op4 ); return 0; case 3: /* saturn.R3=A */ case 7: saturn.PC += 6; - copy_register( saturn.R3, saturn.A, - op4 ); + copy_register( saturn.R3, saturn.A, op4 ); return 0; case 4: /* saturn.R4=A */ saturn.PC += 6; - copy_register( saturn.R4, saturn.A, - op4 ); + copy_register( saturn.R4, saturn.A, op4 ); return 0; case 8: /* saturn.R0=C */ saturn.PC += 6; - copy_register( saturn.R0, saturn.C, - op4 ); + copy_register( saturn.R0, saturn.C, op4 ); return 0; case 9: /* saturn.R1=C */ case 0xd: saturn.PC += 6; - copy_register( saturn.R1, saturn.C, - op4 ); + copy_register( saturn.R1, saturn.C, op4 ); return 0; case 0xa: /* saturn.R2=C */ case 0xe: saturn.PC += 6; - copy_register( saturn.R2, saturn.C, - op4 ); + copy_register( saturn.R2, saturn.C, op4 ); return 0; case 0xb: /* saturn.R3=C */ case 0xf: saturn.PC += 6; - copy_register( saturn.R3, saturn.C, - op4 ); + copy_register( saturn.R3, saturn.C, op4 ); return 0; case 0xc: /* saturn.R4=C */ saturn.PC += 6; - copy_register( saturn.R4, saturn.C, - op4 ); + copy_register( saturn.R4, saturn.C, op4 ); return 0; default: return 1; @@ -837,59 +820,49 @@ static inline int decode_8_thru_f( int op1 ) { switch ( op6 ) { case 0: /* A=R0 */ saturn.PC += 6; - copy_register( saturn.A, saturn.R0, - op4 ); + copy_register( saturn.A, saturn.R0, op4 ); return 0; case 1: /* A=R1 */ case 5: saturn.PC += 6; - copy_register( saturn.A, saturn.R1, - op4 ); + copy_register( saturn.A, saturn.R1, op4 ); return 0; case 2: /* A=R2 */ case 6: saturn.PC += 6; - copy_register( saturn.A, saturn.R2, - op4 ); + copy_register( saturn.A, saturn.R2, op4 ); return 0; case 3: /* A=R3 */ case 7: saturn.PC += 6; - copy_register( saturn.A, saturn.R3, - op4 ); + copy_register( saturn.A, saturn.R3, op4 ); return 0; case 4: /* A=R4 */ saturn.PC += 6; - copy_register( saturn.A, saturn.R4, - op4 ); + copy_register( saturn.A, saturn.R4, op4 ); return 0; case 8: /* C=R0 */ saturn.PC += 6; - copy_register( saturn.C, saturn.R0, - op4 ); + copy_register( saturn.C, saturn.R0, op4 ); return 0; case 9: /* C=R1 */ case 0xd: saturn.PC += 6; - copy_register( saturn.C, saturn.R1, - op4 ); + copy_register( saturn.C, saturn.R1, op4 ); return 0; case 0xa: /* C=R2 */ case 0xe: saturn.PC += 6; - copy_register( saturn.C, saturn.R2, - op4 ); + copy_register( saturn.C, saturn.R2, op4 ); return 0; case 0xb: /* C=R3 */ case 0xf: saturn.PC += 6; - copy_register( saturn.C, saturn.R3, - op4 ); + copy_register( saturn.C, saturn.R3, op4 ); return 0; case 0xc: /* C=R4 */ saturn.PC += 6; - copy_register( saturn.C, saturn.R4, - op4 ); + copy_register( saturn.C, saturn.R4, op4 ); return 0; default: return 1; @@ -898,59 +871,49 @@ static inline int decode_8_thru_f( int op1 ) { switch ( op6 ) { case 0: /* AR0EX */ saturn.PC += 6; - exchange_register( saturn.A, - saturn.R0, op4 ); + exchange_register( saturn.A, saturn.R0, op4 ); return 0; case 1: /* AR1EX */ case 5: saturn.PC += 6; - exchange_register( saturn.A, - saturn.R1, op4 ); + exchange_register( saturn.A, saturn.R1, op4 ); return 0; case 2: /* AR2EX */ case 6: saturn.PC += 6; - exchange_register( saturn.A, - saturn.R2, op4 ); + exchange_register( saturn.A, saturn.R2, op4 ); return 0; case 3: /* AR3EX */ case 7: saturn.PC += 6; - exchange_register( saturn.A, - saturn.R3, op4 ); + exchange_register( saturn.A, saturn.R3, op4 ); return 0; case 4: /* AR4EX */ saturn.PC += 6; - exchange_register( saturn.A, - saturn.R4, op4 ); + exchange_register( saturn.A, saturn.R4, op4 ); return 0; case 8: /* CR0EX */ saturn.PC += 6; - exchange_register( saturn.C, - saturn.R0, op4 ); + exchange_register( saturn.C, saturn.R0, op4 ); return 0; case 9: /* CR1EX */ case 0xd: saturn.PC += 6; - exchange_register( saturn.C, - saturn.R1, op4 ); + exchange_register( saturn.C, saturn.R1, op4 ); return 0; case 0xa: /* CR2EX */ case 0xe: saturn.PC += 6; - exchange_register( saturn.C, - saturn.R2, op4 ); + exchange_register( saturn.C, saturn.R2, op4 ); return 0; case 0xb: /* CR3EX */ case 0xf: saturn.PC += 6; - exchange_register( saturn.C, - saturn.R3, op4 ); + exchange_register( saturn.C, saturn.R3, op4 ); return 0; case 0xc: /* CR4EX */ saturn.PC += 6; - exchange_register( saturn.C, - saturn.R4, op4 ); + exchange_register( saturn.C, saturn.R4, op4 ); return 0; default: return 1; @@ -1093,68 +1056,52 @@ static inline int decode_8_thru_f( int op1 ) { op3 = read_nibble( saturn.PC + 2 ); switch ( op3 ) { case 0: /* ?A=B */ - saturn.CARRY = is_equal_register( - saturn.A, saturn.B, A_FIELD ); + saturn.CARRY = is_equal_register( saturn.A, saturn.B, A_FIELD ); break; case 1: /* ?B=C */ - saturn.CARRY = is_equal_register( - saturn.B, saturn.C, A_FIELD ); + saturn.CARRY = is_equal_register( saturn.B, saturn.C, A_FIELD ); break; case 2: /* ?A=C */ - saturn.CARRY = is_equal_register( - saturn.A, saturn.C, A_FIELD ); + saturn.CARRY = is_equal_register( saturn.A, saturn.C, A_FIELD ); break; case 3: /* ?C=D */ - saturn.CARRY = is_equal_register( - saturn.C, saturn.D, A_FIELD ); + saturn.CARRY = is_equal_register( saturn.C, saturn.D, A_FIELD ); break; case 4: /* ?A#B */ - saturn.CARRY = is_not_equal_register( - saturn.A, saturn.B, A_FIELD ); + saturn.CARRY = is_not_equal_register( saturn.A, saturn.B, A_FIELD ); break; case 5: /* ?B#C */ - saturn.CARRY = is_not_equal_register( - saturn.B, saturn.C, A_FIELD ); + saturn.CARRY = is_not_equal_register( saturn.B, saturn.C, A_FIELD ); break; case 6: /* ?A#C */ - saturn.CARRY = is_not_equal_register( - saturn.A, saturn.C, A_FIELD ); + saturn.CARRY = is_not_equal_register( saturn.A, saturn.C, A_FIELD ); break; case 7: /* ?C#D */ - saturn.CARRY = is_not_equal_register( - saturn.C, saturn.D, A_FIELD ); + saturn.CARRY = is_not_equal_register( saturn.C, saturn.D, A_FIELD ); break; case 8: /* ?A=0 */ - saturn.CARRY = - is_zero_register( saturn.A, A_FIELD ); + saturn.CARRY = is_zero_register( saturn.A, A_FIELD ); break; case 9: /* ?B=0 */ - saturn.CARRY = - is_zero_register( saturn.B, A_FIELD ); + saturn.CARRY = is_zero_register( saturn.B, A_FIELD ); break; case 0xa: /* ?C=0 */ - saturn.CARRY = - is_zero_register( saturn.C, A_FIELD ); + saturn.CARRY = is_zero_register( saturn.C, A_FIELD ); break; case 0xb: /* ?D=0 */ - saturn.CARRY = - is_zero_register( saturn.D, A_FIELD ); + saturn.CARRY = is_zero_register( saturn.D, A_FIELD ); break; case 0xc: /* ?A#0 */ - saturn.CARRY = - is_not_zero_register( saturn.A, A_FIELD ); + saturn.CARRY = is_not_zero_register( saturn.A, A_FIELD ); break; case 0xd: /* ?B#0 */ - saturn.CARRY = - is_not_zero_register( saturn.B, A_FIELD ); + saturn.CARRY = is_not_zero_register( saturn.B, A_FIELD ); break; case 0xe: /* ?C#0 */ - saturn.CARRY = - is_not_zero_register( saturn.C, A_FIELD ); + saturn.CARRY = is_not_zero_register( saturn.C, A_FIELD ); break; case 0xf: /* ?D#0 */ - saturn.CARRY = - is_not_zero_register( saturn.D, A_FIELD ); + saturn.CARRY = is_not_zero_register( saturn.D, A_FIELD ); break; default: return 1; @@ -1178,68 +1125,52 @@ static inline int decode_8_thru_f( int op1 ) { op3 = read_nibble( saturn.PC + 2 ); switch ( op3 ) { case 0: /* ?A>B */ - saturn.CARRY = is_greater_register( - saturn.A, saturn.B, A_FIELD ); + saturn.CARRY = is_greater_register( saturn.A, saturn.B, A_FIELD ); break; case 1: /* ?B>C */ - saturn.CARRY = is_greater_register( - saturn.B, saturn.C, A_FIELD ); + saturn.CARRY = is_greater_register( saturn.B, saturn.C, A_FIELD ); break; case 2: /* ?C>A */ - saturn.CARRY = is_greater_register( - saturn.C, saturn.A, A_FIELD ); + saturn.CARRY = is_greater_register( saturn.C, saturn.A, A_FIELD ); break; case 3: /* ?D>C */ - saturn.CARRY = is_greater_register( - saturn.D, saturn.C, A_FIELD ); + saturn.CARRY = is_greater_register( saturn.D, saturn.C, A_FIELD ); break; case 4: /* ?A=B */ - saturn.CARRY = is_greater_or_equal_register( - saturn.A, saturn.B, A_FIELD ); + saturn.CARRY = is_greater_or_equal_register( saturn.A, saturn.B, A_FIELD ); break; case 9: /* ?B>=C */ - saturn.CARRY = is_greater_or_equal_register( - saturn.B, saturn.C, A_FIELD ); + saturn.CARRY = is_greater_or_equal_register( saturn.B, saturn.C, A_FIELD ); break; case 0xa: /* ?C>=A */ - saturn.CARRY = is_greater_or_equal_register( - saturn.C, saturn.A, A_FIELD ); + saturn.CARRY = is_greater_or_equal_register( saturn.C, saturn.A, A_FIELD ); break; case 0xb: /* ?D>=C */ - saturn.CARRY = is_greater_or_equal_register( - saturn.D, saturn.C, A_FIELD ); + saturn.CARRY = is_greater_or_equal_register( saturn.D, saturn.C, A_FIELD ); break; case 0xc: /* ?A<=B */ - saturn.CARRY = is_less_or_equal_register( - saturn.A, saturn.B, A_FIELD ); + saturn.CARRY = is_less_or_equal_register( saturn.A, saturn.B, A_FIELD ); break; case 0xd: /* ?B<=C */ - saturn.CARRY = is_less_or_equal_register( - saturn.B, saturn.C, A_FIELD ); + saturn.CARRY = is_less_or_equal_register( saturn.B, saturn.C, A_FIELD ); break; case 0xe: /* ?C<=A */ - saturn.CARRY = is_less_or_equal_register( - saturn.C, saturn.A, A_FIELD ); + saturn.CARRY = is_less_or_equal_register( saturn.C, saturn.A, A_FIELD ); break; case 0xf: /* ?D<=C */ - saturn.CARRY = is_less_or_equal_register( - saturn.D, saturn.C, A_FIELD ); + saturn.CARRY = is_less_or_equal_register( saturn.D, saturn.C, A_FIELD ); break; default: return 1; @@ -1293,36 +1224,28 @@ static inline int decode_8_thru_f( int op1 ) { if ( op2 < 8 ) { switch ( op3 ) { case 0: /* ?A=B */ - saturn.CARRY = - is_equal_register( saturn.A, saturn.B, op2 ); + saturn.CARRY = is_equal_register( saturn.A, saturn.B, op2 ); break; case 1: /* ?B=C */ - saturn.CARRY = - is_equal_register( saturn.B, saturn.C, op2 ); + saturn.CARRY = is_equal_register( saturn.B, saturn.C, op2 ); break; case 2: /* ?A=C */ - saturn.CARRY = - is_equal_register( saturn.A, saturn.C, op2 ); + saturn.CARRY = is_equal_register( saturn.A, saturn.C, op2 ); break; case 3: /* ?C=D */ - saturn.CARRY = - is_equal_register( saturn.C, saturn.D, op2 ); + saturn.CARRY = is_equal_register( saturn.C, saturn.D, op2 ); break; case 4: /* ?A#B */ - saturn.CARRY = - is_not_equal_register( saturn.A, saturn.B, op2 ); + saturn.CARRY = is_not_equal_register( saturn.A, saturn.B, op2 ); break; case 5: /* ?B#C */ - saturn.CARRY = - is_not_equal_register( saturn.B, saturn.C, op2 ); + saturn.CARRY = is_not_equal_register( saturn.B, saturn.C, op2 ); break; case 6: /* ?A#C */ - saturn.CARRY = - is_not_equal_register( saturn.A, saturn.C, op2 ); + saturn.CARRY = is_not_equal_register( saturn.A, saturn.C, op2 ); break; case 7: /* ?C#D */ - saturn.CARRY = - is_not_equal_register( saturn.C, saturn.D, op2 ); + saturn.CARRY = is_not_equal_register( saturn.C, saturn.D, op2 ); break; case 8: /* ?A=0 */ saturn.CARRY = is_zero_register( saturn.A, op2 ); @@ -1355,68 +1278,52 @@ static inline int decode_8_thru_f( int op1 ) { op2 &= 7; switch ( op3 ) { case 0: /* ?A>B */ - saturn.CARRY = - is_greater_register( saturn.A, saturn.B, op2 ); + saturn.CARRY = is_greater_register( saturn.A, saturn.B, op2 ); break; case 1: /* ?B>C */ - saturn.CARRY = - is_greater_register( saturn.B, saturn.C, op2 ); + saturn.CARRY = is_greater_register( saturn.B, saturn.C, op2 ); break; case 2: /* ?C>A */ - saturn.CARRY = - is_greater_register( saturn.C, saturn.A, op2 ); + saturn.CARRY = is_greater_register( saturn.C, saturn.A, op2 ); break; case 3: /* ?D>C */ - saturn.CARRY = - is_greater_register( saturn.D, saturn.C, op2 ); + saturn.CARRY = is_greater_register( saturn.D, saturn.C, op2 ); break; case 4: /* ?A=B */ - saturn.CARRY = is_greater_or_equal_register( - saturn.A, saturn.B, op2 ); + saturn.CARRY = is_greater_or_equal_register( saturn.A, saturn.B, op2 ); break; case 9: /* ?B>=C */ - saturn.CARRY = is_greater_or_equal_register( - saturn.B, saturn.C, op2 ); + saturn.CARRY = is_greater_or_equal_register( saturn.B, saturn.C, op2 ); break; case 0xa: /* ?C>=A */ - saturn.CARRY = is_greater_or_equal_register( - saturn.C, saturn.A, op2 ); + saturn.CARRY = is_greater_or_equal_register( saturn.C, saturn.A, op2 ); break; case 0xb: /* ?D>=C */ - saturn.CARRY = is_greater_or_equal_register( - saturn.D, saturn.C, op2 ); + saturn.CARRY = is_greater_or_equal_register( saturn.D, saturn.C, op2 ); break; case 0xc: /* ?A<=B */ - saturn.CARRY = is_less_or_equal_register( - saturn.A, saturn.B, op2 ); + saturn.CARRY = is_less_or_equal_register( saturn.A, saturn.B, op2 ); break; case 0xd: /* ?B<=C */ - saturn.CARRY = is_less_or_equal_register( - saturn.B, saturn.C, op2 ); + saturn.CARRY = is_less_or_equal_register( saturn.B, saturn.C, op2 ); break; case 0xe: /* ?C<=A */ - saturn.CARRY = is_less_or_equal_register( - saturn.C, saturn.A, op2 ); + saturn.CARRY = is_less_or_equal_register( saturn.C, saturn.A, op2 ); break; case 0xf: /* ?D<=C */ - saturn.CARRY = is_less_or_equal_register( - saturn.D, saturn.C, op2 ); + saturn.CARRY = is_less_or_equal_register( saturn.D, saturn.C, op2 ); break; default: return 1; @@ -2002,7 +1909,8 @@ static inline int decode_8_thru_f( int op1 ) { } } -inline int step_instruction( void ) { +inline int step_instruction( void ) +{ int op0, op1, op2, op3; int stop = 0; @@ -2246,7 +2154,8 @@ inline int step_instruction( void ) { return stop; } -inline void schedule( void ) { +inline void schedule( void ) +{ t1_t2_ticks ticks; unsigned long steps; static unsigned long old_stat_instr; @@ -2413,13 +2322,9 @@ inline void schedule( void ) { delta_i = instructions - old_stat_instr; old_stat_instr = instructions; if ( delta_t_1 > 0 ) { - t1_i_per_tick = ( ( NR_SAMPLES - 1 ) * t1_i_per_tick + - ( delta_i / delta_t_16 ) ) / - NR_SAMPLES; + t1_i_per_tick = ( ( NR_SAMPLES - 1 ) * t1_i_per_tick + ( delta_i / delta_t_16 ) ) / NR_SAMPLES; t2_i_per_tick = t1_i_per_tick / 512; - saturn.i_per_s = ( ( NR_SAMPLES - 1 ) * saturn.i_per_s + - ( delta_i / delta_t_1 ) ) / - NR_SAMPLES; + saturn.i_per_s = ( ( NR_SAMPLES - 1 ) * saturn.i_per_s + ( delta_i / delta_t_1 ) ) / NR_SAMPLES; } else { t1_i_per_tick = 8192; t2_i_per_tick = 16; @@ -2452,7 +2357,8 @@ inline void schedule( void ) { } } -void emulate( void ) { +void emulate( void ) +{ struct timeval tv; struct timeval tv2; struct timezone tz; @@ -2474,14 +2380,11 @@ void emulate( void ) { do { step_instruction(); - for ( int i = 0; i < ( int )( sizeof( saturn.keybuf.rows ) / - sizeof( saturn.keybuf.rows[ 0 ] ) ); - i++ ) { + for ( int i = 0; i < ( int )( sizeof( saturn.keybuf.rows ) / sizeof( saturn.keybuf.rows[ 0 ] ) ); i++ ) { if ( saturn.keybuf.rows[ i ] || throttle ) { /* Throttling speed if needed */ gettimeofday( &tv, &tz ); - while ( ( tv.tv_sec == tv2.tv_sec ) && - ( ( tv.tv_usec - tv2.tv_usec ) < 2 ) ) + while ( ( tv.tv_sec == tv2.tv_sec ) && ( ( tv.tv_usec - tv2.tv_usec ) < 2 ) ) gettimeofday( &tv, &tz ); tv2.tv_usec = tv.tv_usec; diff --git a/src/emu_init.c b/src/emu_init.c index 973d4cf..1c9e78e 100644 --- a/src/emu_init.c +++ b/src/emu_init.c @@ -1,15 +1,15 @@ #include #include #include -#include -#include #include +#include #include +#include -#include "runtime_options.h" #include "emulator.h" #include "emulator_inner.h" #include "romio.h" +#include "runtime_options.h" #define X48_MAGIC 0x48503438 #define NR_CONFIG 8 @@ -26,7 +26,8 @@ long port2_size; long port2_mask; short port2_is_ram; -int read_rom( const char* fname ) { +int read_rom( const char* fname ) +{ int ram_size; if ( !read_rom_file( fname, &saturn.rom, &rom_size ) ) @@ -62,7 +63,8 @@ int read_rom( const char* fname ) { return 1; } -void saturn_config_init( void ) { +void saturn_config_init( void ) +{ saturn.version[ 0 ] = VERSION_MAJOR; saturn.version[ 1 ] = VERSION_MINOR; saturn.version[ 2 ] = PATCHLEVEL; @@ -76,7 +78,8 @@ void saturn_config_init( void ) { saturn.lbr = 0x0; } -void init_saturn( void ) { +void init_saturn( void ) +{ memset( &saturn, 0, sizeof( saturn ) - 4 * sizeof( unsigned char* ) ); saturn.PC = 0x00000; saturn.magic = X48_MAGIC; @@ -107,7 +110,8 @@ void init_saturn( void ) { dev_memory_init(); } -int init_emulator( void ) { +int init_emulator( void ) +{ /* If not forced to initialize and files are readble => let's go */ if ( !initialize && read_files() ) { if ( resetOnStartup ) @@ -126,7 +130,8 @@ int init_emulator( void ) { return 0; } -int exit_emulator( void ) { +int exit_emulator( void ) +{ write_files(); return 1; @@ -136,7 +141,8 @@ int exit_emulator( void ) { /* READING ~/.x48ng/{rom,ram,hp48,port1,port2} */ /***********************************************/ -int read_8( FILE* fp, word_8* var ) { +int read_8( FILE* fp, word_8* var ) +{ unsigned char tmp; if ( fread( &tmp, 1, 1, fp ) != 1 ) { @@ -148,7 +154,8 @@ int read_8( FILE* fp, word_8* var ) { return 1; } -int read_char( FILE* fp, char* var ) { +int read_char( FILE* fp, char* var ) +{ char tmp; if ( fread( &tmp, 1, 1, fp ) != 1 ) { @@ -160,7 +167,8 @@ int read_char( FILE* fp, char* var ) { return 1; } -int read_16( FILE* fp, word_16* var ) { +int read_16( FILE* fp, word_16* var ) +{ unsigned char tmp[ 2 ]; if ( fread( &tmp[ 0 ], 1, 2, fp ) != 2 ) { @@ -173,7 +181,8 @@ int read_16( FILE* fp, word_16* var ) { return 1; } -int read_32( FILE* fp, word_32* var ) { +int read_32( FILE* fp, word_32* var ) +{ unsigned char tmp[ 4 ]; if ( fread( &tmp[ 0 ], 1, 4, fp ) != 4 ) { @@ -188,7 +197,8 @@ int read_32( FILE* fp, word_32* var ) { return 1; } -int read_u_long( FILE* fp, unsigned long* var ) { +int read_u_long( FILE* fp, unsigned long* var ) +{ unsigned char tmp[ 4 ]; if ( fread( &tmp[ 0 ], 1, 4, fp ) != 4 ) { @@ -203,7 +213,8 @@ int read_u_long( FILE* fp, unsigned long* var ) { return 1; } -int read_state_file( FILE* fp ) { +int read_state_file( FILE* fp ) +{ int i; /* @@ -368,7 +379,8 @@ int read_state_file( FILE* fp ) { return 1; } -int read_mem_file( char* name, word_4* mem, int size ) { +int read_mem_file( char* name, word_4* mem, int size ) +{ struct stat st; FILE* fp; word_8* tmp_mem; @@ -404,8 +416,7 @@ int read_mem_file( char* name, word_4* mem, int size ) { if ( st.st_size != size / 2 ) { if ( verbose ) - fprintf( stderr, "strange size %s, expected %d, found %ld\n", - name, size / 2, st.st_size ); + fprintf( stderr, "strange size %s, expected %d, found %ld\n", name, size / 2, st.st_size ); fclose( fp ); return 0; } @@ -422,8 +433,7 @@ int read_mem_file( char* name, word_4* mem, int size ) { mem[ j++ ] = ( word_4 )( ( ( int )byte >> 4 ) & 0xf ); } } else { - if ( fread( tmp_mem, 1, ( size_t )size / 2, fp ) != - ( unsigned long )( size / 2 ) ) { + if ( fread( tmp_mem, 1, ( size_t )size / 2, fp ) != ( unsigned long )( size / 2 ) ) { if ( verbose ) fprintf( stderr, "can\'t read %s\n", name ); fclose( fp ); @@ -448,7 +458,8 @@ int read_mem_file( char* name, word_4* mem, int size ) { return 1; } -int read_files( void ) { +int read_files( void ) +{ unsigned long v1, v2; int i, read_version; int ram_size; @@ -515,8 +526,7 @@ int read_files( void ) { */ if ( !read_state_file( fp ) ) { if ( verbose ) - fprintf( stderr, "can\'t handle %s\n", - normalized_state_path ); + fprintf( stderr, "can\'t handle %s\n", normalized_state_path ); init_saturn(); } else if ( verbose ) printf( "read %s\n", normalized_state_path ); @@ -567,8 +577,7 @@ int read_files( void ) { if ( NULL == ( saturn.port1 = ( word_4* )malloc( port1_size ) ) ) { if ( verbose ) fprintf( stderr, "can\'t malloc PORT1[%ld]\n", port1_size ); - } else if ( !read_mem_file( normalized_port1_path, saturn.port1, - port1_size ) ) { + } else if ( !read_mem_file( normalized_port1_path, saturn.port1, port1_size ) ) { port1_size = 0; port1_is_ram = 0; } else { @@ -597,13 +606,11 @@ int read_files( void ) { if ( stat( normalized_port2_path, &st ) >= 0 ) { port2_size = 2 * st.st_size; if ( ( opt_gx && ( ( port2_size % 0x40000 ) == 0 ) ) || - ( !opt_gx && - ( ( port2_size == 0x10000 ) || ( port2_size == 0x40000 ) ) ) ) { + ( !opt_gx && ( ( port2_size == 0x10000 ) || ( port2_size == 0x40000 ) ) ) ) { if ( NULL == ( saturn.port2 = ( word_4* )malloc( port2_size ) ) ) { if ( verbose ) fprintf( stderr, "can\'t malloc PORT2[%ld]\n", port2_size ); - } else if ( !read_mem_file( normalized_port2_path, saturn.port2, - port2_size ) ) { + } else if ( !read_mem_file( normalized_port2_path, saturn.port2, port2_size ) ) { port2_size = 0; port2_is_ram = 0; } else { @@ -631,7 +638,8 @@ int read_files( void ) { /* WRITING ~/.x48ng/{rom,ram,hp48,port1,port2} */ /***********************************************/ -int write_8( FILE* fp, word_8* var ) { +int write_8( FILE* fp, word_8* var ) +{ unsigned char tmp; tmp = *var; @@ -643,7 +651,8 @@ int write_8( FILE* fp, word_8* var ) { return 1; } -int write_char( FILE* fp, char* var ) { +int write_char( FILE* fp, char* var ) +{ char tmp; tmp = *var; @@ -655,7 +664,8 @@ int write_char( FILE* fp, char* var ) { return 1; } -int write_16( FILE* fp, word_16* var ) { +int write_16( FILE* fp, word_16* var ) +{ unsigned char tmp[ 2 ]; tmp[ 0 ] = ( *var >> 8 ) & 0xff; @@ -668,7 +678,8 @@ int write_16( FILE* fp, word_16* var ) { return 1; } -int write_32( FILE* fp, word_32* var ) { +int write_32( FILE* fp, word_32* var ) +{ unsigned char tmp[ 4 ]; tmp[ 0 ] = ( *var >> 24 ) & 0xff; @@ -683,7 +694,8 @@ int write_32( FILE* fp, word_32* var ) { return 1; } -int write_u_long( FILE* fp, unsigned long* var ) { +int write_u_long( FILE* fp, unsigned long* var ) +{ unsigned char tmp[ 4 ]; tmp[ 0 ] = ( *var >> 24 ) & 0xff; @@ -698,7 +710,8 @@ int write_u_long( FILE* fp, unsigned long* var ) { return 1; } -int write_mem_file( char* name, word_4* mem, int size ) { +int write_mem_file( char* name, word_4* mem, int size ) +{ FILE* fp; word_8* tmp_mem; word_8 byte; @@ -727,8 +740,7 @@ int write_mem_file( char* name, word_4* mem, int size ) { tmp_mem[ i ] |= ( mem[ j++ ] << 4 ) & 0xf0; } - if ( fwrite( tmp_mem, 1, ( size_t )size / 2, fp ) != - ( unsigned long )size / 2 ) { + if ( fwrite( tmp_mem, 1, ( size_t )size / 2, fp ) != ( unsigned long )size / 2 ) { if ( verbose ) fprintf( stderr, "can\'t write %s\n", name ); fclose( fp ); @@ -747,7 +759,8 @@ int write_mem_file( char* name, word_4* mem, int size ) { return 1; } -int write_state_file( char* filename ) { +int write_state_file( char* filename ) +{ int i; FILE* fp; @@ -856,7 +869,8 @@ int write_state_file( char* filename ) { return 1; } -int write_files( void ) { +int write_files( void ) +{ struct stat st; int make_dir = 0; int ram_size = opt_gx ? RAM_SIZE_GX : RAM_SIZE_SX; @@ -866,15 +880,13 @@ int write_files( void ) { make_dir = 1; } else { if ( verbose ) - fprintf( stderr, "can\'t stat %s, saving to /tmp\n", - normalized_config_path ); + fprintf( stderr, "can\'t stat %s, saving to /tmp\n", normalized_config_path ); strcpy( normalized_config_path, "/tmp" ); } } else { if ( !S_ISDIR( st.st_mode ) ) { if ( verbose ) - fprintf( stderr, "%s is no directory, saving to /tmp\n", - normalized_config_path ); + fprintf( stderr, "%s is no directory, saving to /tmp\n", normalized_config_path ); strcpy( normalized_config_path, "/tmp" ); } } @@ -882,8 +894,7 @@ int write_files( void ) { if ( make_dir ) { if ( mkdir( normalized_config_path, 0777 ) == -1 ) { if ( verbose ) - fprintf( stderr, "can\'t mkdir %s, saving to /tmp\n", - normalized_config_path ); + fprintf( stderr, "can\'t mkdir %s, saving to /tmp\n", normalized_config_path ); strcpy( normalized_config_path, "/tmp" ); } } @@ -909,14 +920,12 @@ int write_files( void ) { return 0; if ( ( port1_size > 0 ) && port1_is_ram ) { - if ( !write_mem_file( normalized_port1_path, saturn.port1, - port1_size ) ) + if ( !write_mem_file( normalized_port1_path, saturn.port1, port1_size ) ) return 0; } if ( ( port2_size > 0 ) && port2_is_ram ) { - if ( !write_mem_file( normalized_port2_path, saturn.port2, - port2_size ) ) + if ( !write_mem_file( normalized_port2_path, saturn.port2, port2_size ) ) return 0; } diff --git a/src/emu_memory.c b/src/emu_memory.c index c828787..8f49323 100644 --- a/src/emu_memory.c +++ b/src/emu_memory.c @@ -7,8 +7,8 @@ #include "emulator.h" #include "emulator_inner.h" #include "romio.h" -#include "ui.h" /* ui_disp_draw_nibble(); ui_menu_draw_nibble(); */ #include "runtime_options.h" +#include "ui.h" /* ui_disp_draw_nibble(); ui_menu_draw_nibble(); */ #define MCTL_MMIO_SX 0 #define MCTL_SysRAM_SX 1 @@ -26,10 +26,8 @@ #define DISP_INSTR_OFF 0x10 -long nibble_masks[ 16 ] = { 0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000, - 0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000, - 0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000, - 0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000 }; +long nibble_masks[ 16 ] = { 0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000, 0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000, + 0x0000000f, 0x000000f0, 0x00000f00, 0x0000f000, 0x000f0000, 0x00f00000, 0x0f000000, 0xf0000000 }; display_t display; @@ -39,13 +37,14 @@ int ( *read_nibble_crc )( long addr ); static int line_counter = -1; -static inline int calc_crc( int nib ) { - saturn.crc = - ( saturn.crc >> 4 ) ^ ( ( ( saturn.crc ^ nib ) & 0xf ) * 0x1081 ); +static inline int calc_crc( int nib ) +{ + saturn.crc = ( saturn.crc >> 4 ) ^ ( ( ( saturn.crc ^ nib ) & 0xf ) * 0x1081 ); return nib; } -void write_dev_mem( long addr, int val ) { +void write_dev_mem( long addr, int val ) +{ static int old_line_offset = -1; device_check = 1; @@ -57,14 +56,10 @@ void write_dev_mem( long addr, int val ) { display.on = ( val & 0x8 ) >> 3; display.offset = val & 0x7; if ( display.offset > 3 ) - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; else - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; - display.disp_end = - display.disp_start + - ( display.nibs_per_line * ( display.lines + 1 ) ); + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; + display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); device.display_touched = DISP_INSTR_OFF; } return; @@ -186,9 +181,7 @@ void write_dev_mem( long addr, int val ) { saturn.disp_addr |= val << ( ( addr - 0x120 ) * 4 ); if ( display.disp_start != ( saturn.disp_addr & 0xffffe ) ) { display.disp_start = saturn.disp_addr & 0xffffe; - display.disp_end = - display.disp_start + - ( display.nibs_per_line * ( display.lines + 1 ) ); + display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); device.display_touched = DISP_INSTR_OFF; } return; @@ -200,14 +193,10 @@ void write_dev_mem( long addr, int val ) { if ( saturn.line_offset != old_line_offset ) { old_line_offset = saturn.line_offset; if ( display.offset > 3 ) - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; else - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; - display.disp_end = - display.disp_start + - ( display.nibs_per_line * ( display.lines + 1 ) ); + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; + display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); device.display_touched = DISP_INSTR_OFF; } return; @@ -220,9 +209,7 @@ void write_dev_mem( long addr, int val ) { display.lines = saturn.line_count & 0x3f; if ( display.lines == 0 ) display.lines = 63; - display.disp_end = - display.disp_start + - ( display.nibs_per_line * ( display.lines + 1 ) ); + display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); device.display_touched = DISP_INSTR_OFF; } return; @@ -279,13 +266,13 @@ void write_dev_mem( long addr, int val ) { return; default: if ( verbose ) - fprintf( stderr, "%.5lx: UNKNOWN DEVICE WRITE AT 0x%lx !!!\n", - saturn.PC, addr ); + fprintf( stderr, "%.5lx: UNKNOWN DEVICE WRITE AT 0x%lx !!!\n", saturn.PC, addr ); return; } } -int read_dev_mem( long addr ) { +int read_dev_mem( long addr ) +{ switch ( ( int )addr ) { case 0x100: /* DISPLAY IO */ return saturn.disp_io & 0x0f; @@ -362,10 +349,7 @@ int read_dev_mem( long addr ) { line_counter++; if ( line_counter > 0x3f ) line_counter = -1; - return ( ( ( saturn.line_count & 0xc0 ) | - ( line_counter & 0x3f ) ) >> - ( ( addr - 0x128 ) * 4 ) ) & - 0x0f; + return ( ( ( saturn.line_count & 0xc0 ) | ( line_counter & 0x3f ) ) >> ( ( addr - 0x128 ) * 4 ) ) & 0x0f; case 0x12a: case 0x12b: case 0x12c: @@ -397,19 +381,18 @@ int read_dev_mem( long addr ) { return ( saturn.timer2 >> ( ( addr - 0x138 ) * 4 ) ) & 0xf; default: if ( verbose ) - fprintf( stderr, "%.5lx: UNKNOWN DEVICE READ AT 0x%lx !!!\n", - saturn.PC, addr ); + fprintf( stderr, "%.5lx: UNKNOWN DEVICE READ AT 0x%lx !!!\n", saturn.PC, addr ); return 0x00; } } -void write_nibble_sx( long addr, int val ) { +void write_nibble_sx( long addr, int val ) +{ addr &= 0xfffff; val &= 0x0f; switch ( ( int )( addr >> 16 ) & 0x0f ) { case 0: - if ( addr < 0x140 && addr >= 0x100 && - saturn.mem_cntl[ MCTL_MMIO_SX ].config[ 0 ] == 0x100 ) { + if ( addr < 0x140 && addr >= 0x100 && saturn.mem_cntl[ MCTL_MMIO_SX ].config[ 0 ] == 0x100 ) { write_dev_mem( addr, val ); return; } @@ -423,18 +406,15 @@ void write_nibble_sx( long addr, int val ) { return; case 7: if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0x70000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && - addr < 0x74000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && addr < 0x74000 ) { saturn.ram[ addr - 0x70000 ] = val; break; } - if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && - addr < 0x72000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && addr < 0x72000 ) { saturn.ram[ addr - 0x70000 ] = val; break; } - if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == - 0xf0000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xf0000 ) { saturn.ram[ addr - 0x70000 ] = val; break; } @@ -500,13 +480,13 @@ void write_nibble_sx( long addr, int val ) { ui_menu_draw_nibble( addr, val ); } -void write_nibble_gx( long addr, int val ) { +void write_nibble_gx( long addr, int val ) +{ addr &= 0xfffff; val &= 0x0f; switch ( ( int )( addr >> 16 ) & 0x0f ) { case 0: - if ( addr < 0x140 && addr >= 0x100 && - saturn.mem_cntl[ MCTL_MMIO_GX ].config[ 0 ] == 0x100 ) { + if ( addr < 0x140 && addr >= 0x100 && saturn.mem_cntl[ MCTL_MMIO_GX ].config[ 0 ] == 0x100 ) { write_dev_mem( addr, val ); return; } @@ -524,38 +504,31 @@ void write_nibble_gx( long addr, int val ) { } return; case 7: - if ( addr >= 0x7f000 && - saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) { + if ( addr >= 0x7f000 && saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) { return; } - if ( addr >= 0x7e000 && addr < 0x7f000 && - saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) { + if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) { return; } - if ( addr >= 0x7e000 && addr < 0x7f000 && - saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) { + if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) { return; } return; case 8: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && - addr < 0x84000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0x84000 ) { saturn.ram[ addr - 0x80000 ] = val; break; } - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && - addr < 0x82000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0x82000 ) { saturn.ram[ addr - 0x80000 ] = val; break; } - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == - 0xf0000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xf0000 ) { saturn.ram[ addr - 0x80000 ] = val; break; } - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == - 0xc0000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 ) { saturn.ram[ addr - 0x80000 ] = val; break; } @@ -568,16 +541,14 @@ void write_nibble_gx( long addr, int val ) { } } if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == - 0xc0000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 ) { saturn.ram[ addr - 0x80000 ] = val; break; } return; case 0xa: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == - 0xc0000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 ) { saturn.ram[ addr - 0x80000 ] = val; break; } @@ -589,28 +560,23 @@ void write_nibble_gx( long addr, int val ) { return; case 0xb: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == - 0xc0000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 ) { saturn.ram[ addr - 0x80000 ] = val; break; } if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xb0000 ) { if ( port2_is_ram ) - saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xb0000 ) ) & - port2_mask ] = val; + saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xb0000 ) ) & port2_mask ] = val; return; } return; case 0xc: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && - addr < 0xc4000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0xc4000 ) { saturn.ram[ addr - 0xc0000 ] = val; break; } - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && - addr < 0xc2000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0xc2000 ) { saturn.ram[ addr - 0xc0000 ] = val; break; } @@ -624,9 +590,7 @@ void write_nibble_gx( long addr, int val ) { } if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) { if ( port2_is_ram ) - saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xc0000 ) ) & - port2_mask ] = val; + saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] = val; return; } return; @@ -634,8 +598,7 @@ void write_nibble_gx( long addr, int val ) { case 0xe: case 0xf: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 ) - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == - 0xc0000 ) { + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 ) { saturn.ram[ addr - 0xc0000 ] = val; break; } @@ -648,9 +611,7 @@ void write_nibble_gx( long addr, int val ) { if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 1 ] == 0xc0000 ) { if ( port2_is_ram ) - saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xc0000 ) ) & - port2_mask ] = val; + saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] = val; return; } return; @@ -669,7 +630,8 @@ void write_nibble_gx( long addr, int val ) { ui_menu_draw_nibble( addr, val ); } -int read_nibble_sx( long addr ) { +int read_nibble_sx( long addr ) +{ addr &= 0xfffff; switch ( ( int )( addr >> 16 ) & 0x0f ) { case 0: @@ -689,11 +651,9 @@ int read_nibble_sx( long addr ) { return saturn.rom[ addr ]; case 7: if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0x70000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && - addr < 0x74000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && addr < 0x74000 ) return saturn.ram[ addr - 0x70000 ]; - if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && - addr < 0x72000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && addr < 0x72000 ) return saturn.ram[ addr - 0x70000 ]; if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xf0000 ) return saturn.ram[ addr - 0x70000 ]; @@ -734,7 +694,8 @@ int read_nibble_sx( long addr ) { return 0x00; } -int read_nibble_gx( long addr ) { +int read_nibble_gx( long addr ) +{ addr &= 0xfffff; switch ( ( int )( addr >> 16 ) & 0x0f ) { case 0: @@ -756,8 +717,7 @@ int read_nibble_gx( long addr ) { return saturn.ram[ addr - 0x40000 ]; return saturn.rom[ addr ]; case 7: - if ( addr >= 0x7f000 && - saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) { + if ( addr >= 0x7f000 && saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) { if ( addr == 0x7f000 ) { saturn.bank_switch = 0; } @@ -766,22 +726,18 @@ int read_nibble_gx( long addr ) { } return 0x7; } - if ( addr >= 0x7e000 && addr < 0x7f000 && - saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) { + if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) { return 0x7; } - if ( addr >= 0x7e000 && addr < 0x7f000 && - saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) { + if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) { return 0x7; } return saturn.rom[ addr ]; case 8: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && - addr < 0x84000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0x84000 ) return saturn.ram[ addr - 0x80000 ]; - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && - addr < 0x82000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0x82000 ) return saturn.ram[ addr - 0x80000 ]; if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xf0000 ) return saturn.ram[ addr - 0x80000 ]; @@ -818,9 +774,7 @@ int read_nibble_gx( long addr ) { if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 ) return saturn.ram[ addr - 0x80000 ]; if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xb0000 ) { - return saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xb0000 ) ) & - port2_mask ]; + return saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xb0000 ) ) & port2_mask ]; /* if (port2_size > (saturn.bank_switch << 18)) { @@ -833,11 +787,9 @@ int read_nibble_gx( long addr ) { return saturn.rom[ addr ]; case 0xc: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && - addr < 0xc4000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0xc4000 ) return saturn.ram[ addr - 0xc0000 ]; - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && - addr < 0xc2000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0xc2000 ) return saturn.ram[ addr - 0xc0000 ]; return saturn.ram[ addr - 0xc0000 ]; } @@ -845,9 +797,7 @@ int read_nibble_gx( long addr ) { return saturn.port1[ ( addr - 0xc0000 ) & port1_mask ]; } if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) { - return saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xc0000 ) ) & - port2_mask ]; + return saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ]; /* if (port2_size > (saturn.bank_switch << 18)) { @@ -870,9 +820,7 @@ int read_nibble_gx( long addr ) { } if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 1 ] == 0xc0000 ) { - return saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xc0000 ) ) & - port2_mask ]; + return saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ]; /* if (port2_size > (saturn.bank_switch << 18)) { @@ -888,7 +836,8 @@ int read_nibble_gx( long addr ) { return 0x00; } -int read_nibble_crc_sx( long addr ) { +int read_nibble_crc_sx( long addr ) +{ addr &= 0xfffff; switch ( ( int )( addr >> 16 ) & 0x0f ) { case 0: @@ -908,11 +857,9 @@ int read_nibble_crc_sx( long addr ) { return calc_crc( saturn.rom[ addr ] ); case 7: if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0x70000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && - addr < 0x74000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfc000 && addr < 0x74000 ) return calc_crc( saturn.ram[ addr - 0x70000 ] ); - if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && - addr < 0x72000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xfe000 && addr < 0x72000 ) return calc_crc( saturn.ram[ addr - 0x70000 ] ); if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 1 ] == 0xf0000 ) return calc_crc( saturn.ram[ addr - 0x70000 ] ); @@ -923,43 +870,38 @@ int read_nibble_crc_sx( long addr ) { case 0xa: case 0xb: if ( saturn.mem_cntl[ MCTL_PORT1_SX ].config[ 0 ] == 0x80000 ) { - return calc_crc( - saturn.port1[ ( addr - 0x80000 ) & port1_mask ] ); + return calc_crc( saturn.port1[ ( addr - 0x80000 ) & port1_mask ] ); } if ( saturn.mem_cntl[ MCTL_PORT2_SX ].config[ 0 ] == 0x80000 ) { - return calc_crc( - saturn.port2[ ( addr - 0x80000 ) & port2_mask ] ); + return calc_crc( saturn.port2[ ( addr - 0x80000 ) & port2_mask ] ); } return 0x00; case 0xc: case 0xd: case 0xe: if ( saturn.mem_cntl[ MCTL_PORT1_SX ].config[ 0 ] == 0xc0000 ) { - return calc_crc( - saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] ); + return calc_crc( saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] ); } if ( saturn.mem_cntl[ MCTL_PORT2_SX ].config[ 0 ] == 0xc0000 ) { - return calc_crc( - saturn.port2[ ( addr - 0xc0000 ) & port2_mask ] ); + return calc_crc( saturn.port2[ ( addr - 0xc0000 ) & port2_mask ] ); } return 0x00; case 0xf: if ( saturn.mem_cntl[ MCTL_SysRAM_SX ].config[ 0 ] == 0xf0000 ) return calc_crc( saturn.ram[ addr - 0xf0000 ] ); if ( saturn.mem_cntl[ MCTL_PORT1_SX ].config[ 0 ] == 0xc0000 ) { - return calc_crc( - saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] ); + return calc_crc( saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] ); } if ( saturn.mem_cntl[ MCTL_PORT2_SX ].config[ 0 ] == 0xc0000 ) { - return calc_crc( - saturn.port2[ ( addr - 0xc0000 ) & port2_mask ] ); + return calc_crc( saturn.port2[ ( addr - 0xc0000 ) & port2_mask ] ); } return 0x00; } return 0x00; } -int read_nibble_crc_gx( long addr ) { +int read_nibble_crc_gx( long addr ) +{ addr &= 0xfffff; switch ( ( int )( addr >> 16 ) & 0x0f ) { case 0: @@ -981,8 +923,7 @@ int read_nibble_crc_gx( long addr ) { return calc_crc( saturn.ram[ addr - 0x40000 ] ); return calc_crc( saturn.rom[ addr ] ); case 7: - if ( addr >= 0x7f000 && - saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) { + if ( addr >= 0x7f000 && saturn.mem_cntl[ MCTL_BANK_GX ].config[ 0 ] == 0x7f000 ) { if ( addr == 0x7f000 ) { saturn.bank_switch = 0; } @@ -991,22 +932,18 @@ int read_nibble_crc_gx( long addr ) { } return 0x7; } - if ( addr >= 0x7e000 && addr < 0x7f000 && - saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) { + if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0x7e000 ) { return 0x7; } - if ( addr >= 0x7e000 && addr < 0x7f000 && - saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) { + if ( addr >= 0x7e000 && addr < 0x7f000 && saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0x7e000 ) { return 0x7; } return calc_crc( saturn.rom[ addr ] ); case 8: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0x80000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && - addr < 0x84000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0x84000 ) return calc_crc( saturn.ram[ addr - 0x80000 ] ); - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && - addr < 0x82000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0x82000 ) return calc_crc( saturn.ram[ addr - 0x80000 ] ); if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xf0000 ) return calc_crc( saturn.ram[ addr - 0x80000 ] ); @@ -1035,8 +972,7 @@ int read_nibble_crc_gx( long addr ) { if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 ) return calc_crc( saturn.ram[ addr - 0x80000 ] ); if ( saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0xa0000 ) { - return calc_crc( - saturn.port1[ ( addr - 0xa0000 ) & port1_mask ] ); + return calc_crc( saturn.port1[ ( addr - 0xa0000 ) & port1_mask ] ); } return calc_crc( saturn.rom[ addr ] ); case 0xb: @@ -1044,9 +980,7 @@ int read_nibble_crc_gx( long addr ) { if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xc0000 ) return calc_crc( saturn.ram[ addr - 0x80000 ] ); if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xb0000 ) { - return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xb0000 ) ) & - port2_mask ] ); + return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xb0000 ) ) & port2_mask ] ); /* if (port2_size > (saturn.bank_switch << 18)) { @@ -1061,22 +995,17 @@ int read_nibble_crc_gx( long addr ) { return calc_crc( saturn.rom[ addr ] ); case 0xc: if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 0 ] == 0xc0000 ) { - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && - addr < 0xc4000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfc000 && addr < 0xc4000 ) return calc_crc( saturn.ram[ addr - 0xc0000 ] ); - if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && - addr < 0xc2000 ) + if ( saturn.mem_cntl[ MCTL_SysRAM_GX ].config[ 1 ] == 0xfe000 && addr < 0xc2000 ) return calc_crc( saturn.ram[ addr - 0xc0000 ] ); return calc_crc( saturn.ram[ addr - 0xc0000 ] ); } if ( saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0xc0000 ) { - return calc_crc( - saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] ); + return calc_crc( saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] ); } if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) { - return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xc0000 ) ) & - port2_mask ] ); + return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] ); /* if (port2_size > (saturn.bank_switch << 18)) { @@ -1097,15 +1026,11 @@ int read_nibble_crc_gx( long addr ) { return calc_crc( saturn.ram[ addr - 0xc0000 ] ); if ( saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 0 ] == 0xc0000 ) if ( saturn.mem_cntl[ MCTL_PORT1_GX ].config[ 1 ] == 0xc0000 ) { - return calc_crc( - saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] ); + return calc_crc( saturn.port1[ ( addr - 0xc0000 ) & port1_mask ] ); } if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 0 ] == 0xc0000 ) if ( saturn.mem_cntl[ MCTL_PORT2_GX ].config[ 1 ] == 0xc0000 ) { - return calc_crc( - saturn.port2[ ( ( saturn.bank_switch << 18 ) + - ( addr - 0xc0000 ) ) & - port2_mask ] ); + return calc_crc( saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] ); /* if (port2_size > (saturn.bank_switch << 18)) { @@ -1122,7 +1047,8 @@ int read_nibble_crc_gx( long addr ) { return 0x00; } -long read_nibbles( long addr, int len ) { +long read_nibbles( long addr, int len ) +{ long val = 0; addr += len; @@ -1132,7 +1058,8 @@ long read_nibbles( long addr, int len ) { return val; } -void dev_memory_init( void ) { +void dev_memory_init( void ) +{ if ( opt_gx ) { read_nibble = read_nibble_gx; read_nibble_crc = read_nibble_crc_gx; diff --git a/src/emu_register.c b/src/emu_register.c index 26615d8..d91b46f 100644 --- a/src/emu_register.c +++ b/src/emu_register.c @@ -6,14 +6,12 @@ extern long nibble_masks[ 16 ]; -static int start_fields[] = { -1, 0, 2, 0, 15, 3, 0, 0, -1, 0, - 2, 0, 15, 3, 0, 0, 0, 0, 0 }; +static int start_fields[] = { -1, 0, 2, 0, 15, 3, 0, 0, -1, 0, 2, 0, 15, 3, 0, 0, 0, 0, 0 }; -static int end_fields[] = { -1, -1, 2, 2, 15, 14, 1, 15, -1, -1, - 2, 2, 15, 14, 1, 4, 3, 2, 0 }; +static int end_fields[] = { -1, -1, 2, 2, 15, 14, 1, 15, -1, -1, 2, 2, 15, 14, 1, 4, 3, 2, 0 }; -static inline int -get_start( int code ) { /* FIXME: Duplicate from hp48emu_actions.c */ +static inline int get_start( int code ) +{ /* FIXME: Duplicate from hp48emu_actions.c */ int s; if ( ( s = start_fields[ code ] ) == -1 ) @@ -22,8 +20,8 @@ get_start( int code ) { /* FIXME: Duplicate from hp48emu_actions.c */ return s; /* FIXME: potentially return uninitialized s ? */ } -static inline int -get_end( int code ) { /* FIXME: Duplicate from hp48emu_actions.c */ +static inline int get_end( int code ) +{ /* FIXME: Duplicate from hp48emu_actions.c */ int e; if ( ( e = end_fields[ code ] ) == -1 ) @@ -32,8 +30,8 @@ get_end( int code ) { /* FIXME: Duplicate from hp48emu_actions.c */ return e; /* FIXME: potentially return uninitialized e ? */ } -void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2, - int code ) { +void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -53,7 +51,8 @@ void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2, saturn.CARRY = c ? 1 : 0; } -void add_p_plus_one( unsigned char* r ) { +void add_p_plus_one( unsigned char* r ) +{ int t; int s = 0; int e = 4; @@ -73,8 +72,8 @@ void add_p_plus_one( unsigned char* r ) { saturn.CARRY = c ? 1 : 0; } -void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2, - int code ) { +void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -93,7 +92,8 @@ void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2, saturn.CARRY = c ? 1 : 0; } -void complement_2_register( unsigned char* r, int code ) { +void complement_2_register( unsigned char* r, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -115,7 +115,8 @@ void complement_2_register( unsigned char* r, int code ) { saturn.CARRY = carry ? 1 : 0; } -void complement_1_register( unsigned char* r, int code ) { +void complement_1_register( unsigned char* r, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -127,7 +128,8 @@ void complement_1_register( unsigned char* r, int code ) { saturn.CARRY = 0; } -void inc_register( unsigned char* r, int code ) { +void inc_register( unsigned char* r, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -148,7 +150,8 @@ void inc_register( unsigned char* r, int code ) { saturn.CARRY = c ? 1 : 0; } -void add_register_constant( unsigned char* r, int code, int val ) { +void add_register_constant( unsigned char* r, int code, int val ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -169,7 +172,8 @@ void add_register_constant( unsigned char* r, int code, int val ) { saturn.CARRY = c ? 1 : 0; } -void dec_register( unsigned char* r, int code ) { +void dec_register( unsigned char* r, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -190,7 +194,8 @@ void dec_register( unsigned char* r, int code ) { saturn.CARRY = c ? 1 : 0; } -void sub_register_constant( unsigned char* r, int code, int val ) { +void sub_register_constant( unsigned char* r, int code, int val ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -211,7 +216,8 @@ void sub_register_constant( unsigned char* r, int code, int val ) { saturn.CARRY = c ? 1 : 0; } -void zero_register( unsigned char* r, int code ) { +void zero_register( unsigned char* r, int code ) +{ int s = get_start( code ); int e = get_end( code ); @@ -219,8 +225,8 @@ void zero_register( unsigned char* r, int code ) { r[ i ] = 0; } -void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2, - int code ) { +void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code ) +{ int s = get_start( code ); int e = get_end( code ); @@ -228,8 +234,8 @@ void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2, res[ i ] = ( r1[ i ] | r2[ i ] ) & 0xf; } -void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2, - int code ) { +void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code ) +{ int s = get_start( code ); int e = get_end( code ); @@ -237,7 +243,8 @@ void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2, res[ i ] = ( r1[ i ] & r2[ i ] ) & 0xf; } -void copy_register( unsigned char* to, unsigned char* from, int code ) { +void copy_register( unsigned char* to, unsigned char* from, int code ) +{ int s = get_start( code ); int e = get_end( code ); @@ -245,7 +252,8 @@ void copy_register( unsigned char* to, unsigned char* from, int code ) { to[ i ] = from[ i ]; } -void exchange_register( unsigned char* r1, unsigned char* r2, int code ) { +void exchange_register( unsigned char* r1, unsigned char* r2, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -257,7 +265,8 @@ void exchange_register( unsigned char* r1, unsigned char* r2, int code ) { } } -void exchange_reg( unsigned char* r, word_20* d, int code ) { +void exchange_reg( unsigned char* r, word_20* d, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -270,7 +279,8 @@ void exchange_reg( unsigned char* r, word_20* d, int code ) { } } -void shift_left_register( unsigned char* r, int code ) { +void shift_left_register( unsigned char* r, int code ) +{ int s = get_start( code ); int e = get_end( code ); @@ -280,7 +290,8 @@ void shift_left_register( unsigned char* r, int code ) { r[ s ] = 0; } -void shift_left_circ_register( unsigned char* r, int code ) { +void shift_left_circ_register( unsigned char* r, int code ) +{ int s = get_start( code ); int e = get_end( code ); int t = r[ e ] & 0x0f; @@ -291,7 +302,8 @@ void shift_left_circ_register( unsigned char* r, int code ) { r[ s ] = t; } -void shift_right_register( unsigned char* r, int code ) { +void shift_right_register( unsigned char* r, int code ) +{ int s = get_start( code ); int e = get_end( code ); @@ -304,7 +316,8 @@ void shift_right_register( unsigned char* r, int code ) { r[ e ] = 0; } -void shift_right_circ_register( unsigned char* r, int code ) { +void shift_right_circ_register( unsigned char* r, int code ) +{ int s = get_start( code ); int e = get_end( code ); int t = r[ s ] & 0x0f; @@ -317,7 +330,8 @@ void shift_right_circ_register( unsigned char* r, int code ) { saturn.SB = 1; } -void shift_right_bit_register( unsigned char* r, int code ) { +void shift_right_bit_register( unsigned char* r, int code ) +{ int t; int s = get_start( code ); int e = get_end( code ); @@ -332,7 +346,8 @@ void shift_right_bit_register( unsigned char* r, int code ) { saturn.SB = 1; } -int is_zero_register( unsigned char* r, int code ) { +int is_zero_register( unsigned char* r, int code ) +{ int s = get_start( code ); int e = get_end( code ); int z = 1; @@ -346,7 +361,8 @@ int is_zero_register( unsigned char* r, int code ) { return z; } -int is_not_zero_register( unsigned char* r, int code ) { +int is_not_zero_register( unsigned char* r, int code ) +{ int s = get_start( code ); int e = get_end( code ); int z = 0; @@ -360,7 +376,8 @@ int is_not_zero_register( unsigned char* r, int code ) { return z; } -int is_equal_register( unsigned char* r1, unsigned char* r2, int code ) { +int is_equal_register( unsigned char* r1, unsigned char* r2, int code ) +{ int s = get_start( code ); int e = get_end( code ); int z = 1; @@ -374,7 +391,8 @@ int is_equal_register( unsigned char* r1, unsigned char* r2, int code ) { return z; } -int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code ) { +int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code ) +{ int s = get_start( code ); int e = get_end( code ); int z = 0; @@ -388,7 +406,8 @@ int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code ) { return z; } -int is_less_register( unsigned char* r1, unsigned char* r2, int code ) { +int is_less_register( unsigned char* r1, unsigned char* r2, int code ) +{ int s = get_start( code ); int e = get_end( code ); int z = 0; @@ -407,8 +426,8 @@ int is_less_register( unsigned char* r1, unsigned char* r2, int code ) { return z; } -int is_less_or_equal_register( unsigned char* r1, unsigned char* r2, - int code ) { +int is_less_or_equal_register( unsigned char* r1, unsigned char* r2, int code ) +{ int s = get_start( code ); int e = get_end( code ); int z = 1; @@ -427,7 +446,8 @@ int is_less_or_equal_register( unsigned char* r1, unsigned char* r2, return z; } -int is_greater_register( unsigned char* r1, unsigned char* r2, int code ) { +int is_greater_register( unsigned char* r1, unsigned char* r2, int code ) +{ int s = get_start( code ); int e = get_end( code ); int z = 0; @@ -446,8 +466,8 @@ int is_greater_register( unsigned char* r1, unsigned char* r2, int code ) { return z; } -int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2, - int code ) { +int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2, int code ) +{ int s = get_start( code ); int e = get_end( code ); int z = 1; diff --git a/src/emu_serial.c b/src/emu_serial.c index 53eb660..7e890fd 100644 --- a/src/emu_serial.c +++ b/src/emu_serial.c @@ -7,9 +7,9 @@ #include #include -#include "runtime_options.h" #include "emulator.h" #include "emulator_inner.h" +#include "runtime_options.h" static int wire_fd; static int ir_fd; @@ -20,7 +20,8 @@ extern int rece_instr; char* wire_name = ( char* )0; char* ir_name = ( char* )0; -void update_connection_display( void ) { +void update_connection_display( void ) +{ if ( wire_fd == -1 ) { if ( wire_name ) free( wire_name ); @@ -33,7 +34,8 @@ void update_connection_display( void ) { } } -int init_serial( void ) { +int init_serial( void ) +{ int c; int n; char tty_dev_name[ 128 ]; @@ -43,16 +45,14 @@ int init_serial( void ) { ttyp = -1; if ( useTerminal ) { /* Unix98 PTY (Preferred) */ - if ( ( wire_fd = open( "/dev/ptmx", O_RDWR | O_NONBLOCK, 0666 ) ) >= - 0 ) { + if ( ( wire_fd = open( "/dev/ptmx", O_RDWR | O_NONBLOCK, 0666 ) ) >= 0 ) { grantpt( wire_fd ); unlockpt( wire_fd ); if ( ptsname_r( wire_fd, tty_dev_name, 128 ) ) { perror( "Could not get the name of the wire device." ); exit( -1 ); } - if ( ( ttyp = open( tty_dev_name, O_RDWR | O_NDELAY, 0666 ) ) >= - 0 ) { + if ( ( ttyp = open( tty_dev_name, O_RDWR | O_NDELAY, 0666 ) ) >= 0 ) { if ( verbose ) printf( "wire connection on %s\n", tty_dev_name ); wire_name = strdup( tty_dev_name ); @@ -64,9 +64,7 @@ int init_serial( void ) { do { for ( n = 0; n < 16; n++ ) { sprintf( tty_dev_name, "/dev/pty%c%x", c, n ); - if ( ( wire_fd = - open( tty_dev_name, O_RDWR | O_EXCL | O_NDELAY, - 0666 ) ) >= 0 ) { + if ( ( wire_fd = open( tty_dev_name, O_RDWR | O_EXCL | O_NDELAY, 0666 ) ) >= 0 ) { ttyp = wire_fd; sprintf( tty_dev_name, "/dev/tty%c%x", c, n ); if ( verbose ) @@ -88,8 +86,7 @@ int init_serial( void ) { #endif { if ( verbose ) - fprintf( stderr, "ioctl(wire, TCGETS) failed, errno = %d\n", - errno ); + fprintf( stderr, "ioctl(wire, TCGETS) failed, errno = %d\n", errno ); wire_fd = -1; ttyp = -1; } @@ -112,8 +109,7 @@ int init_serial( void ) { #endif { if ( verbose ) - fprintf( stderr, "ioctl(wire, TCSETS) failed, errno = %d\n", - errno ); + fprintf( stderr, "ioctl(wire, TCSETS) failed, errno = %d\n", errno ); wire_fd = -1; ttyp = -1; } @@ -137,8 +133,7 @@ int init_serial( void ) { #endif { if ( verbose ) - fprintf( stderr, "ioctl(IR, TCGETS) failed, errno = %d\n", - errno ); + fprintf( stderr, "ioctl(IR, TCGETS) failed, errno = %d\n", errno ); ir_fd = -1; } } @@ -160,8 +155,7 @@ int init_serial( void ) { #endif { if ( verbose ) - fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n", - errno ); + fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n", errno ); ir_fd = -1; } } @@ -169,7 +163,8 @@ int init_serial( void ) { return 1; } -void serial_baud( int baud ) { +void serial_baud( int baud ) +{ int error = 0; struct termios ttybuf; @@ -181,8 +176,7 @@ void serial_baud( int baud ) { #endif { if ( verbose ) - fprintf( stderr, "ioctl(IR, TCGETS) failed, errno = %d\n", - errno ); + fprintf( stderr, "ioctl(IR, TCGETS) failed, errno = %d\n", errno ); ir_fd = -1; error = 1; } @@ -195,33 +189,33 @@ void serial_baud( int baud ) { ttybuf.c_cflag |= B1200; break; case 1: /* 1920 */ -#ifdef B1920 +# ifdef B1920 ttybuf.c_cflag |= B1920; -#endif +# endif break; case 2: /* 2400 */ ttybuf.c_cflag |= B2400; break; case 3: /* 3840 */ -#ifdef B3840 +# ifdef B3840 ttybuf.c_cflag |= B3840; -#endif +# endif break; case 4: /* 4800 */ ttybuf.c_cflag |= B4800; break; case 5: /* 7680 */ -#ifdef B7680 +# ifdef B7680 ttybuf.c_cflag |= B7680; -#endif +# endif break; case 6: /* 9600 */ ttybuf.c_cflag |= B9600; break; case 7: /* 15360 */ -#ifdef B15360 +# ifdef B15360 ttybuf.c_cflag |= B15360; -#endif +# endif break; } @@ -239,33 +233,33 @@ void serial_baud( int baud ) { ttybuf.c_cflag |= B1200; break; case 1: /* 1920 */ -#ifdef B1920 +# ifdef B1920 ttybuf.c_cflag |= B1920; -#endif +# endif break; case 2: /* 2400 */ ttybuf.c_cflag |= B2400; break; case 3: /* 3840 */ -#ifdef B3840 +# ifdef B3840 ttybuf.c_cflag |= B3840; -#endif +# endif break; case 4: /* 4800 */ ttybuf.c_cflag |= B4800; break; case 5: /* 7680 */ -#ifdef B7680 +# ifdef B7680 ttybuf.c_cflag |= B7680; -#endif +# endif break; case 6: /* 9600 */ ttybuf.c_cflag |= B9600; break; case 7: /* 15360 */ -#ifdef B15360 +# ifdef B15360 ttybuf.c_cflag |= B15360; -#endif +# endif break; } @@ -283,8 +277,7 @@ void serial_baud( int baud ) { #endif { if ( verbose ) - fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n", - errno ); + fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n", errno ); ir_fd = -1; error = 1; } @@ -298,8 +291,7 @@ void serial_baud( int baud ) { #endif { if ( verbose ) - fprintf( stderr, "ioctl(wire, TCGETS) failed, errno = %d\n", - errno ); + fprintf( stderr, "ioctl(wire, TCGETS) failed, errno = %d\n", errno ); wire_fd = -1; ttyp = -1; error = 1; @@ -316,33 +308,33 @@ void serial_baud( int baud ) { ttybuf.c_cflag |= B1200; break; case 1: /* 1920 */ -#ifdef B1920 +# ifdef B1920 ttybuf.c_cflag |= B1920; -#endif +# endif break; case 2: /* 2400 */ ttybuf.c_cflag |= B2400; break; case 3: /* 3840 */ -#ifdef B3840 +# ifdef B3840 ttybuf.c_cflag |= B3840; -#endif +# endif break; case 4: /* 4800 */ ttybuf.c_cflag |= B4800; break; case 5: /* 7680 */ -#ifdef B7680 +# ifdef B7680 ttybuf.c_cflag |= B7680; -#endif +# endif break; case 6: /* 9600 */ ttybuf.c_cflag |= B9600; break; case 7: /* 15360 */ -#ifdef B15360 +# ifdef B15360 ttybuf.c_cflag |= B15360; -#endif +# endif break; } @@ -360,8 +352,7 @@ void serial_baud( int baud ) { #endif { if ( verbose ) - fprintf( stderr, "ioctl(wire, TCSETS) failed, errno = %d\n", - errno ); + fprintf( stderr, "ioctl(wire, TCSETS) failed, errno = %d\n", errno ); wire_fd = -1; ttyp = -1; error = 1; @@ -371,7 +362,8 @@ void serial_baud( int baud ) { update_connection_display(); } -void transmit_char( void ) { +void transmit_char( void ) +{ if ( saturn.ir_ctrl & 0x04 ) { if ( ir_fd == -1 ) { saturn.tcs &= 0x0e; @@ -426,7 +418,8 @@ void transmit_char( void ) { #define NR_BUFFER 256 -void receive_char( void ) { +void receive_char( void ) +{ struct timeval tout; fd_set rfds; int nfd; @@ -455,8 +448,7 @@ void receive_char( void ) { FD_SET( wire_fd, &rfds ); nfd = wire_fd + 1; } - if ( ( nfd = select( nfd, &rfds, ( fd_set* )0, ( fd_set* )0, &tout ) ) > - 0 ) { + if ( ( nfd = select( nfd, &rfds, ( fd_set* )0, ( fd_set* )0, &tout ) ) > 0 ) { if ( saturn.ir_ctrl & 0x04 ) { if ( FD_ISSET( ir_fd, &rfds ) ) { nrd = read( ir_fd, buf, NR_BUFFER ); diff --git a/src/emu_timer.c b/src/emu_timer.c index 4fa68f0..ed14c3b 100644 --- a/src/emu_timer.c +++ b/src/emu_timer.c @@ -1,15 +1,15 @@ +#include #include #include #include #include -#include #include -#include "romio.h" +#include "debugger.h" /* used for in_debugger */ #include "emulator.h" #include "emulator_inner.h" -#include "debugger.h" /* used for in_debugger */ +#include "romio.h" #define NR_TIMERS 4 @@ -52,8 +52,7 @@ word_64 time_offset = 0x0; #define TIMEOUT_GX ( 0x80069 - RAM_BASE_GX ) #define TIMEOUTCLK_GX ( 0x80076 - RAM_BASE_GX ) -#define calc_crc( nib ) \ - ( crc = ( crc >> 4 ) ^ ( ( ( crc ^ ( nib ) ) & 0xf ) * 0x1081 ) ) +#define calc_crc( nib ) ( crc = ( crc >> 4 ) ^ ( ( ( crc ^ ( nib ) ) & 0xf ) * 0x1081 ) ) /* * Set ACCESSTIME: (on startup) @@ -68,7 +67,8 @@ word_64 time_offset = 0x0; * 8. Prevent AutoOff by setting TIMEOUT * */ -void set_accesstime( void ) { +void set_accesstime( void ) +{ struct timeval tv; struct timezone tz; @@ -147,7 +147,8 @@ void set_accesstime( void ) { saturn.ram[ timeoutclk_loc ] = 0xf; } -void start_timer( int timer ) { +void start_timer( int timer ) +{ struct timeval tv; struct timezone tz; @@ -171,7 +172,8 @@ void start_timer( int timer ) { } } -void restart_timer( int timer ) { +void restart_timer( int timer ) +{ struct timeval tv; struct timezone tz; @@ -197,7 +199,8 @@ void restart_timer( int timer ) { } } -void stop_timer( int timer ) { +void stop_timer( int timer ) +{ struct timeval tv; struct timezone tz; @@ -226,7 +229,8 @@ void stop_timer( int timer ) { // &timers[timer].value); } -void reset_timer( int timer ) { +void reset_timer( int timer ) +{ if ( timer > NR_TIMERS ) return; timers[ timer ].run = 0; @@ -237,7 +241,8 @@ void reset_timer( int timer ) { static word_64 zero = 0; -word_64 get_timer( int timer ) { +word_64 get_timer( int timer ) +{ struct timeval tv; struct timezone tz; @@ -277,7 +282,8 @@ word_64 get_timer( int timer ) { * */ -t1_t2_ticks get_t1_t2( void ) { +t1_t2_ticks get_t1_t2( void ) +{ struct timeval tv; struct timezone tz; @@ -329,8 +335,7 @@ t1_t2_ticks get_t1_t2( void ) { * Don't adjust the time, can't come from user, anyhow. */ - if ( ( saturn.timer2 >= 0 && access_time < 0 ) || - ( ( unsigned long )saturn.timer2 > access_time ) ) { + if ( ( saturn.timer2 >= 0 && access_time < 0 ) || ( ( unsigned long )saturn.timer2 > access_time ) ) { /* * check OK, return calculated time */ @@ -359,8 +364,7 @@ t1_t2_ticks get_t1_t2( void ) { access_time -= adj_time; } - if ( ( saturn.timer2 >= 0 && ( access_time < 0 ) ) || - ( ( unsigned long )saturn.timer2 > access_time ) ) { + if ( ( saturn.timer2 >= 0 && ( access_time < 0 ) ) || ( ( unsigned long )saturn.timer2 > access_time ) ) { /* * check OK, return calculated time */ diff --git a/src/emulator_inner.h b/src/emulator_inner.h index d8f4b7c..b273127 100644 --- a/src/emulator_inner.h +++ b/src/emulator_inner.h @@ -74,19 +74,15 @@ int get_identification( void ); void add_p_plus_one( unsigned char* r ); void add_register_constant( unsigned char* res, int code, int val ); void sub_register_constant( unsigned char* res, int code, int val ); -void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2, - int code ); -void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2, - int code ); +void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code ); +void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code ); void complement_2_register( unsigned char* r, int code ); void complement_1_register( unsigned char* r, int code ); void inc_register( unsigned char* r, int code ); void dec_register( unsigned char* r, int code ); void zero_register( unsigned char* r, int code ); -void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2, - int code ); -void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2, - int code ); +void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code ); +void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2, int code ); void copy_register( unsigned char* to, unsigned char* from, int code ); void exchange_register( unsigned char* r1, unsigned char* r2, int code ); void exchange_reg( unsigned char* r, word_20* d, int code ); @@ -102,8 +98,7 @@ int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code ); int is_less_register( unsigned char* r1, unsigned char* r2, int code ); int is_less_or_equal_register( unsigned char* r1, unsigned char* r2, int code ); int is_greater_register( unsigned char* r1, unsigned char* r2, int code ); -int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2, - int code ); +int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2, int code ); /****************/ /* emu_serial.c */ diff --git a/src/main.c b/src/main.c index 0949f46..0b6be35 100644 --- a/src/main.c +++ b/src/main.c @@ -1,20 +1,21 @@ #include #include +#include +#include #include #include #include #include #include #include -#include -#include -#include "runtime_options.h" -#include "emulator.h" #include "debugger.h" +#include "emulator.h" +#include "runtime_options.h" #include "ui.h" /* init_ui(); */ -void signal_handler( int sig ) { +void signal_handler( int sig ) +{ switch ( sig ) { case SIGINT: /* Ctrl-C */ enter_debugger |= USER_INTERRUPT; @@ -30,7 +31,8 @@ void signal_handler( int sig ) { } } -int main( int argc, char** argv ) { +int main( int argc, char** argv ) +{ setlocale( LC_ALL, "C" ); /**********/ diff --git a/src/romio.c b/src/romio.c index 5ac1dd9..6ebe5d2 100644 --- a/src/romio.c +++ b/src/romio.c @@ -1,7 +1,7 @@ #include #include -#include #include +#include #include "romio.h" @@ -11,7 +11,8 @@ unsigned int opt_gx = 0; unsigned int rom_size = 0; -int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) { +int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) +{ struct stat st; FILE* fp; unsigned char* tmp_mem; @@ -38,11 +39,9 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) { return 0; } - if ( four[ 0 ] == 0x02 && four[ 1 ] == 0x03 && four[ 2 ] == 0x06 && - four[ 3 ] == 0x09 ) { + if ( four[ 0 ] == 0x02 && four[ 1 ] == 0x03 && four[ 2 ] == 0x06 && four[ 3 ] == 0x09 ) { *size = st.st_size; - } else if ( four[ 0 ] == 0x32 && four[ 1 ] == 0x96 && four[ 2 ] == 0x1b && - four[ 3 ] == 0x80 ) { + } else if ( four[ 0 ] == 0x32 && four[ 1 ] == 0x96 && four[ 2 ] == 0x1b && four[ 3 ] == 0x80 ) { *size = 2 * st.st_size; } else if ( four[ 1 ] == 0x49 ) { fprintf( stderr, "%s is an HP49 ROM\n", name ); @@ -83,8 +82,7 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) { */ if ( st.st_size != *size / 2 ) { - fprintf( stderr, "strange size %s, expected %d, found %ld\n", name, - *size / 2, st.st_size ); + fprintf( stderr, "strange size %s, expected %d, found %ld\n", name, *size / 2, st.st_size ); free( *mem ); *mem = NULL; *size = 0; @@ -92,8 +90,7 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) { return 0; } - if ( NULL == - ( tmp_mem = ( unsigned char* )malloc( ( size_t )st.st_size ) ) ) { + if ( NULL == ( tmp_mem = ( unsigned char* )malloc( ( size_t )st.st_size ) ) ) { for ( i = 0, j = 0; i < *size / 2; i++ ) { if ( 1 != fread( &byte, 1, 1, fp ) ) { fprintf( stderr, "can\'t read %s\n", name ); @@ -132,16 +129,13 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) { if ( *size == ROM_SIZE_GX ) { opt_gx = 1; } else if ( *size == 4 * ROM_SIZE_GX ) { - fprintf( stderr, "%s seems to be HP49 ROM, but size is 0x%x\n", - name, *size ); + fprintf( stderr, "%s seems to be HP49 ROM, but size is 0x%x\n", name, *size ); opt_gx = 2; } else if ( *size == 8 * ROM_SIZE_GX ) { - fprintf( stderr, "%s seems to be HP49 ROM, but size is 0x%x\n", - name, *size ); + fprintf( stderr, "%s seems to be HP49 ROM, but size is 0x%x\n", name, *size ); opt_gx = 2; } else { - fprintf( stderr, "%s seems to be G/GX ROM, but size is 0x%x\n", - name, *size ); + fprintf( stderr, "%s seems to be G/GX ROM, but size is 0x%x\n", name, *size ); free( *mem ); *mem = NULL; *size = 0; @@ -151,8 +145,7 @@ int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ) { if ( *size == ROM_SIZE_SX ) { opt_gx = 0; } else { - fprintf( stderr, "%s seems to be S/SX ROM, but size is 0x%x\n", - name, *size ); + fprintf( stderr, "%s seems to be S/SX ROM, but size is 0x%x\n", name, *size ); free( *mem ); *mem = NULL; *size = 0; diff --git a/src/romio.h b/src/romio.h index a81c2a3..98001ba 100644 --- a/src/romio.h +++ b/src/romio.h @@ -4,7 +4,6 @@ extern unsigned int opt_gx; extern unsigned int rom_size; -extern int read_rom_file( const char* name, unsigned char** mem, - unsigned int* size ); +extern int read_rom_file( const char* name, unsigned char** mem, unsigned int* size ); #endif /* !_ROMIO_H */ diff --git a/src/runtime_options.c b/src/runtime_options.c index 962c747..1009fce 100644 --- a/src/runtime_options.c +++ b/src/runtime_options.c @@ -1,10 +1,10 @@ #include +#include #include #include #include -#include -#include #include +#include #include @@ -63,7 +63,8 @@ char normalized_state_path[ MAX_LENGTH_FILENAME ]; char normalized_port1_path[ MAX_LENGTH_FILENAME ]; char normalized_port2_path[ MAX_LENGTH_FILENAME ]; -void get_absolute_config_dir( char* source, char* dest ) { +void get_absolute_config_dir( char* source, char* dest ) +{ char* home; struct passwd* pwd; @@ -90,14 +91,14 @@ void get_absolute_config_dir( char* source, char* dest ) { strcat( dest, "/" ); } -static inline void normalize_filenames( void ) { +static inline void normalize_filenames( void ) +{ struct stat st; int normalized_config_path_exist = 1; get_absolute_config_dir( configDir, normalized_config_path ); if ( verbose ) - fprintf( stderr, "normalized_config_path: %s\n", - normalized_config_path ); + fprintf( stderr, "normalized_config_path: %s\n", normalized_config_path ); if ( stat( normalized_config_path, &st ) == -1 ) if ( errno == ENOENT ) @@ -141,122 +142,121 @@ static inline void normalize_filenames( void ) { strcat( normalized_port2_path, port2FileName ); } -int parse_args( int argc, char* argv[] ) { +int parse_args( int argc, char* argv[] ) +{ int option_index; int c = '?'; char* optstring = "c:S:u:hvVtsirT"; static struct option long_options[] = { - { "config-dir", required_argument, NULL, 1000 }, - { "rom", required_argument, NULL, 1010 }, - { "ram", required_argument, NULL, 1011 }, - { "state", required_argument, NULL, 1012 }, - { "port1", required_argument, NULL, 1013 }, - { "port2", required_argument, NULL, 1014 }, + {"config-dir", required_argument, NULL, 1000 }, + { "rom", required_argument, NULL, 1010 }, + { "ram", required_argument, NULL, 1011 }, + { "state", required_argument, NULL, 1012 }, + { "port1", required_argument, NULL, 1013 }, + { "port2", required_argument, NULL, 1014 }, - { "serial-line", required_argument, NULL, 1015 }, + { "serial-line", required_argument, NULL, 1015 }, - { "front-end", required_argument, NULL, 'u' }, + { "front-end", required_argument, NULL, 'u' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'v' }, - { "verbose", no_argument, &verbose, 1 }, - { "use-terminal", no_argument, &useTerminal, 1 }, - { "use-serial", no_argument, &useSerial, 1 }, + { "verbose", no_argument, &verbose, 1 }, + { "use-terminal", no_argument, &useTerminal, 1 }, + { "use-serial", no_argument, &useSerial, 1 }, - { "initialize", no_argument, &initialize, 1 }, - { "reset", no_argument, &resetOnStartup, 1 }, - { "throttle", no_argument, &throttle, 1 }, + { "initialize", no_argument, &initialize, 1 }, + { "reset", no_argument, &resetOnStartup, 1 }, + { "throttle", no_argument, &throttle, 1 }, - { "no-debug", no_argument, &useDebugger, 0 }, + { "no-debug", no_argument, &useDebugger, 0 }, - { "sdl", no_argument, &frontend_type, FRONTEND_SDL }, - { "sdl-no-chrome", no_argument, &show_ui_chrome, 0 }, - { "sdl-fullscreen", no_argument, &show_ui_fullscreen, 1 }, + { "sdl", no_argument, &frontend_type, FRONTEND_SDL }, + { "sdl-no-chrome", no_argument, &show_ui_chrome, 0 }, + { "sdl-fullscreen", no_argument, &show_ui_fullscreen, 1 }, - { "x11", no_argument, &frontend_type, FRONTEND_X11 }, - { "x11-netbook", no_argument, &netbook, 1 }, - { "x11-mono", no_argument, &mono, 1 }, - { "x11-gray", no_argument, &gray, 1 }, - { "x11-visual", required_argument, NULL, 8110 }, - { "x11-small-font", required_argument, NULL, 8111 }, - { "x11-medium-font", required_argument, NULL, 8112 }, - { "x11-large-font", required_argument, NULL, 8113 }, - { "x11-connection-font", required_argument, NULL, 8114 }, + { "x11", no_argument, &frontend_type, FRONTEND_X11 }, + { "x11-netbook", no_argument, &netbook, 1 }, + { "x11-mono", no_argument, &mono, 1 }, + { "x11-gray", no_argument, &gray, 1 }, + { "x11-visual", required_argument, NULL, 8110 }, + { "x11-small-font", required_argument, NULL, 8111 }, + { "x11-medium-font", required_argument, NULL, 8112 }, + { "x11-large-font", required_argument, NULL, 8113 }, + { "x11-connection-font", required_argument, NULL, 8114 }, - { "tui", no_argument, &frontend_type, FRONTEND_TEXT }, + { "tui", no_argument, &frontend_type, FRONTEND_TEXT}, - { 0, 0, 0, 0 } }; + { 0, 0, 0, 0 } + }; - char* help_text = - "usage: %s [options]\n" - "options:\n" - "\t-h --help\t\t\twhat you are reading\n" - "\t-v --version\t\t\tshow version\n" - "\t --config-dir=\t\tuse as x48ng's home (default: " - "~/.x48ng/)\n" - "\t --rom=\tuse (absolute or relative to " - ") as ROM (default: rom)\n" - "\t --ram=\tuse (absolute or relative to " - ") as RAM (default: ram)\n" - "\t --state=\tuse (absolute or relative " - "to ) as STATE (default: hp48)\n" - "\t --port1=\tuse (absolute or relative " - "to ) as PORT1 (default: port1)\n" - "\t --port2=\tuse (absolute or relative " - "to ) as PORT2 (default: port2)\n" - "\t --serial-line=\t\tuse as serial device default: " - "%s)\n" - "\t-V --verbose\t\t\tbe verbose (default: false)\n" - "\t-u --front-end\t\t\tspecify a front-end (available: x11, sdl, " - "text; " - "default: x11)\n" - "\t --x11\t\tuse X11 front-end (default: true)\n" - "\t --sdl\t\tuse SDL front-end (default: false)\n" - "\t --tui\t\tuse terminal front-end (default: false)\n" - "\t-t --use-terminal\t\tactivate pseudo terminal interface (default: " - "true)\n" - "\t-s --use-serial\t\t\tactivate serial interface (default: false)\n" - "\t --no-debug\t\t\tdisable the debugger\n" - "\t-i --initialize\t\t\tinitialize the content of \n" - "\t-r --reset\t\t\tperform a reset on startup\n" - "\t-T --throttle\t\t\ttry to emulate real speed (default: false)\n" - "\t --sdl-no-chrome\t\tonly display the LCD (default: " - "false)\n" - "\t --sdl-fullscreen\t\tmake the UI fullscreen " - "(default: " - "false)\n" - "\t --x11-netbook\t\tmake the UI horizontal (default: " - "false)\n" - "\t --x11-mono\t\t\tmake the UI monochrome (default: " - "false)\n" - "\t --x11-gray\t\t\tmake the UI grayscale (default: " - "false)\n" - "\t --x11-visual=\tuse visual (default: " - "default), possible values: " - "\n" - "\t --x11-small-font=\tuse as small " - "font (default: %s)\n" - "\t --x11-medium-font=\tuse as medium " - "font (default: %s)\n" - "\t --x11-large-font=\tuse as large " - "font (default: %s)\n" - "\t --x11-connection-font=\tuse as " - "connection font (default: %s)\n"; + char* help_text = "usage: %s [options]\n" + "options:\n" + "\t-h --help\t\t\twhat you are reading\n" + "\t-v --version\t\t\tshow version\n" + "\t --config-dir=\t\tuse as x48ng's home (default: " + "~/.x48ng/)\n" + "\t --rom=\tuse (absolute or relative to " + ") as ROM (default: rom)\n" + "\t --ram=\tuse (absolute or relative to " + ") as RAM (default: ram)\n" + "\t --state=\tuse (absolute or relative " + "to ) as STATE (default: hp48)\n" + "\t --port1=\tuse (absolute or relative " + "to ) as PORT1 (default: port1)\n" + "\t --port2=\tuse (absolute or relative " + "to ) as PORT2 (default: port2)\n" + "\t --serial-line=\t\tuse as serial device default: " + "%s)\n" + "\t-V --verbose\t\t\tbe verbose (default: false)\n" + "\t-u --front-end\t\t\tspecify a front-end (available: x11, sdl, " + "text; " + "default: x11)\n" + "\t --x11\t\tuse X11 front-end (default: true)\n" + "\t --sdl\t\tuse SDL front-end (default: false)\n" + "\t --tui\t\tuse terminal front-end (default: false)\n" + "\t-t --use-terminal\t\tactivate pseudo terminal interface (default: " + "true)\n" + "\t-s --use-serial\t\t\tactivate serial interface (default: false)\n" + "\t --no-debug\t\t\tdisable the debugger\n" + "\t-i --initialize\t\t\tinitialize the content of \n" + "\t-r --reset\t\t\tperform a reset on startup\n" + "\t-T --throttle\t\t\ttry to emulate real speed (default: false)\n" + "\t --sdl-no-chrome\t\tonly display the LCD (default: " + "false)\n" + "\t --sdl-fullscreen\t\tmake the UI fullscreen " + "(default: " + "false)\n" + "\t --x11-netbook\t\tmake the UI horizontal (default: " + "false)\n" + "\t --x11-mono\t\t\tmake the UI monochrome (default: " + "false)\n" + "\t --x11-gray\t\t\tmake the UI grayscale (default: " + "false)\n" + "\t --x11-visual=\tuse visual (default: " + "default), possible values: " + "\n" + "\t --x11-small-font=\tuse as small " + "font (default: %s)\n" + "\t --x11-medium-font=\tuse as medium " + "font (default: %s)\n" + "\t --x11-large-font=\tuse as large " + "font (default: %s)\n" + "\t --x11-connection-font=\tuse as " + "connection font (default: %s)\n"; while ( c != EOF ) { c = getopt_long( argc, argv, optstring, long_options, &option_index ); switch ( c ) { case 'h': - fprintf( stdout, help_text, progname, serialLine, smallFont, - mediumFont, largeFont, connFont ); + fprintf( stdout, help_text, progname, serialLine, smallFont, mediumFont, largeFont, connFont ); exit( 0 ); break; case 'v': - fprintf( stdout, "%s %d.%d.%d\n", progname, VERSION_MAJOR, - VERSION_MINOR, PATCHLEVEL ); + fprintf( stdout, "%s %d.%d.%d\n", progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL ); exit( 0 ); break; case 1000: @@ -390,16 +390,12 @@ int parse_args( int argc, char* argv[] ) { fprintf( stderr, "largeFont = %s\n", largeFont ); fprintf( stderr, "connFont = %s\n", connFont ); - fprintf( stderr, "normalized_config_path = %s\n", - normalized_config_path ); + fprintf( stderr, "normalized_config_path = %s\n", normalized_config_path ); fprintf( stderr, "normalized_rom_path = %s\n", normalized_rom_path ); fprintf( stderr, "normalized_ram_path = %s\n", normalized_ram_path ); - fprintf( stderr, "normalized_state_path = %s\n", - normalized_state_path ); - fprintf( stderr, "normalized_port1_path = %s\n", - normalized_port1_path ); - fprintf( stderr, "normalized_port2_path = %s\n", - normalized_port2_path ); + fprintf( stderr, "normalized_state_path = %s\n", normalized_state_path ); + fprintf( stderr, "normalized_port1_path = %s\n", normalized_port1_path ); + fprintf( stderr, "normalized_port2_path = %s\n", normalized_port2_path ); } return ( optind ); diff --git a/src/tools/checkrom.c b/src/tools/checkrom.c index 47c694c..d8b3b89 100644 --- a/src/tools/checkrom.c +++ b/src/tools/checkrom.c @@ -1,7 +1,7 @@ #include #include -#include #include +#include #include "romio.h" @@ -10,10 +10,10 @@ unsigned short rom_crc, crc; int verbose = 0; -#define calc_crc( n ) \ - ( crc = ( ( crc >> 4 ) ^ ( ( ( crc ^ n ) & 0xf ) * 0x1081 ) ) ) +#define calc_crc( n ) ( crc = ( ( crc >> 4 ) ^ ( ( ( crc ^ n ) & 0xf ) * 0x1081 ) ) ) -int main( int argc, char** argv ) { +int main( int argc, char** argv ) +{ unsigned char version[ 7 ]; long ver_addr; int i, a, c, d, d0, d1, D0, D1; @@ -25,8 +25,7 @@ int main( int argc, char** argv ) { } if ( !read_rom_file( argv[ 1 ], &rom, &rom_size ) ) { - fprintf( stderr, "%s: can\'t read ROM from %s\n", argv[ 0 ], - argv[ 1 ] ); + fprintf( stderr, "%s: can\'t read ROM from %s\n", argv[ 0 ], argv[ 1 ] ); exit( 1 ); } diff --git a/src/tools/dump2rom.c b/src/tools/dump2rom.c index 788c7e8..9a8a5d1 100644 --- a/src/tools/dump2rom.c +++ b/src/tools/dump2rom.c @@ -1,14 +1,15 @@ +#include #include #include #include #include -#include unsigned char* core; #define DEFAULT_ROM_FILE "rom.dump" -int write_mem_file( char* name, unsigned char* mem, size_t size ) { +int write_mem_file( char* name, unsigned char* mem, size_t size ) +{ FILE* fp; unsigned char* tmp_mem; unsigned char byte; @@ -49,7 +50,8 @@ int write_mem_file( char* name, unsigned char* mem, size_t size ) { return 1; } -int main( int argc, char** argv ) { +int main( int argc, char** argv ) +{ FILE* dump; long addr; size_t size; @@ -86,8 +88,7 @@ int main( int argc, char** argv ) { } else if ( ch >= 'A' && ch <= 'F' ) { addr |= ch - 'A' + 10; } else { - fprintf( stderr, "%s: Illegal char %c at %lx\n", argv[ 0 ], ch, - addr ); + fprintf( stderr, "%s: Illegal char %c at %lx\n", argv[ 0 ], ch, addr ); error = 1; break; } @@ -101,14 +102,12 @@ int main( int argc, char** argv ) { break; } if ( ch != ':' ) { - fprintf( stderr, "%s: Illegal char %c, expected \':\' at %lx\n", - argv[ 0 ], ch, addr ); + fprintf( stderr, "%s: Illegal char %c, expected \':\' at %lx\n", argv[ 0 ], ch, addr ); break; } for ( i = 0; i < 16; i++ ) { if ( ( ch = fgetc( dump ) ) < 0 ) { - fprintf( stderr, "%s: Unexpected EOF at %lx\n", argv[ 0 ], - addr ); + fprintf( stderr, "%s: Unexpected EOF at %lx\n", argv[ 0 ], addr ); error = 1; break; } @@ -117,8 +116,7 @@ int main( int argc, char** argv ) { } else if ( ch >= 'A' && ch <= 'F' ) { core[ addr++ ] = ( unsigned char )( ch - 'A' + 10 ); } else { - fprintf( stderr, "%s: Illegal char %c at %lx\n", argv[ 0 ], ch, - addr ); + fprintf( stderr, "%s: Illegal char %c at %lx\n", argv[ 0 ], ch, addr ); error = 1; break; } @@ -128,8 +126,7 @@ int main( int argc, char** argv ) { if ( ( ch = fgetc( dump ) ) < 0 ) break; if ( ch != '\n' ) { - fprintf( stderr, "%s: Illegal char %c, expected \'\\n\' at %lx\n", - argv[ 0 ], ch, addr ); + fprintf( stderr, "%s: Illegal char %c, expected \'\\n\' at %lx\n", argv[ 0 ], ch, addr ); break; } } @@ -142,8 +139,7 @@ int main( int argc, char** argv ) { else size = 0x80000; if ( !write_mem_file( DEFAULT_ROM_FILE, core, size ) ) { - fprintf( stderr, "%s: can\'t write to %s\n", argv[ 0 ], - DEFAULT_ROM_FILE ); + fprintf( stderr, "%s: can\'t write to %s\n", argv[ 0 ], DEFAULT_ROM_FILE ); exit( 1 ); } diff --git a/src/tools/mkcard.c b/src/tools/mkcard.c index 76722c0..fa2772f 100644 --- a/src/tools/mkcard.c +++ b/src/tools/mkcard.c @@ -1,12 +1,13 @@ +#include #include #include #include #include -#include unsigned char* mem; -int write_mem_file( char* name, unsigned char* mem, size_t size ) { +int write_mem_file( char* name, unsigned char* mem, size_t size ) +{ FILE* fp; if ( NULL == ( fp = fopen( name, "w" ) ) ) { @@ -24,15 +25,15 @@ int write_mem_file( char* name, unsigned char* mem, size_t size ) { return 1; } -int main( int argc, char** argv ) { +int main( int argc, char** argv ) +{ size_t size; char* name; char* asize; unsigned char* core; if ( argc < 2 ) { - fprintf( stderr, "usage: %s [32K | 128K | 1M | 2M | 4M] file-name\n", - argv[ 0 ] ); + fprintf( stderr, "usage: %s [32K | 128K | 1M | 2M | 4M] file-name\n", argv[ 0 ] ); exit( 1 ); } @@ -53,8 +54,7 @@ int main( int argc, char** argv ) { else if ( !strcmp( asize, "4M" ) ) size = 0x400000; else { - fprintf( stderr, - "size must be one of 32K, 128K, 256K, 512K, 1M, 2M, or 4M\n" ); + fprintf( stderr, "size must be one of 32K, 128K, 256K, 512K, 1M, 2M, or 4M\n" ); exit( 1 ); } diff --git a/src/ui.c b/src/ui.c index 65d83a4..7e1043c 100644 --- a/src/ui.c +++ b/src/ui.c @@ -1,7 +1,7 @@ #include -#include "ui.h" #include "runtime_options.h" +#include "ui.h" #include "ui_inner.h" int last_annunc_state = -1; @@ -10,134 +10,135 @@ unsigned char disp_buf[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ]; unsigned char lcd_buffer[ DISP_ROWS ][ NIBS_PER_BUFFER_ROW ]; letter_t small_font[ 128 ] = { - { 0, 0, 0 }, - { nl_gx_width, nl_gx_height, nl_gx_bitmap }, /* \001 == \n gx */ - { comma_gx_width, comma_gx_height, comma_gx_bitmap }, /* \002 == comma gx */ - { arrow_gx_width, arrow_gx_height, arrow_gx_bitmap }, /* \003 == \-> gx */ - { equal_gx_width, equal_gx_height, equal_gx_bitmap }, /* \004 == equal gx */ - { pi_gx_width, pi_gx_height, pi_gx_bitmap }, /* \005 == pi gx */ - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, /* # 16 */ - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { blank_width, blank_height, blank_bitmap }, /* # 32 */ - { 0, 0, 0 }, - { 0, 0, 0 }, - { hash_width, hash_height, hash_bitmap }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { lbrace_width, lbrace_height, lbrace_bitmap }, - { rbrace_width, rbrace_height, rbrace_bitmap }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { comma_width, comma_height, comma_bitmap }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { slash_width, slash_height, slash_bitmap }, - { 0, 0, 0 }, /* # 48 */ - { 0, 0, 0 }, - { two_width, two_height, two_bitmap }, - { three_width, three_height, three_bitmap }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { small_colon_width, small_colon_height, small_colon_bitmap }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { equal_width, equal_height, equal_bitmap }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, /* # 64 */ - { A_width, A_height, A_bitmap }, - { B_width, B_height, B_bitmap }, - { C_width, C_height, C_bitmap }, - { D_width, D_height, D_bitmap }, - { E_width, E_height, E_bitmap }, - { F_width, F_height, F_bitmap }, - { G_width, G_height, G_bitmap }, - { H_width, H_height, H_bitmap }, - { I_width, I_height, I_bitmap }, - { J_width, J_height, J_bitmap }, - { K_width, K_height, K_bitmap }, - { L_width, L_height, L_bitmap }, - { M_width, M_height, M_bitmap }, - { N_width, N_height, N_bitmap }, - { O_width, O_height, O_bitmap }, - { P_width, P_height, P_bitmap }, /* # 80 */ - { Q_width, Q_height, Q_bitmap }, - { R_width, R_height, R_bitmap }, - { S_width, S_height, S_bitmap }, - { T_width, T_height, T_bitmap }, - { U_width, U_height, U_bitmap }, - { V_width, V_height, V_bitmap }, - { W_width, W_height, W_bitmap }, - { X_width, X_height, X_bitmap }, - { Y_width, Y_height, Y_bitmap }, - { Z_width, Z_height, Z_bitmap }, - { lbracket_width, lbracket_height, lbracket_bitmap }, - { 0, 0, 0 }, - { rbracket_width, rbracket_height, rbracket_bitmap }, - { 0, 0, 0 }, - { under_width, under_height, under_bitmap }, - { 0, 0, 0 }, /* # 96 */ - { arrow_width, arrow_height, arrow_bitmap }, /* a == left arrow */ - { diff_width, diff_height, diff_bitmap }, /* b == differential */ - { integral_width, integral_height, integral_bitmap }, /* c == integral */ - { sigma_width, sigma_height, sigma_bitmap }, /* d == sigma */ - { sqr_width, sqr_height, sqr_bitmap }, /* e == sqr */ - { root_width, root_height, root_bitmap }, /* f == root */ - { pow10_width, pow10_height, pow10_bitmap }, /* g == pow10 */ - { exp_width, exp_height, exp_bitmap }, /* h == exp */ - { prog_width, prog_height, prog_bitmap }, /* i == << >> */ - { string_width, string_height, string_bitmap }, /* j == " " */ - { nl_width, nl_height, nl_bitmap }, /* k == New Line */ - { pi_width, pi_height, pi_bitmap }, /* l == pi */ - { angle_width, angle_height, angle_bitmap }, /* m == angle */ - { sqr_gx_width, sqr_gx_height, sqr_gx_bitmap }, /* n == sqr gx */ - { root_gx_width, root_gx_height, root_gx_bitmap }, /* o == root gx */ - { pow10_gx_width, pow10_gx_height, pow10_gx_bitmap }, /* p == pow10 gx */ - { exp_gx_width, exp_gx_height, exp_gx_bitmap }, /* q == exp gx */ - { parens_gx_width, parens_gx_height, parens_gx_bitmap }, /* r == ( ) gx */ - { hash_gx_width, hash_gx_height, hash_gx_bitmap }, /* s == # gx */ - { bracket_gx_width, bracket_gx_height, bracket_gx_bitmap }, /* t == [] gx */ - { under_gx_width, under_gx_height, under_gx_bitmap }, /* u == _ gx */ - { prog_gx_width, prog_gx_height, prog_gx_bitmap }, /* v == << >> gx */ - { quote_gx_width, quote_gx_height, quote_gx_bitmap }, /* w == " " gx */ - { curly_gx_width, curly_gx_height, curly_gx_bitmap }, /* x == {} gx */ - { colon_gx_width, colon_gx_height, colon_gx_bitmap }, /* y == :: gx */ - { angle_gx_width, angle_gx_height, angle_gx_bitmap }, /* z == angle gx */ - { lcurly_width, lcurly_height, lcurly_bitmap }, - { 0, 0, 0 }, - { rcurly_width, rcurly_height, rcurly_bitmap }, - { 0, 0, 0 }, - { 0, 0, 0 } }; + {0, 0, 0 }, + { nl_gx_width, nl_gx_height, nl_gx_bitmap }, /* \001 == \n gx */ + { comma_gx_width, comma_gx_height, comma_gx_bitmap }, /* \002 == comma gx */ + { arrow_gx_width, arrow_gx_height, arrow_gx_bitmap }, /* \003 == \-> gx */ + { equal_gx_width, equal_gx_height, equal_gx_bitmap }, /* \004 == equal gx */ + { pi_gx_width, pi_gx_height, pi_gx_bitmap }, /* \005 == pi gx */ + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, /* # 16 */ + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { blank_width, blank_height, blank_bitmap }, /* # 32 */ + { 0, 0, 0 }, + { 0, 0, 0 }, + { hash_width, hash_height, hash_bitmap }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { lbrace_width, lbrace_height, lbrace_bitmap }, + { rbrace_width, rbrace_height, rbrace_bitmap }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { comma_width, comma_height, comma_bitmap }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { slash_width, slash_height, slash_bitmap }, + { 0, 0, 0 }, /* # 48 */ + { 0, 0, 0 }, + { two_width, two_height, two_bitmap }, + { three_width, three_height, three_bitmap }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { small_colon_width, small_colon_height, small_colon_bitmap}, + { 0, 0, 0 }, + { 0, 0, 0 }, + { equal_width, equal_height, equal_bitmap }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, /* # 64 */ + { A_width, A_height, A_bitmap }, + { B_width, B_height, B_bitmap }, + { C_width, C_height, C_bitmap }, + { D_width, D_height, D_bitmap }, + { E_width, E_height, E_bitmap }, + { F_width, F_height, F_bitmap }, + { G_width, G_height, G_bitmap }, + { H_width, H_height, H_bitmap }, + { I_width, I_height, I_bitmap }, + { J_width, J_height, J_bitmap }, + { K_width, K_height, K_bitmap }, + { L_width, L_height, L_bitmap }, + { M_width, M_height, M_bitmap }, + { N_width, N_height, N_bitmap }, + { O_width, O_height, O_bitmap }, + { P_width, P_height, P_bitmap }, /* # 80 */ + { Q_width, Q_height, Q_bitmap }, + { R_width, R_height, R_bitmap }, + { S_width, S_height, S_bitmap }, + { T_width, T_height, T_bitmap }, + { U_width, U_height, U_bitmap }, + { V_width, V_height, V_bitmap }, + { W_width, W_height, W_bitmap }, + { X_width, X_height, X_bitmap }, + { Y_width, Y_height, Y_bitmap }, + { Z_width, Z_height, Z_bitmap }, + { lbracket_width, lbracket_height, lbracket_bitmap }, + { 0, 0, 0 }, + { rbracket_width, rbracket_height, rbracket_bitmap }, + { 0, 0, 0 }, + { under_width, under_height, under_bitmap }, + { 0, 0, 0 }, /* # 96 */ + { arrow_width, arrow_height, arrow_bitmap }, /* a == left arrow */ + { diff_width, diff_height, diff_bitmap }, /* b == differential */ + { integral_width, integral_height, integral_bitmap }, /* c == integral */ + { sigma_width, sigma_height, sigma_bitmap }, /* d == sigma */ + { sqr_width, sqr_height, sqr_bitmap }, /* e == sqr */ + { root_width, root_height, root_bitmap }, /* f == root */ + { pow10_width, pow10_height, pow10_bitmap }, /* g == pow10 */ + { exp_width, exp_height, exp_bitmap }, /* h == exp */ + { prog_width, prog_height, prog_bitmap }, /* i == << >> */ + { string_width, string_height, string_bitmap }, /* j == " " */ + { nl_width, nl_height, nl_bitmap }, /* k == New Line */ + { pi_width, pi_height, pi_bitmap }, /* l == pi */ + { angle_width, angle_height, angle_bitmap }, /* m == angle */ + { sqr_gx_width, sqr_gx_height, sqr_gx_bitmap }, /* n == sqr gx */ + { root_gx_width, root_gx_height, root_gx_bitmap }, /* o == root gx */ + { pow10_gx_width, pow10_gx_height, pow10_gx_bitmap }, /* p == pow10 gx */ + { exp_gx_width, exp_gx_height, exp_gx_bitmap }, /* q == exp gx */ + { parens_gx_width, parens_gx_height, parens_gx_bitmap }, /* r == ( ) gx */ + { hash_gx_width, hash_gx_height, hash_gx_bitmap }, /* s == # gx */ + { bracket_gx_width, bracket_gx_height, bracket_gx_bitmap }, /* t == [] gx */ + { under_gx_width, under_gx_height, under_gx_bitmap }, /* u == _ gx */ + { prog_gx_width, prog_gx_height, prog_gx_bitmap }, /* v == << >> gx */ + { quote_gx_width, quote_gx_height, quote_gx_bitmap }, /* w == " " gx */ + { curly_gx_width, curly_gx_height, curly_gx_bitmap }, /* x == {} gx */ + { colon_gx_width, colon_gx_height, colon_gx_bitmap }, /* y == :: gx */ + { angle_gx_width, angle_gx_height, angle_gx_bitmap }, /* z == angle gx */ + { lcurly_width, lcurly_height, lcurly_bitmap }, + { 0, 0, 0 }, + { rcurly_width, rcurly_height, rcurly_bitmap }, + { 0, 0, 0 }, + { 0, 0, 0 } +}; void ( *ui_disp_draw_nibble )( word_20 addr, word_4 val ); void ( *ui_menu_draw_nibble )( word_20 addr, word_4 val ); @@ -149,7 +150,8 @@ void ( *ui_draw_annunc )( void ); void ( *ui_init_LCD )( void ); void ( *init_ui )( int argc, char** argv ); -void setup_frontend( void ) { +void setup_frontend( void ) +{ switch ( frontend_type ) { case FRONTEND_X11: default: @@ -190,7 +192,8 @@ void setup_frontend( void ) { } } -int SmallTextWidth( const char* string, unsigned int length ) { +int SmallTextWidth( const char* string, unsigned int length ) +{ unsigned int i; int w; @@ -200,8 +203,7 @@ int SmallTextWidth( const char* string, unsigned int length ) { w += small_font[ ( int )string[ i ] ].w + 1; } else { if ( verbose ) - fprintf( stderr, "Unknown small letter 0x00%x\n", - ( int )string[ i ] ); + fprintf( stderr, "Unknown small letter 0x00%x\n", ( int )string[ i ] ); w += 5; } } diff --git a/src/ui_inner.h b/src/ui_inner.h index 27d921b..187b6b6 100644 --- a/src/ui_inner.h +++ b/src/ui_inner.h @@ -103,119 +103,83 @@ #define hp_width 96 #define hp_height 24 static unsigned char hp_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf8, 0x9f, 0xfd, 0x3f, 0x60, 0xcc, 0x6f, 0x66, 0x83, 0xdf, 0xff, 0x3f, - 0xfc, 0x9f, 0xf1, 0x7f, 0x60, 0xcc, 0x60, 0x66, 0x83, 0x01, 0x06, 0x06, - 0xfc, 0xc7, 0xc0, 0x7f, 0x60, 0xcc, 0x60, 0x66, 0x83, 0x01, 0x06, 0x06, - 0xfc, 0xc3, 0x80, 0x7f, 0x60, 0xcc, 0x40, 0x26, 0x83, 0x01, 0x06, 0x06, - 0xfc, 0x61, 0x00, 0x7f, 0xe0, 0xcf, 0xcf, 0x36, 0x83, 0x1f, 0x06, 0x06, - 0xfc, 0x60, 0x00, 0x7e, 0x60, 0xcc, 0xc0, 0x36, 0x83, 0x01, 0x06, 0x06, - 0xfc, 0x30, 0x00, 0x7e, 0x60, 0xcc, 0x80, 0x19, 0x83, 0x01, 0x06, 0x06, - 0x7c, 0xb0, 0x68, 0x7c, 0x60, 0xcc, 0x80, 0x19, 0x83, 0x01, 0x06, 0x06, - 0x7c, 0xf8, 0xf9, 0x7c, 0x60, 0xcc, 0x8f, 0x19, 0xbf, 0x1f, 0x06, 0x06, - 0x7c, 0x98, 0xcd, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0xcc, 0xcc, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7c, 0xcc, 0x66, 0x7c, 0xe0, 0x87, 0x81, 0x67, 0x0c, 0xc3, 0xcf, 0x0f, - 0x7c, 0x66, 0x66, 0x7c, 0x60, 0xcc, 0xc3, 0x6c, 0x86, 0xc7, 0xd8, 0x18, - 0x7c, 0x66, 0x3f, 0x7e, 0x60, 0x4c, 0x62, 0x60, 0x83, 0xc4, 0xd8, 0x30, - 0xfc, 0x00, 0x03, 0x7e, 0x60, 0x6c, 0x66, 0xe0, 0xc1, 0xcc, 0xd8, 0x30, - 0xfc, 0x80, 0x01, 0x7f, 0xe0, 0x67, 0x66, 0xe0, 0xc1, 0xcc, 0xcf, 0x30, - 0xfc, 0x81, 0x81, 0x7f, 0x60, 0xe0, 0x67, 0x60, 0xc3, 0xcf, 0xcc, 0x30, - 0xfc, 0xc3, 0xc0, 0x7f, 0x60, 0x30, 0x6c, 0x60, 0x66, 0xd8, 0xd8, 0x30, - 0xfc, 0xcf, 0xf0, 0x7f, 0x60, 0x30, 0xcc, 0x6c, 0x6c, 0xd8, 0xd8, 0x18, - 0xf8, 0x6f, 0xfe, 0x3f, 0x60, 0x30, 0x8c, 0x67, 0x78, 0xd8, 0xd8, 0x0f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf8, 0x9f, 0xfd, 0x3f, 0x60, 0xcc, 0x6f, 0x66, 0x83, 0xdf, 0xff, 0x3f, 0xfc, 0x9f, 0xf1, 0x7f, 0x60, 0xcc, + 0x60, 0x66, 0x83, 0x01, 0x06, 0x06, 0xfc, 0xc7, 0xc0, 0x7f, 0x60, 0xcc, 0x60, 0x66, 0x83, 0x01, 0x06, 0x06, 0xfc, 0xc3, 0x80, + 0x7f, 0x60, 0xcc, 0x40, 0x26, 0x83, 0x01, 0x06, 0x06, 0xfc, 0x61, 0x00, 0x7f, 0xe0, 0xcf, 0xcf, 0x36, 0x83, 0x1f, 0x06, 0x06, + 0xfc, 0x60, 0x00, 0x7e, 0x60, 0xcc, 0xc0, 0x36, 0x83, 0x01, 0x06, 0x06, 0xfc, 0x30, 0x00, 0x7e, 0x60, 0xcc, 0x80, 0x19, 0x83, + 0x01, 0x06, 0x06, 0x7c, 0xb0, 0x68, 0x7c, 0x60, 0xcc, 0x80, 0x19, 0x83, 0x01, 0x06, 0x06, 0x7c, 0xf8, 0xf9, 0x7c, 0x60, 0xcc, + 0x8f, 0x19, 0xbf, 0x1f, 0x06, 0x06, 0x7c, 0x98, 0xcd, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc, + 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0x66, 0x7c, 0xe0, 0x87, 0x81, 0x67, 0x0c, 0xc3, 0xcf, 0x0f, + 0x7c, 0x66, 0x66, 0x7c, 0x60, 0xcc, 0xc3, 0x6c, 0x86, 0xc7, 0xd8, 0x18, 0x7c, 0x66, 0x3f, 0x7e, 0x60, 0x4c, 0x62, 0x60, 0x83, + 0xc4, 0xd8, 0x30, 0xfc, 0x00, 0x03, 0x7e, 0x60, 0x6c, 0x66, 0xe0, 0xc1, 0xcc, 0xd8, 0x30, 0xfc, 0x80, 0x01, 0x7f, 0xe0, 0x67, + 0x66, 0xe0, 0xc1, 0xcc, 0xcf, 0x30, 0xfc, 0x81, 0x81, 0x7f, 0x60, 0xe0, 0x67, 0x60, 0xc3, 0xcf, 0xcc, 0x30, 0xfc, 0xc3, 0xc0, + 0x7f, 0x60, 0x30, 0x6c, 0x60, 0x66, 0xd8, 0xd8, 0x30, 0xfc, 0xcf, 0xf0, 0x7f, 0x60, 0x30, 0xcc, 0x6c, 0x6c, 0xd8, 0xd8, 0x18, + 0xf8, 0x6f, 0xfe, 0x3f, 0x60, 0x30, 0x8c, 0x67, 0x78, 0xd8, 0xd8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define hp48sx_width 42 #define hp48sx_height 10 -static unsigned char hp48sx_bitmap[] = { - 0xe0, 0xf1, 0xc3, 0x3f, 0x87, 0x03, 0xf0, 0xf9, 0xe7, 0x7f, 0xc7, 0x01, - 0xf8, 0x39, 0xe7, 0x70, 0xee, 0x00, 0xdc, 0x39, 0xe7, 0x00, 0x7e, 0x00, - 0xee, 0xf0, 0xe3, 0x0f, 0x3c, 0x00, 0xe7, 0xf8, 0xc1, 0x1f, 0x1c, 0x00, - 0xff, 0x9d, 0x03, 0x1c, 0x3e, 0x00, 0xff, 0x9d, 0x3b, 0x1c, 0x3f, 0x00, - 0x70, 0xfc, 0xfb, 0x9f, 0x73, 0x00, 0x70, 0xf8, 0xf1, 0xcf, 0x71, 0x00 }; +static unsigned char hp48sx_bitmap[] = { 0xe0, 0xf1, 0xc3, 0x3f, 0x87, 0x03, 0xf0, 0xf9, 0xe7, 0x7f, 0xc7, 0x01, 0xf8, 0x39, 0xe7, + 0x70, 0xee, 0x00, 0xdc, 0x39, 0xe7, 0x00, 0x7e, 0x00, 0xee, 0xf0, 0xe3, 0x0f, 0x3c, 0x00, + 0xe7, 0xf8, 0xc1, 0x1f, 0x1c, 0x00, 0xff, 0x9d, 0x03, 0x1c, 0x3e, 0x00, 0xff, 0x9d, 0x3b, + 0x1c, 0x3f, 0x00, 0x70, 0xfc, 0xfb, 0x9f, 0x73, 0x00, 0x70, 0xf8, 0xf1, 0xcf, 0x71, 0x00 }; #define hp48gx_width 44 #define hp48gx_height 14 static unsigned char hp48gx_bitmap[] = { - 0x00, 0xc3, 0x03, 0x7c, 0x0c, 0x0c, 0x80, 0xe3, 0x07, 0xff, 0x0c, 0x0e, - 0xc0, 0x33, 0x86, 0xc3, 0x1c, 0x06, 0xe0, 0x31, 0xc6, 0xc0, 0x18, 0x03, - 0xb0, 0x31, 0xe6, 0x00, 0xb0, 0x01, 0x98, 0x31, 0x63, 0x00, 0xf0, 0x01, - 0x8c, 0xe1, 0x61, 0x00, 0xe0, 0x00, 0xc6, 0xb8, 0x31, 0xfc, 0x70, 0x00, - 0xc7, 0x18, 0x33, 0xfc, 0xf8, 0x00, 0xff, 0x0d, 0x33, 0x60, 0xd8, 0x00, - 0xff, 0x0d, 0x73, 0x60, 0x8c, 0x01, 0x60, 0x8c, 0x63, 0x30, 0x86, 0x03, - 0x60, 0xfc, 0xe1, 0x3f, 0x07, 0x03, 0x60, 0xf8, 0x80, 0x37, 0x03, 0x03 }; + 0x00, 0xc3, 0x03, 0x7c, 0x0c, 0x0c, 0x80, 0xe3, 0x07, 0xff, 0x0c, 0x0e, 0xc0, 0x33, 0x86, 0xc3, 0x1c, 0x06, 0xe0, 0x31, 0xc6, + 0xc0, 0x18, 0x03, 0xb0, 0x31, 0xe6, 0x00, 0xb0, 0x01, 0x98, 0x31, 0x63, 0x00, 0xf0, 0x01, 0x8c, 0xe1, 0x61, 0x00, 0xe0, 0x00, + 0xc6, 0xb8, 0x31, 0xfc, 0x70, 0x00, 0xc7, 0x18, 0x33, 0xfc, 0xf8, 0x00, 0xff, 0x0d, 0x33, 0x60, 0xd8, 0x00, 0xff, 0x0d, 0x73, + 0x60, 0x8c, 0x01, 0x60, 0x8c, 0x63, 0x30, 0x86, 0x03, 0x60, 0xfc, 0xe1, 0x3f, 0x07, 0x03, 0x60, 0xf8, 0x80, 0x37, 0x03, 0x03 }; #define science_width 131 #define science_height 8 static unsigned char science_bitmap[] = { - 0x38, 0x1c, 0xf2, 0x09, 0x7d, 0x79, 0xe2, 0x80, 0x2f, 0xe4, 0x41, 0x08, - 0x79, 0x20, 0x3c, 0xc2, 0x07, 0x44, 0x22, 0x12, 0x08, 0x11, 0x09, 0x12, - 0x81, 0x20, 0x22, 0x62, 0x08, 0x89, 0x30, 0x44, 0x42, 0x00, 0x02, 0x01, - 0x09, 0x94, 0x88, 0x04, 0x09, 0x40, 0x40, 0x11, 0x52, 0x94, 0x88, 0x28, - 0x42, 0x21, 0x00, 0x1c, 0x01, 0xf9, 0x94, 0x88, 0x3c, 0x09, 0xc0, 0xc7, - 0xf0, 0x51, 0x94, 0x84, 0x28, 0x3e, 0xe1, 0x03, 0xa0, 0x00, 0x09, 0x94, - 0x88, 0x04, 0x05, 0x40, 0xc0, 0x10, 0x48, 0x94, 0x44, 0x24, 0x22, 0x21, - 0x00, 0xa1, 0xa0, 0x04, 0xa2, 0x44, 0x82, 0x04, 0x21, 0xa0, 0x08, 0xfc, - 0xa2, 0x42, 0x7e, 0xa1, 0x10, 0x00, 0x91, 0x90, 0x04, 0x42, 0x44, 0x82, - 0x84, 0x20, 0x10, 0x09, 0x84, 0x42, 0x22, 0x42, 0xb1, 0x10, 0x00, 0x0e, - 0x8f, 0x7c, 0x42, 0x44, 0x82, 0x78, 0xe0, 0x0b, 0x09, 0x82, 0x42, 0x1e, - 0x41, 0x9f, 0xf7, 0x01 }; + 0x38, 0x1c, 0xf2, 0x09, 0x7d, 0x79, 0xe2, 0x80, 0x2f, 0xe4, 0x41, 0x08, 0x79, 0x20, 0x3c, 0xc2, 0x07, 0x44, 0x22, 0x12, + 0x08, 0x11, 0x09, 0x12, 0x81, 0x20, 0x22, 0x62, 0x08, 0x89, 0x30, 0x44, 0x42, 0x00, 0x02, 0x01, 0x09, 0x94, 0x88, 0x04, + 0x09, 0x40, 0x40, 0x11, 0x52, 0x94, 0x88, 0x28, 0x42, 0x21, 0x00, 0x1c, 0x01, 0xf9, 0x94, 0x88, 0x3c, 0x09, 0xc0, 0xc7, + 0xf0, 0x51, 0x94, 0x84, 0x28, 0x3e, 0xe1, 0x03, 0xa0, 0x00, 0x09, 0x94, 0x88, 0x04, 0x05, 0x40, 0xc0, 0x10, 0x48, 0x94, + 0x44, 0x24, 0x22, 0x21, 0x00, 0xa1, 0xa0, 0x04, 0xa2, 0x44, 0x82, 0x04, 0x21, 0xa0, 0x08, 0xfc, 0xa2, 0x42, 0x7e, 0xa1, + 0x10, 0x00, 0x91, 0x90, 0x04, 0x42, 0x44, 0x82, 0x84, 0x20, 0x10, 0x09, 0x84, 0x42, 0x22, 0x42, 0xb1, 0x10, 0x00, 0x0e, + 0x8f, 0x7c, 0x42, 0x44, 0x82, 0x78, 0xe0, 0x0b, 0x09, 0x82, 0x42, 0x1e, 0x41, 0x9f, 0xf7, 0x01 }; #define gx_128K_ram_x_hot 1 #define gx_128K_ram_y_hot 8 #define gx_128K_ram_width 43 #define gx_128K_ram_height 31 static unsigned char gx_128K_ram_bitmap[] = { - 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, - 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xe2, 0xdf, 0xff, 0xff, 0x03, 0x00, - 0x9c, 0xdf, 0xff, 0xff, 0x03, 0x00, 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00, - 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00, 0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, - 0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xdd, 0xff, 0x7f, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xdd, 0xff, 0xbf, 0x03, 0x00, - 0xfe, 0xdb, 0xff, 0xdf, 0x03, 0x00, 0xfe, 0xdb, 0xff, 0xef, 0x03, 0x00, - 0xfe, 0xd7, 0xff, 0xf7, 0x03, 0x00, 0xfe, 0xcf, 0xff, 0xfb, 0x03, 0x00, - 0xfe, 0xcf, 0xff, 0xfc, 0x03, 0x00, 0xfe, 0x1f, 0x3f, 0xff, 0x03, 0x00, - 0xfe, 0xdf, 0xc0, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, - 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x30, 0x12, 0x1c, 0x44, 0x04, - 0x27, 0x49, 0x0a, 0x24, 0x46, 0x04, 0x84, 0x39, 0x06, 0x24, 0xc9, 0x06, - 0x62, 0x24, 0x07, 0x9e, 0xaf, 0x06, 0x12, 0x24, 0x09, 0x92, 0xa8, 0x05, - 0xf2, 0x18, 0x11, 0x52, 0x28, 0x05 }; + 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xe2, 0xdf, 0xff, + 0xff, 0x03, 0x00, 0x9c, 0xdf, 0xff, 0xff, 0x03, 0x00, 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00, 0x7e, 0xdf, 0xff, 0xff, 0x01, 0x00, + 0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xde, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xdd, 0xff, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xfe, 0xdd, 0xff, 0xbf, 0x03, 0x00, 0xfe, 0xdb, 0xff, 0xdf, 0x03, 0x00, 0xfe, 0xdb, 0xff, 0xef, 0x03, 0x00, + 0xfe, 0xd7, 0xff, 0xf7, 0x03, 0x00, 0xfe, 0xcf, 0xff, 0xfb, 0x03, 0x00, 0xfe, 0xcf, 0xff, 0xfc, 0x03, 0x00, 0xfe, 0x1f, 0x3f, + 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xc0, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xdf, 0xff, 0xff, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc4, 0x30, 0x12, 0x1c, 0x44, 0x04, 0x27, 0x49, 0x0a, 0x24, 0x46, 0x04, 0x84, 0x39, 0x06, 0x24, 0xc9, 0x06, + 0x62, 0x24, 0x07, 0x9e, 0xaf, 0x06, 0x12, 0x24, 0x09, 0x92, 0xa8, 0x05, 0xf2, 0x18, 0x11, 0x52, 0x28, 0x05 }; #define gx_silver_x_hot 0 #define gx_silver_y_hot 8 #define gx_silver_width 35 #define gx_silver_height 21 static unsigned char gx_silver_bitmap[] = { - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x00, 0x00, 0xc4, 0x40, 0x00, 0x00, - 0x00, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, - 0x42, 0x00, 0x00, 0x02, 0x01, 0x42, 0x00, 0x00, 0x02, 0x01, 0x44, 0x00, - 0x00, 0x01, 0xfd, 0xff, 0xff, 0xff, 0x07, 0x01, 0x44, 0x00, 0x80, 0x00, - 0x01, 0x48, 0x00, 0x40, 0x00, 0x01, 0x48, 0x00, 0x20, 0x00, 0x00, 0x50, - 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x00, 0x60, 0x00, 0x06, - 0x00, 0x00, 0xc0, 0x81, 0x01, 0x00, 0x00, 0x40, 0x7e, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 }; + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x00, 0x00, 0xc4, + 0x40, 0x00, 0x00, 0x00, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, 0x41, 0x00, 0x00, 0x04, 0x02, 0x42, 0x00, 0x00, 0x02, 0x01, 0x42, + 0x00, 0x00, 0x02, 0x01, 0x44, 0x00, 0x00, 0x01, 0xfd, 0xff, 0xff, 0xff, 0x07, 0x01, 0x44, 0x00, 0x80, 0x00, 0x01, 0x48, 0x00, + 0x40, 0x00, 0x01, 0x48, 0x00, 0x20, 0x00, 0x00, 0x50, 0x00, 0x10, 0x00, 0x00, 0x60, 0x00, 0x08, 0x00, 0x00, 0x60, 0x00, 0x06, + 0x00, 0x00, 0xc0, 0x81, 0x01, 0x00, 0x00, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 }; #define gx_green_x_hot 11 #define gx_green_y_hot 0 #define gx_green_width 34 #define gx_green_height 22 static unsigned char gx_green_bitmap[] = { - 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, - 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, - 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, - 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, - 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, - 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, - 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, - 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03 }; + 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0xfc, + 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, + 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, + 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0x03 }; /* #endif /\* !_HP_H *\/ */ @@ -224,39 +188,33 @@ static unsigned char gx_green_bitmap[] = { #define ann_alpha_width 15 #define ann_alpha_height 12 -static unsigned char ann_alpha_bitmap[] = { - 0xe0, 0x03, 0x18, 0x44, 0x0c, 0x4c, 0x06, 0x2c, 0x07, 0x2c, 0x07, 0x1c, - 0x07, 0x0c, 0x07, 0x0c, 0x07, 0x0e, 0x0e, 0x4d, 0xf8, 0x38, 0x00, 0x00 }; +static unsigned char ann_alpha_bitmap[] = { 0xe0, 0x03, 0x18, 0x44, 0x0c, 0x4c, 0x06, 0x2c, 0x07, 0x2c, 0x07, 0x1c, + 0x07, 0x0c, 0x07, 0x0c, 0x07, 0x0e, 0x0e, 0x4d, 0xf8, 0x38, 0x00, 0x00 }; #define ann_battery_width 15 #define ann_battery_height 12 -static unsigned char ann_battery_bitmap[] = { - 0x04, 0x10, 0x02, 0x20, 0x12, 0x24, 0x09, 0x48, 0xc9, 0x49, 0xc9, 0x49, - 0xc9, 0x49, 0x09, 0x48, 0x12, 0x24, 0x02, 0x20, 0x04, 0x10, 0x00, 0x00 }; +static unsigned char ann_battery_bitmap[] = { 0x04, 0x10, 0x02, 0x20, 0x12, 0x24, 0x09, 0x48, 0xc9, 0x49, 0xc9, 0x49, + 0xc9, 0x49, 0x09, 0x48, 0x12, 0x24, 0x02, 0x20, 0x04, 0x10, 0x00, 0x00 }; #define ann_busy_width 15 #define ann_busy_height 12 -static unsigned char ann_busy_bitmap[] = { - 0xfc, 0x1f, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, - 0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0xc8, 0x09, 0xe8, 0x0b, 0xfc, 0x1f }; +static unsigned char ann_busy_bitmap[] = { 0xfc, 0x1f, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, + 0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0xc8, 0x09, 0xe8, 0x0b, 0xfc, 0x1f }; #define ann_io_width 15 #define ann_io_height 12 -static unsigned char ann_io_bitmap[] = { - 0x0c, 0x00, 0x1e, 0x00, 0x33, 0x0c, 0x61, 0x18, 0xcc, 0x30, 0xfe, 0x7f, - 0xfe, 0x7f, 0xcc, 0x30, 0x61, 0x18, 0x33, 0x0c, 0x1e, 0x00, 0x0c, 0x00 }; +static unsigned char ann_io_bitmap[] = { 0x0c, 0x00, 0x1e, 0x00, 0x33, 0x0c, 0x61, 0x18, 0xcc, 0x30, 0xfe, 0x7f, + 0xfe, 0x7f, 0xcc, 0x30, 0x61, 0x18, 0x33, 0x0c, 0x1e, 0x00, 0x0c, 0x00 }; #define ann_left_width 15 #define ann_left_height 12 -static unsigned char ann_left_bitmap[] = { - 0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78, - 0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33 }; +static unsigned char ann_left_bitmap[] = { 0xfe, 0x3f, 0xff, 0x7f, 0x9f, 0x7f, 0xcf, 0x7f, 0xe7, 0x7f, 0x03, 0x78, + 0x03, 0x70, 0xe7, 0x73, 0xcf, 0x73, 0x9f, 0x73, 0xff, 0x73, 0xfe, 0x33 }; #define ann_right_width 15 #define ann_right_height 12 -static unsigned char ann_right_bitmap[] = { - 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60, - 0x07, 0x60, 0xe7, 0x73, 0xe7, 0x79, 0xe7, 0x7c, 0xe7, 0x7f, 0xe6, 0x3f }; +static unsigned char ann_right_bitmap[] = { 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7c, 0xff, 0x79, 0xff, 0x73, 0x0f, 0x60, + 0x07, 0x60, 0xe7, 0x73, 0xe7, 0x79, 0xe7, 0x7c, 0xe7, 0x7f, 0xe6, 0x3f }; /* #endif /\* !_ANNUNC_H *\/ */ @@ -265,134 +223,107 @@ static unsigned char ann_right_bitmap[] = { #define menu_label_width 24 #define menu_label_height 11 -static unsigned char menu_label_bitmap[] = { - 0xfe, 0xff, 0x7f, 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, 0xfe, 0xff, 0x7f }; +static unsigned char menu_label_bitmap[] = { 0xfe, 0xff, 0x7f, 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, 0xfe, 0xff, 0x7f }; #define up_width 11 #define up_height 11 -static unsigned char up_bitmap[] = { - 0x20, 0x00, 0x20, 0x00, 0x70, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xf8, - 0x00, 0xfc, 0x01, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x03, 0xff, 0x07 }; +static unsigned char up_bitmap[] = { 0x20, 0x00, 0x20, 0x00, 0x70, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xf8, + 0x00, 0xfc, 0x01, 0xfc, 0x01, 0xfe, 0x03, 0xfe, 0x03, 0xff, 0x07 }; #define down_width 11 #define down_height 11 -static unsigned char down_bitmap[] = { - 0xff, 0x07, 0xfe, 0x03, 0xfe, 0x03, 0xfc, 0x01, 0xfc, 0x01, 0xf8, - 0x00, 0xf8, 0x00, 0x70, 0x00, 0x70, 0x00, 0x20, 0x00, 0x20, 0x00 }; +static unsigned char down_bitmap[] = { 0xff, 0x07, 0xfe, 0x03, 0xfe, 0x03, 0xfc, 0x01, 0xfc, 0x01, 0xf8, + 0x00, 0xf8, 0x00, 0x70, 0x00, 0x70, 0x00, 0x20, 0x00, 0x20, 0x00 }; #define left_width 11 #define left_height 11 -static unsigned char left_bitmap[] = { - 0x00, 0x04, 0x00, 0x07, 0xc0, 0x07, 0xf0, 0x07, 0xfc, 0x07, 0xff, - 0x07, 0xfc, 0x07, 0xf0, 0x07, 0xc0, 0x07, 0x00, 0x07, 0x00, 0x04 }; +static unsigned char left_bitmap[] = { 0x00, 0x04, 0x00, 0x07, 0xc0, 0x07, 0xf0, 0x07, 0xfc, 0x07, 0xff, + 0x07, 0xfc, 0x07, 0xf0, 0x07, 0xc0, 0x07, 0x00, 0x07, 0x00, 0x04 }; #define right_width 11 #define right_height 11 -static unsigned char right_bitmap[] = { - 0x01, 0x00, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, - 0x07, 0xff, 0x01, 0x7f, 0x00, 0x1f, 0x00, 0x07, 0x00, 0x01, 0x00 }; +static unsigned char right_bitmap[] = { 0x01, 0x00, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x00, 0xff, 0x01, 0xff, + 0x07, 0xff, 0x01, 0x7f, 0x00, 0x1f, 0x00, 0x07, 0x00, 0x01, 0x00 }; #define sqrt_width 20 #define sqrt_height 11 -static unsigned char sqrt_bitmap[] = { - 0x00, 0xff, 0x0f, 0x00, 0x01, 0x08, 0x00, 0x01, 0x08, 0x80, 0x8c, - 0x01, 0x80, 0x58, 0x01, 0x80, 0x38, 0x00, 0x47, 0x30, 0x00, 0x4c, - 0x30, 0x00, 0x58, 0x78, 0x00, 0x30, 0x6a, 0x01, 0x20, 0xc6, 0x00 }; +static unsigned char sqrt_bitmap[] = { 0x00, 0xff, 0x0f, 0x00, 0x01, 0x08, 0x00, 0x01, 0x08, 0x80, 0x8c, 0x01, 0x80, 0x58, 0x01, 0x80, 0x38, + 0x00, 0x47, 0x30, 0x00, 0x4c, 0x30, 0x00, 0x58, 0x78, 0x00, 0x30, 0x6a, 0x01, 0x20, 0xc6, 0x00 }; #define power_width 17 #define power_height 14 -static unsigned char power_bitmap[] = { - 0x00, 0x8c, 0x01, 0x00, 0x58, 0x01, 0x00, 0x38, 0x00, 0xc8, 0x30, - 0x00, 0x9c, 0x30, 0x00, 0x98, 0x78, 0x00, 0x58, 0x6a, 0x01, 0x58, - 0xc6, 0x00, 0x38, 0x00, 0x00, 0x30, 0x00, 0x00, 0x10, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00 }; +static unsigned char power_bitmap[] = { 0x00, 0x8c, 0x01, 0x00, 0x58, 0x01, 0x00, 0x38, 0x00, 0xc8, 0x30, 0x00, 0x9c, 0x30, + 0x00, 0x98, 0x78, 0x00, 0x58, 0x6a, 0x01, 0x58, 0xc6, 0x00, 0x38, 0x00, 0x00, 0x30, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00 }; #define inv_width 18 #define inv_height 13 -static unsigned char inv_bitmap[] = { - 0x0c, 0x04, 0x00, 0x0f, 0x06, 0x00, 0x0c, 0x02, 0x00, 0x0c, - 0x03, 0x00, 0x0c, 0x01, 0x00, 0x8c, 0x19, 0x03, 0x8c, 0xb0, - 0x02, 0xcc, 0x70, 0x00, 0x40, 0x60, 0x00, 0x60, 0x60, 0x00, - 0x20, 0xf0, 0x00, 0x30, 0xd4, 0x02, 0x10, 0x8c, 0x01 }; +static unsigned char inv_bitmap[] = { 0x0c, 0x04, 0x00, 0x0f, 0x06, 0x00, 0x0c, 0x02, 0x00, 0x0c, 0x03, 0x00, 0x0c, + 0x01, 0x00, 0x8c, 0x19, 0x03, 0x8c, 0xb0, 0x02, 0xcc, 0x70, 0x00, 0x40, 0x60, + 0x00, 0x60, 0x60, 0x00, 0x20, 0xf0, 0x00, 0x30, 0xd4, 0x02, 0x10, 0x8c, 0x01 }; #define neg_width 21 #define neg_height 11 -static unsigned char neg_bitmap[] = { - 0x18, 0x00, 0x00, 0x18, 0x30, 0x00, 0x18, 0x30, 0x00, 0xff, 0x18, - 0x00, 0xff, 0x18, 0x00, 0x18, 0x0c, 0x00, 0x18, 0x0c, 0x00, 0x18, - 0xc6, 0x1f, 0x00, 0xc6, 0x1f, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00 }; +static unsigned char neg_bitmap[] = { 0x18, 0x00, 0x00, 0x18, 0x30, 0x00, 0x18, 0x30, 0x00, 0xff, 0x18, 0x00, 0xff, 0x18, 0x00, 0x18, 0x0c, + 0x00, 0x18, 0x0c, 0x00, 0x18, 0xc6, 0x1f, 0x00, 0xc6, 0x1f, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00 }; #define bs_width 11 #define bs_height 11 -static unsigned char bs_bitmap[] = { - 0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0xfc, 0x07, 0xfe, 0x07, 0xff, - 0x07, 0xfe, 0x07, 0xfc, 0x07, 0x38, 0x00, 0x30, 0x00, 0x20, 0x00 }; +static unsigned char bs_bitmap[] = { 0x20, 0x00, 0x30, 0x00, 0x38, 0x00, 0xfc, 0x07, 0xfe, 0x07, 0xff, + 0x07, 0xfe, 0x07, 0xfc, 0x07, 0x38, 0x00, 0x30, 0x00, 0x20, 0x00 }; #define alpha_width 12 #define alpha_height 10 -static unsigned char alpha_bitmap[] = { - 0x78, 0x00, 0x84, 0x08, 0x82, 0x09, 0x83, 0x05, 0x83, 0x05, - 0x83, 0x03, 0x83, 0x01, 0x83, 0x01, 0x46, 0x09, 0x3c, 0x06 }; +static unsigned char alpha_bitmap[] = { 0x78, 0x00, 0x84, 0x08, 0x82, 0x09, 0x83, 0x05, 0x83, 0x05, + 0x83, 0x03, 0x83, 0x01, 0x83, 0x01, 0x46, 0x09, 0x3c, 0x06 }; #define div_width 10 #define div_height 10 -static unsigned char div_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x03, 0xff, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x30, 0x00, 0x30, 0x00 }; +static unsigned char div_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, + 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00 }; #define shl_width 24 #define shl_height 14 -static unsigned char shl_bitmap[] = { - 0xfe, 0xff, 0x7f, 0xff, 0xfc, 0xff, 0x7f, 0xfc, 0xff, 0x3f, 0xfe, - 0xff, 0x1f, 0xff, 0xff, 0x0f, 0x00, 0xfc, 0x07, 0x00, 0xf8, 0x0f, - 0x00, 0xf0, 0x1f, 0xff, 0xf1, 0x3f, 0xfe, 0xf1, 0x7f, 0xfc, 0xf1, - 0xff, 0xfc, 0xf1, 0xff, 0xff, 0xf1, 0xfe, 0xff, 0x71 }; +static unsigned char shl_bitmap[] = { 0xfe, 0xff, 0x7f, 0xff, 0xfc, 0xff, 0x7f, 0xfc, 0xff, 0x3f, 0xfe, 0xff, 0x1f, 0xff, + 0xff, 0x0f, 0x00, 0xfc, 0x07, 0x00, 0xf8, 0x0f, 0x00, 0xf0, 0x1f, 0xff, 0xf1, 0x3f, + 0xfe, 0xf1, 0x7f, 0xfc, 0xf1, 0xff, 0xfc, 0xf1, 0xff, 0xff, 0xf1, 0xfe, 0xff, 0x71 }; #define mul_width 10 #define mul_height 10 -static unsigned char mul_bitmap[] = { 0x03, 0x03, 0x87, 0x03, 0xce, 0x01, 0xfc, - 0x00, 0x78, 0x00, 0x78, 0x00, 0xfc, 0x00, - 0xce, 0x01, 0x87, 0x03, 0x03, 0x03 }; +static unsigned char mul_bitmap[] = { 0x03, 0x03, 0x87, 0x03, 0xce, 0x01, 0xfc, 0x00, 0x78, 0x00, + 0x78, 0x00, 0xfc, 0x00, 0xce, 0x01, 0x87, 0x03, 0x03, 0x03 }; #define shr_width 24 #define shr_height 14 -static unsigned char shr_bitmap[] = { - 0xfe, 0xff, 0x7f, 0xff, 0x3f, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0x7f, - 0xfc, 0xff, 0xff, 0xf8, 0x3f, 0x00, 0xf0, 0x1f, 0x00, 0xe0, 0x0f, - 0x00, 0xf0, 0x8f, 0xff, 0xf8, 0x8f, 0x7f, 0xfc, 0x8f, 0x3f, 0xfe, - 0x8f, 0x3f, 0xff, 0x8f, 0xff, 0xff, 0x8e, 0xff, 0x7f }; +static unsigned char shr_bitmap[] = { 0xfe, 0xff, 0x7f, 0xff, 0x3f, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0x7f, 0xfc, 0xff, 0xff, + 0xf8, 0x3f, 0x00, 0xf0, 0x1f, 0x00, 0xe0, 0x0f, 0x00, 0xf0, 0x8f, 0xff, 0xf8, 0x8f, + 0x7f, 0xfc, 0x8f, 0x3f, 0xfe, 0x8f, 0x3f, 0xff, 0x8f, 0xff, 0xff, 0x8e, 0xff, 0x7f }; #define minus_width 10 #define minus_height 10 -static unsigned char minus_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, - 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static unsigned char minus_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, + 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define plus_width 10 #define plus_height 10 -static unsigned char plus_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, - 0x00, 0xff, 0x03, 0xff, 0x03, 0x30, 0x00, - 0x30, 0x00, 0x30, 0x00, 0x30, 0x00 }; +static unsigned char plus_bitmap[] = { 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0xff, 0x03, + 0xff, 0x03, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00 }; #define colon_width 2 #define colon_height 10 -static unsigned char colon_bitmap[] = { 0x03, 0x03, 0x03, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00 }; +static unsigned char colon_bitmap[] = { 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; /* Below used only for X11 */ #define last_width 120 #define last_height 6 -static unsigned char last_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xc6, 0x1c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x11, 0x49, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, 0x8f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xc9, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }; +static unsigned char last_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xc6, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x11, 0x49, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x8f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x29, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xc9, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }; /* #endif /\* !_BUTTONS_H *\/ */ @@ -404,48 +335,39 @@ static unsigned char last_bitmap[] = { #define blank_width 4 #define blank_height 7 -static unsigned char blank_bitmap[] = { 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 }; +static unsigned char blank_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define hash_width 5 #define hash_height 7 -static unsigned char hash_bitmap[] = { 0x00, 0x0a, 0x1f, 0x0a, - 0x0a, 0x1f, 0x0a }; +static unsigned char hash_bitmap[] = { 0x00, 0x0a, 0x1f, 0x0a, 0x0a, 0x1f, 0x0a }; #define lbrace_width 3 #define lbrace_height 7 -static unsigned char lbrace_bitmap[] = { 0x04, 0x02, 0x01, 0x01, - 0x01, 0x02, 0x04 }; +static unsigned char lbrace_bitmap[] = { 0x04, 0x02, 0x01, 0x01, 0x01, 0x02, 0x04 }; #define rbrace_width 3 #define rbrace_height 7 -static unsigned char rbrace_bitmap[] = { 0x01, 0x02, 0x04, 0x04, - 0x04, 0x02, 0x01 }; +static unsigned char rbrace_bitmap[] = { 0x01, 0x02, 0x04, 0x04, 0x04, 0x02, 0x01 }; #define comma_width 3 #define comma_height 7 -static unsigned char comma_bitmap[] = { 0x00, 0x00, 0x00, 0x00, - 0x06, 0x06, 0x03 }; +static unsigned char comma_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x03 }; #define slash_width 3 #define slash_height 7 -static unsigned char slash_bitmap[] = { 0x04, 0x04, 0x02, 0x02, - 0x02, 0x01, 0x01 }; +static unsigned char slash_bitmap[] = { 0x04, 0x04, 0x02, 0x02, 0x02, 0x01, 0x01 }; #define two_width 5 #define two_height 7 -static unsigned char two_bitmap[] = { 0x0e, 0x11, 0x10, 0x08, - 0x04, 0x02, 0x1f }; +static unsigned char two_bitmap[] = { 0x0e, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1f }; #define three_width 5 #define three_height 7 -static unsigned char three_bitmap[] = { 0x0e, 0x11, 0x10, 0x0c, - 0x10, 0x11, 0x0e }; +static unsigned char three_bitmap[] = { 0x0e, 0x11, 0x10, 0x0c, 0x10, 0x11, 0x0e }; #define small_colon_width 2 #define small_colon_height 7 -static unsigned char small_colon_bitmap[] = { 0x00, 0x03, 0x03, 0x00, - 0x03, 0x03, 0x00 }; +static unsigned char small_colon_bitmap[] = { 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00 }; #define A_width 5 #define A_height 7 @@ -553,81 +475,64 @@ static unsigned char Z_bitmap[] = { 0x1f, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f }; #define lbracket_width 3 #define lbracket_height 7 -static unsigned char lbracket_bitmap[] = { 0x07, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x07 }; +static unsigned char lbracket_bitmap[] = { 0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07 }; #define rbracket_width 3 #define rbracket_height 7 -static unsigned char rbracket_bitmap[] = { 0x07, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x07 }; +static unsigned char rbracket_bitmap[] = { 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07 }; #define arrow_width 7 #define arrow_height 7 -static unsigned char arrow_bitmap[] = { 0x00, 0x08, 0x18, 0x3f, - 0x18, 0x08, 0x00 }; +static unsigned char arrow_bitmap[] = { 0x00, 0x08, 0x18, 0x3f, 0x18, 0x08, 0x00 }; #define diff_width 5 #define diff_height 7 -static unsigned char diff_bitmap[] = { 0x0e, 0x10, 0x10, 0x1e, - 0x11, 0x11, 0x0e }; +static unsigned char diff_bitmap[] = { 0x0e, 0x10, 0x10, 0x1e, 0x11, 0x11, 0x0e }; #define integral_width 5 #define integral_height 8 -static unsigned char integral_bitmap[] = { 0x0c, 0x12, 0x02, 0x04, - 0x04, 0x08, 0x09, 0x06 }; +static unsigned char integral_bitmap[] = { 0x0c, 0x12, 0x02, 0x04, 0x04, 0x08, 0x09, 0x06 }; #define sigma_width 6 #define sigma_height 9 -static unsigned char sigma_bitmap[] = { 0x3f, 0x21, 0x02, 0x04, 0x08, - 0x04, 0x02, 0x21, 0x3f }; +static unsigned char sigma_bitmap[] = { 0x3f, 0x21, 0x02, 0x04, 0x08, 0x04, 0x02, 0x21, 0x3f }; #define sqr_width 11 #define sqr_height 10 -static unsigned char sqr_bitmap[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00, - 0x02, 0x26, 0x01, 0x94, 0x07, 0x08, 0x00, - 0x14, 0x00, 0x53, 0x00, 0x21, 0x00 }; +static unsigned char sqr_bitmap[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00, 0x02, 0x26, 0x01, + 0x94, 0x07, 0x08, 0x00, 0x14, 0x00, 0x53, 0x00, 0x21, 0x00 }; #define root_width 18 #define root_height 13 -static unsigned char root_bitmap[] = { - 0x26, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0xfe, 0x03, 0x14, - 0x02, 0x02, 0x53, 0x02, 0x00, 0x21, 0x99, 0x00, 0x00, 0x91, - 0x00, 0x10, 0x91, 0x00, 0xa0, 0x50, 0x00, 0xc0, 0x60, 0x00, - 0x80, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x00 }; +static unsigned char root_bitmap[] = { 0x26, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0xfe, 0x03, 0x14, 0x02, 0x02, 0x53, + 0x02, 0x00, 0x21, 0x99, 0x00, 0x00, 0x91, 0x00, 0x10, 0x91, 0x00, 0xa0, 0x50, + 0x00, 0xc0, 0x60, 0x00, 0x80, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x00 }; #define pow10_width 13 #define pow10_height 9 -static unsigned char pow10_bitmap[] = { 0x00, 0x12, 0x00, 0x0c, 0x32, 0x04, - 0x4b, 0x0a, 0x4a, 0x09, 0x4a, 0x00, - 0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 }; +static unsigned char pow10_bitmap[] = { 0x00, 0x12, 0x00, 0x0c, 0x32, 0x04, 0x4b, 0x0a, 0x4a, + 0x09, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 }; #define exp_width 11 #define exp_height 9 -static unsigned char exp_bitmap[] = { 0x80, 0x04, 0x00, 0x03, 0x00, 0x01, - 0x8c, 0x02, 0x52, 0x02, 0x09, 0x00, - 0x07, 0x00, 0x21, 0x00, 0x1e, 0x00 }; +static unsigned char exp_bitmap[] = { 0x80, 0x04, 0x00, 0x03, 0x00, 0x01, 0x8c, 0x02, 0x52, + 0x02, 0x09, 0x00, 0x07, 0x00, 0x21, 0x00, 0x1e, 0x00 }; #define under_width 6 #define under_height 7 -static unsigned char under_bitmap[] = { 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3f }; +static unsigned char under_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f }; #define prog_width 16 #define prog_height 7 -static unsigned char prog_bitmap[] = { 0x48, 0x12, 0x24, 0x24, 0x12, - 0x48, 0x09, 0x90, 0x12, 0x48, - 0x24, 0x24, 0x48, 0x12 }; +static unsigned char prog_bitmap[] = { 0x48, 0x12, 0x24, 0x24, 0x12, 0x48, 0x09, 0x90, 0x12, 0x48, 0x24, 0x24, 0x48, 0x12 }; #define string_width 10 #define string_height 7 -static unsigned char string_bitmap[] = { 0x85, 0x02, 0x85, 0x02, 0x85, - 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 }; +static unsigned char string_bitmap[] = { 0x85, 0x02, 0x85, 0x02, 0x85, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define equal_width 5 #define equal_height 7 -static unsigned char equal_bitmap[] = { 0x00, 0x1f, 0x00, 0x00, - 0x1f, 0x00, 0x00 }; +static unsigned char equal_bitmap[] = { 0x00, 0x1f, 0x00, 0x00, 0x1f, 0x00, 0x00 }; #define nl_width 8 #define nl_height 7 @@ -639,128 +544,105 @@ static unsigned char pi_bitmap[] = { 0x20, 0x1f, 0x12, 0x12, 0x12, 0x12, 0x12 }; #define angle_width 8 #define angle_height 7 -static unsigned char angle_bitmap[] = { 0x40, 0x20, 0x10, 0x28, - 0x44, 0x42, 0xff }; +static unsigned char angle_bitmap[] = { 0x40, 0x20, 0x10, 0x28, 0x44, 0x42, 0xff }; #define lcurly_width 5 #define lcurly_height 7 -static unsigned char lcurly_bitmap[] = { 0x18, 0x04, 0x04, 0x02, - 0x04, 0x04, 0x18 }; +static unsigned char lcurly_bitmap[] = { 0x18, 0x04, 0x04, 0x02, 0x04, 0x04, 0x18 }; #define rcurly_width 5 #define rcurly_height 7 -static unsigned char rcurly_bitmap[] = { 0x03, 0x04, 0x04, 0x08, - 0x04, 0x04, 0x03 }; +static unsigned char rcurly_bitmap[] = { 0x03, 0x04, 0x04, 0x08, 0x04, 0x04, 0x03 }; #define sqr_gx_width 11 #define sqr_gx_height 13 -static unsigned char sqr_gx_bitmap[] = { - 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, - 0x01, 0x80, 0x07, 0x00, 0x00, 0x66, 0x00, 0x14, 0x00, - 0x08, 0x00, 0x14, 0x00, 0x53, 0x00, 0x21, 0x00 }; +static unsigned char sqr_gx_bitmap[] = { 0x00, 0x03, 0x80, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x80, 0x07, 0x00, + 0x00, 0x66, 0x00, 0x14, 0x00, 0x08, 0x00, 0x14, 0x00, 0x53, 0x00, 0x21, 0x00 }; #define root_gx_width 18 #define root_gx_height 15 -static unsigned char root_gx_bitmap[] = { - 0x66, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x14, 0x00, 0x00, - 0x53, 0xfe, 0x03, 0x21, 0x02, 0x02, 0x00, 0x02, 0x00, 0x00, 0x99, 0x00, - 0x00, 0x91, 0x00, 0x10, 0x91, 0x00, 0xa0, 0x50, 0x00, 0xc0, 0x60, 0x00, - 0x80, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x00 }; +static unsigned char root_gx_bitmap[] = { 0x66, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x14, 0x00, 0x00, 0x53, 0xfe, 0x03, + 0x21, 0x02, 0x02, 0x00, 0x02, 0x00, 0x00, 0x99, 0x00, 0x00, 0x91, 0x00, 0x10, 0x91, 0x00, + 0xa0, 0x50, 0x00, 0xc0, 0x60, 0x00, 0x80, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x00 }; #define pow10_gx_width 13 #define pow10_gx_height 12 -static unsigned char pow10_gx_bitmap[] = { - 0x00, 0x12, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x09, 0x32, 0x00, - 0x4b, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 }; +static unsigned char pow10_gx_bitmap[] = { 0x00, 0x12, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x09, 0x32, 0x00, + 0x4b, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x4a, 0x00, 0x32, 0x00 }; #define exp_gx_width 13 #define exp_gx_height 12 -static unsigned char exp_gx_bitmap[] = { - 0x00, 0xfb, 0x00, 0xf6, 0x00, 0xe6, 0x00, 0xf6, 0x80, 0xed, 0x18, 0xe0, - 0x36, 0xe0, 0x36, 0xe0, 0x1f, 0xe0, 0x03, 0xe0, 0x13, 0xe0, 0x0e, 0xe0 }; +static unsigned char exp_gx_bitmap[] = { 0x00, 0xfb, 0x00, 0xf6, 0x00, 0xe6, 0x00, 0xf6, 0x80, 0xed, 0x18, 0xe0, + 0x36, 0xe0, 0x36, 0xe0, 0x1f, 0xe0, 0x03, 0xe0, 0x13, 0xe0, 0x0e, 0xe0 }; #define parens_gx_width 20 #define parens_gx_height 12 -static unsigned char parens_gx_bitmap[] = { - 0x0c, 0x00, 0x03, 0x06, 0x00, 0x06, 0x06, 0x00, 0x06, 0x03, 0x00, 0x0c, - 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, - 0x03, 0x00, 0x0c, 0x06, 0x00, 0x06, 0x06, 0x00, 0x06, 0x0c, 0x00, 0x03 }; +static unsigned char parens_gx_bitmap[] = { 0x0c, 0x00, 0x03, 0x06, 0x00, 0x06, 0x06, 0x00, 0x06, 0x03, 0x00, 0x0c, + 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, 0x03, 0x00, 0x0c, + 0x03, 0x00, 0x0c, 0x06, 0x00, 0x06, 0x06, 0x00, 0x06, 0x0c, 0x00, 0x03 }; #define hash_gx_width 8 #define hash_gx_height 12 -static unsigned char hash_gx_bitmap[] = { 0x00, 0x00, 0x48, 0x48, 0xfe, 0x24, - 0x24, 0x7f, 0x12, 0x12, 0x00, 0x00 }; +static unsigned char hash_gx_bitmap[] = { 0x00, 0x00, 0x48, 0x48, 0xfe, 0x24, 0x24, 0x7f, 0x12, 0x12, 0x00, 0x00 }; #define bracket_gx_width 12 #define bracket_gx_height 12 -static unsigned char bracket_gx_bitmap[] = { - 0x0f, 0x0f, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, - 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x0f, 0x0f }; +static unsigned char bracket_gx_bitmap[] = { 0x0f, 0x0f, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, + 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x03, 0x0c, 0x0f, 0x0f }; #define under_gx_width 10 #define under_gx_height 12 -static unsigned char under_gx_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0xff, 0x03 }; +static unsigned char under_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0xff, 0x03 }; #define prog_gx_width 24 #define prog_gx_height 12 -static unsigned char prog_gx_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xc3, 0x18, - 0x8c, 0x81, 0x31, 0xc6, 0x00, 0x63, 0x63, 0x00, 0xc6, 0xc6, 0x00, 0x63, - 0x8c, 0x81, 0x31, 0x18, 0xc3, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static unsigned char prog_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xc3, 0x18, + 0x8c, 0x81, 0x31, 0xc6, 0x00, 0x63, 0x63, 0x00, 0xc6, 0xc6, 0x00, 0x63, + 0x8c, 0x81, 0x31, 0x18, 0xc3, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define quote_gx_width 12 #define quote_gx_height 12 -static unsigned char quote_gx_bitmap[] = { - 0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static unsigned char quote_gx_bitmap[] = { 0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define curly_gx_width 14 #define curly_gx_height 12 -static unsigned char curly_gx_bitmap[] = { - 0x0c, 0x0c, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x03, 0x30, - 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x0c, 0x0c }; +static unsigned char curly_gx_bitmap[] = { 0x0c, 0x0c, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x03, 0x30, + 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x06, 0x18, 0x0c, 0x0c }; #define colon_gx_width 8 #define colon_gx_height 12 -static unsigned char colon_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, - 0xc3, 0x00, 0x00, 0xc3, 0xc3, 0x00 }; +static unsigned char colon_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x00, 0x00, 0xc3, 0xc3, 0x00 }; #define angle_gx_width 12 #define angle_gx_height 12 -static unsigned char angle_gx_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0xe0, 0x01, - 0xb0, 0x03, 0x18, 0x03, 0x0c, 0x03, 0x06, 0x03, 0xff, 0x0f, 0xff, 0x0f }; +static unsigned char angle_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xc0, 0x00, 0xe0, 0x01, + 0xb0, 0x03, 0x18, 0x03, 0x0c, 0x03, 0x06, 0x03, 0xff, 0x0f, 0xff, 0x0f }; #define pi_gx_width 10 #define pi_gx_height 12 -static unsigned char pi_gx_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0x03, 0xff, 0x01, - 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00 }; +static unsigned char pi_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0x03, 0xff, 0x01, + 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00, 0xcc, 0x00 }; #define nl_gx_width 18 #define nl_gx_height 12 -static unsigned char nl_gx_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x03, 0xf0, 0x00, 0x03, - 0xfc, 0x00, 0x03, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0xfc, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static unsigned char nl_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x03, 0xf0, 0x00, 0x03, + 0xfc, 0x00, 0x03, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0xfc, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define comma_gx_width 3 #define comma_gx_height 12 -static unsigned char comma_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x07, 0x07, 0x04, 0x04, 0x02 }; +static unsigned char comma_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x04, 0x04, 0x02 }; #define arrow_gx_width 18 #define arrow_gx_height 12 -static unsigned char arrow_gx_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x3c, 0x00, - 0x00, 0xfc, 0x00, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0x00, 0xfc, 0x00, - 0x00, 0x3c, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static unsigned char arrow_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x3c, 0x00, + 0x00, 0xfc, 0x00, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0x00, 0xfc, 0x00, + 0x00, 0x3c, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define equal_gx_width 8 #define equal_gx_height 12 -static unsigned char equal_gx_bitmap[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, - 0x00, 0xff, 0xff, 0x00, 0x00, 0x00 }; +static unsigned char equal_gx_bitmap[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00 }; /*************/ /* functions */ diff --git a/src/ui_sdl.c b/src/ui_sdl.c index 3a74b63..f560da0 100644 --- a/src/ui_sdl.c +++ b/src/ui_sdl.c @@ -1,27 +1,25 @@ +#include #include #include #include #include #include -#include -#include #include #include #include +#include #include #include /* lineColor(); pixelColor(); rectangleColor();stringColor(); */ -#include "runtime_options.h" #include "emulator.h" #include "romio.h" +#include "runtime_options.h" #include "ui.h" #include "ui_inner.h" -#define _KEYBOARD_HEIGHT \ - ( buttons_gx[ LAST_BUTTON ].y + buttons_gx[ LAST_BUTTON ].h ) -#define _KEYBOARD_WIDTH \ - ( buttons_gx[ LAST_BUTTON ].x + buttons_gx[ LAST_BUTTON ].w ) +#define _KEYBOARD_HEIGHT ( buttons_gx[ LAST_BUTTON ].y + buttons_gx[ LAST_BUTTON ].h ) +#define _KEYBOARD_WIDTH ( buttons_gx[ LAST_BUTTON ].x + buttons_gx[ LAST_BUTTON ].w ) #define _TOP_SKIP 65 #define _SIDE_SKIP 20 @@ -106,698 +104,193 @@ typedef struct sdl_ann_struct_t { static sdl_keypad_t keypad; static sdl_color_t* sdl_colors; -static sdl_color_t sdl_colors_sx[] = { { "white", 255, 255, 255 }, - { "left", 255, 166, 0 }, - { "right", 0, 210, 255 }, - { "but_top", 109, 93, 93 }, - { "button", 90, 77, 77 }, - { "but_bot", 76, 65, 65 }, - { "lcd_col", 202, 221, 92 }, - { "pix_col", 0, 0, 128 }, - { "pad_top", 109, 78, 78 }, - { "pad", 90, 64, 64 }, - { "pad_bot", 76, 54, 54 }, - { "disp_pad_top", 155, 118, 84 }, - { "disp_pad", 124, 94, 67 }, - { "disp_pad_bot", 100, 75, 53 }, - { "logo", 204, 169, 107 }, - { "logo_back", 64, 64, 64 }, - { "label", 202, 184, 144 }, - { "frame", 0, 0, 0 }, - { "underlay", 60, 42, 42 }, - { "black", 0, 0, 0 }, - { 0 } }; +static sdl_color_t sdl_colors_sx[] = { + {"white", 255, 255, 255}, + { "left", 255, 166, 0 }, + { "right", 0, 210, 255}, + { "but_top", 109, 93, 93 }, + { "button", 90, 77, 77 }, + { "but_bot", 76, 65, 65 }, + { "lcd_col", 202, 221, 92 }, + { "pix_col", 0, 0, 128}, + { "pad_top", 109, 78, 78 }, + { "pad", 90, 64, 64 }, + { "pad_bot", 76, 54, 54 }, + { "disp_pad_top", 155, 118, 84 }, + { "disp_pad", 124, 94, 67 }, + { "disp_pad_bot", 100, 75, 53 }, + { "logo", 204, 169, 107}, + { "logo_back", 64, 64, 64 }, + { "label", 202, 184, 144}, + { "frame", 0, 0, 0 }, + { "underlay", 60, 42, 42 }, + { "black", 0, 0, 0 }, + /* { 0 } */ +}; -static sdl_color_t sdl_colors_gx[] = { { "white", 255, 255, 255 }, - { "left", 255, 186, 255 }, - { "right", 0, 255, 204 }, - { "but_top", 104, 104, 104 }, - { "button", 88, 88, 88 }, - { "but_bot", 74, 74, 74 }, - { "lcd_col", 202, 221, 92 }, - { "pix_col", 0, 0, 128 }, - { "pad_top", 88, 88, 88 }, - { "pad", 74, 74, 74 }, - { "pad_bot", 64, 64, 64 }, - { "disp_pad_top", 128, 128, 138 }, - { "disp_pad", 104, 104, 110 }, - { "disp_pad_bot", 84, 84, 90 }, - { "logo", 176, 176, 184 }, - { "logo_back", 104, 104, 110 }, - { "label", 240, 240, 240 }, - { "frame", 0, 0, 0 }, - { "underlay", 104, 104, 110 }, - { "black", 0, 0, 0 }, - { 0 } }; +static sdl_color_t sdl_colors_gx[] = { + {"white", 255, 255, 255}, + { "left", 255, 186, 255}, + { "right", 0, 255, 204}, + { "but_top", 104, 104, 104}, + { "button", 88, 88, 88 }, + { "but_bot", 74, 74, 74 }, + { "lcd_col", 202, 221, 92 }, + { "pix_col", 0, 0, 128}, + { "pad_top", 88, 88, 88 }, + { "pad", 74, 74, 74 }, + { "pad_bot", 64, 64, 64 }, + { "disp_pad_top", 128, 128, 138}, + { "disp_pad", 104, 104, 110}, + { "disp_pad_bot", 84, 84, 90 }, + { "logo", 176, 176, 184}, + { "logo_back", 104, 104, 110}, + { "label", 240, 240, 240}, + { "frame", 0, 0, 0 }, + { "underlay", 104, 104, 110}, + { "black", 0, 0, 0 }, + /* { 0 } */ +}; // This will take the value of the defines, but can be run-time modified -static unsigned KEYBOARD_HEIGHT, KEYBOARD_WIDTH, TOP_SKIP, SIDE_SKIP, - BOTTOM_SKIP, DISP_KBD_SKIP, DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_OFFSET_X, - DISPLAY_OFFSET_Y, DISP_FRAME, KEYBOARD_OFFSET_X, KEYBOARD_OFFSET_Y, - KBD_UPLINE; +static unsigned KEYBOARD_HEIGHT, KEYBOARD_WIDTH, TOP_SKIP, SIDE_SKIP, BOTTOM_SKIP, DISP_KBD_SKIP, DISPLAY_WIDTH, DISPLAY_HEIGHT, + DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, DISP_FRAME, KEYBOARD_OFFSET_X, KEYBOARD_OFFSET_Y, KBD_UPLINE; static unsigned int ARGBColors[ BLACK + 1 ]; static sdl_button_t* buttons = 0; static sdl_button_t buttons_sx[] = { - { "A", - 0, - 0x14, - 0, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "A", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "B", - 0, - 0x84, - 50, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "B", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "C", - 0, - 0x83, - 100, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "C", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "D", - 0, - 0x82, - 150, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "D", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "E", - 0, - 0x81, - 200, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "E", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "F", - 0, - 0x80, - 250, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "F", - 0, - 0, - 0, - 0, - 0, - 0 }, + {"A", 0, 0x14, 0, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "A", 0, 0, 0, 0, 0, 0}, + { "B", 0, 0x84, 50, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "B", 0, 0, 0, 0, 0, 0}, + { "C", 0, 0x83, 100, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "C", 0, 0, 0, 0, 0, 0}, + { "D", 0, 0x82, 150, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "D", 0, 0, 0, 0, 0, 0}, + { "E", 0, 0x81, 200, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "E", 0, 0, 0, 0, 0, 0}, + { "F", 0, 0x80, 250, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "F", 0, 0, 0, 0, 0, 0}, - { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, - 0, 0, 0, "G", "PRINT", 1, 0, 0, 0, 0 }, - { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, - 0, 0, 0, "H", "I/O", 1, 0, 0, 0, 0 }, - { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, - 0, 0, 0, "I", "MODES", 1, 0, 0, 0, 0 }, - { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, - 0, 0, 0, "J", "MEMORY", 1, 0, 0, 0, 0 }, - { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, - up_width, up_height, up_bitmap, "K", "LIBRARY", 1, 0, 0, 0, 0 }, - { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, - 0, 0, 0, "L", "PREV", 0, 0, 0, 0, 0 }, + { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0, "G", "PRINT", 1, 0, 0, 0, 0}, + { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0, "H", "I/O", 1, 0, 0, 0, 0}, + { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0, "I", "MODES", 1, 0, 0, 0, 0}, + { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0, "J", "MEMORY", 1, 0, 0, 0, 0}, + { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, up_width, up_height, up_bitmap, "K", "LIBRARY", 1, 0, 0, 0, 0}, + { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0, "L", "PREV", 0, 0, 0, 0, 0}, - { "COLON", - 0, - 0x04, - 0, - 100, - 36, - 26, - WHITE, - 0, - 0, - colon_width, - colon_height, - colon_bitmap, - "M", - "UP", - 0, - "HOME", - 0, - 0, - 0 }, - { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, - 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0, 0 }, - { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, - 0, 0, 0, "O", "aQ", 0, "aNUM", 0, 0, 0 }, - { "LEFT", 0, 0x62, 150, 100, 36, - 26, WHITE, 0, 0, left_width, left_height, left_bitmap, - "P", "GRAPH", 0, 0, 0, 0, 0 }, - { "DOWN", 0, 0x61, 200, 100, 36, - 26, WHITE, 0, 0, down_width, down_height, down_bitmap, - "Q", "REVIEW", 0, 0, 0, 0, 0 }, - { "RIGHT", - 0, - 0x60, - 250, - 100, - 36, - 26, - WHITE, - 0, - 0, - right_width, - right_height, - right_bitmap, - "R", - "SWAP", - 0, - 0, - 0, - 0, - 0 }, + { "COLON", 0, 0x04, 0, 100, 36, 26, WHITE, 0, 0, colon_width, colon_height, colon_bitmap, "M", "UP", 0, "HOME", 0, 0, 0}, + { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0, 0}, + { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0, "O", "aQ", 0, "aNUM", 0, 0, 0}, + { "LEFT", 0, 0x62, 150, 100, 36, 26, WHITE, 0, 0, left_width, left_height, left_bitmap, "P", "GRAPH", 0, 0, 0, 0, 0}, + { "DOWN", 0, 0x61, 200, 100, 36, 26, WHITE, 0, 0, down_width, down_height, down_bitmap, "Q", "REVIEW", 0, 0, 0, 0, 0}, + { "RIGHT", 0, 0x60, 250, 100, 36, 26, WHITE, 0, 0, right_width, right_height, right_bitmap, "R", "SWAP", 0, 0, 0, 0, 0}, - { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, - 0, 0, 0, "S", "ASIN", 0, "b", 0, 0, 0 }, - { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, - 0, 0, 0, "T", "ACOS", 0, "c", 0, 0, 0 }, - { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, - 0, 0, 0, "U", "ATAN", 0, "d", 0, 0, 0 }, - { "SQRT", 0, 0x52, 150, 150, 36, - 26, WHITE, 0, 0, sqrt_width, sqrt_height, sqrt_bitmap, - "V", "e", 0, "f", 0, 0, 0 }, - { "POWER", - 0, - 0x51, - 200, - 150, - 36, - 26, - WHITE, - 0, - 0, - power_width, - power_height, - power_bitmap, - "W", - "g", - 0, - "LOG", - 0, - 0, - 0 }, - { "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, - inv_width, inv_height, inv_bitmap, "X", "h", 0, "LN", 0, 0, 0 }, + { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0, "S", "ASIN", 0, "b", 0, 0, 0}, + { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0, "T", "ACOS", 0, "c", 0, 0, 0}, + { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0, "U", "ATAN", 0, "d", 0, 0, 0}, + { "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, 0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "e", 0, "f", 0, 0, 0}, + { "POWER", 0, 0x51, 200, 150, 36, 26, WHITE, 0, 0, power_width, power_height, power_bitmap, "W", "g", 0, "LOG", 0, 0, 0}, + { "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, inv_width, inv_height, inv_bitmap, "X", "h", 0, "LN", 0, 0, 0}, - { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, - 0, 0, 0, 0, "EQUATION", 0, "MATRIX", 0, 0, 0 }, - { "NEG", 0, 0x43, 100, 200, 36, - 26, WHITE, 0, 0, neg_width, neg_height, neg_bitmap, - "Y", "EDIT", 0, "VISIT", 0, 0, 0 }, - { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, - 0, 0, 0, "Z", "2D", 0, "3D", 0, 0, 0 }, - { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, - 0, 0, 0, 0, "PURGE", 0, 0, 0, 0, 0 }, - { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, - bs_width, bs_height, bs_bitmap, 0, "DROP", 0, "CLR", 0, 0, 0 }, + { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0, 0, "EQUATION", 0, "MATRIX", 0, 0, 0}, + { "NEG", 0, 0x43, 100, 200, 36, 26, WHITE, 0, 0, neg_width, neg_height, neg_bitmap, "Y", "EDIT", 0, "VISIT", 0, 0, 0}, + { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0, "Z", "2D", 0, "3D", 0, 0, 0}, + { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0, 0, "PURGE", 0, 0, 0, 0, 0}, + { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, bs_width, bs_height, bs_bitmap, 0, "DROP", 0, "CLR", 0, 0, 0}, - { "ALPHA", - 0, - 0x35, - 0, - 250, - 36, - 26, - WHITE, - 0, - 0, - alpha_width, - alpha_height, - alpha_bitmap, - 0, - "USR", - 0, - "ENTRY", - 0, - 0, - 0 }, - { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, - 0, 0, 0, 0, "SOLVE", 1, 0, 0, 0, 0 }, - { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, - 0, 0, 0, 0, "PLOT", 1, 0, 0, 0, 0 }, - { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, - 0, 0, 0, 0, "ALGEBRA", 1, 0, 0, 0, 0 }, - { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, - div_width, div_height, div_bitmap, 0, "( )", 0, "#", 0, 0, 0 }, + { "ALPHA", 0, 0x35, 0, 250, 36, 26, WHITE, 0, 0, alpha_width, alpha_height, alpha_bitmap, 0, "USR", 0, "ENTRY", 0, 0, 0}, + { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0, 0, "SOLVE", 1, 0, 0, 0, 0}, + { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0, 0, "PLOT", 1, 0, 0, 0, 0}, + { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0, 0, "ALGEBRA", 1, 0, 0, 0, 0}, + { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, div_height, div_bitmap, 0, "( )", 0, "#", 0, 0, 0}, - { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, - shl_width, shl_height, shl_bitmap, 0, 0, 0, 0, 0, 0, 0 }, - { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, - 0, 0, 0, 0, "TIME", 1, 0, 0, 0, 0 }, - { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, - 0, 0, 0, 0, "STAT", 1, 0, 0, 0, 0 }, - { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, - 0, 0, 0, 0, "UNITS", 1, 0, 0, 0, 0 }, - { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, - mul_width, mul_height, mul_bitmap, 0, "[ ]", 0, "_", 0, 0, 0 }, + { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, shl_width, shl_height, shl_bitmap, 0, 0, 0, 0, 0, 0, 0}, + { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0, 0, "TIME", 1, 0, 0, 0, 0}, + { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0, 0, "STAT", 1, 0, 0, 0, 0}, + { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0, 0, "UNITS", 1, 0, 0, 0, 0}, + { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, mul_height, mul_bitmap, 0, "[ ]", 0, "_", 0, 0, 0}, - { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, - shr_width, shr_height, shr_bitmap, 0, 0, 0, 0, 0, 0, 0 }, - { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, - 0, 0, 0, 0, "RAD", 0, "POLAR", 0, 0, 0 }, - { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, - 0, 0, 0, 0, "STACK", 0, "ARG", 0, 0, 0 }, - { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, - 0, 0, 0, 0, "CMD", 0, "MENU", 0, 0, 0 }, - { "MINUS", - 0, - 0x10, - 240, - 350, - 46, - 26, - WHITE, - 0, - 0, - minus_width, - minus_height, - minus_bitmap, - 0, - "i", - 0, - "j", - 0, - 0, - 0 }, + { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, shr_width, shr_height, shr_bitmap, 0, 0, 0, 0, 0, 0, 0}, + { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0, 0, "RAD", 0, "POLAR", 0, 0, 0}, + { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0, 0, "STACK", 0, "ARG", 0, 0, 0}, + { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0, 0, "CMD", 0, "MENU", 0, 0, 0}, + { "MINUS", 0, 0x10, 240, 350, 46, 26, WHITE, 0, 0, minus_width, minus_height, minus_bitmap, 0, "i", 0, "j", 0, 0, 0}, - { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, - 0, 0, 0, 0, "CONT", 0, "OFF", "ATTN", 0, 0 }, - { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, - 0, 0, 0, 0, "= ", 0, " a", 0, 0, 0 }, - { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, - 0, 0, 0, 0, ", ", 0, " k", 0, 0, 0 }, - { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, - 0, 0, 0, 0, "l ", 0, " m", 0, 0, 0 }, - { "PLUS", 0, 0x00, 240, 400, 46, - 26, WHITE, 0, 0, plus_width, plus_height, plus_bitmap, - 0, "{ }", 0, ": :", 0, 0, 0 }, - - { 0 } }; + { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0, 0, "CONT", 0, "OFF", "ATTN", 0, 0}, + { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0, 0, "= ", 0, " a", 0, 0, 0}, + { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0, 0, ", ", 0, " k", 0, 0, 0}, + { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0, 0, "l ", 0, " m", 0, 0, 0}, + { "PLUS", 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0, plus_width, plus_height, plus_bitmap, 0, "{ }", 0, ": :", 0, 0, 0}, + /* { 0 } */ +}; static sdl_button_t buttons_gx[] = { - { "A", - 0, - 0x14, - 0, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "A", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "B", - 0, - 0x84, - 50, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "B", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "C", - 0, - 0x83, - 100, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "C", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "D", - 0, - 0x82, - 150, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "D", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "E", - 0, - 0x81, - 200, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "E", - 0, - 0, - 0, - 0, - 0, - 0 }, - { "F", - 0, - 0x80, - 250, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "F", - 0, - 0, - 0, - 0, - 0, - 0 }, + {"A", 0, 0x14, 0, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "A", 0, 0, 0, 0, 0, 0}, + { "B", 0, 0x84, 50, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "B", 0, 0, 0, 0, 0, 0}, + { "C", 0, 0x83, 100, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "C", 0, 0, 0, 0, 0, 0}, + { "D", 0, 0x82, 150, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "D", 0, 0, 0, 0, 0, 0}, + { "E", 0, 0x81, 200, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "E", 0, 0, 0, 0, 0, 0}, + { "F", 0, 0x80, 250, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "F", 0, 0, 0, 0, 0, 0}, - { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, - 0, 0, 0, "G", "RAD", 0, "POLAR", 0, 0, 0 }, - { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, - 0, 0, 0, "H", 0, 0, "CHARS", 0, 0, 0 }, - { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, - 0, 0, 0, "I", 0, 0, "MODES", 0, 0, 0 }, - { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, - 0, 0, 0, "J", 0, 0, "MEMORY", 0, 0, 0 }, - { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, - up_width, up_height, up_bitmap, "K", 0, 0, "STACK", 0, 0, 0 }, - { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, - 0, 0, 0, "L", "PREV", 0, "MENU", 0, 0, 0 }, + { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0, "G", "RAD", 0, "POLAR", 0, 0, 0}, + { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0, "H", 0, 0, "CHARS", 0, 0, 0}, + { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0, "I", 0, 0, "MODES", 0, 0, 0}, + { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0, "J", 0, 0, "MEMORY", 0, 0, 0}, + { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, up_width, up_height, up_bitmap, "K", 0, 0, "STACK", 0, 0, 0}, + { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0, "L", "PREV", 0, "MENU", 0, 0, 0}, - { "COLON", - 0, - 0x04, - 0, - 100, - 36, - 26, - WHITE, - 0, - 0, - colon_width, - colon_height, - colon_bitmap, - "M", - "UP", - 0, - "HOME", - 0, - 0, - 0 }, - { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, - 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0, 0 }, - { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, - 0, 0, 0, "O", "aNUM", 0, "UNDO", 0, 0, 0 }, - { "LEFT", 0, 0x62, 150, 100, 36, - 26, WHITE, 0, 0, left_width, left_height, left_bitmap, - "P", "PICTURE", 0, 0, 0, 0, 0 }, - { "DOWN", 0, 0x61, 200, 100, 36, - 26, WHITE, 0, 0, down_width, down_height, down_bitmap, - "Q", "VIEW", 0, 0, 0, 0, 0 }, - { "RIGHT", - 0, - 0x60, - 250, - 100, - 36, - 26, - WHITE, - 0, - 0, - right_width, - right_height, - right_bitmap, - "R", - "SWAP", - 0, - 0, - 0, - 0, - 0 }, + { "COLON", 0, 0x04, 0, 100, 36, 26, WHITE, 0, 0, colon_width, colon_height, colon_bitmap, "M", "UP", 0, "HOME", 0, 0, 0}, + { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0, 0}, + { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0, "O", "aNUM", 0, "UNDO", 0, 0, 0}, + { "LEFT", 0, 0x62, 150, 100, 36, 26, WHITE, 0, 0, left_width, left_height, left_bitmap, "P", "PICTURE", 0, 0, 0, 0, 0}, + { "DOWN", 0, 0x61, 200, 100, 36, 26, WHITE, 0, 0, down_width, down_height, down_bitmap, "Q", "VIEW", 0, 0, 0, 0, 0}, + { "RIGHT", 0, 0x60, 250, 100, 36, 26, WHITE, 0, 0, right_width, right_height, right_bitmap, "R", "SWAP", 0, 0, 0, 0, 0}, - { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, - 0, 0, 0, "S", "ASIN", 0, "b", 0, 0, 0 }, - { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, - 0, 0, 0, "T", "ACOS", 0, "c", 0, 0, 0 }, - { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, - 0, 0, 0, "U", "ATAN", 0, "d", 0, 0, 0 }, - { "SQRT", 0, 0x52, 150, 150, 36, - 26, WHITE, 0, 0, sqrt_width, sqrt_height, sqrt_bitmap, - "V", "n", 0, "o", 0, 0, 0 }, - { "POWER", - 0, - 0x51, - 200, - 150, - 36, - 26, - WHITE, - 0, - 0, - power_width, - power_height, - power_bitmap, - "W", - "p", - 0, - "LOG", - 0, - 0, - 0 }, - { "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, - inv_width, inv_height, inv_bitmap, "X", "q", 0, "LN", 0, 0, 0 }, + { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0, "S", "ASIN", 0, "b", 0, 0, 0}, + { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0, "T", "ACOS", 0, "c", 0, 0, 0}, + { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0, "U", "ATAN", 0, "d", 0, 0, 0}, + { "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, 0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "n", 0, "o", 0, 0, 0}, + { "POWER", 0, 0x51, 200, 150, 36, 26, WHITE, 0, 0, power_width, power_height, power_bitmap, "W", "p", 0, "LOG", 0, 0, 0}, + { "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, inv_width, inv_height, inv_bitmap, "X", "q", 0, "LN", 0, 0, 0}, - { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, - 0, 0, 0, 0, "EQUATION", 0, "MATRIX", 0, 0, 0 }, - { "NEG", 0, 0x43, 100, 200, 36, - 26, WHITE, 0, 0, neg_width, neg_height, neg_bitmap, - "Y", "EDIT", 0, "CMD", 0, 0, 0 }, - { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, - 0, 0, 0, "Z", "PURG", 0, "ARG", 0, 0, 0 }, - { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, - 0, 0, 0, 0, "CLEAR", 0, 0, 0, 0, 0 }, - { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, - bs_width, bs_height, bs_bitmap, 0, "DROP", 0, 0, 0, 0, 0 }, + { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0, 0, "EQUATION", 0, "MATRIX", 0, 0, 0}, + { "NEG", 0, 0x43, 100, 200, 36, 26, WHITE, 0, 0, neg_width, neg_height, neg_bitmap, "Y", "EDIT", 0, "CMD", 0, 0, 0}, + { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0, "Z", "PURG", 0, "ARG", 0, 0, 0}, + { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0, 0, "CLEAR", 0, 0, 0, 0, 0}, + { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, bs_width, bs_height, bs_bitmap, 0, "DROP", 0, 0, 0, 0, 0}, - { "ALPHA", - 0, - 0x35, - 0, - 250, - 36, - 26, - WHITE, - 0, - 0, - alpha_width, - alpha_height, - alpha_bitmap, - 0, - "USER", - 0, - "ENTRY", - 0, - 0, - 0 }, - { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, - 0, 0, 0, 0, 0, 1, "SOLVE", 0, 0, 0 }, - { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, - 0, 0, 0, 0, 0, 1, "PLOT", 0, 0, 0 }, - { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, - 0, 0, 0, 0, 0, 1, "SYMBOLIC", 0, 0, 0 }, - { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, - div_width, div_height, div_bitmap, 0, "r ", 0, "s", 0, 0, 0 }, + { "ALPHA", 0, 0x35, 0, 250, 36, 26, WHITE, 0, 0, alpha_width, alpha_height, alpha_bitmap, 0, "USER", 0, "ENTRY", 0, 0, 0}, + { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0, 0, 0, 1, "SOLVE", 0, 0, 0}, + { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0, 0, 0, 1, "PLOT", 0, 0, 0}, + { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0, 0, 0, 1, "SYMBOLIC", 0, 0, 0}, + { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, div_height, div_bitmap, 0, "r ", 0, "s", 0, 0, 0}, - { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, - shl_width, shl_height, shl_bitmap, 0, 0, 0, 0, 0, 0, 0 }, - { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, - 0, 0, 0, 0, 0, 1, "TIME", 0, 0, 0 }, - { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, - 0, 0, 0, 0, 0, 1, "STAT", 0, 0, 0 }, - { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, - 0, 0, 0, 0, 0, 1, "UNITS", 0, 0, 0 }, - { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, - mul_width, mul_height, mul_bitmap, 0, "t ", 0, "u", 0, 0, 0 }, + { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, shl_width, shl_height, shl_bitmap, 0, 0, 0, 0, 0, 0, 0}, + { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0, 0, 0, 1, "TIME", 0, 0, 0}, + { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0, 0, 0, 1, "STAT", 0, 0, 0}, + { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0, 0, 0, 1, "UNITS", 0, 0, 0}, + { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, mul_height, mul_bitmap, 0, "t ", 0, "u", 0, 0, 0}, - { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, - shr_width, shr_height, shr_bitmap, 0, 0, 1, " ", 0, 0, 0 }, - { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, - 0, 0, 0, 0, 0, 1, "I/O", 0, 0, 0 }, - { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, - 0, 0, 0, 0, 0, 1, "LIBRARY", 0, 0, 0 }, - { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, - 0, 0, 0, 0, 0, 1, "EQ LIB", 0, 0, 0 }, - { "MINUS", - 0, - 0x10, - 240, - 350, - 46, - 26, - WHITE, - 0, - 0, - minus_width, - minus_height, - minus_bitmap, - 0, - "v ", - 0, - "w", - 0, - 0, - 0 }, + { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, shr_width, shr_height, shr_bitmap, 0, 0, 1, " ", 0, 0, 0}, + { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0, 0, 0, 1, "I/O", 0, 0, 0}, + { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0, 0, 0, 1, "LIBRARY", 0, 0, 0}, + { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0, 0, 0, 1, "EQ LIB", 0, 0, 0}, + { "MINUS", 0, 0x10, 240, 350, 46, 26, WHITE, 0, 0, minus_width, minus_height, minus_bitmap, 0, "v ", 0, "w", 0, 0, 0}, - { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, - 0, 0, 0, 0, "CONT", 0, "OFF", "CANCEL", 0, 0 }, - { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, - 0, 0, 0, 0, "\004 ", 0, "\003", 0, 0, 0 }, - { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, - 0, 0, 0, 0, "\002 ", 0, "\001", 0, 0, 0 }, - { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, - 0, 0, 0, 0, "\005 ", 0, "z", 0, 0, 0 }, - { "PLUS", 0, 0x00, 240, 400, 46, - 26, WHITE, 0, 0, plus_width, plus_height, plus_bitmap, - 0, "x ", 0, "y", 0, 0, 0 }, - - { 0 } }; + { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0, 0, "CONT", 0, "OFF", "CANCEL", 0, 0}, + { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0, 0, "\004 ", 0, "\003", 0, 0, 0}, + { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0, 0, "\002 ", 0, "\001", 0, 0, 0}, + { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0, 0, "\005 ", 0, "z", 0, 0, 0}, + { "PLUS", 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0, plus_width, plus_height, plus_bitmap, 0, "x ", 0, "y", 0, 0, 0}, + /* { 0 } */ +}; static sdl_ann_struct_t ann_tbl[] = { - { ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bitmap, 0, 0 }, - { ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bitmap, 0, - 0 }, - { ANN_ALPHA, 106, 4, ann_alpha_width, ann_alpha_height, ann_alpha_bitmap, 0, - 0 }, - { ANN_BATTERY, 151, 4, ann_battery_width, ann_battery_height, - ann_battery_bitmap, 0, 0 }, - { ANN_BUSY, 196, 4, ann_busy_width, ann_busy_height, ann_busy_bitmap, 0, - 0 }, - { ANN_IO, 241, 4, ann_io_width, ann_io_height, ann_io_bitmap, 0, 0 }, - { 0 } }; + {ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bitmap, 0, 0}, + { ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bitmap, 0, 0}, + { ANN_ALPHA, 106, 4, ann_alpha_width, ann_alpha_height, ann_alpha_bitmap, 0, 0}, + { ANN_BATTERY, 151, 4, ann_battery_width, ann_battery_height, ann_battery_bitmap, 0, 0}, + { ANN_BUSY, 196, 4, ann_busy_width, ann_busy_height, ann_busy_bitmap, 0, 0}, + { ANN_IO, 241, 4, ann_io_width, ann_io_height, ann_io_bitmap, 0, 0}, + /* { 0 } */ +}; // State to displayed zoomed last pressed key static SDL_Surface* showkeylastsurf = 0; @@ -808,9 +301,9 @@ static SDL_Surface* sdlwindow; /****************************/ /* functions implementation */ /****************************/ -static inline unsigned bgra2argb( unsigned color ) { - unsigned a = ( color >> 24 ) & 0xff, r = ( color >> 16 ) & 0xff, - g = ( color >> 8 ) & 0xff, b = color & 0xff; +static inline unsigned bgra2argb( unsigned color ) +{ + unsigned a = ( color >> 24 ) & 0xff, r = ( color >> 16 ) & 0xff, g = ( color >> 8 ) & 0xff, b = color & 0xff; color = a | ( r << 24 ) | ( g << 16 ) | ( b << 8 ); return color; @@ -819,15 +312,13 @@ static inline unsigned bgra2argb( unsigned color ) { /* Create a surface from binary bitmap data */ -static SDL_Surface* SDLCreateSurfFromData( unsigned int w, unsigned int h, - unsigned char* data, - unsigned int coloron, - unsigned int coloroff ) { +static SDL_Surface* SDLCreateSurfFromData( unsigned int w, unsigned int h, unsigned char* data, unsigned int coloron, + unsigned int coloroff ) +{ unsigned int x, y; SDL_Surface* surf; - surf = SDL_CreateRGBSurface( SDL_SWSURFACE, w, h, 32, 0x00ff0000, - 0x0000ff00, 0x000000ff, 0xff000000 ); + surf = SDL_CreateRGBSurface( SDL_SWSURFACE, w, h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 ); SDL_LockSurface( surf ); @@ -855,9 +346,8 @@ static SDL_Surface* SDLCreateSurfFromData( unsigned int w, unsigned int h, return surf; } -static void SDLDrawSmallString( int x, int y, const char* string, - unsigned int length, unsigned int coloron, - unsigned int coloroff ) { +static void SDLDrawSmallString( int x, int y, const char* string, unsigned int length, unsigned int coloron, unsigned int coloroff ) +{ unsigned int i; for ( i = 0; i < length; i++ ) { @@ -865,9 +355,7 @@ static void SDLDrawSmallString( int x, int y, const char* string, int w = small_font[ ( int )string[ i ] ].w; int h = small_font[ ( int )string[ i ] ].h; - SDL_Surface* surf = SDLCreateSurfFromData( - w, h, small_font[ ( int )string[ i ] ].bits, coloron, - coloroff ); + SDL_Surface* surf = SDLCreateSurfFromData( w, h, small_font[ ( int )string[ i ] ].bits, coloron, coloroff ); SDL_Rect srect; SDL_Rect drect; @@ -886,7 +374,8 @@ static void SDLDrawSmallString( int x, int y, const char* string, } } -static void SDLInit( void ) { +static void SDLInit( void ) +{ unsigned int width, height; // Initialize SDL @@ -915,11 +404,9 @@ static void SDLInit( void ) { KBD_UPLINE = _KBD_UPLINE; if ( show_ui_chrome ) { - width = ( buttons_gx[ LAST_BUTTON ].x + buttons_gx[ LAST_BUTTON ].w ) + - 2 * SIDE_SKIP; - height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP + - buttons_gx[ LAST_BUTTON ].y + buttons_gx[ LAST_BUTTON ].h + - BOTTOM_SKIP; + width = ( buttons_gx[ LAST_BUTTON ].x + buttons_gx[ LAST_BUTTON ].w ) + 2 * SIDE_SKIP; + height = + DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP + buttons_gx[ LAST_BUTTON ].y + buttons_gx[ LAST_BUTTON ].h + BOTTOM_SKIP; } else { width = DISPLAY_WIDTH; height = DISPLAY_HEIGHT; @@ -939,7 +426,8 @@ static void SDLInit( void ) { } } -static void sdl_button_pressed( int b ) { +static void sdl_button_pressed( int b ) +{ // Check not already pressed (may be important: avoids a useless do_kbd_int) if ( buttons[ b ].pressed == 1 ) return; @@ -965,7 +453,8 @@ static void sdl_button_pressed( int b ) { } } -static void sdl_button_released( int b ) { +static void sdl_button_released( int b ) +{ // Check not already released (not critical) if ( buttons[ b ].pressed == 0 ) return; @@ -983,12 +472,12 @@ static void sdl_button_released( int b ) { } } -static void SDLCreateColors( void ) { +static void SDLCreateColors( void ) +{ unsigned i; for ( i = WHITE; i < BLACK; i++ ) - ARGBColors[ i ] = 0xff000000 | ( sdl_colors[ i ].r << 16 ) | - ( sdl_colors[ i ].g << 8 ) | sdl_colors[ i ].b; + ARGBColors[ i ] = 0xff000000 | ( sdl_colors[ i ].r << 16 ) | ( sdl_colors[ i ].g << 8 ) | sdl_colors[ i ].b; // Adjust the LCD color according to the contrast int contrast, r, g, b; @@ -1001,14 +490,14 @@ static void SDLCreateColors( void ) { r = ( 0x13 - contrast ) * ( sdl_colors[ LCD ].r / 0x10 ); g = ( 0x13 - contrast ) * ( sdl_colors[ LCD ].g / 0x10 ); - b = 128 - - ( ( 0x13 - contrast ) * ( ( 128 - sdl_colors[ LCD ].b ) / 0x10 ) ); + b = 128 - ( ( 0x13 - contrast ) * ( ( 128 - sdl_colors[ LCD ].b ) / 0x10 ) ); ARGBColors[ PIXEL ] = 0xff000000 | ( r << 16 ) | ( g << 8 ) | b; } // This should be called once to setup the surfaces. Calling it multiple // times is fine, it won't do anything on subsequent calls. -static void SDLCreateAnnunc( void ) { +static void SDLCreateAnnunc( void ) +{ for ( int i = 0; i < 6; i++ ) { // If the SDL surface does not exist yet, we create it on the fly if ( ann_tbl[ i ].surfaceon ) { @@ -1016,24 +505,23 @@ static void SDLCreateAnnunc( void ) { ann_tbl[ i ].surfaceon = 0; } - ann_tbl[ i ].surfaceon = SDLCreateSurfFromData( - ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].bits, - ARGBColors[ PIXEL ], ARGBColors[ LCD ] ); + ann_tbl[ i ].surfaceon = + SDLCreateSurfFromData( ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].bits, ARGBColors[ PIXEL ], ARGBColors[ LCD ] ); if ( ann_tbl[ i ].surfaceoff ) { SDL_FreeSurface( ann_tbl[ i ].surfaceoff ); ann_tbl[ i ].surfaceoff = 0; } - ann_tbl[ i ].surfaceoff = SDLCreateSurfFromData( - ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].bits, - ARGBColors[ LCD ], ARGBColors[ LCD ] ); + ann_tbl[ i ].surfaceoff = + SDLCreateSurfFromData( ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].bits, ARGBColors[ LCD ], ARGBColors[ LCD ] ); } } // Find which key is pressed, if any. // Returns -1 is no key is pressed -static int SDLCoordinateToKey( unsigned int x, unsigned int y ) { +static int SDLCoordinateToKey( unsigned int x, unsigned int y ) +{ /* return immediatly if the click isn't even in the keyboard area */ if ( y < KEYBOARD_OFFSET_Y ) return -1; @@ -1068,7 +556,8 @@ static int SDLCoordinateToKey( unsigned int x, unsigned int y ) { // Map the keyboard keys to the HP keys // Returns -1 if there is no mapping -static int SDLKeyToKey( SDLKey k ) { +static int SDLKeyToKey( SDLKey k ) +{ switch ( k ) { case SDLK_0: return BUTTON_0; @@ -1293,147 +782,104 @@ static int SDLKeyToKey( SDLKey k ) { return -1; } -static void SDLDrawMore( unsigned int cut, unsigned int offset_y, - int keypad_width, int keypad_height ) { +static void SDLDrawMore( unsigned int cut, unsigned int offset_y, int keypad_width, int keypad_height ) +{ // bottom lines - lineColor( sdlwindow, 1, keypad_height - 1, keypad_width - 1, - keypad_height - 1, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, 2, keypad_height - 2, keypad_width - 2, - keypad_height - 2, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, 1, keypad_height - 1, keypad_width - 1, keypad_height - 1, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, 2, keypad_height - 2, keypad_width - 2, keypad_height - 2, bgra2argb( ARGBColors[ PAD_TOP ] ) ); // right lines - lineColor( sdlwindow, keypad_width - 1, keypad_height - 1, keypad_width - 1, - cut, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, keypad_width - 2, keypad_height - 2, keypad_width - 2, - cut, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 1, keypad_height - 1, keypad_width - 1, cut, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 2, keypad_height - 2, keypad_width - 2, cut, bgra2argb( ARGBColors[ PAD_TOP ] ) ); // right lines - lineColor( sdlwindow, keypad_width - 1, cut - 1, keypad_width - 1, 1, - bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); - lineColor( sdlwindow, keypad_width - 2, cut - 1, keypad_width - 2, 2, - bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 1, cut - 1, keypad_width - 1, 1, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 2, cut - 1, keypad_width - 2, 2, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); // top lines - lineColor( sdlwindow, 0, 0, keypad_width - 2, 0, - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); - lineColor( sdlwindow, 1, 1, keypad_width - 3, 1, - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, 0, 0, keypad_width - 2, 0, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, 1, 1, keypad_width - 3, 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); // left lines - lineColor( sdlwindow, 0, cut - 1, 0, 0, - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); - lineColor( sdlwindow, 1, cut - 1, 1, 1, - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, 0, cut - 1, 0, 0, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, 1, cut - 1, 1, 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); // left lines - lineColor( sdlwindow, 0, keypad_height - 2, 0, cut, - bgra2argb( ARGBColors[ PAD_BOT ] ) ); - lineColor( sdlwindow, 1, keypad_height - 3, 1, cut, - bgra2argb( ARGBColors[ PAD_BOT ] ) ); + lineColor( sdlwindow, 0, keypad_height - 2, 0, cut, bgra2argb( ARGBColors[ PAD_BOT ] ) ); + lineColor( sdlwindow, 1, keypad_height - 3, 1, cut, bgra2argb( ARGBColors[ PAD_BOT ] ) ); // lower the menu buttons // bottom lines - lineColor( sdlwindow, 3, keypad_height - 3, keypad_width - 3, - keypad_height - 3, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, 4, keypad_height - 4, keypad_width - 4, - keypad_height - 4, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, 3, keypad_height - 3, keypad_width - 3, keypad_height - 3, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, 4, keypad_height - 4, keypad_width - 4, keypad_height - 4, bgra2argb( ARGBColors[ PAD_TOP ] ) ); // right lines - lineColor( sdlwindow, keypad_width - 3, keypad_height - 3, keypad_width - 3, - cut, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, keypad_width - 4, keypad_height - 4, keypad_width - 4, - cut, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 3, keypad_height - 3, keypad_width - 3, cut, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 4, keypad_height - 4, keypad_width - 4, cut, bgra2argb( ARGBColors[ PAD_TOP ] ) ); // right lines - lineColor( sdlwindow, keypad_width - 3, cut - 1, keypad_width - 3, - offset_y - ( KBD_UPLINE - 1 ), + lineColor( sdlwindow, keypad_width - 3, cut - 1, keypad_width - 3, offset_y - ( KBD_UPLINE - 1 ), bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); - lineColor( sdlwindow, keypad_width - 4, cut - 1, keypad_width - 4, - offset_y - ( KBD_UPLINE - 2 ), + lineColor( sdlwindow, keypad_width - 4, cut - 1, keypad_width - 4, offset_y - ( KBD_UPLINE - 2 ), bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); // top lines - lineColor( sdlwindow, 2, offset_y - ( KBD_UPLINE - 0 ), keypad_width - 4, - offset_y - ( KBD_UPLINE - 0 ), + lineColor( sdlwindow, 2, offset_y - ( KBD_UPLINE - 0 ), keypad_width - 4, offset_y - ( KBD_UPLINE - 0 ), bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); - lineColor( sdlwindow, 3, offset_y - ( KBD_UPLINE - 1 ), keypad_width - 5, - offset_y - ( KBD_UPLINE - 1 ), + lineColor( sdlwindow, 3, offset_y - ( KBD_UPLINE - 1 ), keypad_width - 5, offset_y - ( KBD_UPLINE - 1 ), bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); // left lines - lineColor( sdlwindow, 2, cut - 1, 2, offset_y - ( KBD_UPLINE - 1 ), - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); - lineColor( sdlwindow, 3, cut - 1, 3, offset_y - ( KBD_UPLINE - 2 ), - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, 2, cut - 1, 2, offset_y - ( KBD_UPLINE - 1 ), bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, 3, cut - 1, 3, offset_y - ( KBD_UPLINE - 2 ), bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); // left lines - lineColor( sdlwindow, 2, keypad_height - 4, 2, cut, - bgra2argb( ARGBColors[ PAD_BOT ] ) ); - lineColor( sdlwindow, 3, keypad_height - 5, 3, cut, - bgra2argb( ARGBColors[ PAD_BOT ] ) ); + lineColor( sdlwindow, 2, keypad_height - 4, 2, cut, bgra2argb( ARGBColors[ PAD_BOT ] ) ); + lineColor( sdlwindow, 3, keypad_height - 5, 3, cut, bgra2argb( ARGBColors[ PAD_BOT ] ) ); // lower the keyboard // bottom lines - lineColor( sdlwindow, 5, keypad_height - 5, keypad_width - 3, - keypad_height - 5, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, 6, keypad_height - 6, keypad_width - 4, - keypad_height - 6, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, 5, keypad_height - 5, keypad_width - 3, keypad_height - 5, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, 6, keypad_height - 6, keypad_width - 4, keypad_height - 6, bgra2argb( ARGBColors[ PAD_TOP ] ) ); // right lines - lineColor( sdlwindow, keypad_width - 5, keypad_height - 5, keypad_width - 5, - cut + 1, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, keypad_width - 6, keypad_height - 6, keypad_width - 6, - cut + 2, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 5, keypad_height - 5, keypad_width - 5, cut + 1, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 6, keypad_height - 6, keypad_width - 6, cut + 2, bgra2argb( ARGBColors[ PAD_TOP ] ) ); // top lines - lineColor( sdlwindow, 4, cut, keypad_width - 6, cut, - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); - lineColor( sdlwindow, 5, cut + 1, keypad_width - 7, cut + 1, - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, 4, cut, keypad_width - 6, cut, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, 5, cut + 1, keypad_width - 7, cut + 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); // left lines - lineColor( sdlwindow, 4, keypad_height - 6, 4, cut + 1, - bgra2argb( ARGBColors[ PAD_BOT ] ) ); - lineColor( sdlwindow, 5, keypad_height - 7, 5, cut + 2, - bgra2argb( ARGBColors[ PAD_BOT ] ) ); + lineColor( sdlwindow, 4, keypad_height - 6, 4, cut + 1, bgra2argb( ARGBColors[ PAD_BOT ] ) ); + lineColor( sdlwindow, 5, keypad_height - 7, 5, cut + 2, bgra2argb( ARGBColors[ PAD_BOT ] ) ); // round off the bottom edge - lineColor( sdlwindow, keypad_width - 7, keypad_height - 7, keypad_width - 7, - keypad_height - 14, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, keypad_width - 8, keypad_height - 8, keypad_width - 8, - keypad_height - 11, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, keypad_width - 7, keypad_height - 7, - keypad_width - 14, keypad_height - 7, - bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, keypad_width - 7, keypad_height - 8, - keypad_width - 11, keypad_height - 8, - bgra2argb( ARGBColors[ PAD_TOP ] ) ); - pixelColor( sdlwindow, keypad_width - 9, keypad_height - 9, - bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 7, keypad_height - 7, keypad_width - 7, keypad_height - 14, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 8, keypad_height - 8, keypad_width - 8, keypad_height - 11, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 7, keypad_height - 7, keypad_width - 14, keypad_height - 7, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, keypad_width - 7, keypad_height - 8, keypad_width - 11, keypad_height - 8, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + pixelColor( sdlwindow, keypad_width - 9, keypad_height - 9, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, 7, keypad_height - 7, 13, keypad_height - 7, - bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, 8, keypad_height - 8, 10, keypad_height - 8, - bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, 7, keypad_height - 7, 13, keypad_height - 7, bgra2argb( ARGBColors[ PAD_TOP ] ) ); + lineColor( sdlwindow, 8, keypad_height - 8, 10, keypad_height - 8, bgra2argb( ARGBColors[ PAD_TOP ] ) ); - lineColor( sdlwindow, 6, keypad_height - 8, 6, keypad_height - 14, - bgra2argb( ARGBColors[ PAD_BOT ] ) ); - lineColor( sdlwindow, 7, keypad_height - 9, 7, keypad_height - 11, - bgra2argb( ARGBColors[ PAD_BOT ] ) ); + lineColor( sdlwindow, 6, keypad_height - 8, 6, keypad_height - 14, bgra2argb( ARGBColors[ PAD_BOT ] ) ); + lineColor( sdlwindow, 7, keypad_height - 9, 7, keypad_height - 11, bgra2argb( ARGBColors[ PAD_BOT ] ) ); } -static void SDLDrawLogo() { +static void SDLDrawLogo() +{ int x, y; SDL_Surface* surf; int display_width = DISPLAY_WIDTH; // insert the HP Logo - surf = SDLCreateSurfFromData( hp_width, hp_height, hp_bitmap, - ARGBColors[ LOGO ], ARGBColors[ LOGO_BACK ] ); + surf = SDLCreateSurfFromData( hp_width, hp_height, hp_bitmap, ARGBColors[ LOGO ], ARGBColors[ LOGO_BACK ] ); if ( opt_gx ) x = DISPLAY_OFFSET_X - 6; else @@ -1453,29 +899,22 @@ static void SDLDrawLogo() { SDL_FreeSurface( surf ); if ( !opt_gx ) { - lineColor( sdlwindow, DISPLAY_OFFSET_X, 9, - DISPLAY_OFFSET_X + hp_width - 1, 9, + lineColor( sdlwindow, DISPLAY_OFFSET_X, 9, DISPLAY_OFFSET_X + hp_width - 1, 9, bgra2argb( ARGBColors[ FRAME ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X - 1, 10, DISPLAY_OFFSET_X - 1, 10 + hp_height - 1, bgra2argb( ARGBColors[ FRAME ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X, 10 + hp_height, DISPLAY_OFFSET_X + hp_width - 1, 10 + hp_height, bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X - 1, 10, DISPLAY_OFFSET_X - 1, - 10 + hp_height - 1, bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X, 10 + hp_height, - DISPLAY_OFFSET_X + hp_width - 1, 10 + hp_height, - bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X + hp_width, 10, - DISPLAY_OFFSET_X + hp_width, 10 + hp_height - 1, + lineColor( sdlwindow, DISPLAY_OFFSET_X + hp_width, 10, DISPLAY_OFFSET_X + hp_width, 10 + hp_height - 1, bgra2argb( ARGBColors[ FRAME ] ) ); } // write the name of it if ( opt_gx ) { - x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width + - gx_128K_ram_x_hot + 2; + x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width + gx_128K_ram_x_hot + 2; y = 10 + gx_128K_ram_y_hot; - surf = SDLCreateSurfFromData( gx_128K_ram_width, gx_128K_ram_height, - gx_128K_ram_bitmap, ARGBColors[ LABEL ], - ARGBColors[ DISP_PAD ] ); + surf = + SDLCreateSurfFromData( gx_128K_ram_width, gx_128K_ram_height, gx_128K_ram_bitmap, ARGBColors[ LABEL ], ARGBColors[ DISP_PAD ] ); srect.x = 0; srect.y = 0; srect.w = gx_128K_ram_width; @@ -1489,9 +928,7 @@ static void SDLDrawLogo() { x = DISPLAY_OFFSET_X + hp_width; y = hp_height + 8 - hp48gx_height; - surf = - SDLCreateSurfFromData( hp48gx_width, hp48gx_height, hp48gx_bitmap, - ARGBColors[ LOGO ], ARGBColors[ DISP_PAD ] ); + surf = SDLCreateSurfFromData( hp48gx_width, hp48gx_height, hp48gx_bitmap, ARGBColors[ LOGO ], ARGBColors[ DISP_PAD ] ); srect.x = 0; srect.y = 0; srect.w = hp48gx_width; @@ -1503,13 +940,10 @@ static void SDLDrawLogo() { SDL_BlitSurface( surf, &srect, sdlwindow, &drect ); SDL_FreeSurface( surf ); - x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + - gx_silver_x_hot + 2; + x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + gx_silver_x_hot + 2; y = 10 + gx_silver_y_hot; - surf = SDLCreateSurfFromData( - gx_silver_width, gx_silver_height, gx_silver_bitmap, - ARGBColors[ LOGO ], - 0 ); // Background transparent: draw only silver line + surf = SDLCreateSurfFromData( gx_silver_width, gx_silver_height, gx_silver_bitmap, ARGBColors[ LOGO ], + 0 ); // Background transparent: draw only silver line srect.x = 0; srect.y = 0; srect.w = gx_silver_width; @@ -1521,13 +955,10 @@ static void SDLDrawLogo() { SDL_BlitSurface( surf, &srect, sdlwindow, &drect ); SDL_FreeSurface( surf ); - x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width + - gx_green_x_hot + 2; + x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width + gx_green_x_hot + 2; y = 10 + gx_green_y_hot; - surf = SDLCreateSurfFromData( - gx_green_width, gx_green_height, gx_green_bitmap, - ARGBColors[ RIGHT ], - 0 ); // Background transparent: draw only green menu + surf = SDLCreateSurfFromData( gx_green_width, gx_green_height, gx_green_bitmap, ARGBColors[ RIGHT ], + 0 ); // Background transparent: draw only green menu srect.x = 0; srect.y = 0; srect.w = gx_green_width; @@ -1541,9 +972,8 @@ static void SDLDrawLogo() { } else { x = DISPLAY_OFFSET_X; y = TOP_SKIP - DISP_FRAME - hp48sx_height - 3; - surf = SDLCreateSurfFromData( - hp48sx_width, hp48sx_height, hp48sx_bitmap, ARGBColors[ RIGHT ], - 0 ); // Background transparent: draw only green menu + surf = SDLCreateSurfFromData( hp48sx_width, hp48sx_height, hp48sx_bitmap, ARGBColors[ RIGHT ], + 0 ); // Background transparent: draw only green menu srect.x = 0; srect.y = 0; srect.w = hp48sx_width; @@ -1557,9 +987,8 @@ static void SDLDrawLogo() { x = DISPLAY_OFFSET_X + display_width - 1 - science_width; y = TOP_SKIP - DISP_FRAME - science_height - 4; - surf = SDLCreateSurfFromData( - science_width, science_height, science_bitmap, ARGBColors[ RIGHT ], - 0 ); // Background transparent: draw only green menu + surf = SDLCreateSurfFromData( science_width, science_height, science_bitmap, ARGBColors[ RIGHT ], + 0 ); // Background transparent: draw only green menu srect.x = 0; srect.y = 0; srect.w = science_width; @@ -1573,21 +1002,20 @@ static void SDLDrawLogo() { } } -static void SDLCreateKeys( void ) { +static void SDLCreateKeys( void ) +{ unsigned i, x, y; unsigned pixel; for ( i = BUTTON_A; i <= LAST_BUTTON; i++ ) { // Create surfaces for each button if ( !buttons[ i ].surfaceup ) - buttons[ i ].surfaceup = SDL_CreateRGBSurface( - SDL_SWSURFACE, buttons[ i ].w, buttons[ i ].h, 32, 0x00ff0000, - 0x0000ff00, 0x000000ff, 0xff000000 ); + buttons[ i ].surfaceup = + SDL_CreateRGBSurface( SDL_SWSURFACE, buttons[ i ].w, buttons[ i ].h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 ); if ( !buttons[ i ].surfacedown ) - buttons[ i ].surfacedown = SDL_CreateRGBSurface( - SDL_SWSURFACE, buttons[ i ].w, buttons[ i ].h, 32, 0x00ff0000, - 0x0000ff00, 0x000000ff, 0xff000000 ); + buttons[ i ].surfacedown = + SDL_CreateRGBSurface( SDL_SWSURFACE, buttons[ i ].w, buttons[ i ].h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 ); // Use alpha channel pixel = 0x00000000; @@ -1607,153 +1035,99 @@ static void SDLCreateKeys( void ) { // draw the released button // draw edge of button - lineColor( buttons[ i ].surfaceup, 1, buttons[ i ].h - 2, 1, 1, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfaceup, 2, buttons[ i ].h - 3, 2, 2, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfaceup, 3, buttons[ i ].h - 4, 3, 3, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfaceup, 1, buttons[ i ].h - 2, 1, 1, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfaceup, 2, buttons[ i ].h - 3, 2, 2, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfaceup, 3, buttons[ i ].h - 4, 3, 3, bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfaceup, 1, 1, buttons[ i ].w - 2, 1, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfaceup, 2, 2, buttons[ i ].w - 3, 2, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfaceup, 3, 3, buttons[ i ].w - 4, 3, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfaceup, 4, 4, buttons[ i ].w - 5, 4, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfaceup, 1, 1, buttons[ i ].w - 2, 1, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfaceup, 2, 2, buttons[ i ].w - 3, 2, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfaceup, 3, 3, buttons[ i ].w - 4, 3, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfaceup, 4, 4, buttons[ i ].w - 5, 4, bgra2argb( ARGBColors[ BUT_TOP ] ) ); - pixelColor( buttons[ i ].surfaceup, 4, 5, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); + pixelColor( buttons[ i ].surfaceup, 4, 5, bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfaceup, 3, buttons[ i ].h - 2, - buttons[ i ].w - 2, buttons[ i ].h - 2, + lineColor( buttons[ i ].surfaceup, 3, buttons[ i ].h - 2, buttons[ i ].w - 2, buttons[ i ].h - 2, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - lineColor( buttons[ i ].surfaceup, 4, buttons[ i ].h - 3, - buttons[ i ].w - 3, buttons[ i ].h - 3, + lineColor( buttons[ i ].surfaceup, 4, buttons[ i ].h - 3, buttons[ i ].w - 3, buttons[ i ].h - 3, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - lineColor( buttons[ i ].surfaceup, buttons[ i ].w - 2, - buttons[ i ].h - 2, buttons[ i ].w - 2, 3, + lineColor( buttons[ i ].surfaceup, buttons[ i ].w - 2, buttons[ i ].h - 2, buttons[ i ].w - 2, 3, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - lineColor( buttons[ i ].surfaceup, buttons[ i ].w - 3, - buttons[ i ].h - 3, buttons[ i ].w - 3, 4, + lineColor( buttons[ i ].surfaceup, buttons[ i ].w - 3, buttons[ i ].h - 3, buttons[ i ].w - 3, 4, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - lineColor( buttons[ i ].surfaceup, buttons[ i ].w - 4, - buttons[ i ].h - 4, buttons[ i ].w - 4, 5, + lineColor( buttons[ i ].surfaceup, buttons[ i ].w - 4, buttons[ i ].h - 4, buttons[ i ].w - 4, 5, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - pixelColor( buttons[ i ].surfaceup, buttons[ i ].w - 5, - buttons[ i ].h - 4, bgra2argb( ARGBColors[ BUT_BOT ] ) ); + pixelColor( buttons[ i ].surfaceup, buttons[ i ].w - 5, buttons[ i ].h - 4, bgra2argb( ARGBColors[ BUT_BOT ] ) ); // draw frame around button - lineColor( buttons[ i ].surfaceup, 0, buttons[ i ].h - 3, 0, 2, + lineColor( buttons[ i ].surfaceup, 0, buttons[ i ].h - 3, 0, 2, bgra2argb( ARGBColors[ FRAME ] ) ); + lineColor( buttons[ i ].surfaceup, 2, 0, buttons[ i ].w - 3, 0, bgra2argb( ARGBColors[ FRAME ] ) ); + lineColor( buttons[ i ].surfaceup, 2, buttons[ i ].h - 1, buttons[ i ].w - 3, buttons[ i ].h - 1, bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( buttons[ i ].surfaceup, 2, 0, buttons[ i ].w - 3, 0, - bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( buttons[ i ].surfaceup, 2, buttons[ i ].h - 1, - buttons[ i ].w - 3, buttons[ i ].h - 1, - bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( buttons[ i ].surfaceup, buttons[ i ].w - 1, - buttons[ i ].h - 3, buttons[ i ].w - 1, 2, + lineColor( buttons[ i ].surfaceup, buttons[ i ].w - 1, buttons[ i ].h - 3, buttons[ i ].w - 1, 2, bgra2argb( ARGBColors[ FRAME ] ) ); if ( i == BUTTON_ON ) { - lineColor( buttons[ i ].surfaceup, 1, 1, buttons[ 1 ].w - 2, 1, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfaceup, 1, 2, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfaceup, buttons[ i ].w - 2, 2, - bgra2argb( ARGBColors[ FRAME ] ) ); + lineColor( buttons[ i ].surfaceup, 1, 1, buttons[ 1 ].w - 2, 1, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfaceup, 1, 2, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfaceup, buttons[ i ].w - 2, 2, bgra2argb( ARGBColors[ FRAME ] ) ); } else { - pixelColor( buttons[ i ].surfaceup, 1, 1, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfaceup, buttons[ i ].w - 2, 1, - bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfaceup, 1, 1, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfaceup, buttons[ i ].w - 2, 1, bgra2argb( ARGBColors[ FRAME ] ) ); } - pixelColor( buttons[ i ].surfaceup, 1, buttons[ i ].h - 2, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfaceup, buttons[ i ].w - 2, - buttons[ i ].h - 2, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfaceup, 1, buttons[ i ].h - 2, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfaceup, buttons[ i ].w - 2, buttons[ i ].h - 2, bgra2argb( ARGBColors[ FRAME ] ) ); // draw the depressed button // draw edge of button - lineColor( buttons[ i ].surfacedown, 2, buttons[ i ].h - 4, 2, 2, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfacedown, 3, buttons[ i ].h - 5, 3, 3, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfacedown, 2, 2, buttons[ i ].w - 4, 2, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfacedown, 3, 3, buttons[ i ].w - 5, 3, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); - pixelColor( buttons[ i ].surfacedown, 4, 4, - bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfacedown, 2, buttons[ i ].h - 4, 2, 2, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfacedown, 3, buttons[ i ].h - 5, 3, 3, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfacedown, 2, 2, buttons[ i ].w - 4, 2, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + lineColor( buttons[ i ].surfacedown, 3, 3, buttons[ i ].w - 5, 3, bgra2argb( ARGBColors[ BUT_TOP ] ) ); + pixelColor( buttons[ i ].surfacedown, 4, 4, bgra2argb( ARGBColors[ BUT_TOP ] ) ); - lineColor( buttons[ i ].surfacedown, 3, buttons[ i ].h - 3, - buttons[ i ].w - 3, buttons[ i ].h - 3, + lineColor( buttons[ i ].surfacedown, 3, buttons[ i ].h - 3, buttons[ i ].w - 3, buttons[ i ].h - 3, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - lineColor( buttons[ i ].surfacedown, 4, buttons[ i ].h - 4, - buttons[ i ].w - 4, buttons[ i ].h - 4, + lineColor( buttons[ i ].surfacedown, 4, buttons[ i ].h - 4, buttons[ i ].w - 4, buttons[ i ].h - 4, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - lineColor( buttons[ i ].surfacedown, buttons[ i ].w - 3, - buttons[ i ].h - 3, buttons[ i ].w - 3, 3, + lineColor( buttons[ i ].surfacedown, buttons[ i ].w - 3, buttons[ i ].h - 3, buttons[ i ].w - 3, 3, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - lineColor( buttons[ i ].surfacedown, buttons[ i ].w - 4, - buttons[ i ].h - 4, buttons[ i ].w - 4, 4, + lineColor( buttons[ i ].surfacedown, buttons[ i ].w - 4, buttons[ i ].h - 4, buttons[ i ].w - 4, 4, bgra2argb( ARGBColors[ BUT_BOT ] ) ); - pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 5, - buttons[ i ].h - 5, bgra2argb( ARGBColors[ BUT_BOT ] ) ); + pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 5, buttons[ i ].h - 5, bgra2argb( ARGBColors[ BUT_BOT ] ) ); // draw frame around button - lineColor( buttons[ i ].surfacedown, 0, buttons[ i ].h - 3, 0, 2, + lineColor( buttons[ i ].surfacedown, 0, buttons[ i ].h - 3, 0, 2, bgra2argb( ARGBColors[ FRAME ] ) ); + lineColor( buttons[ i ].surfacedown, 2, 0, buttons[ i ].w - 3, 0, bgra2argb( ARGBColors[ FRAME ] ) ); + lineColor( buttons[ i ].surfacedown, 2, buttons[ i ].h - 1, buttons[ i ].w - 3, buttons[ i ].h - 1, bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( buttons[ i ].surfacedown, 2, 0, buttons[ i ].w - 3, 0, - bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( buttons[ i ].surfacedown, 2, buttons[ i ].h - 1, - buttons[ i ].w - 3, buttons[ i ].h - 1, - bgra2argb( ARGBColors[ FRAME ] ) ); - lineColor( buttons[ i ].surfacedown, buttons[ i ].w - 1, - buttons[ i ].h - 3, buttons[ i ].w - 1, 2, + lineColor( buttons[ i ].surfacedown, buttons[ i ].w - 1, buttons[ i ].h - 3, buttons[ i ].w - 1, 2, bgra2argb( ARGBColors[ FRAME ] ) ); if ( i == BUTTON_ON ) { - lineColor( buttons[ i ].surfacedown, 1, 1, buttons[ i ].w - 2, 1, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, 1, 2, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 2, 2, - bgra2argb( ARGBColors[ FRAME ] ) ); + lineColor( buttons[ i ].surfacedown, 1, 1, buttons[ i ].w - 2, 1, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, 1, 2, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 2, 2, bgra2argb( ARGBColors[ FRAME ] ) ); } else { - pixelColor( buttons[ i ].surfacedown, 1, 1, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 2, 1, - bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, 1, 1, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 2, 1, bgra2argb( ARGBColors[ FRAME ] ) ); } - pixelColor( buttons[ i ].surfacedown, 1, buttons[ i ].h - 2, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 2, - buttons[ i ].h - 2, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, 1, buttons[ i ].h - 2, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 2, buttons[ i ].h - 2, bgra2argb( ARGBColors[ FRAME ] ) ); if ( i == BUTTON_ON ) { - rectangleColor( buttons[ i ].surfacedown, 1, 2, - 1 + buttons[ i ].w - 3, 2 + buttons[ i ].h - 4, + rectangleColor( buttons[ i ].surfacedown, 1, 2, 1 + buttons[ i ].w - 3, 2 + buttons[ i ].h - 4, bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, 2, 3, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 3, 3, - bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, 2, 3, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 3, 3, bgra2argb( ARGBColors[ FRAME ] ) ); } else { - rectangleColor( buttons[ i ].surfacedown, 1, 1, - 1 + buttons[ i ].w - 3, 1 + buttons[ i ].h - 3, + rectangleColor( buttons[ i ].surfacedown, 1, 1, 1 + buttons[ i ].w - 3, 1 + buttons[ i ].h - 3, bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, 2, 2, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 3, 2, - bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, 2, 2, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 3, 2, bgra2argb( ARGBColors[ FRAME ] ) ); } - pixelColor( buttons[ i ].surfacedown, 2, buttons[ i ].h - 3, - bgra2argb( ARGBColors[ FRAME ] ) ); - pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 3, - buttons[ i ].h - 3, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, 2, buttons[ i ].h - 3, bgra2argb( ARGBColors[ FRAME ] ) ); + pixelColor( buttons[ i ].surfacedown, buttons[ i ].w - 3, buttons[ i ].h - 3, bgra2argb( ARGBColors[ FRAME ] ) ); if ( buttons[ i ].label != ( char* )0 ) { // Todo: use SDL_ttf to print "nice" fonts @@ -1761,10 +1135,8 @@ static void SDLCreateKeys( void ) { // for the time being use SDL_gfxPrimitives' font x = ( buttons[ i ].w - strlen( buttons[ i ].label ) * 8 ) / 2; y = ( buttons[ i ].h + 1 ) / 2 - 4; - stringColor( buttons[ i ].surfaceup, x, y, buttons[ i ].label, - 0xffffffff ); - stringColor( buttons[ i ].surfacedown, x, y, buttons[ i ].label, - 0xffffffff ); + stringColor( buttons[ i ].surfaceup, x, y, buttons[ i ].label, 0xffffffff ); + stringColor( buttons[ i ].surfacedown, x, y, buttons[ i ].label, 0xffffffff ); } // Pixmap centered in button if ( buttons[ i ].lw != 0 ) { @@ -1774,8 +1146,7 @@ static void SDLCreateKeys( void ) { // Blit the label surface to the button SDL_Surface* surf; - surf = SDLCreateSurfFromData( buttons[ i ].lw, buttons[ i ].lh, - buttons[ i ].lb, colorfg, colorbg ); + surf = SDLCreateSurfFromData( buttons[ i ].lw, buttons[ i ].lh, buttons[ i ].lb, colorfg, colorbg ); // Draw the surface on the center of the button x = ( 1 + buttons[ i ].w - buttons[ i ].lw ) / 2; y = ( 1 + buttons[ i ].h - buttons[ i ].lh ) / 2 + 1; @@ -1797,7 +1168,8 @@ static void SDLCreateKeys( void ) { } // Draw the left labels (violet on GX) -static void SDLDrawKeysLabelsLeft( void ) { +static void SDLDrawKeysLabelsLeft( void ) +{ int i, x, y; unsigned int pw /* , ph */; int wl, wr, ws; @@ -1824,10 +1196,7 @@ static void SDLDrawKeysLabelsLeft( void ) { colorbg = ARGBColors[ UNDERLAY ]; colorfg = ARGBColors[ LEFT ]; - x = ( pw + 1 - - SmallTextWidth( buttons[ i ].left, - strlen( buttons[ i ].left ) ) ) / - 2; + x = ( pw + 1 - SmallTextWidth( buttons[ i ].left, strlen( buttons[ i ].left ) ) ) / 2; if ( opt_gx ) y = 14; else @@ -1836,15 +1205,13 @@ static void SDLDrawKeysLabelsLeft( void ) { // Set the coordinates to absolute if ( opt_gx ) { x += offset_x + buttons[ i ].x - 6; - y += offset_y + buttons[ i ].y - small_ascent - small_descent - - 6; + y += offset_y + buttons[ i ].y - small_ascent - small_descent - 6; } else { x += offset_x + buttons[ i ].x + ( buttons[ i ].w - pw ) / 2; y += offset_y + buttons[ i ].y - small_ascent - small_descent; } - SDLDrawSmallString( x, y, buttons[ i ].left, - strlen( buttons[ i ].left ), colorfg, colorbg ); + SDLDrawSmallString( x, y, buttons[ i ].left, strlen( buttons[ i ].left ), colorfg, colorbg ); } else // is_menu { colorbg = ARGBColors[ BLACK ]; @@ -1853,33 +1220,27 @@ static void SDLDrawKeysLabelsLeft( void ) { if ( buttons[ i ].right == ( char* )0 ) { // centered label x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - - SmallTextWidth( buttons[ i ].left, - strlen( buttons[ i ].left ) ) ) / - 2; + ( 1 + buttons[ i ].w - SmallTextWidth( buttons[ i ].left, strlen( buttons[ i ].left ) ) ) / 2; } else { // label to the left - wl = SmallTextWidth( buttons[ i ].left, - strlen( buttons[ i ].left ) ); - wr = SmallTextWidth( buttons[ i ].right, - strlen( buttons[ i ].right ) ); + wl = SmallTextWidth( buttons[ i ].left, strlen( buttons[ i ].left ) ); + wr = SmallTextWidth( buttons[ i ].right, strlen( buttons[ i ].right ) ); ws = SmallTextWidth( " ", 1 ); - x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - ( wl + wr + ws ) ) / 2; + x = offset_x + buttons[ i ].x + ( 1 + buttons[ i ].w - ( wl + wr + ws ) ) / 2; } y = offset_y + buttons[ i ].y - small_descent; - SDLDrawSmallString( x, y, buttons[ i ].left, - strlen( buttons[ i ].left ), colorfg, colorbg ); + SDLDrawSmallString( x, y, buttons[ i ].left, strlen( buttons[ i ].left ), colorfg, colorbg ); } // is_menu } // for } // Draw the right labels (green on GX) -static void SDLDrawKeysLabelsRight( void ) { +static void SDLDrawKeysLabelsRight( void ) +{ int i, x, y; unsigned int pw /* , ph */; int wl, wr, ws; @@ -1903,10 +1264,7 @@ static void SDLDrawKeysLabelsRight( void ) { colorbg = ARGBColors[ UNDERLAY ]; colorfg = ARGBColors[ RIGHT ]; - x = ( pw + 1 - - SmallTextWidth( buttons[ i ].right, - strlen( buttons[ i ].right ) ) ) / - 2; + x = ( pw + 1 - SmallTextWidth( buttons[ i ].right, strlen( buttons[ i ].right ) ) ) / 2; if ( opt_gx ) y = 14; else @@ -1915,16 +1273,13 @@ static void SDLDrawKeysLabelsRight( void ) { // Set the coordinates to absolute if ( opt_gx ) { x += offset_x + buttons[ i ].x - 6; - y += offset_y + buttons[ i ].y - small_ascent - small_descent - - 6; + y += offset_y + buttons[ i ].y - small_ascent - small_descent - 6; } else { x += offset_x + buttons[ i ].x + ( buttons[ i ].w - pw ) / 2; y += offset_y + buttons[ i ].y - small_ascent - small_descent; } - SDLDrawSmallString( x, y, buttons[ i ].right, - strlen( buttons[ i ].right ), colorfg, - colorbg ); + SDLDrawSmallString( x, y, buttons[ i ].right, strlen( buttons[ i ].right ), colorfg, colorbg ); } // buttons[i].is_menu else { colorbg = ARGBColors[ BLACK ]; @@ -1933,34 +1288,27 @@ static void SDLDrawKeysLabelsRight( void ) { if ( buttons[ i ].left == ( char* )0 ) { // centered label x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - - SmallTextWidth( buttons[ i ].right, - strlen( buttons[ i ].right ) ) ) / - 2; + ( 1 + buttons[ i ].w - SmallTextWidth( buttons[ i ].right, strlen( buttons[ i ].right ) ) ) / 2; } else { // label to the right - wl = SmallTextWidth( buttons[ i ].left, - strlen( buttons[ i ].left ) ); - wr = SmallTextWidth( buttons[ i ].right, - strlen( buttons[ i ].right ) ); + wl = SmallTextWidth( buttons[ i ].left, strlen( buttons[ i ].left ) ); + wr = SmallTextWidth( buttons[ i ].right, strlen( buttons[ i ].right ) ); ws = SmallTextWidth( " ", 1 ); - x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - ( wl + wr + ws ) ) / 2 + wl + ws; + x = offset_x + buttons[ i ].x + ( 1 + buttons[ i ].w - ( wl + wr + ws ) ) / 2 + wl + ws; } y = offset_y + buttons[ i ].y - small_descent; - SDLDrawSmallString( x, y, buttons[ i ].right, - strlen( buttons[ i ].right ), colorfg, - colorbg ); + SDLDrawSmallString( x, y, buttons[ i ].right, strlen( buttons[ i ].right ), colorfg, colorbg ); } } // for } // Draw the letter bottom right of the keys -static void SDLDrawKeysLetters( void ) { +static void SDLDrawKeysLetters( void ) +{ int i, x, y; int offset_y = KEYBOARD_OFFSET_Y; int offset_x = KEYBOARD_OFFSET_X; @@ -1979,19 +1327,18 @@ static void SDLDrawKeysLetters( void ) { x = offset_x + buttons[ i ].x + buttons[ i ].w + 3; y = offset_y + buttons[ i ].y + buttons[ i ].h + 1; } else { - x = offset_x + buttons[ i ].x + buttons[ i ].w - - SmallTextWidth( buttons[ i ].letter, 1 ) / 2 + 5; + x = offset_x + buttons[ i ].x + buttons[ i ].w - SmallTextWidth( buttons[ i ].letter, 1 ) / 2 + 5; y = offset_y + buttons[ i ].y + buttons[ i ].h - 2; } - SDLDrawSmallString( x, y, buttons[ i ].letter, 1, 0xffffffff, - colorbg ); + SDLDrawSmallString( x, y, buttons[ i ].letter, 1, 0xffffffff, colorbg ); } } } // Bottom label: the only one is the cancel button -static void SDLDrawKeysLabelsBottom( void ) { +static void SDLDrawKeysLabelsBottom( void ) +{ int i, x, y; int offset_y = KEYBOARD_OFFSET_Y; int offset_x = KEYBOARD_OFFSET_X; @@ -2009,18 +1356,15 @@ static void SDLDrawKeysLabelsBottom( void ) { colorfg = ARGBColors[ WHITE ]; - x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - - SmallTextWidth( buttons[ i ].sub, strlen( buttons[ i ].sub ) ) ) / - 2; + x = offset_x + buttons[ i ].x + ( 1 + buttons[ i ].w - SmallTextWidth( buttons[ i ].sub, strlen( buttons[ i ].sub ) ) ) / 2; y = offset_y + buttons[ i ].y + buttons[ i ].h + small_ascent + 2; - SDLDrawSmallString( x, y, buttons[ i ].sub, strlen( buttons[ i ].sub ), - colorfg, colorbg ); + SDLDrawSmallString( x, y, buttons[ i ].sub, strlen( buttons[ i ].sub ), colorfg, colorbg ); } } // Draws the greyish area around keys that trigger menus -static void SDLDrawKeyMenu( void ) { +static void SDLDrawKeyMenu( void ) +{ int i, x, y; int offset_y = KEYBOARD_OFFSET_Y; int offset_x = KEYBOARD_OFFSET_X; @@ -2059,7 +1403,8 @@ static void SDLDrawKeyMenu( void ) { } } -static void SDLDrawButtons( void ) { +static void SDLDrawButtons( void ) +{ SDL_Rect srect, drect; for ( int i = FIRST_BUTTON; i <= LAST_BUTTON; i++ ) { @@ -2073,22 +1418,19 @@ static void SDLDrawButtons( void ) { drect.w = buttons[ i ].w; drect.h = buttons[ i ].h; if ( buttons[ i ].pressed ) - SDL_BlitSurface( buttons[ i ].surfacedown, &srect, sdlwindow, - &drect ); + SDL_BlitSurface( buttons[ i ].surfacedown, &srect, sdlwindow, &drect ); else - SDL_BlitSurface( buttons[ i ].surfaceup, &srect, sdlwindow, - &drect ); + SDL_BlitSurface( buttons[ i ].surfaceup, &srect, sdlwindow, &drect ); } // Always update immediately buttons - SDL_UpdateRect( - sdlwindow, KEYBOARD_OFFSET_X + buttons[ 0 ].x, - KEYBOARD_OFFSET_Y + buttons[ 0 ].y, - buttons[ LAST_BUTTON ].x + buttons[ LAST_BUTTON ].w - buttons[ 0 ].x, - buttons[ LAST_BUTTON ].y + buttons[ LAST_BUTTON ].h - buttons[ 0 ].y ); + SDL_UpdateRect( sdlwindow, KEYBOARD_OFFSET_X + buttons[ 0 ].x, KEYBOARD_OFFSET_Y + buttons[ 0 ].y, + buttons[ LAST_BUTTON ].x + buttons[ LAST_BUTTON ].w - buttons[ 0 ].x, + buttons[ LAST_BUTTON ].y + buttons[ LAST_BUTTON ].h - buttons[ 0 ].y ); } -static void SDLDrawKeypad( void ) { +static void SDLDrawKeypad( void ) +{ SDLDrawKeyMenu(); SDLDrawKeysLetters(); SDLDrawKeysLabelsBottom(); @@ -2098,114 +1440,74 @@ static void SDLDrawKeypad( void ) { SDLDrawButtons(); } -static void SDLDrawBezel() { +static void SDLDrawBezel() +{ unsigned int i; int display_height = DISPLAY_HEIGHT; int display_width = DISPLAY_WIDTH; // draw the frame around the display for ( i = 0; i < DISP_FRAME; i++ ) { - lineColor( sdlwindow, DISPLAY_OFFSET_X - i, - DISPLAY_OFFSET_Y + display_height + 2 * i, - DISPLAY_OFFSET_X + display_width + i, - DISPLAY_OFFSET_Y + display_height + 2 * i, - bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X - i, - DISPLAY_OFFSET_Y + display_height + 2 * i + 1, - DISPLAY_OFFSET_X + display_width + i, - DISPLAY_OFFSET_Y + display_height + 2 * i + 1, - bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + i, - DISPLAY_OFFSET_Y - i, DISPLAY_OFFSET_X + display_width + i, - DISPLAY_OFFSET_Y + display_height + 2 * i, - bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X - i, DISPLAY_OFFSET_Y + display_height + 2 * i, DISPLAY_OFFSET_X + display_width + i, + DISPLAY_OFFSET_Y + display_height + 2 * i, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X - i, DISPLAY_OFFSET_Y + display_height + 2 * i + 1, DISPLAY_OFFSET_X + display_width + i, + DISPLAY_OFFSET_Y + display_height + 2 * i + 1, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + i, DISPLAY_OFFSET_Y - i, DISPLAY_OFFSET_X + display_width + i, + DISPLAY_OFFSET_Y + display_height + 2 * i, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) ); } for ( i = 0; i < DISP_FRAME; i++ ) { - lineColor( - sdlwindow, DISPLAY_OFFSET_X - i - 1, DISPLAY_OFFSET_Y - i - 1, - DISPLAY_OFFSET_X + display_width + i - 1, DISPLAY_OFFSET_Y - i - 1, - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X - i - 1, - DISPLAY_OFFSET_Y - i - 1, DISPLAY_OFFSET_X - i - 1, - DISPLAY_OFFSET_Y + display_height + 2 * i - 1, - bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X - i - 1, DISPLAY_OFFSET_Y - i - 1, DISPLAY_OFFSET_X + display_width + i - 1, + DISPLAY_OFFSET_Y - i - 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X - i - 1, DISPLAY_OFFSET_Y - i - 1, DISPLAY_OFFSET_X - i - 1, + DISPLAY_OFFSET_Y + display_height + 2 * i - 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) ); } // round off corners - lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, - DISPLAY_OFFSET_Y - DISP_FRAME, DISPLAY_OFFSET_X - DISP_FRAME + 3, - DISPLAY_OFFSET_Y - DISP_FRAME, - bgra2argb( ARGBColors[ DISP_PAD ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, - DISPLAY_OFFSET_Y - DISP_FRAME, DISPLAY_OFFSET_X - DISP_FRAME, - DISPLAY_OFFSET_Y - DISP_FRAME + 3, - bgra2argb( ARGBColors[ DISP_PAD ] ) ); - pixelColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME + 1, - DISPLAY_OFFSET_Y - DISP_FRAME + 1, + lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y - DISP_FRAME, DISPLAY_OFFSET_X - DISP_FRAME + 3, + DISPLAY_OFFSET_Y - DISP_FRAME, bgra2argb( ARGBColors[ DISP_PAD ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y - DISP_FRAME, DISPLAY_OFFSET_X - DISP_FRAME, + DISPLAY_OFFSET_Y - DISP_FRAME + 3, bgra2argb( ARGBColors[ DISP_PAD ] ) ); + pixelColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME + 1, DISPLAY_OFFSET_Y - DISP_FRAME + 1, bgra2argb( ARGBColors[ DISP_PAD ] ) ); + + lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4, DISPLAY_OFFSET_Y - DISP_FRAME, + DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y - DISP_FRAME, bgra2argb( ARGBColors[ DISP_PAD ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y - DISP_FRAME, + DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y - DISP_FRAME + 3, bgra2argb( ARGBColors[ DISP_PAD ] ) ); + pixelColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2, DISPLAY_OFFSET_Y - DISP_FRAME + 1, bgra2argb( ARGBColors[ DISP_PAD ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4, - DISPLAY_OFFSET_Y - DISP_FRAME, - DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, - DISPLAY_OFFSET_Y - DISP_FRAME, + lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4, + DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, bgra2argb( ARGBColors[ DISP_PAD ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, + DISPLAY_OFFSET_X - DISP_FRAME + 3, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, bgra2argb( ARGBColors[ DISP_PAD ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, - DISPLAY_OFFSET_Y - DISP_FRAME, - DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, - DISPLAY_OFFSET_Y - DISP_FRAME + 3, - bgra2argb( ARGBColors[ DISP_PAD ] ) ); - pixelColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2, - DISPLAY_OFFSET_Y - DISP_FRAME + 1, + pixelColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME + 1, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2, bgra2argb( ARGBColors[ DISP_PAD ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4, - DISPLAY_OFFSET_X - DISP_FRAME, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, + lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4, + DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, bgra2argb( ARGBColors[ DISP_PAD ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, - DISPLAY_OFFSET_X - DISP_FRAME + 3, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, + lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, + DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, bgra2argb( ARGBColors[ DISP_PAD ] ) ); - pixelColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME + 1, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2, - bgra2argb( ARGBColors[ DISP_PAD ] ) ); - - lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4, - DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, - bgra2argb( ARGBColors[ DISP_PAD ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, - DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, - bgra2argb( ARGBColors[ DISP_PAD ] ) ); - pixelColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2, - DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2, + pixelColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2, bgra2argb( ARGBColors[ DISP_PAD ] ) ); // simulate rounded lcd corners - lineColor( sdlwindow, DISPLAY_OFFSET_X - 1, DISPLAY_OFFSET_Y + 1, - DISPLAY_OFFSET_X - 1, DISPLAY_OFFSET_Y + display_height - 2, + lineColor( sdlwindow, DISPLAY_OFFSET_X - 1, DISPLAY_OFFSET_Y + 1, DISPLAY_OFFSET_X - 1, DISPLAY_OFFSET_Y + display_height - 2, bgra2argb( ARGBColors[ LCD ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X + 1, DISPLAY_OFFSET_Y - 1, - DISPLAY_OFFSET_X + display_width - 2, DISPLAY_OFFSET_Y - 1, - bgra2argb( ARGBColors[ LCD ] ) ); - lineColor( - sdlwindow, DISPLAY_OFFSET_X + 1, DISPLAY_OFFSET_Y + display_height, - DISPLAY_OFFSET_X + display_width - 2, DISPLAY_OFFSET_Y + display_height, - bgra2argb( ARGBColors[ LCD ] ) ); - lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width, - DISPLAY_OFFSET_Y + 1, DISPLAY_OFFSET_X + display_width, - DISPLAY_OFFSET_Y + display_height - 2, + lineColor( sdlwindow, DISPLAY_OFFSET_X + 1, DISPLAY_OFFSET_Y - 1, DISPLAY_OFFSET_X + display_width - 2, DISPLAY_OFFSET_Y - 1, bgra2argb( ARGBColors[ LCD ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X + 1, DISPLAY_OFFSET_Y + display_height, DISPLAY_OFFSET_X + display_width - 2, + DISPLAY_OFFSET_Y + display_height, bgra2argb( ARGBColors[ LCD ] ) ); + lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width, DISPLAY_OFFSET_Y + 1, DISPLAY_OFFSET_X + display_width, + DISPLAY_OFFSET_Y + display_height - 2, bgra2argb( ARGBColors[ LCD ] ) ); } -static void SDLDrawBackground( int width, int height, int w_top, int h_top ) { +static void SDLDrawBackground( int width, int height, int w_top, int h_top ) +{ SDL_Rect rect; rect.x = 0; @@ -2219,7 +1521,8 @@ static void SDLDrawBackground( int width, int height, int w_top, int h_top ) { SDL_FillRect( sdlwindow, &rect, ARGBColors[ DISP_PAD ] ); } -static void SDLDrawBackgroundLCD() { +static void SDLDrawBackgroundLCD() +{ SDL_Rect rect; rect.x = DISPLAY_OFFSET_X; @@ -2229,7 +1532,8 @@ static void SDLDrawBackgroundLCD() { SDL_FillRect( sdlwindow, &rect, ARGBColors[ LCD ] ); } -static void SDLDrawAnnunc( char* annunc ) { +static void SDLDrawAnnunc( char* annunc ) +{ SDLCreateAnnunc(); // Print the annunciator @@ -2245,21 +1549,18 @@ static void SDLDrawAnnunc( char* annunc ) { drect.w = ann_tbl[ i ].width; drect.h = ann_tbl[ i ].height; if ( annunc[ i ] ) - SDL_BlitSurface( ann_tbl[ i ].surfaceon, &srect, sdlwindow, - &drect ); + SDL_BlitSurface( ann_tbl[ i ].surfaceon, &srect, sdlwindow, &drect ); else - SDL_BlitSurface( ann_tbl[ i ].surfaceoff, &srect, sdlwindow, - &drect ); + SDL_BlitSurface( ann_tbl[ i ].surfaceoff, &srect, sdlwindow, &drect ); } // Always immediately update annunciators - SDL_UpdateRect( sdlwindow, DISPLAY_OFFSET_X + ann_tbl[ 0 ].x, - DISPLAY_OFFSET_Y + ann_tbl[ 0 ].y, - ann_tbl[ 5 ].x + ann_tbl[ 5 ].width - ann_tbl[ 0 ].x, - ann_tbl[ 5 ].y + ann_tbl[ 5 ].height - ann_tbl[ 0 ].y ); + SDL_UpdateRect( sdlwindow, DISPLAY_OFFSET_X + ann_tbl[ 0 ].x, DISPLAY_OFFSET_Y + ann_tbl[ 0 ].y, + ann_tbl[ 5 ].x + ann_tbl[ 5 ].width - ann_tbl[ 0 ].x, ann_tbl[ 5 ].y + ann_tbl[ 5 ].height - ann_tbl[ 0 ].y ); } -static void SDLDrawNibble( int nx, int ny, int val ) { +static void SDLDrawNibble( int nx, int ny, int val ) +{ int x, y; int xoffset = DISPLAY_OFFSET_X + 5; int yoffset = DISPLAY_OFFSET_Y + 20; @@ -2270,8 +1571,7 @@ static void SDLDrawNibble( int nx, int ny, int val ) { for ( y = 0; y < 2; y++ ) { unsigned int* lineptr; - lineptr = - ( unsigned int* )( buffer + pitch * ( yoffset + 2 * ny + y ) ); + lineptr = ( unsigned int* )( buffer + pitch * ( yoffset + 2 * ny + y ) ); for ( x = 0; x < 4; x++ ) { // Check if bit is on @@ -2299,7 +1599,8 @@ static void SDLDrawNibble( int nx, int ny, int val ) { #endif } -static void SDLUIHideKey( void ) { +static void SDLUIHideKey( void ) +{ SDL_Rect drect; if ( showkeylastsurf == 0 ) @@ -2310,8 +1611,7 @@ static void SDLUIHideKey( void ) { SDL_BlitSurface( showkeylastsurf, 0, sdlwindow, &drect ); // Update - SDL_UpdateRect( sdlwindow, showkeylastx, showkeylasty, showkeylastsurf->w, - showkeylastsurf->h ); + SDL_UpdateRect( sdlwindow, showkeylastx, showkeylasty, showkeylastsurf->w, showkeylastsurf->h ); // Free SDL_FreeSurface( showkeylastsurf ); @@ -2319,7 +1619,8 @@ static void SDLUIHideKey( void ) { } // Show the hp key which is being pressed -static void SDLUIShowKey( int hpkey ) { +static void SDLUIShowKey( int hpkey ) +{ SDL_Rect srect, drect; SDL_Surface* ssurf; int x; @@ -2338,19 +1639,14 @@ static void SDLUIShowKey( int hpkey ) { return; // Which surface to show - ssurf = ( buttons[ hpkey ].pressed ) ? buttons[ hpkey ].surfacedown - : buttons[ hpkey ].surfaceup; + ssurf = ( buttons[ hpkey ].pressed ) ? buttons[ hpkey ].surfacedown : buttons[ hpkey ].surfaceup; // Background backup - showkeylastsurf = - SDL_CreateRGBSurface( SDL_SWSURFACE, ssurf->w, ssurf->h, 32, 0x00ff0000, - 0x0000ff00, 0x000000ff, 0xff000000 ); + showkeylastsurf = SDL_CreateRGBSurface( SDL_SWSURFACE, ssurf->w, ssurf->h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 ); // Where to - x = KEYBOARD_OFFSET_X + buttons[ hpkey ].x - - ( ssurf->w - ssurf->w + 1 ) / 2; - y = KEYBOARD_OFFSET_Y + buttons[ hpkey ].y - - ( ssurf->h - ssurf->h + 1 ) / 2; + x = KEYBOARD_OFFSET_X + buttons[ hpkey ].x - ( ssurf->w - ssurf->w + 1 ) / 2; + y = KEYBOARD_OFFSET_Y + buttons[ hpkey ].y - ( ssurf->h - ssurf->h + 1 ) / 2; // blitting does not clip to screen, so if we are out of the screen we // shift the button to fit if ( x < 0 ) @@ -2386,13 +1682,15 @@ static void SDLUIShowKey( int hpkey ) { static inline void SDLUIFeedback( void ) {} -static void button_release_all( void ) { +static void button_release_all( void ) +{ for ( int b = BUTTON_A; b <= LAST_BUTTON; b++ ) if ( buttons[ b ].pressed ) sdl_button_released( b ); } -static void SDLDrawSerialDevices() { +static void SDLDrawSerialDevices() +{ char text[ 1024 ] = ""; if ( verbose ) { @@ -2416,7 +1714,8 @@ static void SDLDrawSerialDevices() { stringColor( sdlwindow, 10, 240, text, 0xffffffff ); } -static inline void draw_nibble( int c, int r, int val ) { +static inline void draw_nibble( int c, int r, int val ) +{ int x, y; x = ( c * 4 ); // x: start in pixels @@ -2433,7 +1732,8 @@ static inline void draw_nibble( int c, int r, int val ) { } } -static inline void draw_row( long addr, int row ) { +static inline void draw_row( long addr, int row ) +{ int i, v; int line_length; @@ -2449,13 +1749,13 @@ static inline void draw_row( long addr, int row ) { } } -static void SDLCreateHP( void ) { +static void SDLCreateHP( void ) +{ unsigned int width, height; if ( show_ui_chrome ) { width = KEYBOARD_WIDTH + 2 * SIDE_SKIP; - height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP + - KEYBOARD_HEIGHT + BOTTOM_SKIP; + height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP + KEYBOARD_HEIGHT + BOTTOM_SKIP; } else { width = KEYBOARD_WIDTH; height = DISPLAY_HEIGHT; @@ -2502,13 +1802,13 @@ static void SDLCreateHP( void ) { /**********/ /* public */ /**********/ -int sdl_get_event( void ) { +int sdl_get_event( void ) +{ SDL_Event event; int hpkey; int rv; - static int lasthpkey = -1; // last key that was pressed or -1 for none - static int lastticks = - -1; // time at which a key was pressed or -1 if timer expired + static int lasthpkey = -1; // last key that was pressed or -1 for none + static int lastticks = -1; // time at which a key was pressed or -1 if timer expired static int lastislongpress = 0; // last key press was a long press static int keyispressed = -1; // Indicate if a key is being held down by // a finger (not set for long presses) @@ -2525,8 +1825,7 @@ int sdl_get_event( void ) { int x, y, state; state = SDL_GetMouseState( &x, &y ); - if ( state & SDL_BUTTON( 1 ) && - SDLCoordinateToKey( x, y ) == lasthpkey ) { + if ( state & SDL_BUTTON( 1 ) && SDLCoordinateToKey( x, y ) == lasthpkey ) { lastislongpress = 1; SDLUIFeedback(); } @@ -2685,7 +1984,8 @@ int sdl_get_event( void ) { return 1; } -void sdl_adjust_contrast() { +void sdl_adjust_contrast() +{ SDLCreateColors(); SDLCreateAnnunc(); @@ -2701,7 +2001,8 @@ void sdl_adjust_contrast() { sdl_draw_annunc(); } -void sdl_init_LCD( void ) { +void sdl_init_LCD( void ) +{ display.on = ( int )( saturn.disp_io & 0x8 ) >> 3; display.disp_start = ( saturn.disp_addr & 0xffffe ); @@ -2712,14 +2013,11 @@ void sdl_init_LCD( void ) { display.lines = 63; if ( display.offset > 3 ) - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; else - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; - display.disp_end = - display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); + display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); display.menu_start = saturn.menu_addr; display.menu_end = saturn.menu_addr + 0x110; @@ -2733,7 +2031,8 @@ void sdl_init_LCD( void ) { memset( lcd_buffer, 0xf0, sizeof( lcd_buffer ) ); } -void sdl_update_LCD( void ) { +void sdl_update_LCD( void ) +{ int i, j; long addr; static int old_offset = -1; @@ -2742,17 +2041,13 @@ void sdl_update_LCD( void ) { if ( display.on ) { addr = display.disp_start; if ( display.offset != old_offset ) { - memset( disp_buf, 0xf0, - ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); - memset( lcd_buffer, 0xf0, - ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); + memset( disp_buf, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); + memset( lcd_buffer, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); old_offset = display.offset; } if ( display.lines != old_lines ) { - memset( &disp_buf[ 56 ][ 0 ], 0xf0, - ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); - memset( &lcd_buffer[ 56 ][ 0 ], 0xf0, - ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); + memset( &disp_buf[ 56 ][ 0 ], 0xf0, ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); + memset( &lcd_buffer[ 56 ][ 0 ], 0xf0, ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); old_lines = display.lines; } for ( i = 0; i <= display.lines; i++ ) { @@ -2778,7 +2073,8 @@ void sdl_update_LCD( void ) { void sdl_refresh_LCD( void ) {} -void sdl_disp_draw_nibble( word_20 addr, word_4 val ) { +void sdl_disp_draw_nibble( word_20 addr, word_4 val ) +{ long offset; int x, y; @@ -2804,7 +2100,8 @@ void sdl_disp_draw_nibble( word_20 addr, word_4 val ) { } } -void sdl_menu_draw_nibble( word_20 addr, word_4 val ) { +void sdl_menu_draw_nibble( word_20 addr, word_4 val ) +{ long offset; int x, y; @@ -2817,7 +2114,8 @@ void sdl_menu_draw_nibble( word_20 addr, word_4 val ) { } } -void sdl_draw_annunc( void ) { +void sdl_draw_annunc( void ) +{ int val; val = display.annunc; @@ -2829,13 +2127,13 @@ void sdl_draw_annunc( void ) { char sdl_annuncstate[ 6 ]; for ( int i = 0; ann_tbl[ i ].bit; i++ ) - sdl_annuncstate[ i ] = - ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? 1 : 0; + sdl_annuncstate[ i ] = ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? 1 : 0; SDLDrawAnnunc( sdl_annuncstate ); } -void init_sdl_ui( int argc, char** argv ) { +void init_sdl_ui( int argc, char** argv ) +{ SDLInit(); SDLCreateHP(); sdl_init_LCD(); diff --git a/src/ui_text.c b/src/ui_text.c index 82fc846..bcb198c 100644 --- a/src/ui_text.c +++ b/src/ui_text.c @@ -1,19 +1,19 @@ +#include #include #include #include #include #include -#include -#include #include #include #include +#include #include -#include "runtime_options.h" #include "emulator.h" #include "romio.h" +#include "runtime_options.h" #include "ui.h" #include "ui_inner.h" @@ -32,263 +32,176 @@ typedef struct tui_button_t { short pressed; int code; - int x; - int y; - unsigned int w; - unsigned int h; + /* int x; */ + /* int y; */ + /* unsigned int w; */ + /* unsigned int h; */ - int lc; - const char* label; - short font_size; - unsigned int lw; - unsigned int lh; - unsigned char* lb; + /* int lc; */ + /* const char* label; */ + /* short font_size; */ + /* unsigned int lw; */ + /* unsigned int lh; */ + /* unsigned char* lb; */ - const char* letter; + /* const char* letter; */ - const char* left; - short is_menu; - const char* right; - const char* sub; + /* const char* left; */ + /* short is_menu; */ + /* const char* right; */ + /* const char* sub; */ } tui_button_t; /*************/ /* variables */ /*************/ static tui_ann_struct_t ann_tbl[] = { - { ANN_LEFT, 16, 4, '<' }, /* '↰' */ - { ANN_RIGHT, 61, 4, '>' }, /* '↱ */ - { ANN_ALPHA, 106, 4, 'a' }, /* 'α' */ - { ANN_BATTERY, 151, 4, 'B' }, /* '🪫' */ - { ANN_BUSY, 196, 4, '*' }, /* '⌛' */ - { ANN_IO, 241, 4, '^' }, /* '☃' */ - { 0 } }; + {ANN_LEFT, 16, 4, '<'}, /* '↰' */ + { ANN_RIGHT, 61, 4, '>'}, /* '↱ */ + { ANN_ALPHA, 106, 4, 'a'}, /* 'α' */ + { ANN_BATTERY, 151, 4, 'B'}, /* '🪫' */ + { ANN_BUSY, 196, 4, '*'}, /* '⌛' */ + { ANN_IO, 241, 4, '^'}, /* '☃' */ + /* { 0 } */ +}; static tui_button_t* buttons = 0; static tui_button_t buttons_sx[] = { - { "A", 0, 0x14, 0, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "A", 0, 0, 0, 0 }, - { "B", 0, 0x84, 50, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "B", 0, 0, 0, 0 }, - { "C", 0, 0x83, 100, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "C", 0, 0, 0, 0 }, - { "D", 0, 0x82, 150, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "D", 0, 0, 0, 0 }, - { "E", 0, 0x81, 200, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "E", 0, 0, 0, 0 }, - { "F", 0, 0x80, 250, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "F", 0, 0, 0, 0 }, + {"A", 0, 0x14 }, + { "B", 0, 0x84 }, + { "C", 0, 0x83 }, + { "D", 0, 0x82 }, + { "E", 0, 0x81 }, + { "F", 0, 0x80 }, - { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0, "G", "PRINT", - 1, 0, 0 }, - { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0, "H", "I/O", - 1, 0, 0 }, - { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0, "I", - "MODES", 1, 0, 0 }, - { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0, "J", - "MEMORY", 1, 0, 0 }, - { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, up_width, up_height, - up_bitmap, "K", "LIBRARY", 1, 0, 0 }, - { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0, "L", "PREV", - 0, 0, 0 }, + { "MTH", 0, 0x24 }, + { "PRG", 0, 0x74 }, + { "CST", 0, 0x73 }, + { "VAR", 0, 0x72 }, + { "UP", 0, 0x71 }, + { "NXT", 0, 0x70 }, - { "COLON", 0, 0x04, 0, 100, 36, 26, WHITE, 0, 0, colon_width, - colon_height, colon_bitmap, "M", "UP", 0, "HOME", 0 }, - { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0, "N", "DEF", - 0, "RCL", 0 }, - { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0, "O", - "aQ", 0, "aNUM", 0 }, - { "LEFT", 0, 0x62, 150, 100, 36, 26, WHITE, 0, 0, left_width, - left_height, left_bitmap, "P", "GRAPH", 0, 0, 0 }, - { "DOWN", 0, 0x61, 200, 100, 36, 26, WHITE, 0, 0, down_width, - down_height, down_bitmap, "Q", "REVIEW", 0, 0, 0 }, - { "RIGHT", 0, 0x60, 250, 100, 36, 26, WHITE, 0, 0, right_width, - right_height, right_bitmap, "R", "SWAP", 0, 0, 0 }, + { "COLON", 0, 0x04 }, + { "STO", 0, 0x64 }, + { "EVAL", 0, 0x63 }, + { "LEFT", 0, 0x62 }, + { "DOWN", 0, 0x61 }, + { "RIGHT", 0, 0x60 }, - { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0, "S", "ASIN", - 0, "b", 0 }, - { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0, "T", "ACOS", - 0, "c", 0 }, - { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0, "U", - "ATAN", 0, "d", 0 }, - { "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, 0, sqrt_width, - sqrt_height, sqrt_bitmap, "V", "e", 0, "f", 0 }, - { "POWER", 0, 0x51, 200, 150, 36, 26, WHITE, 0, 0, power_width, - power_height, power_bitmap, "W", "g", 0, "LOG", 0 }, - { "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, inv_width, inv_height, - inv_bitmap, "X", "h", 0, "LN", 0 }, + { "SIN", 0, 0x34 }, + { "COS", 0, 0x54 }, + { "TAN", 0, 0x53 }, + { "SQRT", 0, 0x52 }, + { "POWER", 0, 0x51 }, + { "INV", 0, 0x50 }, - { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0, 0, - "EQUATION", 0, "MATRIX", 0 }, - { "NEG", 0, 0x43, 100, 200, 36, 26, WHITE, 0, 0, neg_width, neg_height, - neg_bitmap, "Y", "EDIT", 0, "VISIT", 0 }, - { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0, "Z", "2D", - 0, "3D", 0 }, - { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0, 0, "PURGE", - 0, 0, 0 }, - { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, bs_width, bs_height, - bs_bitmap, 0, "DROP", 0, "CLR", 0 }, + { "ENTER", 0, 0x44 }, + { "NEG", 0, 0x43 }, + { "EEX", 0, 0x42 }, + { "DEL", 0, 0x41 }, + { "BS", 0, 0x40 }, - { "ALPHA", 0, 0x35, 0, 250, 36, 26, WHITE, 0, 0, alpha_width, - alpha_height, alpha_bitmap, 0, "USR", 0, "ENTRY", 0 }, - { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0, 0, "SOLVE", 1, - 0, 0 }, - { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0, 0, "PLOT", 1, - 0, 0 }, - { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0, 0, "ALGEBRA", - 1, 0, 0 }, - { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, div_height, - div_bitmap, 0, "( )", 0, "#", 0 }, + { "ALPHA", 0, 0x35 }, + { "7", 0, 0x33 }, + { "8", 0, 0x32 }, + { "9", 0, 0x31 }, + { "DIV", 0, 0x30 }, - { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, shl_width, shl_height, - shl_bitmap, 0, 0, 0, 0, 0 }, - { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0, 0, "TIME", 1, 0, - 0 }, - { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0, 0, "STAT", 1, - 0, 0 }, - { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0, 0, "UNITS", 1, - 0, 0 }, - { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, mul_height, - mul_bitmap, 0, "[ ]", 0, "_", 0 }, + { "SHL", 0, 0x25 }, + { "4", 0, 0x23 }, + { "5", 0, 0x22 }, + { "6", 0, 0x21 }, + { "MUL", 0, 0x20 }, - { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, shr_width, shr_height, - shr_bitmap, 0, 0, 0, 0, 0 }, - { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0, 0, "RAD", 0, - "POLAR", 0 }, - { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0, 0, "STACK", 0, - "ARG", 0 }, - { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0, 0, "CMD", 0, - "MENU", 0 }, - { "MINUS", 0, 0x10, 240, 350, 46, 26, WHITE, 0, 0, minus_width, - minus_height, minus_bitmap, 0, "i", 0, "j", 0 }, + { "SHR", 0, 0x15 }, + { "1", 0, 0x13 }, + { "2", 0, 0x12 }, + { "3", 0, 0x11 }, + { "MINUS", 0, 0x10 }, - { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0, 0, "CONT", 0, - "OFF", "ATTN" }, - { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0, 0, "= ", 0, - " a", 0 }, - { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0, 0, ", ", - 0, " k", 0 }, - { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0, 0, "l ", 0, - " m", 0 }, - { "PLUS", 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0, plus_width, - plus_height, plus_bitmap, 0, "{ }", 0, ": :", 0 } }; + { "ON", 0, 0x8000}, + { "0", 0, 0x03 }, + { "PERIOD", 0, 0x02 }, + { "SPC", 0, 0x01 }, + { "PLUS", 0, 0x00 }, + /* { 0 } */ +}; static tui_button_t buttons_gx[] = { - { "A", 0, 0x14, 0, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "A", 0, 0, 0, 0 }, - { "B", 0, 0x84, 50, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "B", 0, 0, 0, 0 }, - { "C", 0, 0x83, 100, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "C", 0, 0, 0, 0 }, - { "D", 0, 0x82, 150, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "D", 0, 0, 0, 0 }, - { "E", 0, 0x81, 200, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "E", 0, 0, 0, 0 }, - { "F", 0, 0x80, 250, 0, 36, 23, WHITE, 0, 0, menu_label_width, - menu_label_height, menu_label_bitmap, "F", 0, 0, 0, 0 }, + {"A", 0, 0x14 }, + { "B", 0, 0x84 }, + { "C", 0, 0x83 }, + { "D", 0, 0x82 }, + { "E", 0, 0x81 }, + { "F", 0, 0x80 }, - { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0, "G", "RAD", 0, - "POLAR", 0 }, - { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0, "H", 0, 0, - "CHARS", 0 }, - { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0, "I", 0, 0, - "MODES", 0 }, - { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0, "J", 0, 0, - "MEMORY", 0 }, - { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, up_width, up_height, - up_bitmap, "K", 0, 0, "STACK", 0 }, - { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0, "L", "PREV", - 0, "MENU", 0 }, + { "MTH", 0, 0x24 }, + { "PRG", 0, 0x74 }, + { "CST", 0, 0x73 }, + { "VAR", 0, 0x72 }, + { "UP", 0, 0x71 }, + { "NXT", 0, 0x70 }, - { "COLON", 0, 0x04, 0, 100, 36, 26, WHITE, 0, 0, colon_width, - colon_height, colon_bitmap, "M", "UP", 0, "HOME", 0 }, - { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0, "N", "DEF", - 0, "RCL", 0 }, - { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0, "O", - "aNUM", 0, "UNDO", 0 }, - { "LEFT", 0, 0x62, 150, 100, 36, 26, WHITE, 0, 0, left_width, - left_height, left_bitmap, "P", "PICTURE", 0, 0, 0 }, - { "DOWN", 0, 0x61, 200, 100, 36, 26, WHITE, 0, 0, down_width, - down_height, down_bitmap, "Q", "VIEW", 0, 0, 0 }, - { "RIGHT", 0, 0x60, 250, 100, 36, 26, WHITE, 0, 0, right_width, - right_height, right_bitmap, "R", "SWAP", 0, 0, 0 }, + { "COLON", 0, 0x04 }, + { "STO", 0, 0x64 }, + { "EVAL", 0, 0x63 }, + { "LEFT", 0, 0x62 }, + { "DOWN", 0, 0x61 }, + { "RIGHT", 0, 0x60 }, - { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0, "S", "ASIN", - 0, "b", 0 }, - { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0, "T", "ACOS", - 0, "c", 0 }, - { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0, "U", - "ATAN", 0, "d", 0 }, - { "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, 0, sqrt_width, - sqrt_height, sqrt_bitmap, "V", "n", 0, "o", 0 }, - { "POWER", 0, 0x51, 200, 150, 36, 26, WHITE, 0, 0, power_width, - power_height, power_bitmap, "W", "p", 0, "LOG", 0 }, - { "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, inv_width, inv_height, - inv_bitmap, "X", "q", 0, "LN", 0 }, + { "SIN", 0, 0x34 }, + { "COS", 0, 0x54 }, + { "TAN", 0, 0x53 }, + { "SQRT", 0, 0x52 }, + { "POWER", 0, 0x51 }, + { "INV", 0, 0x50 }, - { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0, 0, - "EQUATION", 0, "MATRIX", 0 }, - { "NEG", 0, 0x43, 100, 200, 36, 26, WHITE, 0, 0, neg_width, neg_height, - neg_bitmap, "Y", "EDIT", 0, "CMD", 0 }, - { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0, "Z", - "PURG", 0, "ARG", 0 }, - { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0, 0, "CLEAR", - 0, 0, 0 }, - { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, bs_width, bs_height, - bs_bitmap, 0, "DROP", 0, 0, 0 }, + { "ENTER", 0, 0x44 }, + { "NEG", 0, 0x43 }, + { "EEX", 0, 0x42 }, + { "DEL", 0, 0x41 }, + { "BS", 0, 0x40 }, - { "ALPHA", 0, 0x35, 0, 250, 36, 26, WHITE, 0, 0, alpha_width, - alpha_height, alpha_bitmap, 0, "USER", 0, "ENTRY", 0 }, - { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0, 0, 0, 1, - "SOLVE", 0 }, - { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0, 0, 0, 1, - "PLOT", 0 }, - { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0, 0, 0, 1, - "SYMBOLIC", 0 }, - { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, div_height, - div_bitmap, 0, "r ", 0, "s", 0 }, + { "ALPHA", 0, 0x35 }, + { "7", 0, 0x33 }, + { "8", 0, 0x32 }, + { "9", 0, 0x31 }, + { "DIV", 0, 0x30 }, - { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, shl_width, shl_height, - shl_bitmap, 0, 0, 0, 0, 0 }, - { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0, 0, 0, 1, "TIME", - 0 }, - { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0, 0, 0, 1, - "STAT", 0 }, - { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0, 0, 0, 1, - "UNITS", 0 }, - { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, mul_height, - mul_bitmap, 0, "t ", 0, "u", 0 }, + { "SHL", 0, 0x25 }, + { "4", 0, 0x23 }, + { "5", 0, 0x22 }, + { "6", 0, 0x21 }, + { "MUL", 0, 0x20 }, - { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, shr_width, shr_height, - shr_bitmap, 0, 0, 1, " ", 0 }, - { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0, 0, 0, 1, "I/O", - 0 }, - { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0, 0, 0, 1, - "LIBRARY", 0 }, - { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0, 0, 0, 1, - "EQ LIB", 0 }, - { "MINUS", 0, 0x10, 240, 350, 46, 26, WHITE, 0, 0, minus_width, - minus_height, minus_bitmap, 0, "v ", 0, "w", 0 }, + { "SHR", 0, 0x15 }, + { "1", 0, 0x13 }, + { "2", 0, 0x12 }, + { "3", 0, 0x11 }, + { "MINUS", 0, 0x10 }, - { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0, 0, "CONT", 0, - "OFF", "CANCEL" }, - { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0, 0, "\004 ", 0, - "\003", 0 }, - { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0, 0, - "\002 ", 0, "\001", 0 }, - { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0, 0, "\005 ", - 0, "z", 0 }, - { "PLUS", 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0, plus_width, - plus_height, plus_bitmap, 0, "x ", 0, "y", 0 }, - - { 0 } }; + { "ON", 0, 0x8000}, + { "0", 0, 0x03 }, + { "PERIOD", 0, 0x02 }, + { "SPC", 0, 0x01 }, + { "PLUS", 0, 0x00 }, + /* { 0 } */ +}; /****************************/ /* functions implementation */ /****************************/ -static inline void draw_nibble( int c, int r, int val ) { +static int tui_draw_nibble( int x, int y, int val ) +{ + /* TODO */ + + return 0; +} + +static inline void draw_nibble( int c, int r, int val ) +{ int x, y; x = ( c * 4 ); // x: start in pixels @@ -301,11 +214,12 @@ static inline void draw_nibble( int c, int r, int val ) { if ( val != lcd_buffer[ r ][ c ] ) { lcd_buffer[ r ][ c ] = val; - /* TEXTDrawNibble( x, y, val ); */ + tui_draw_nibble( x, y, val ); } } -static inline void draw_row( long addr, int row ) { +static inline void draw_row( long addr, int row ) +{ int i, v; int line_length; @@ -321,7 +235,8 @@ static inline void draw_row( long addr, int row ) { } } -static void tui_button_pressed( int b ) { +static void tui_button_pressed( int b ) +{ // Check not already pressed (may be important: avoids a useless do_kbd_int) if ( buttons[ b ].pressed == 1 ) return; @@ -347,7 +262,8 @@ static void tui_button_pressed( int b ) { } } -static void tui_button_released( int b ) { +static void tui_button_released( int b ) +{ // Check not already released (not critical) if ( buttons[ b ].pressed == 0 ) return; @@ -365,7 +281,8 @@ static void tui_button_released( int b ) { } } -static void tui_button_release_all( void ) { +static void tui_button_release_all( void ) +{ for ( int b = FIRST_BUTTON; b <= LAST_BUTTON; b++ ) if ( buttons[ b ].pressed ) tui_button_released( b ); @@ -374,7 +291,8 @@ static void tui_button_release_all( void ) { /**********/ /* public */ /**********/ -int text_get_event( void ) { +int text_get_event( void ) +{ int hpkey = -1; /* check for input */ @@ -581,7 +499,8 @@ int text_get_event( void ) { void text_adjust_contrast() {} -void text_init_LCD( void ) { +void text_init_LCD( void ) +{ display.on = ( int )( saturn.disp_io & 0x8 ) >> 3; display.disp_start = ( saturn.disp_addr & 0xffffe ); @@ -592,14 +511,11 @@ void text_init_LCD( void ) { display.lines = 63; if ( display.offset > 3 ) - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; else - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; - display.disp_end = - display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); + display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); display.menu_start = saturn.menu_addr; display.menu_end = saturn.menu_addr + 0x110; @@ -613,7 +529,8 @@ void text_init_LCD( void ) { memset( lcd_buffer, 0xf0, sizeof( lcd_buffer ) ); } -void text_update_LCD( void ) { +void text_update_LCD( void ) +{ int i, j; long addr; static int old_offset = -1; @@ -622,17 +539,13 @@ void text_update_LCD( void ) { if ( display.on ) { addr = display.disp_start; if ( display.offset != old_offset ) { - memset( disp_buf, 0xf0, - ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); - memset( lcd_buffer, 0xf0, - ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); + memset( disp_buf, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); + memset( lcd_buffer, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); old_offset = display.offset; } if ( display.lines != old_lines ) { - memset( &disp_buf[ 56 ][ 0 ], 0xf0, - ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); - memset( &lcd_buffer[ 56 ][ 0 ], 0xf0, - ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); + memset( &disp_buf[ 56 ][ 0 ], 0xf0, ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); + memset( &lcd_buffer[ 56 ][ 0 ], 0xf0, ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); old_lines = display.lines; } for ( i = 0; i <= display.lines; i++ ) { @@ -658,7 +571,8 @@ void text_update_LCD( void ) { void text_refresh_LCD( void ) {} -void text_disp_draw_nibble( word_20 addr, word_4 val ) { +void text_disp_draw_nibble( word_20 addr, word_4 val ) +{ long offset; int x, y; @@ -684,7 +598,8 @@ void text_disp_draw_nibble( word_20 addr, word_4 val ) { } } -void text_menu_draw_nibble( word_20 addr, word_4 val ) { +void text_menu_draw_nibble( word_20 addr, word_4 val ) +{ long offset; int x, y; @@ -697,7 +612,8 @@ void text_menu_draw_nibble( word_20 addr, word_4 val ) { } } -void text_draw_annunc( void ) { +void text_draw_annunc( void ) +{ int val; val = display.annunc; @@ -709,13 +625,13 @@ void text_draw_annunc( void ) { char annuncstate[ 6 ]; for ( int i = 0; ann_tbl[ i ].bit; i++ ) - annuncstate[ i ] = - ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? 1 : 0; + annuncstate[ i ] = ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? 1 : 0; /* TEXTDrawAnnunc( annuncstate ); */ } -void init_text_ui( int argc, char** argv ) { +void init_text_ui( int argc, char** argv ) +{ buttons = ( tui_button_t* )malloc( sizeof( buttons_gx ) ); if ( opt_gx ) diff --git a/src/ui_x11.c b/src/ui_x11.c index bf9b417..4e52d71 100644 --- a/src/ui_x11.c +++ b/src/ui_x11.c @@ -1,26 +1,26 @@ -#include -#include +#include #include #include +#include +#include #include -#include -#include +#include +#include #include #include #include -#include -#include +#include #include #include #include -#include -#include #include +#include +#include -#include "runtime_options.h" #include "emulator.h" #include "romio.h" +#include "runtime_options.h" #include "ui.h" #include "ui_inner.h" @@ -55,194 +55,133 @@ #define hp48_icon_width 32 #define hp48_icon_height 64 static unsigned char hp48_icon_bitmap[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, - 0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x07, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, - 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x03, 0x8c, 0x31, 0xc6, 0x03, 0x8c, 0x31, 0xc6, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, - 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, - 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff }; + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x07, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, + 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, + 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x8c, 0x31, 0xc6, + 0x03, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, + 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; #define hp48_top_width 32 #define hp48_top_height 30 static unsigned char hp48_top_bitmap[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, - 0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x07, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff }; + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, + 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, + 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, + 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff }; #define hp48_bottom_width 32 #define hp48_bottom_height 64 static unsigned char hp48_bottom_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, - 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x03, 0x8c, 0x31, 0xc6, 0x03, 0x8c, 0x31, 0xc6, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, - 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, - 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x8c, 0x31, 0xc6, + 0x03, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x30, 0x0c, 0xc3, 0xe3, 0x30, + 0x0c, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; #define hp48_logo_width 13 #define hp48_logo_height 4 -static unsigned char hp48_logo_bitmap[] = { 0x00, 0x00, 0x00, 0x00, - 0xf8, 0x1f, 0xf8, 0x1f }; +static unsigned char hp48_logo_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0xf8, 0x1f }; #define hp48_text_width 29 #define hp48_text_height 7 -static unsigned char hp48_text_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xfe, 0x1f }; +static unsigned char hp48_text_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xfe, 0x1f }; #define hp48_disp_width 29 #define hp48_disp_height 21 static unsigned char hp48_disp_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, - 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, - 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, - 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, - 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, + 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, + 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f }; #define hp48_keys_width 30 #define hp48_keys_height 61 static unsigned char hp48_keys_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39, - 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfc, 0x73, 0xce, 0x39, 0xfc, 0x73, 0xce, 0x39, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xcf, 0xf3, 0x3c, - 0x1c, 0xcf, 0xf3, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0xcf, 0xf3, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xcf, 0xf3, 0x3c, - 0x1c, 0xcf, 0xf3, 0x3c }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, + 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, + 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x73, 0xce, 0x39, 0x9c, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x73, 0xce, 0x39, 0xfc, 0x73, 0xce, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, + 0xcf, 0xf3, 0x3c, 0x1c, 0xcf, 0xf3, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0xcf, + 0xf3, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0xcf, 0xf3, 0x3c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xcf, 0xf3, 0x3c, 0x1c, 0xcf, 0xf3, 0x3c }; #define hp48_orange_width 5 #define hp48_orange_height 53 -static unsigned char hp48_orange_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c }; +static unsigned char hp48_orange_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c }; #define hp48_blue_width 5 #define hp48_blue_height 57 -static unsigned char hp48_blue_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c }; +static unsigned char hp48_blue_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c }; #define hp48_on_width 25 #define hp48_on_height 19 -static unsigned char hp48_on_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x00, - 0x00, 0x00, 0x13, 0x01, 0x00, 0x80, 0x12, 0x01, 0x80, 0x48, 0x12, - 0x01, 0x80, 0xc8, 0xe7, 0x00, 0x00, 0x05, 0x12, 0x01, 0x00, 0x02, - 0x12, 0x01, 0x00, 0x05, 0x12, 0x01, 0x80, 0x08, 0xe2, 0x00 }; +static unsigned char hp48_on_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x13, 0x01, + 0x00, 0x80, 0x12, 0x01, 0x80, 0x48, 0x12, 0x01, 0x80, 0xc8, 0xe7, 0x00, 0x00, 0x05, 0x12, 0x01, + 0x00, 0x02, 0x12, 0x01, 0x00, 0x05, 0x12, 0x01, 0x80, 0x08, 0xe2, 0x00 }; #define hp48_top_gx_width 32 #define hp48_top_gx_height 30 static unsigned char hp48_top_gx_bitmap[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x08, 0xff, 0xe1, - 0x07, 0x08, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff }; + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x08, 0xff, 0xe1, 0x07, 0x08, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xf0, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, + 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, + 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, + 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x63, 0x8c, 0x31, 0xc6, 0x63, 0x8c, 0x31, 0xc6, 0xff, 0xff, 0xff, 0xff }; #define hp48_logo_gx_width 16 #define hp48_logo_gx_height 4 -static unsigned char hp48_logo_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, - 0xf8, 0xf7, 0xf8, 0xf7 }; +static unsigned char hp48_logo_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf7, 0xf8, 0xf7 }; #define hp48_text_gx_width 29 #define hp48_text_gx_height 7 -static unsigned char hp48_text_gx_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f }; +static unsigned char hp48_text_gx_bitmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f }; #define hp48_green_gx_width 29 #define hp48_green_gx_height 57 static unsigned char hp48_green_gx_bitmap[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 }; typedef struct x11_color_t { const char* name; @@ -356,916 +295,176 @@ static char* res_name; static char* res_class; static x11_color_t colors_sx[] = { - { "white", - 255, - 255, - 255, - 255, - 255, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "left", - 255, - 166, - 0, - 255, - 230, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "right", - 0, - 210, - 255, - 255, - 169, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "but_top", - 109, - 93, - 93, - 0, - 91, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "button", - 90, - 77, - 77, - 0, - 81, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "but_bot", - 76, - 65, - 65, - 0, - 69, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "lcd_col", - 202, - 221, - 92, - 255, - 205, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "pix_col", - 0, - 0, - 128, - 0, - 20, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "pad_top", - 109, - 78, - 78, - 0, - 88, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "pad", 90, 64, 64, 0, 73, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "pad_bot", - 76, - 54, - 54, - 0, - 60, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "disp_pad_top", - 155, - 118, - 84, - 0, - 124, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "disp_pad", - 124, - 94, - 67, - 0, - 99, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "disp_pad_bot", - 100, - 75, - 53, - 0, - 79, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "logo", - 204, - 169, - 107, - 255, - 172, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "logo_back", - 64, - 64, - 64, - 0, - 65, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "label", - 202, - 184, - 144, - 255, - 185, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "frame", 0, 0, 0, 255, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "underlay", - 60, - 42, - 42, - 0, - 48, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "black", 0, 0, 0, 0, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { 0 } }; + {"white", 255, 255, 255, 255, 255, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "left", 255, 166, 0, 255, 230, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "right", 0, 210, 255, 255, 169, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "but_top", 109, 93, 93, 0, 91, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "button", 90, 77, 77, 0, 81, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "but_bot", 76, 65, 65, 0, 69, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "lcd_col", 202, 221, 92, 255, 205, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "pix_col", 0, 0, 128, 0, 20, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "pad_top", 109, 78, 78, 0, 88, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "pad", 90, 64, 64, 0, 73, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "pad_bot", 76, 54, 54, 0, 60, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "disp_pad_top", 155, 118, 84, 0, 124, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "disp_pad", 124, 94, 67, 0, 99, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "disp_pad_bot", 100, 75, 53, 0, 79, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "logo", 204, 169, 107, 255, 172, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "logo_back", 64, 64, 64, 0, 65, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "label", 202, 184, 144, 255, 185, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "frame", 0, 0, 0, 255, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "underlay", 60, 42, 42, 0, 48, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "black", 0, 0, 0, 0, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + /* { 0 } */ +}; static x11_color_t colors_gx[] = { - { "white", - 255, - 255, - 255, - 255, - 255, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "left", - 255, - 186, - 255, - 255, - 220, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "right", - 0, - 255, - 204, - 255, - 169, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "but_top", - 104, - 104, - 104, - 0, - 104, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "button", - 88, - 88, - 88, - 0, - 88, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "but_bot", - 74, - 74, - 74, - 0, - 74, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "lcd_col", - 202, - 221, - 92, - 255, - 205, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "pix_col", - 0, - 0, - 128, - 0, - 20, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "pad_top", - 88, - 88, - 88, - 0, - 88, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "pad", 74, 74, 74, 0, 74, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "pad_bot", - 64, - 64, - 64, - 0, - 64, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "disp_pad_top", - 128, - 128, - 138, - 0, - 128, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "disp_pad", - 104, - 104, - 110, - 0, - 104, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "disp_pad_bot", - 84, - 84, - 90, - 0, - 84, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "logo", - 176, - 176, - 184, - 255, - 176, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "logo_back", - 104, - 104, - 110, - 0, - 104, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "label", - 240, - 240, - 240, - 255, - 240, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "frame", 0, 0, 0, 255, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "underlay", - 104, - 104, - 110, - 0, - 104, - { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { "black", 0, 0, 0, 0, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } }, - { 0 } }; + {"white", 255, 255, 255, 255, 255, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "left", 255, 186, 255, 255, 220, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "right", 0, 255, 204, 255, 169, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "but_top", 104, 104, 104, 0, 104, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "button", 88, 88, 88, 0, 88, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "but_bot", 74, 74, 74, 0, 74, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "lcd_col", 202, 221, 92, 255, 205, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "pix_col", 0, 0, 128, 0, 20, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "pad_top", 88, 88, 88, 0, 88, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "pad", 74, 74, 74, 0, 74, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "pad_bot", 64, 64, 64, 0, 64, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "disp_pad_top", 128, 128, 138, 0, 128, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "disp_pad", 104, 104, 110, 0, 104, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "disp_pad_bot", 84, 84, 90, 0, 84, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "logo", 176, 176, 184, 255, 176, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "logo_back", 104, 104, 110, 0, 104, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "label", 240, 240, 240, 255, 240, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "frame", 0, 0, 0, 255, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "underlay", 104, 104, 110, 0, 104, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + { "black", 0, 0, 0, 0, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }}, + /* { 0 } */ +}; static x11_button_t* buttons = 0; static x11_button_t buttons_sx[] = { - { "A", - 0, - 0x14, - 0, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "A", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "B", - 0, - 0x84, - 50, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "B", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "C", - 0, - 0x83, - 100, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "C", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "D", - 0, - 0x82, - 150, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "D", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "E", - 0, - 0x81, - 200, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "E", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "F", - 0, - 0x80, - 250, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "F", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, + {"A", 0, 0x14, 0, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "A", 0, 0, 0, 0, 0, 0, 0}, + { "B", 0, 0x84, 50, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "B", 0, 0, 0, 0, 0, 0, 0}, + { "C", 0, 0x83, 100, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "C", 0, 0, 0, 0, 0, 0, 0}, + { "D", 0, 0x82, 150, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "D", 0, 0, 0, 0, 0, 0, 0}, + { "E", 0, 0x81, 200, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "E", 0, 0, 0, 0, 0, 0, 0}, + { "F", 0, 0x80, 250, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "F", 0, 0, 0, 0, 0, 0, 0}, - { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, - 0, 0, 0, "G", "PRINT", 1, 0, 0, 0, 0, 0 }, - { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, - 0, 0, 0, "H", "I/O", 1, 0, 0, 0, 0, 0 }, - { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, - 0, 0, 0, "I", "MODES", 1, 0, 0, 0, 0, 0 }, - { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, - 0, 0, 0, "J", "MEMORY", 1, 0, 0, 0, 0, 0 }, - { "UP", 0, 0x71, 200, 50, 36, 26, - WHITE, 0, 0, up_width, up_height, up_bitmap, "K", "LIBRARY", - 1, 0, 0, 0, 0, 0 }, - { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, - 0, 0, 0, "L", "PREV", 0, 0, 0, 0, 0, 0 }, + { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0, "G", "PRINT", 1, 0, 0, 0, 0, 0}, + { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0, "H", "I/O", 1, 0, 0, 0, 0, 0}, + { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0, "I", "MODES", 1, 0, 0, 0, 0, 0}, + { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0, "J", "MEMORY", 1, 0, 0, 0, 0, 0}, + { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, up_width, up_height, up_bitmap, "K", "LIBRARY", 1, 0, 0, 0, 0, 0}, + { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0, "L", "PREV", 0, 0, 0, 0, 0, 0}, - { "COLON", - 0, - 0x04, - 0, - 100, - 36, - 26, - WHITE, - 0, - 0, - colon_width, - colon_height, - colon_bitmap, - "M", - "UP", - 0, - "HOME", - 0, - 0, - 0, - 0 }, - { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, - 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0, 0, 0 }, - { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, - 0, 0, 0, "O", "aQ", 0, "aNUM", 0, 0, 0, 0 }, - { "LEFT", 0, 0x62, 150, 100, - 36, 26, WHITE, 0, 0, left_width, - left_height, left_bitmap, "P", "GRAPH", 0, 0, - 0, 0, 0, 0 }, - { "DOWN", 0, 0x61, 200, 100, - 36, 26, WHITE, 0, 0, down_width, - down_height, down_bitmap, "Q", "REVIEW", 0, 0, - 0, 0, 0, 0 }, - { "RIGHT", - 0, - 0x60, - 250, - 100, - 36, - 26, - WHITE, - 0, - 0, - right_width, - right_height, - right_bitmap, - "R", - "SWAP", - 0, - 0, - 0, - 0, - 0, - 0 }, + { "COLON", 0, 0x04, 0, 100, 36, 26, WHITE, 0, 0, colon_width, colon_height, colon_bitmap, "M", "UP", 0, "HOME", 0, 0, 0, 0}, + { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0, 0, 0}, + { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0, "O", "aQ", 0, "aNUM", 0, 0, 0, 0}, + { "LEFT", 0, 0x62, 150, 100, 36, 26, WHITE, 0, 0, left_width, left_height, left_bitmap, "P", "GRAPH", 0, 0, 0, 0, 0, 0}, + { "DOWN", 0, 0x61, 200, 100, 36, 26, WHITE, 0, 0, down_width, down_height, down_bitmap, "Q", "REVIEW", 0, 0, 0, 0, 0, 0}, + { "RIGHT", 0, 0x60, 250, 100, 36, 26, WHITE, 0, 0, right_width, right_height, right_bitmap, "R", "SWAP", 0, 0, 0, 0, 0, 0}, - { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, - 0, 0, 0, "S", "ASIN", 0, "b", 0, 0, 0, 0 }, - { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, - 0, 0, 0, "T", "ACOS", 0, "c", 0, 0, 0, 0 }, - { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, - 0, 0, 0, "U", "ATAN", 0, "d", 0, 0, 0, 0 }, - { "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, - 0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "e", 0, "f", 0, 0, - 0, 0 }, - { "POWER", - 0, - 0x51, - 200, - 150, - 36, - 26, - WHITE, - 0, - 0, - power_width, - power_height, - power_bitmap, - "W", - "g", - 0, - "LOG", - 0, - 0, - 0, - 0 }, - { "INV", 0, 0x50, 250, 150, 36, 26, - WHITE, 0, 0, inv_width, inv_height, inv_bitmap, "X", "h", - 0, "LN", 0, 0, 0, 0 }, + { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0, "S", "ASIN", 0, "b", 0, 0, 0, 0}, + { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0, "T", "ACOS", 0, "c", 0, 0, 0, 0}, + { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0, "U", "ATAN", 0, "d", 0, 0, 0, 0}, + { "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, 0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "e", 0, "f", 0, 0, 0, 0}, + { "POWER", 0, 0x51, 200, 150, 36, 26, WHITE, 0, 0, power_width, power_height, power_bitmap, "W", "g", 0, "LOG", 0, 0, 0, 0}, + { "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, inv_width, inv_height, inv_bitmap, "X", "h", 0, "LN", 0, 0, 0, 0}, - { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, - 0, 0, 0, 0, "EQUATION", 0, "MATRIX", 0, 0, 0, 0 }, - { "NEG", 0, 0x43, 100, 200, 36, 26, - WHITE, 0, 0, neg_width, neg_height, neg_bitmap, "Y", "EDIT", - 0, "VISIT", 0, 0, 0, 0 }, - { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, - 0, 0, 0, "Z", "2D", 0, "3D", 0, 0, 0, 0 }, - { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, - 0, 0, 0, 0, "PURGE", 0, 0, 0, 0, 0, 0 }, - { "BS", 0, 0x40, 250, 200, 36, 26, - WHITE, 0, 0, bs_width, bs_height, bs_bitmap, 0, "DROP", - 0, "CLR", 0, 0, 0, 0 }, + { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0, 0, "EQUATION", 0, "MATRIX", 0, 0, 0, 0}, + { "NEG", 0, 0x43, 100, 200, 36, 26, WHITE, 0, 0, neg_width, neg_height, neg_bitmap, "Y", "EDIT", 0, "VISIT", 0, 0, 0, 0}, + { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0, "Z", "2D", 0, "3D", 0, 0, 0, 0}, + { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0, 0, "PURGE", 0, 0, 0, 0, 0, 0}, + { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, bs_width, bs_height, bs_bitmap, 0, "DROP", 0, "CLR", 0, 0, 0, 0}, - { "ALPHA", - 0, - 0x35, - 0, - 250, - 36, - 26, - WHITE, - 0, - 0, - alpha_width, - alpha_height, - alpha_bitmap, - 0, - "USR", - 0, - "ENTRY", - 0, - 0, - 0, - 0 }, - { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, - 0, 0, 0, 0, "SOLVE", 1, 0, 0, 0, 0, 0 }, - { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, - 0, 0, 0, 0, "PLOT", 1, 0, 0, 0, 0, 0 }, - { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, - 0, 0, 0, 0, "ALGEBRA", 1, 0, 0, 0, 0, 0 }, - { "DIV", 0, 0x30, 240, 250, 46, 26, - WHITE, 0, 0, div_width, div_height, div_bitmap, 0, "( )", - 0, "#", 0, 0, 0, 0 }, + { "ALPHA", 0, 0x35, 0, 250, 36, 26, WHITE, 0, 0, alpha_width, alpha_height, alpha_bitmap, 0, "USR", 0, "ENTRY", 0, 0, 0, 0}, + { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0, 0, "SOLVE", 1, 0, 0, 0, 0, 0}, + { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0, 0, "PLOT", 1, 0, 0, 0, 0, 0}, + { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0, 0, "ALGEBRA", 1, 0, 0, 0, 0, 0}, + { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, div_height, div_bitmap, 0, "( )", 0, "#", 0, 0, 0, 0}, - { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, - shl_width, shl_height, shl_bitmap, 0, 0, 0, 0, 0, 0, 0, 0 }, - { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, - 0, 0, 0, 0, "TIME", 1, 0, 0, 0, 0, 0 }, - { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, - 0, 0, 0, 0, "STAT", 1, 0, 0, 0, 0, 0 }, - { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, - 0, 0, 0, 0, "UNITS", 1, 0, 0, 0, 0, 0 }, - { "MUL", 0, 0x20, 240, 300, 46, 26, - WHITE, 0, 0, mul_width, mul_height, mul_bitmap, 0, "[ ]", - 0, "_", 0, 0, 0, 0 }, + { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, shl_width, shl_height, shl_bitmap, 0, 0, 0, 0, 0, 0, 0, 0}, + { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0, 0, "TIME", 1, 0, 0, 0, 0, 0}, + { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0, 0, "STAT", 1, 0, 0, 0, 0, 0}, + { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0, 0, "UNITS", 1, 0, 0, 0, 0, 0}, + { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, mul_height, mul_bitmap, 0, "[ ]", 0, "_", 0, 0, 0, 0}, - { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, - shr_width, shr_height, shr_bitmap, 0, 0, 0, 0, 0, 0, 0, 0 }, - { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, - 0, 0, 0, 0, "RAD", 0, "POLAR", 0, 0, 0, 0 }, - { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, - 0, 0, 0, 0, "STACK", 0, "ARG", 0, 0, 0, 0 }, - { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, - 0, 0, 0, 0, "CMD", 0, "MENU", 0, 0, 0, 0 }, - { "MINUS", - 0, - 0x10, - 240, - 350, - 46, - 26, - WHITE, - 0, - 0, - minus_width, - minus_height, - minus_bitmap, - 0, - "i", - 0, - "j", - 0, - 0, - 0, - 0 }, + { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, shr_width, shr_height, shr_bitmap, 0, 0, 0, 0, 0, 0, 0, 0}, + { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0, 0, "RAD", 0, "POLAR", 0, 0, 0, 0}, + { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0, 0, "STACK", 0, "ARG", 0, 0, 0, 0}, + { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0, 0, "CMD", 0, "MENU", 0, 0, 0, 0}, + { "MINUS", 0, 0x10, 240, 350, 46, 26, WHITE, 0, 0, minus_width, minus_height, minus_bitmap, 0, "i", 0, "j", 0, 0, 0, 0}, - { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, - 0, 0, 0, 0, "CONT", 0, "OFF", "ATTN", 0, 0, 0 }, - { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, - 0, 0, 0, 0, "= ", 0, " a", 0, 0, 0, 0 }, - { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, - 0, 0, 0, 0, ", ", 0, " k", 0, 0, 0, 0 }, - { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, - 0, 0, 0, 0, "l ", 0, " m", 0, 0, 0, 0 }, - { "PLUS", 0, 0x00, 240, 400, - 46, 26, WHITE, 0, 0, plus_width, - plus_height, plus_bitmap, 0, "{ }", 0, ": :", - 0, 0, 0, 0 }, - - { 0 } }; + { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0, 0, "CONT", 0, "OFF", "ATTN", 0, 0, 0}, + { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0, 0, "= ", 0, " a", 0, 0, 0, 0}, + { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0, 0, ", ", 0, " k", 0, 0, 0, 0}, + { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0, 0, "l ", 0, " m", 0, 0, 0, 0}, + { "PLUS", 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0, plus_width, plus_height, plus_bitmap, 0, "{ }", 0, ": :", 0, 0, 0, 0}, + /* { 0 } */ +}; static x11_button_t buttons_gx[] = { - { "A", - 0, - 0x14, - 0, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "A", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "B", - 0, - 0x84, - 50, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "B", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "C", - 0, - 0x83, - 100, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "C", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "D", - 0, - 0x82, - 150, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "D", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "E", - 0, - 0x81, - 200, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "E", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, - { "F", - 0, - 0x80, - 250, - 0, - 36, - 23, - WHITE, - 0, - 0, - menu_label_width, - menu_label_height, - menu_label_bitmap, - "F", - 0, - 0, - 0, - 0, - 0, - 0, - 0 }, + {"A", 0, 0x14, 0, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "A", 0, 0, 0, 0, 0, 0, 0}, + { "B", 0, 0x84, 50, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "B", 0, 0, 0, 0, 0, 0, 0}, + { "C", 0, 0x83, 100, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "C", 0, 0, 0, 0, 0, 0, 0}, + { "D", 0, 0x82, 150, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "D", 0, 0, 0, 0, 0, 0, 0}, + { "E", 0, 0x81, 200, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "E", 0, 0, 0, 0, 0, 0, 0}, + { "F", 0, 0x80, 250, 0, 36, 23, WHITE, 0, 0, menu_label_width, menu_label_height, menu_label_bitmap, "F", 0, 0, 0, 0, 0, 0, 0}, - { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, - 0, 0, 0, "G", "RAD", 0, "POLAR", 0, 0, 0, 0 }, - { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, - 0, 0, 0, "H", 0, 0, "CHARS", 0, 0, 0, 0 }, - { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, - 0, 0, 0, "I", 0, 0, "MODES", 0, 0, 0, 0 }, - { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, - 0, 0, 0, "J", 0, 0, "MEMORY", 0, 0, 0, 0 }, - { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, - up_width, up_height, up_bitmap, "K", 0, 0, "STACK", 0, 0, 0, 0 }, - { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, - 0, 0, 0, "L", "PREV", 0, "MENU", 0, 0, 0, 0 }, + { "MTH", 0, 0x24, 0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0, "G", "RAD", 0, "POLAR", 0, 0, 0, 0}, + { "PRG", 0, 0x74, 50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0, "H", 0, 0, "CHARS", 0, 0, 0, 0}, + { "CST", 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0, "I", 0, 0, "MODES", 0, 0, 0, 0}, + { "VAR", 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0, "J", 0, 0, "MEMORY", 0, 0, 0, 0}, + { "UP", 0, 0x71, 200, 50, 36, 26, WHITE, 0, 0, up_width, up_height, up_bitmap, "K", 0, 0, "STACK", 0, 0, 0, 0}, + { "NXT", 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0, "L", "PREV", 0, "MENU", 0, 0, 0, 0}, - { "COLON", - 0, - 0x04, - 0, - 100, - 36, - 26, - WHITE, - 0, - 0, - colon_width, - colon_height, - colon_bitmap, - "M", - "UP", - 0, - "HOME", - 0, - 0, - 0, - 0 }, - { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, - 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0, 0, 0 }, - { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, - 0, 0, 0, "O", "aNUM", 0, "UNDO", 0, 0, 0, 0 }, - { "LEFT", 0, 0x62, 150, 100, - 36, 26, WHITE, 0, 0, left_width, - left_height, left_bitmap, "P", "PICTURE", 0, 0, - 0, 0, 0, 0 }, - { "DOWN", 0, 0x61, 200, 100, - 36, 26, WHITE, 0, 0, down_width, - down_height, down_bitmap, "Q", "VIEW", 0, 0, - 0, 0, 0, 0 }, - { "RIGHT", - 0, - 0x60, - 250, - 100, - 36, - 26, - WHITE, - 0, - 0, - right_width, - right_height, - right_bitmap, - "R", - "SWAP", - 0, - 0, - 0, - 0, - 0, - 0 }, + { "COLON", 0, 0x04, 0, 100, 36, 26, WHITE, 0, 0, colon_width, colon_height, colon_bitmap, "M", "UP", 0, "HOME", 0, 0, 0, 0}, + { "STO", 0, 0x64, 50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0, "N", "DEF", 0, "RCL", 0, 0, 0, 0}, + { "EVAL", 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0, "O", "aNUM", 0, "UNDO", 0, 0, 0, 0}, + { "LEFT", 0, 0x62, 150, 100, 36, 26, WHITE, 0, 0, left_width, left_height, left_bitmap, "P", "PICTURE", 0, 0, 0, 0, 0, 0}, + { "DOWN", 0, 0x61, 200, 100, 36, 26, WHITE, 0, 0, down_width, down_height, down_bitmap, "Q", "VIEW", 0, 0, 0, 0, 0, 0}, + { "RIGHT", 0, 0x60, 250, 100, 36, 26, WHITE, 0, 0, right_width, right_height, right_bitmap, "R", "SWAP", 0, 0, 0, 0, 0, 0}, - { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, - 0, 0, 0, "S", "ASIN", 0, "b", 0, 0, 0, 0 }, - { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, - 0, 0, 0, "T", "ACOS", 0, "c", 0, 0, 0, 0 }, - { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, - 0, 0, 0, "U", "ATAN", 0, "d", 0, 0, 0, 0 }, - { "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, - 0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "n", 0, "o", 0, 0, - 0, 0 }, - { "POWER", - 0, - 0x51, - 200, - 150, - 36, - 26, - WHITE, - 0, - 0, - power_width, - power_height, - power_bitmap, - "W", - "p", - 0, - "LOG", - 0, - 0, - 0, - 0 }, - { "INV", 0, 0x50, 250, 150, 36, 26, - WHITE, 0, 0, inv_width, inv_height, inv_bitmap, "X", "q", - 0, "LN", 0, 0, 0, 0 }, + { "SIN", 0, 0x34, 0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0, "S", "ASIN", 0, "b", 0, 0, 0, 0}, + { "COS", 0, 0x54, 50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0, "T", "ACOS", 0, "c", 0, 0, 0, 0}, + { "TAN", 0, 0x53, 100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0, "U", "ATAN", 0, "d", 0, 0, 0, 0}, + { "SQRT", 0, 0x52, 150, 150, 36, 26, WHITE, 0, 0, sqrt_width, sqrt_height, sqrt_bitmap, "V", "n", 0, "o", 0, 0, 0, 0}, + { "POWER", 0, 0x51, 200, 150, 36, 26, WHITE, 0, 0, power_width, power_height, power_bitmap, "W", "p", 0, "LOG", 0, 0, 0, 0}, + { "INV", 0, 0x50, 250, 150, 36, 26, WHITE, 0, 0, inv_width, inv_height, inv_bitmap, "X", "q", 0, "LN", 0, 0, 0, 0}, - { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, - 0, 0, 0, 0, "EQUATION", 0, "MATRIX", 0, 0, 0, 0 }, - { "NEG", 0, 0x43, 100, 200, 36, 26, - WHITE, 0, 0, neg_width, neg_height, neg_bitmap, "Y", "EDIT", - 0, "CMD", 0, 0, 0, 0 }, - { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, - 0, 0, 0, "Z", "PURG", 0, "ARG", 0, 0, 0, 0 }, - { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, - 0, 0, 0, 0, "CLEAR", 0, 0, 0, 0, 0, 0 }, - { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, - bs_width, bs_height, bs_bitmap, 0, "DROP", 0, 0, 0, 0, 0, 0 }, + { "ENTER", 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0, 0, "EQUATION", 0, "MATRIX", 0, 0, 0, 0}, + { "NEG", 0, 0x43, 100, 200, 36, 26, WHITE, 0, 0, neg_width, neg_height, neg_bitmap, "Y", "EDIT", 0, "CMD", 0, 0, 0, 0}, + { "EEX", 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0, "Z", "PURG", 0, "ARG", 0, 0, 0, 0}, + { "DEL", 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0, 0, "CLEAR", 0, 0, 0, 0, 0, 0}, + { "BS", 0, 0x40, 250, 200, 36, 26, WHITE, 0, 0, bs_width, bs_height, bs_bitmap, 0, "DROP", 0, 0, 0, 0, 0, 0}, - { "ALPHA", - 0, - 0x35, - 0, - 250, - 36, - 26, - WHITE, - 0, - 0, - alpha_width, - alpha_height, - alpha_bitmap, - 0, - "USER", - 0, - "ENTRY", - 0, - 0, - 0, - 0 }, - { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, - 0, 0, 0, 0, 0, 1, "SOLVE", 0, 0, 0, 0 }, - { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, - 0, 0, 0, 0, 0, 1, "PLOT", 0, 0, 0, 0 }, - { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, - 0, 0, 0, 0, 0, 1, "SYMBOLIC", 0, 0, 0, 0 }, - { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, - div_height, div_bitmap, 0, "r ", 0, "s", 0, 0, 0, 0 }, + { "ALPHA", 0, 0x35, 0, 250, 36, 26, WHITE, 0, 0, alpha_width, alpha_height, alpha_bitmap, 0, "USER", 0, "ENTRY", 0, 0, 0, 0}, + { "7", 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0, 0, 0, 1, "SOLVE", 0, 0, 0, 0}, + { "8", 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0, 0, 0, 1, "PLOT", 0, 0, 0, 0}, + { "9", 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0, 0, 0, 1, "SYMBOLIC", 0, 0, 0, 0}, + { "DIV", 0, 0x30, 240, 250, 46, 26, WHITE, 0, 0, div_width, div_height, div_bitmap, 0, "r ", 0, "s", 0, 0, 0, 0}, - { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, - shl_width, shl_height, shl_bitmap, 0, 0, 0, 0, 0, 0, 0, 0 }, - { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, - 0, 0, 0, 0, 0, 1, "TIME", 0, 0, 0, 0 }, - { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, - 0, 0, 0, 0, 0, 1, "STAT", 0, 0, 0, 0 }, - { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, - 0, 0, 0, 0, 0, 1, "UNITS", 0, 0, 0, 0 }, - { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, - mul_height, mul_bitmap, 0, "t ", 0, "u", 0, 0, 0, 0 }, + { "SHL", 0, 0x25, 0, 300, 36, 26, LEFT, 0, 0, shl_width, shl_height, shl_bitmap, 0, 0, 0, 0, 0, 0, 0, 0}, + { "4", 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0, 0, 0, 1, "TIME", 0, 0, 0, 0}, + { "5", 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0, 0, 0, 1, "STAT", 0, 0, 0, 0}, + { "6", 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0, 0, 0, 1, "UNITS", 0, 0, 0, 0}, + { "MUL", 0, 0x20, 240, 300, 46, 26, WHITE, 0, 0, mul_width, mul_height, mul_bitmap, 0, "t ", 0, "u", 0, 0, 0, 0}, - { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, - shr_width, shr_height, shr_bitmap, 0, 0, 1, " ", 0, 0, 0, 0 }, - { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, - 0, 0, 0, 0, 0, 1, "I/O", 0, 0, 0, 0 }, - { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, - 0, 0, 0, 0, 0, 1, "LIBRARY", 0, 0, 0, 0 }, - { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, - 0, 0, 0, 0, 0, 1, "EQ LIB", 0, 0, 0, 0 }, - { "MINUS", - 0, - 0x10, - 240, - 350, - 46, - 26, - WHITE, - 0, - 0, - minus_width, - minus_height, - minus_bitmap, - 0, - "v ", - 0, - "w", - 0, - 0, - 0, - 0 }, + { "SHR", 0, 0x15, 0, 350, 36, 26, RIGHT, 0, 0, shr_width, shr_height, shr_bitmap, 0, 0, 1, " ", 0, 0, 0, 0}, + { "1", 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0, 0, 0, 1, "I/O", 0, 0, 0, 0}, + { "2", 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0, 0, 0, 1, "LIBRARY", 0, 0, 0, 0}, + { "3", 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0, 0, 0, 1, "EQ LIB", 0, 0, 0, 0}, + { "MINUS", 0, 0x10, 240, 350, 46, 26, WHITE, 0, 0, minus_width, minus_height, minus_bitmap, 0, "v ", 0, "w", 0, 0, 0, 0}, - { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, - 0, 0, 0, 0, "CONT", 0, "OFF", "CANCEL", 0, 0, 0 }, - { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, - 0, 0, 0, 0, "\004 ", 0, "\003", 0, 0, 0, 0 }, - { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, - 0, 0, 0, 0, "\002 ", 0, "\001", 0, 0, 0, 0 }, - { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, - 0, 0, 0, 0, "\005 ", 0, "z", 0, 0, 0, 0 }, - { "PLUS", 0, 0x00, 240, 400, - 46, 26, WHITE, 0, 0, plus_width, - plus_height, plus_bitmap, 0, "x ", 0, "y", - 0, 0, 0, 0 }, - - { 0 } }; + { "ON", 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0, 0, "CONT", 0, "OFF", "CANCEL", 0, 0, 0}, + { "0", 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0, 0, "\004 ", 0, "\003", 0, 0, 0, 0}, + { "PERIOD", 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0, 0, "\002 ", 0, "\001", 0, 0, 0, 0}, + { "SPC", 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0, 0, "\005 ", 0, "z", 0, 0, 0, 0}, + { "PLUS", 0, 0x00, 240, 400, 46, 26, WHITE, 0, 0, plus_width, plus_height, plus_bitmap, 0, "x ", 0, "y", 0, 0, 0, 0}, + /* { 0 } */ +}; #define MAX_PASTE 128 static int paste[ MAX_PASTE * 3 ]; @@ -1288,62 +487,61 @@ static icon_map_t* icon_maps; static Pixmap nibble_maps[ 16 ]; static unsigned char nibbles[ 16 ][ 2 ] = { - { 0x00, 0x00 }, /* ---- */ - { 0x03, 0x03 }, /* *--- */ - { 0x0c, 0x0c }, /* -*-- */ - { 0x0f, 0x0f }, /* **-- */ - { 0x30, 0x30 }, /* --*- */ - { 0x33, 0x33 }, /* *-*- */ - { 0x3c, 0x3c }, /* -**- */ - { 0x3f, 0x3f }, /* ***- */ - { 0xc0, 0xc0 }, /* ---* */ - { 0xc3, 0xc3 }, /* *--* */ - { 0xcc, 0xcc }, /* -*-* */ - { 0xcf, 0xcf }, /* **-* */ - { 0xf0, 0xf0 }, /* --** */ - { 0xf3, 0xf3 }, /* *-** */ - { 0xfc, 0xfc }, /* -*** */ - { 0xff, 0xff } /* **** */ + {0x00, 0x00}, /* ---- */ + { 0x03, 0x03}, /* *--- */ + { 0x0c, 0x0c}, /* -*-- */ + { 0x0f, 0x0f}, /* **-- */ + { 0x30, 0x30}, /* --*- */ + { 0x33, 0x33}, /* *-*- */ + { 0x3c, 0x3c}, /* -**- */ + { 0x3f, 0x3f}, /* ***- */ + { 0xc0, 0xc0}, /* ---* */ + { 0xc3, 0xc3}, /* *--* */ + { 0xcc, 0xcc}, /* -*-* */ + { 0xcf, 0xcf}, /* **-* */ + { 0xf0, 0xf0}, /* --** */ + { 0xf3, 0xf3}, /* *-** */ + { 0xfc, 0xfc}, /* -*** */ + { 0xff, 0xff} /* **** */ }; static unsigned char nibble_bitmap[ 16 ]; static x11_ann_struct_t ann_tbl[] = { - { ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bitmap, 0 }, - { ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bitmap, - 0 }, - { ANN_ALPHA, 106, 4, ann_alpha_width, ann_alpha_height, ann_alpha_bitmap, - 0 }, - { ANN_BATTERY, 151, 4, ann_battery_width, ann_battery_height, - ann_battery_bitmap, 0 }, - { ANN_BUSY, 196, 4, ann_busy_width, ann_busy_height, ann_busy_bitmap, 0 }, - { ANN_IO, 241, 4, ann_io_width, ann_io_height, ann_io_bitmap, 0 }, - { 0 } }; + {ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bitmap, 0}, + { ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bitmap, 0}, + { ANN_ALPHA, 106, 4, ann_alpha_width, ann_alpha_height, ann_alpha_bitmap, 0}, + { ANN_BATTERY, 151, 4, ann_battery_width, ann_battery_height, ann_battery_bitmap, 0}, + { ANN_BUSY, 196, 4, ann_busy_width, ann_busy_height, ann_busy_bitmap, 0}, + { ANN_IO, 241, 4, ann_io_width, ann_io_height, ann_io_bitmap, 0}, + /* { 0 } */ +}; static icon_map_t icon_maps_sx[] = { - { hp48_icon_width, hp48_icon_height, BLACK, hp48_icon_bitmap }, - { hp48_on_width, hp48_on_height, PIXEL, hp48_on_bitmap }, - { hp48_disp_width, hp48_disp_height, LCD, hp48_disp_bitmap }, - { hp48_top_width, hp48_top_height, DISP_PAD, hp48_top_bitmap }, - { hp48_bottom_width, hp48_bottom_height, PAD, hp48_bottom_bitmap }, - { hp48_logo_width, hp48_logo_height, LOGO, hp48_logo_bitmap }, - { hp48_text_width, hp48_text_height, LABEL, hp48_text_bitmap }, - { hp48_keys_width, hp48_keys_height, BLACK, hp48_keys_bitmap }, - { hp48_orange_width, hp48_orange_height, LEFT, hp48_orange_bitmap }, - { hp48_blue_width, hp48_blue_height, RIGHT, hp48_blue_bitmap } }; + {hp48_icon_width, hp48_icon_height, BLACK, hp48_icon_bitmap }, + { hp48_on_width, hp48_on_height, PIXEL, hp48_on_bitmap }, + { hp48_disp_width, hp48_disp_height, LCD, hp48_disp_bitmap }, + { hp48_top_width, hp48_top_height, DISP_PAD, hp48_top_bitmap }, + { hp48_bottom_width, hp48_bottom_height, PAD, hp48_bottom_bitmap}, + { hp48_logo_width, hp48_logo_height, LOGO, hp48_logo_bitmap }, + { hp48_text_width, hp48_text_height, LABEL, hp48_text_bitmap }, + { hp48_keys_width, hp48_keys_height, BLACK, hp48_keys_bitmap }, + { hp48_orange_width, hp48_orange_height, LEFT, hp48_orange_bitmap}, + { hp48_blue_width, hp48_blue_height, RIGHT, hp48_blue_bitmap } +}; static icon_map_t icon_maps_gx[] = { - { hp48_icon_width, hp48_icon_height, BLACK, hp48_icon_bitmap }, - { hp48_on_width, hp48_on_height, PIXEL, hp48_on_bitmap }, - { hp48_disp_width, hp48_disp_height, LCD, hp48_disp_bitmap }, - { hp48_top_gx_width, hp48_top_gx_height, DISP_PAD, hp48_top_gx_bitmap }, - { hp48_bottom_width, hp48_bottom_height, PAD, hp48_bottom_bitmap }, - { hp48_logo_gx_width, hp48_logo_gx_height, LOGO, hp48_logo_gx_bitmap }, - { hp48_text_gx_width, hp48_text_gx_height, LABEL, hp48_text_gx_bitmap }, - { hp48_keys_width, hp48_keys_height, BLACK, hp48_keys_bitmap }, - { hp48_orange_width, hp48_orange_height, LEFT, hp48_orange_bitmap }, - { hp48_green_gx_width, hp48_green_gx_height, RIGHT, - hp48_green_gx_bitmap } }; + {hp48_icon_width, hp48_icon_height, BLACK, hp48_icon_bitmap }, + { hp48_on_width, hp48_on_height, PIXEL, hp48_on_bitmap }, + { hp48_disp_width, hp48_disp_height, LCD, hp48_disp_bitmap }, + { hp48_top_gx_width, hp48_top_gx_height, DISP_PAD, hp48_top_gx_bitmap }, + { hp48_bottom_width, hp48_bottom_height, PAD, hp48_bottom_bitmap }, + { hp48_logo_gx_width, hp48_logo_gx_height, LOGO, hp48_logo_gx_bitmap }, + { hp48_text_gx_width, hp48_text_gx_height, LABEL, hp48_text_gx_bitmap }, + { hp48_keys_width, hp48_keys_height, BLACK, hp48_keys_bitmap }, + { hp48_orange_width, hp48_orange_height, LEFT, hp48_orange_bitmap }, + { hp48_green_gx_width, hp48_green_gx_height, RIGHT, hp48_green_gx_bitmap} +}; static int saved_argc; static char** saved_argv; @@ -1351,7 +549,8 @@ static char** saved_argv; /*************/ /* functions */ /*************/ -static void fatal_exit( char* error, char* advice ) { +static void fatal_exit( char* error, char* advice ) +{ if ( error[ 0 ] == '\0' ) { fprintf( stderr, "FATAL ERROR, exit.\n" ); exit( 1 ); @@ -1365,15 +564,14 @@ static void fatal_exit( char* error, char* advice ) { exit( 1 ); } -inline Visual* pick_visual_of_class( Display* dpy, int visual_class, - unsigned int* depth ) { +inline Visual* pick_visual_of_class( Display* dpy, int visual_class, unsigned int* depth ) +{ XVisualInfo vi_in, *vi_out; int out_count; vi_in.class = visual_class; vi_in.screen = DefaultScreen( dpy ); - vi_out = XGetVisualInfo( dpy, VisualClassMask | VisualScreenMask, &vi_in, - &out_count ); + vi_out = XGetVisualInfo( dpy, VisualClassMask | VisualScreenMask, &vi_in, &out_count ); if ( vi_out ) { /* choose the 'best' one, if multiple */ int i, best; Visual* visual; @@ -1390,14 +588,14 @@ inline Visual* pick_visual_of_class( Display* dpy, int visual_class, } } -inline Visual* id_to_visual( Display* dpy, int id, unsigned int* depth ) { +inline Visual* id_to_visual( Display* dpy, int id, unsigned int* depth ) +{ XVisualInfo vi_in, *vi_out; int out_count; vi_in.screen = DefaultScreen( dpy ); vi_in.visualid = id; - vi_out = XGetVisualInfo( dpy, VisualScreenMask | VisualIDMask, &vi_in, - &out_count ); + vi_out = XGetVisualInfo( dpy, VisualScreenMask | VisualIDMask, &vi_in, &out_count ); if ( vi_out ) { Visual* v = vi_out[ 0 ].visual; *depth = vi_out[ 0 ].depth; @@ -1407,7 +605,8 @@ inline Visual* id_to_visual( Display* dpy, int id, unsigned int* depth ) { return 0; } -Visual* get_visual_resource( Display* dpy, unsigned int* depth ) { +Visual* get_visual_resource( Display* dpy, unsigned int* depth ) +{ char c; int vclass; int id; @@ -1453,7 +652,8 @@ Visual* get_visual_resource( Display* dpy, unsigned int* depth ) { return pick_visual_of_class( dpy, vclass, depth ); } -XFontStruct* load_x11_font( Display* dpy, char* fontname ) { +XFontStruct* load_x11_font( Display* dpy, char* fontname ) +{ XFontStruct* f = ( XFontStruct* )0; f = XLoadQueryFont( dpy, fontname ); @@ -1469,7 +669,8 @@ XFontStruct* load_x11_font( Display* dpy, char* fontname ) { return f; } -int AllocColors( void ) { +int AllocColors( void ) +{ int c, error, dyn; int r_shift = 0, g_shift = 0, b_shift = 0; XSetWindowAttributes xswa; @@ -1514,16 +715,13 @@ int AllocColors( void ) { break; } if ( direct_color ) { - colors[ c ].xcolor.pixel = - ( ( colors[ c ].xcolor.red >> r_shift ) & visual->red_mask ) | - ( ( colors[ c ].xcolor.green >> g_shift ) & - visual->green_mask ) | - ( ( colors[ c ].xcolor.blue >> b_shift ) & visual->blue_mask ); + colors[ c ].xcolor.pixel = ( ( colors[ c ].xcolor.red >> r_shift ) & visual->red_mask ) | + ( ( colors[ c ].xcolor.green >> g_shift ) & visual->green_mask ) | + ( ( colors[ c ].xcolor.blue >> b_shift ) & visual->blue_mask ); XStoreColor( dpy, cmap, &colors[ c ].xcolor ); } else { if ( dynamic_color && c == PIXEL ) { - if ( XAllocColorCells( dpy, cmap, True, ( unsigned long* )0, 0, - &colors[ c ].xcolor.pixel, 1 ) == 0 ) { + if ( XAllocColorCells( dpy, cmap, True, ( unsigned long* )0, 0, &colors[ c ].xcolor.pixel, 1 ) == 0 ) { dyn = 0; if ( XAllocColor( dpy, cmap, &colors[ c ].xcolor ) == 0 ) { if ( verbose ) @@ -1602,8 +800,7 @@ int AllocColors( void ) { break; } if ( dynamic_color && c == PIXEL ) { - if ( XAllocColorCells( dpy, cmap, True, ( unsigned long* )0, 0, - &colors[ c ].xcolor.pixel, 1 ) == 0 ) { + if ( XAllocColorCells( dpy, cmap, True, ( unsigned long* )0, 0, &colors[ c ].xcolor.pixel, 1 ) == 0 ) { dyn = 0; if ( XAllocColor( dpy, cmap, &colors[ c ].xcolor ) == 0 ) fatal_exit( "can\'t alloc Color.\n", "" ); @@ -1627,7 +824,8 @@ int AllocColors( void ) { return 0; } -int InitDisplay( int argc, char** argv ) { +int InitDisplay( int argc, char** argv ) +{ /* * open the display */ @@ -1660,19 +858,15 @@ int InitDisplay( int argc, char** argv ) { return 0; } -int DrawSmallString( Display* the_dpy, Drawable d, GC the_gc, int x, int y, - const char* string, unsigned int length ) { +int DrawSmallString( Display* the_dpy, Drawable d, GC the_gc, int x, int y, const char* string, unsigned int length ) +{ Pixmap pix; for ( unsigned int i = 0; i < length; i++ ) { if ( small_font[ ( int )string[ i ] ].h != 0 ) { - pix = XCreateBitmapFromData( - the_dpy, d, ( char* )small_font[ ( int )string[ i ] ].bits, - small_font[ ( int )string[ i ] ].w, - small_font[ ( int )string[ i ] ].h ); - XCopyPlane( the_dpy, pix, d, the_gc, 0, 0, - small_font[ ( int )string[ i ] ].w, - small_font[ ( int )string[ i ] ].h, x, + pix = XCreateBitmapFromData( the_dpy, d, ( char* )small_font[ ( int )string[ i ] ].bits, small_font[ ( int )string[ i ] ].w, + small_font[ ( int )string[ i ] ].h ); + XCopyPlane( the_dpy, pix, d, the_gc, 0, 0, small_font[ ( int )string[ i ] ].w, small_font[ ( int )string[ i ] ].h, x, ( int )( y - small_font[ ( int )string[ i ] ].h ), 1 ); XFreePixmap( the_dpy, pix ); } @@ -1681,8 +875,8 @@ int DrawSmallString( Display* the_dpy, Drawable d, GC the_gc, int x, int y, return 0; } -void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, - XFontStruct* f_med, XFontStruct* f_big ) { +void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, XFontStruct* f_med, XFontStruct* f_big ) +{ int x, y; XSetWindowAttributes xswa; XFontStruct* finfo; @@ -1706,32 +900,26 @@ void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, /* * create the buttons subwindows */ - buttons[ i ].xwin = XCreateSimpleWindow( - dpy, mainW, off_x + buttons[ i ].x, off_y + buttons[ i ].y, - buttons[ i ].w, buttons[ i ].h, 0, COLOR( BLACK ), pixel ); + buttons[ i ].xwin = XCreateSimpleWindow( dpy, mainW, off_x + buttons[ i ].x, off_y + buttons[ i ].y, buttons[ i ].w, buttons[ i ].h, + 0, COLOR( BLACK ), pixel ); - XDefineCursor( dpy, buttons[ i ].xwin, - XCreateFontCursor( dpy, XC_hand1 ) ); + XDefineCursor( dpy, buttons[ i ].xwin, XCreateFontCursor( dpy, XC_hand1 ) ); xswa.event_mask = LeaveWindowMask | ExposureMask | StructureNotifyMask; xswa.backing_store = Always; - XChangeWindowAttributes( dpy, buttons[ i ].xwin, - CWEventMask | CWBackingStore, &xswa ); + XChangeWindowAttributes( dpy, buttons[ i ].xwin, CWEventMask | CWBackingStore, &xswa ); /* * draw the released button */ - buttons[ i ].map = XCreatePixmap( - dpy, buttons[ i ].xwin, buttons[ i ].w, buttons[ i ].h, depth ); + buttons[ i ].map = XCreatePixmap( dpy, buttons[ i ].xwin, buttons[ i ].w, buttons[ i ].h, depth ); XSetForeground( dpy, gc, pixel ); - XFillRectangle( dpy, buttons[ i ].map, gc, 0, 0, buttons[ i ].w, - buttons[ i ].h ); + XFillRectangle( dpy, buttons[ i ].map, gc, 0, 0, buttons[ i ].w, buttons[ i ].h ); XSetForeground( dpy, gc, COLOR( BUTTON ) ); - XFillRectangle( dpy, buttons[ i ].map, gc, 1, 1, buttons[ i ].w - 2, - buttons[ i ].h - 2 ); + XFillRectangle( dpy, buttons[ i ].map, gc, 1, 1, buttons[ i ].w - 2, buttons[ i ].h - 2 ); if ( buttons[ i ].label != ( char* )0 ) { @@ -1762,15 +950,10 @@ void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, XSetBackground( dpy, gc, COLOR( BUTTON ) ); XSetForeground( dpy, gc, COLOR( buttons[ i ].lc ) ); - XTextExtents( finfo, buttons[ i ].label, - ( int )strlen( buttons[ i ].label ), &dir, &fa, &fd, - &xchar ); + XTextExtents( finfo, buttons[ i ].label, ( int )strlen( buttons[ i ].label ), &dir, &fa, &fd, &xchar ); x = ( buttons[ i ].w - xchar.width ) / 2; - y = ( 1 + buttons[ i ].h - ( xchar.ascent + xchar.descent ) ) / 2 + - xchar.ascent + 1; - XDrawImageString( dpy, buttons[ i ].map, gc, x, y, - buttons[ i ].label, - ( int )strlen( buttons[ i ].label ) ); + y = ( 1 + buttons[ i ].h - ( xchar.ascent + xchar.descent ) ) / 2 + xchar.ascent + 1; + XDrawImageString( dpy, buttons[ i ].map, gc, x, y, buttons[ i ].label, ( int )strlen( buttons[ i ].label ) ); XSetBackground( dpy, gc, COLOR( BLACK ) ); @@ -1782,15 +965,12 @@ void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, XSetBackground( dpy, gc, COLOR( BUTTON ) ); XSetForeground( dpy, gc, COLOR( buttons[ i ].lc ) ); - pix = XCreateBitmapFromData( dpy, buttons[ i ].xwin, - ( char* )buttons[ i ].lb, - buttons[ i ].lw, buttons[ i ].lh ); + pix = XCreateBitmapFromData( dpy, buttons[ i ].xwin, ( char* )buttons[ i ].lb, buttons[ i ].lw, buttons[ i ].lh ); x = ( 1 + buttons[ i ].w - buttons[ i ].lw ) / 2; y = ( 1 + buttons[ i ].h - buttons[ i ].lh ) / 2 + 1; - XCopyPlane( dpy, pix, buttons[ i ].map, gc, 0, 0, buttons[ i ].lw, - buttons[ i ].lh, x, y, 1 ); + XCopyPlane( dpy, pix, buttons[ i ].map, gc, 0, 0, buttons[ i ].lw, buttons[ i ].lh, x, y, 1 ); XFreePixmap( dpy, pix ); @@ -1802,91 +982,66 @@ void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, */ XSetForeground( dpy, gc, COLOR( BUT_TOP ) ); - XDrawLine( dpy, buttons[ i ].map, gc, 1, ( int )( buttons[ i ].h - 2 ), - 1, 1 ); - XDrawLine( dpy, buttons[ i ].map, gc, 2, ( int )( buttons[ i ].h - 3 ), - 2, 2 ); - XDrawLine( dpy, buttons[ i ].map, gc, 3, ( int )( buttons[ i ].h - 4 ), - 3, 3 ); + XDrawLine( dpy, buttons[ i ].map, gc, 1, ( int )( buttons[ i ].h - 2 ), 1, 1 ); + XDrawLine( dpy, buttons[ i ].map, gc, 2, ( int )( buttons[ i ].h - 3 ), 2, 2 ); + XDrawLine( dpy, buttons[ i ].map, gc, 3, ( int )( buttons[ i ].h - 4 ), 3, 3 ); - XDrawLine( dpy, buttons[ i ].map, gc, 1, 1, - ( int )( buttons[ i ].w - 2 ), 1 ); - XDrawLine( dpy, buttons[ i ].map, gc, 2, 2, - ( int )( buttons[ i ].w - 3 ), 2 ); - XDrawLine( dpy, buttons[ i ].map, gc, 3, 3, - ( int )( buttons[ i ].w - 4 ), 3 ); - XDrawLine( dpy, buttons[ i ].map, gc, 4, 4, - ( int )( buttons[ i ].w - 5 ), 4 ); + XDrawLine( dpy, buttons[ i ].map, gc, 1, 1, ( int )( buttons[ i ].w - 2 ), 1 ); + XDrawLine( dpy, buttons[ i ].map, gc, 2, 2, ( int )( buttons[ i ].w - 3 ), 2 ); + XDrawLine( dpy, buttons[ i ].map, gc, 3, 3, ( int )( buttons[ i ].w - 4 ), 3 ); + XDrawLine( dpy, buttons[ i ].map, gc, 4, 4, ( int )( buttons[ i ].w - 5 ), 4 ); XDrawPoint( dpy, buttons[ i ].map, gc, 4, 5 ); XSetForeground( dpy, gc, COLOR( BUT_BOT ) ); - XDrawLine( dpy, buttons[ i ].map, gc, 3, ( int )( buttons[ i ].h - 2 ), - ( int )( buttons[ i ].w - 2 ), + XDrawLine( dpy, buttons[ i ].map, gc, 3, ( int )( buttons[ i ].h - 2 ), ( int )( buttons[ i ].w - 2 ), ( int )( buttons[ i ].h - 2 ) ); - XDrawLine( dpy, buttons[ i ].map, gc, 4, ( int )( buttons[ i ].h - 3 ), - ( int )( buttons[ i ].w - 3 ), + XDrawLine( dpy, buttons[ i ].map, gc, 4, ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 3 ), ( int )( buttons[ i ].h - 3 ) ); - XDrawLine( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 2 ), - ( int )( buttons[ i ].h - 2 ), ( int )( buttons[ i ].w - 2 ), + XDrawLine( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 2 ), ( int )( buttons[ i ].h - 2 ), ( int )( buttons[ i ].w - 2 ), 3 ); - XDrawLine( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 3 ), - ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 3 ), + XDrawLine( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 3 ), ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 3 ), 4 ); - XDrawLine( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 4 ), - ( int )( buttons[ i ].h - 4 ), ( int )( buttons[ i ].w - 4 ), + XDrawLine( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 4 ), ( int )( buttons[ i ].h - 4 ), ( int )( buttons[ i ].w - 4 ), 5 ); - XDrawPoint( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 5 ), - ( int )( buttons[ i ].h - 4 ) ); + XDrawPoint( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 5 ), ( int )( buttons[ i ].h - 4 ) ); /* * draw frame around button */ XSetForeground( dpy, gc, COLOR( FRAME ) ); - XDrawLine( dpy, buttons[ i ].map, gc, 0, ( int )( buttons[ i ].h - 3 ), - 0, 2 ); - XDrawLine( dpy, buttons[ i ].map, gc, 2, 0, - ( int )( buttons[ i ].w - 3 ), 0 ); - XDrawLine( dpy, buttons[ i ].map, gc, 2, ( int )( buttons[ i ].h - 1 ), - ( int )( buttons[ i ].w - 3 ), + XDrawLine( dpy, buttons[ i ].map, gc, 0, ( int )( buttons[ i ].h - 3 ), 0, 2 ); + XDrawLine( dpy, buttons[ i ].map, gc, 2, 0, ( int )( buttons[ i ].w - 3 ), 0 ); + XDrawLine( dpy, buttons[ i ].map, gc, 2, ( int )( buttons[ i ].h - 1 ), ( int )( buttons[ i ].w - 3 ), ( int )( buttons[ i ].h - 1 ) ); - XDrawLine( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 1 ), - ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 1 ), + XDrawLine( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 1 ), ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 1 ), 2 ); if ( i == BUTTON_ON ) { - XDrawLine( dpy, buttons[ i ].map, gc, 1, 1, - ( int )( buttons[ i ].w - 2 ), 1 ); + XDrawLine( dpy, buttons[ i ].map, gc, 1, 1, ( int )( buttons[ i ].w - 2 ), 1 ); XDrawPoint( dpy, buttons[ i ].map, gc, 1, 2 ); - XDrawPoint( dpy, buttons[ i ].map, gc, - ( int )( buttons[ i ].w - 2 ), 2 ); + XDrawPoint( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 2 ), 2 ); } else { XDrawPoint( dpy, buttons[ i ].map, gc, 1, 1 ); - XDrawPoint( dpy, buttons[ i ].map, gc, - ( int )( buttons[ i ].w - 2 ), 1 ); + XDrawPoint( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 2 ), 1 ); } - XDrawPoint( dpy, buttons[ i ].map, gc, 1, - ( int )( buttons[ i ].h - 2 ) ); - XDrawPoint( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 2 ), - ( int )( buttons[ i ].h - 2 ) ); + XDrawPoint( dpy, buttons[ i ].map, gc, 1, ( int )( buttons[ i ].h - 2 ) ); + XDrawPoint( dpy, buttons[ i ].map, gc, ( int )( buttons[ i ].w - 2 ), ( int )( buttons[ i ].h - 2 ) ); /* * draw the depressed button */ - buttons[ i ].down = XCreatePixmap( - dpy, buttons[ i ].xwin, buttons[ i ].w, buttons[ i ].h, depth ); + buttons[ i ].down = XCreatePixmap( dpy, buttons[ i ].xwin, buttons[ i ].w, buttons[ i ].h, depth ); XSetForeground( dpy, gc, pixel ); - XFillRectangle( dpy, buttons[ i ].down, gc, 0, 0, buttons[ i ].w, - buttons[ i ].h ); + XFillRectangle( dpy, buttons[ i ].down, gc, 0, 0, buttons[ i ].w, buttons[ i ].h ); XSetForeground( dpy, gc, COLOR( BUTTON ) ); - XFillRectangle( dpy, buttons[ i ].down, gc, 1, 1, buttons[ i ].w - 2, - buttons[ i ].h - 2 ); + XFillRectangle( dpy, buttons[ i ].down, gc, 1, 1, buttons[ i ].w - 2, buttons[ i ].h - 2 ); if ( buttons[ i ].label != ( char* )0 ) { @@ -1917,15 +1072,10 @@ void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, XSetBackground( dpy, gc, COLOR( BUTTON ) ); XSetForeground( dpy, gc, COLOR( buttons[ i ].lc ) ); - XTextExtents( finfo, buttons[ i ].label, - ( int )strlen( buttons[ i ].label ), &dir, &fa, &fd, - &xchar ); + XTextExtents( finfo, buttons[ i ].label, ( int )strlen( buttons[ i ].label ), &dir, &fa, &fd, &xchar ); x = ( buttons[ i ].w - xchar.width ) / 2; - y = ( 1 + buttons[ i ].h - ( xchar.ascent + xchar.descent ) ) / 2 + - xchar.ascent; - XDrawImageString( dpy, buttons[ i ].down, gc, x, y, - buttons[ i ].label, - ( int )strlen( buttons[ i ].label ) ); + y = ( 1 + buttons[ i ].h - ( xchar.ascent + xchar.descent ) ) / 2 + xchar.ascent; + XDrawImageString( dpy, buttons[ i ].down, gc, x, y, buttons[ i ].label, ( int )strlen( buttons[ i ].label ) ); XSetBackground( dpy, gc, COLOR( BLACK ) ); @@ -1937,15 +1087,12 @@ void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, XSetBackground( dpy, gc, COLOR( BUTTON ) ); XSetForeground( dpy, gc, COLOR( buttons[ i ].lc ) ); - pix = XCreateBitmapFromData( dpy, buttons[ i ].xwin, - ( char* )buttons[ i ].lb, - buttons[ i ].lw, buttons[ i ].lh ); + pix = XCreateBitmapFromData( dpy, buttons[ i ].xwin, ( char* )buttons[ i ].lb, buttons[ i ].lw, buttons[ i ].lh ); x = ( 1 + buttons[ i ].w - buttons[ i ].lw ) / 2; y = ( 1 + buttons[ i ].h - buttons[ i ].lh ) / 2; - XCopyPlane( dpy, pix, buttons[ i ].down, gc, 0, 0, buttons[ i ].lw, - buttons[ i ].lh, x, y, 1 ); + XCopyPlane( dpy, pix, buttons[ i ].down, gc, 0, 0, buttons[ i ].lw, buttons[ i ].lh, x, y, 1 ); XFreePixmap( dpy, pix ); @@ -1957,115 +1104,89 @@ void CreateButton( int i, int off_x, int off_y, XFontStruct* f_small, */ XSetForeground( dpy, gc, COLOR( BUT_TOP ) ); - XDrawLine( dpy, buttons[ i ].down, gc, 2, ( int )( buttons[ i ].h - 4 ), - 2, 2 ); - XDrawLine( dpy, buttons[ i ].down, gc, 3, ( int )( buttons[ i ].h - 5 ), - 3, 3 ); + XDrawLine( dpy, buttons[ i ].down, gc, 2, ( int )( buttons[ i ].h - 4 ), 2, 2 ); + XDrawLine( dpy, buttons[ i ].down, gc, 3, ( int )( buttons[ i ].h - 5 ), 3, 3 ); - XDrawLine( dpy, buttons[ i ].down, gc, 2, 2, - ( int )( buttons[ i ].w - 4 ), 2 ); - XDrawLine( dpy, buttons[ i ].down, gc, 3, 3, - ( int )( buttons[ i ].w - 5 ), 3 ); + XDrawLine( dpy, buttons[ i ].down, gc, 2, 2, ( int )( buttons[ i ].w - 4 ), 2 ); + XDrawLine( dpy, buttons[ i ].down, gc, 3, 3, ( int )( buttons[ i ].w - 5 ), 3 ); XDrawPoint( dpy, buttons[ i ].down, gc, 4, 4 ); XSetForeground( dpy, gc, COLOR( BUT_BOT ) ); - XDrawLine( dpy, buttons[ i ].down, gc, 3, ( int )( buttons[ i ].h - 3 ), - ( int )( buttons[ i ].w - 3 ), + XDrawLine( dpy, buttons[ i ].down, gc, 3, ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 3 ), ( int )( buttons[ i ].h - 3 ) ); - XDrawLine( dpy, buttons[ i ].down, gc, 4, ( int )( buttons[ i ].h - 4 ), - ( int )( buttons[ i ].w - 4 ), + XDrawLine( dpy, buttons[ i ].down, gc, 4, ( int )( buttons[ i ].h - 4 ), ( int )( buttons[ i ].w - 4 ), ( int )( buttons[ i ].h - 4 ) ); - XDrawLine( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 3 ), - ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 3 ), + XDrawLine( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 3 ), ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 3 ), 3 ); - XDrawLine( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 4 ), - ( int )( buttons[ i ].h - 4 ), ( int )( buttons[ i ].w - 4 ), + XDrawLine( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 4 ), ( int )( buttons[ i ].h - 4 ), ( int )( buttons[ i ].w - 4 ), 4 ); - XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 5 ), - ( int )( buttons[ i ].h - 5 ) ); + XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 5 ), ( int )( buttons[ i ].h - 5 ) ); /* * draw frame around button */ XSetForeground( dpy, gc, COLOR( FRAME ) ); - XDrawLine( dpy, buttons[ i ].down, gc, 0, ( int )( buttons[ i ].h - 3 ), - 0, 2 ); - XDrawLine( dpy, buttons[ i ].down, gc, 2, 0, - ( int )( buttons[ i ].w - 3 ), 0 ); - XDrawLine( dpy, buttons[ i ].down, gc, 2, ( int )( buttons[ i ].h - 1 ), - ( int )( buttons[ i ].w - 3 ), + XDrawLine( dpy, buttons[ i ].down, gc, 0, ( int )( buttons[ i ].h - 3 ), 0, 2 ); + XDrawLine( dpy, buttons[ i ].down, gc, 2, 0, ( int )( buttons[ i ].w - 3 ), 0 ); + XDrawLine( dpy, buttons[ i ].down, gc, 2, ( int )( buttons[ i ].h - 1 ), ( int )( buttons[ i ].w - 3 ), ( int )( buttons[ i ].h - 1 ) ); - XDrawLine( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 1 ), - ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 1 ), + XDrawLine( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 1 ), ( int )( buttons[ i ].h - 3 ), ( int )( buttons[ i ].w - 1 ), 2 ); if ( i == BUTTON_ON ) { - XDrawLine( dpy, buttons[ i ].down, gc, 1, 1, - ( int )( buttons[ i ].w - 2 ), 1 ); + XDrawLine( dpy, buttons[ i ].down, gc, 1, 1, ( int )( buttons[ i ].w - 2 ), 1 ); XDrawPoint( dpy, buttons[ i ].down, gc, 1, 2 ); - XDrawPoint( dpy, buttons[ i ].down, gc, - ( int )( buttons[ i ].w - 2 ), 2 ); + XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 2 ), 2 ); } else { XDrawPoint( dpy, buttons[ i ].down, gc, 1, 1 ); - XDrawPoint( dpy, buttons[ i ].down, gc, - ( int )( buttons[ i ].w - 2 ), 1 ); + XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 2 ), 1 ); } - XDrawPoint( dpy, buttons[ i ].down, gc, 1, - ( int )( buttons[ i ].h - 2 ) ); - XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 2 ), - ( int )( buttons[ i ].h - 2 ) ); + XDrawPoint( dpy, buttons[ i ].down, gc, 1, ( int )( buttons[ i ].h - 2 ) ); + XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 2 ), ( int )( buttons[ i ].h - 2 ) ); if ( i == BUTTON_ON ) { - XDrawRectangle( dpy, buttons[ i ].down, gc, 1, 2, - buttons[ i ].w - 3, buttons[ i ].h - 4 ); + XDrawRectangle( dpy, buttons[ i ].down, gc, 1, 2, buttons[ i ].w - 3, buttons[ i ].h - 4 ); XDrawPoint( dpy, buttons[ i ].down, gc, 2, 3 ); - XDrawPoint( dpy, buttons[ i ].down, gc, - ( int )( buttons[ i ].w - 3 ), 3 ); + XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 3 ), 3 ); } else { - XDrawRectangle( dpy, buttons[ i ].down, gc, 1, 1, - buttons[ i ].w - 3, buttons[ i ].h - 3 ); + XDrawRectangle( dpy, buttons[ i ].down, gc, 1, 1, buttons[ i ].w - 3, buttons[ i ].h - 3 ); XDrawPoint( dpy, buttons[ i ].down, gc, 2, 2 ); - XDrawPoint( dpy, buttons[ i ].down, gc, - ( int )( buttons[ i ].w - 3 ), 2 ); + XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 3 ), 2 ); } - XDrawPoint( dpy, buttons[ i ].down, gc, 2, - ( int )( buttons[ i ].h - 3 ) ); - XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 3 ), - ( int )( buttons[ i ].h - 3 ) ); + XDrawPoint( dpy, buttons[ i ].down, gc, 2, ( int )( buttons[ i ].h - 3 ) ); + XDrawPoint( dpy, buttons[ i ].down, gc, ( int )( buttons[ i ].w - 3 ), ( int )( buttons[ i ].h - 3 ) ); } } -void DrawButtons( void ) { +void DrawButtons( void ) +{ int i; for ( i = FIRST_BUTTON; i <= LAST_BUTTON; i++ ) { if ( buttons[ i ].pressed ) { - XCopyArea( dpy, buttons[ i ].down, buttons[ i ].xwin, gc, 0, 0, - buttons[ i ].w, buttons[ i ].h, 0, 0 ); + XCopyArea( dpy, buttons[ i ].down, buttons[ i ].xwin, gc, 0, 0, buttons[ i ].w, buttons[ i ].h, 0, 0 ); } else { - XCopyArea( dpy, buttons[ i ].map, buttons[ i ].xwin, gc, 0, 0, - buttons[ i ].w, buttons[ i ].h, 0, 0 ); + XCopyArea( dpy, buttons[ i ].map, buttons[ i ].xwin, gc, 0, 0, buttons[ i ].w, buttons[ i ].h, 0, 0 ); } } } -void DrawButton( int i ) { +void DrawButton( int i ) +{ if ( buttons[ i ].pressed ) { - XCopyArea( dpy, buttons[ i ].down, buttons[ i ].xwin, gc, 0, 0, - buttons[ i ].w, buttons[ i ].h, 0, 0 ); + XCopyArea( dpy, buttons[ i ].down, buttons[ i ].xwin, gc, 0, 0, buttons[ i ].w, buttons[ i ].h, 0, 0 ); } else { - XCopyArea( dpy, buttons[ i ].map, buttons[ i ].xwin, gc, 0, 0, - buttons[ i ].w, buttons[ i ].h, 0, 0 ); + XCopyArea( dpy, buttons[ i ].map, buttons[ i ].xwin, gc, 0, 0, buttons[ i ].w, buttons[ i ].h, 0, 0 ); } } -void CreateBackground( int width, int height, int w_top, int h_top, - x11_keypad_t* keypad ) { +void CreateBackground( int width, int height, int w_top, int h_top, x11_keypad_t* keypad ) +{ XSetBackground( dpy, gc, COLOR( PAD ) ); XSetForeground( dpy, gc, COLOR( PAD ) ); @@ -2077,8 +1198,8 @@ void CreateBackground( int width, int height, int w_top, int h_top, XFillRectangle( dpy, keypad->pixmap, gc, 0, 0, width, height ); } -void CreateKeypad( unsigned int offset_y, unsigned int offset_x, - x11_keypad_t* keypad ) { +void CreateKeypad( unsigned int offset_y, unsigned int offset_x, x11_keypad_t* keypad ) +{ int i, x, y; int wl, wr, ws; Pixmap pix; @@ -2111,13 +1232,11 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, x = offset_x + buttons[ i ].x + buttons[ i ].w + 3; y = offset_y + buttons[ i ].y + buttons[ i ].h + 1; } else { - x = offset_x + buttons[ i ].x + buttons[ i ].w - - SmallTextWidth( buttons[ i ].letter, 1 ) / 2 + 5; + x = offset_x + buttons[ i ].x + buttons[ i ].w - SmallTextWidth( buttons[ i ].letter, 1 ) / 2 + 5; y = offset_y + buttons[ i ].y + buttons[ i ].h - 2; } - DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].letter, - 1 ); + DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].letter, 1 ); } } @@ -2135,15 +1254,10 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, XSetBackground( dpy, gc, pixel ); XSetForeground( dpy, gc, COLOR( WHITE ) ); - x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - - SmallTextWidth( buttons[ i ].sub, - strlen( buttons[ i ].sub ) ) ) / - 2; + x = offset_x + buttons[ i ].x + ( 1 + buttons[ i ].w - SmallTextWidth( buttons[ i ].sub, strlen( buttons[ i ].sub ) ) ) / 2; y = offset_y + buttons[ i ].y + buttons[ i ].h + small_ascent + 2; - DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].sub, - strlen( buttons[ i ].sub ) ); + DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].sub, strlen( buttons[ i ].sub ) ); } } @@ -2176,17 +1290,13 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, XSetBackground( dpy, gc, COLOR( UNDERLAY ) ); XSetForeground( dpy, gc, COLOR( LEFT ) ); - x = ( pw + 1 - - SmallTextWidth( buttons[ i ].left, - strlen( buttons[ i ].left ) ) ) / - 2; + x = ( pw + 1 - SmallTextWidth( buttons[ i ].left, strlen( buttons[ i ].left ) ) ) / 2; if ( opt_gx ) y = 14; else y = 9; - DrawSmallString( dpy, pix, gc, x, y, buttons[ i ].left, - strlen( buttons[ i ].left ) ); + DrawSmallString( dpy, pix, gc, x, y, buttons[ i ].left, strlen( buttons[ i ].left ) ); XSetForeground( dpy, gc, pixel ); @@ -2199,12 +1309,10 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, if ( opt_gx ) { x = offset_x + buttons[ i ].x - 6; - y = offset_y + buttons[ i ].y - small_ascent - - small_descent - 6; + y = offset_y + buttons[ i ].y - small_ascent - small_descent - 6; } else { x = offset_x + buttons[ i ].x + ( buttons[ i ].w - pw ) / 2; - y = offset_y + buttons[ i ].y - small_ascent - - small_descent; + y = offset_y + buttons[ i ].y - small_ascent - small_descent; } XCopyArea( dpy, pix, keypad->pixmap, gc, 0, 0, pw, ph, x, y ); @@ -2219,28 +1327,20 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, if ( buttons[ i ].right == ( char* )0 ) { /* centered label */ x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - - SmallTextWidth( buttons[ i ].left, - strlen( buttons[ i ].left ) ) ) / - 2; + ( 1 + buttons[ i ].w - SmallTextWidth( buttons[ i ].left, strlen( buttons[ i ].left ) ) ) / 2; } else { /* label to the left */ - wl = SmallTextWidth( buttons[ i ].left, - strlen( buttons[ i ].left ) ); - wr = SmallTextWidth( buttons[ i ].right, - strlen( buttons[ i ].right ) ); + wl = SmallTextWidth( buttons[ i ].left, strlen( buttons[ i ].left ) ); + wr = SmallTextWidth( buttons[ i ].right, strlen( buttons[ i ].right ) ); ws = SmallTextWidth( " ", 1 ); - x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - ( wl + wr + ws ) ) / 2; + x = offset_x + buttons[ i ].x + ( 1 + buttons[ i ].w - ( wl + wr + ws ) ) / 2; } y = offset_y + buttons[ i ].y - small_descent; - DrawSmallString( dpy, keypad->pixmap, gc, x, y, - buttons[ i ].left, - strlen( buttons[ i ].left ) ); + DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].left, strlen( buttons[ i ].left ) ); } } } @@ -2279,17 +1379,13 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, XSetBackground( dpy, gc, COLOR( UNDERLAY ) ); XSetForeground( dpy, gc, COLOR( RIGHT ) ); - x = ( pw + 1 - - SmallTextWidth( buttons[ i ].right, - strlen( buttons[ i ].right ) ) ) / - 2; + x = ( pw + 1 - SmallTextWidth( buttons[ i ].right, strlen( buttons[ i ].right ) ) ) / 2; if ( opt_gx ) y = 14; else y = 8; - DrawSmallString( dpy, pix, gc, x, y, buttons[ i ].right, - strlen( buttons[ i ].right ) ); + DrawSmallString( dpy, pix, gc, x, y, buttons[ i ].right, strlen( buttons[ i ].right ) ); XSetForeground( dpy, gc, pixel ); @@ -2302,12 +1398,10 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, if ( opt_gx ) { x = offset_x + buttons[ i ].x - 6; - y = offset_y + buttons[ i ].y - small_ascent - - small_descent - 6; + y = offset_y + buttons[ i ].y - small_ascent - small_descent - 6; } else { x = offset_x + buttons[ i ].x + ( buttons[ i ].w - pw ) / 2; - y = offset_y + buttons[ i ].y - small_ascent - - small_descent; + y = offset_y + buttons[ i ].y - small_ascent - small_descent; } XCopyArea( dpy, pix, keypad->pixmap, gc, 0, 0, pw, ph, x, y ); @@ -2322,28 +1416,20 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, if ( buttons[ i ].left == ( char* )0 ) { /* centered label */ x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - - SmallTextWidth( buttons[ i ].right, - strlen( buttons[ i ].right ) ) ) / - 2; + ( 1 + buttons[ i ].w - SmallTextWidth( buttons[ i ].right, strlen( buttons[ i ].right ) ) ) / 2; } else { /* label to the right */ - wl = SmallTextWidth( buttons[ i ].left, - strlen( buttons[ i ].left ) ); - wr = SmallTextWidth( buttons[ i ].right, - strlen( buttons[ i ].right ) ); + wl = SmallTextWidth( buttons[ i ].left, strlen( buttons[ i ].left ) ); + wr = SmallTextWidth( buttons[ i ].right, strlen( buttons[ i ].right ) ); ws = SmallTextWidth( " ", 1 ); - x = offset_x + buttons[ i ].x + - ( 1 + buttons[ i ].w - ( wl + wr + ws ) ) / 2 + wl + ws; + x = offset_x + buttons[ i ].x + ( 1 + buttons[ i ].w - ( wl + wr + ws ) ) / 2 + wl + ws; } y = offset_y + buttons[ i ].y - small_descent; - DrawSmallString( dpy, keypad->pixmap, gc, x, y, - buttons[ i ].right, - strlen( buttons[ i ].right ) ); + DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].right, strlen( buttons[ i ].right ) ); } } } @@ -2356,23 +1442,20 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, XSetBackground( dpy, gc, COLOR( PAD ) ); XSetForeground( dpy, gc, COLOR( WHITE ) ); - pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )last_bitmap, - last_width, last_height ); + pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )last_bitmap, last_width, last_height ); x = offset_x + buttons[ BUTTON_1 ].x + buttons[ BUTTON_1 ].w + - ( buttons[ BUTTON_2 ].x - buttons[ BUTTON_1 ].x - - buttons[ BUTTON_1 ].w ) / - 2; + ( buttons[ BUTTON_2 ].x - buttons[ BUTTON_1 ].x - buttons[ BUTTON_1 ].w ) / 2; y = offset_y + buttons[ BUTTON_5 ].y + buttons[ BUTTON_5 ].h + 2; - XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, last_width, last_height, - x, y, 1 ); + XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, last_width, last_height, x, y, 1 ); XFreePixmap( dpy, pix ); } } -void CreateBezel( x11_keypad_t* keypad ) { +void CreateBezel( x11_keypad_t* keypad ) +{ int i; /* @@ -2381,32 +1464,21 @@ void CreateBezel( x11_keypad_t* keypad ) { XSetForeground( dpy, gc, COLOR( DISP_PAD_TOP ) ); for ( i = 0; i < DISP_FRAME; i++ ) { - XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i + 1 ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i + 1 ) ); - XDrawLine( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ), - ( int )( DISPLAY_OFFSET_Y - i ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i + 1 ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i + 1 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ), ( int )( DISPLAY_OFFSET_Y - i ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ) ); } XSetForeground( dpy, gc, COLOR( DISP_PAD_BOT ) ); for ( i = 0; i < DISP_FRAME; i++ ) { - XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i - 1 ), - ( int )( DISPLAY_OFFSET_Y - i - 1 ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i - 1 ), - ( int )( DISPLAY_OFFSET_Y - i - 1 ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i - 1 ), - ( int )( DISPLAY_OFFSET_Y - i - 1 ), - ( int )( DISPLAY_OFFSET_X - i - 1 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i - 1 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i - 1 ), ( int )( DISPLAY_OFFSET_Y - i - 1 ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i - 1 ), ( int )( DISPLAY_OFFSET_Y - i - 1 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i - 1 ), ( int )( DISPLAY_OFFSET_Y - i - 1 ), + ( int )( DISPLAY_OFFSET_X - i - 1 ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i - 1 ) ); } /* @@ -2414,89 +1486,58 @@ void CreateBezel( x11_keypad_t* keypad ) { */ XSetForeground( dpy, gc, COLOR( DISP_PAD ) ); - XDrawLine( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 3 ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ), + ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 3 ), ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ), + ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), ( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 3 ) ); + XDrawPoint( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 1 ), ( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 1 ) ); + + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 4 ), + ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ), ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ) ); - XDrawLine( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), + ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ), ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), ( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 3 ) ); - XDrawPoint( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 1 ), + XDrawPoint( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 2 ), ( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 1 ) ); - XDrawLine( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 4 ), - ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), - ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ) ); - XDrawLine( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), - ( int )( DISPLAY_OFFSET_Y - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), - ( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 3 ) ); - XDrawPoint( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 2 ), - ( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 1 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4 ), ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ), ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 3 ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) ); + XDrawPoint( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 1 ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2 ) ); - XDrawLine( - dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4 ), - ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) ); - XDrawLine( - dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ), - ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 3 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) ); - XDrawPoint( - dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 1 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2 ) ); - - XDrawLine( - dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4 ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) ); - XDrawLine( - dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 4 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) ); - XDrawPoint( - dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 2 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4 ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 4 ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) ); + XDrawPoint( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 2 ), + ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2 ) ); /* * simulate rounded lcd corners */ XSetForeground( dpy, gc, COLOR( LCD ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - 1 ), - ( int )( DISPLAY_OFFSET_Y + 1 ), ( int )( DISPLAY_OFFSET_X - 1 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT - 2 ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + 1 ), - ( int )( DISPLAY_OFFSET_Y - 1 ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH - 2 ), - ( int )( DISPLAY_OFFSET_Y - 1 ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + 1 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH - 2 ), - ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT ) ); - XDrawLine( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH ), - ( int )( DISPLAY_OFFSET_Y + 1 ), - ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - 1 ), ( int )( DISPLAY_OFFSET_Y + 1 ), ( int )( DISPLAY_OFFSET_X - 1 ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT - 2 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + 1 ), ( int )( DISPLAY_OFFSET_Y - 1 ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH - 2 ), ( int )( DISPLAY_OFFSET_Y - 1 ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + 1 ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH - 2 ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT ) ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH ), ( int )( DISPLAY_OFFSET_Y + 1 ), + ( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH ), ( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT - 2 ) ); } -void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { +void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) +{ Pixmap pix; int cut = 0; int x, y; @@ -2508,26 +1549,18 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { /* bottom lines */ int keypad_width = keypad->width; - XDrawLine( dpy, keypad->pixmap, gc, 1, ( int )( keypad->height - 1 ), - ( int )( keypad_width - 1 ), ( int )( keypad->height - 1 ) ); - XDrawLine( dpy, keypad->pixmap, gc, 2, ( int )( keypad->height - 2 ), - ( int )( keypad_width - 2 ), ( int )( keypad->height - 2 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 1, ( int )( keypad->height - 1 ), ( int )( keypad_width - 1 ), ( int )( keypad->height - 1 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 2, ( int )( keypad->height - 2 ), ( int )( keypad_width - 2 ), ( int )( keypad->height - 2 ) ); /* right lines */ - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 1 ), - ( int )( keypad->height - 1 ), ( int )( keypad->width - 1 ), - cut ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 2 ), - ( int )( keypad->height - 2 ), ( int )( keypad->width - 2 ), - cut ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 1 ), ( int )( keypad->height - 1 ), ( int )( keypad->width - 1 ), cut ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 2 ), ( int )( keypad->height - 2 ), ( int )( keypad->width - 2 ), cut ); XSetForeground( dpy, gc, COLOR( DISP_PAD_TOP ) ); /* right lines */ - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 1 ), cut - 1, - ( int )( keypad->width - 1 ), 1 ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 2 ), cut - 1, - ( int )( keypad->width - 2 ), 2 ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 1 ), cut - 1, ( int )( keypad->width - 1 ), 1 ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 2 ), cut - 1, ( int )( keypad->width - 2 ), 2 ); XSetForeground( dpy, gc, COLOR( DISP_PAD_BOT ) ); @@ -2542,10 +1575,8 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { XSetForeground( dpy, gc, COLOR( PAD_BOT ) ); /* left lines */ - XDrawLine( dpy, keypad->pixmap, gc, 0, ( int )( keypad->height - 2 ), 0, - cut ); - XDrawLine( dpy, keypad->pixmap, gc, 1, ( int )( keypad->height - 3 ), 1, - cut ); + XDrawLine( dpy, keypad->pixmap, gc, 0, ( int )( keypad->height - 2 ), 0, cut ); + XDrawLine( dpy, keypad->pixmap, gc, 1, ( int )( keypad->height - 3 ), 1, cut ); /* * lower the menu buttons @@ -2553,34 +1584,24 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { XSetForeground( dpy, gc, COLOR( PAD_TOP ) ); /* bottom lines */ - XDrawLine( dpy, keypad->pixmap, gc, 3, ( int )( keypad->height - 3 ), - ( int )( keypad->width - 3 ), ( int )( keypad->height - 3 ) ); - XDrawLine( dpy, keypad->pixmap, gc, 4, ( int )( keypad->height - 4 ), - ( int )( keypad->width - 4 ), ( int )( keypad->height - 4 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 3, ( int )( keypad->height - 3 ), ( int )( keypad->width - 3 ), ( int )( keypad->height - 3 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 4, ( int )( keypad->height - 4 ), ( int )( keypad->width - 4 ), ( int )( keypad->height - 4 ) ); /* right lines */ - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 3 ), - ( int )( keypad->height - 3 ), ( int )( keypad->width - 3 ), - cut ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 4 ), - ( int )( keypad->height - 4 ), ( int )( keypad->width - 4 ), - cut ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 3 ), ( int )( keypad->height - 3 ), ( int )( keypad->width - 3 ), cut ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 4 ), ( int )( keypad->height - 4 ), ( int )( keypad->width - 4 ), cut ); XSetForeground( dpy, gc, COLOR( DISP_PAD_TOP ) ); /* right lines */ - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 3 ), cut - 1, - ( int )( keypad->width - 3 ), offset_y - 24 ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 4 ), cut - 1, - ( int )( keypad->width - 4 ), offset_y - 23 ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 3 ), cut - 1, ( int )( keypad->width - 3 ), offset_y - 24 ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 4 ), cut - 1, ( int )( keypad->width - 4 ), offset_y - 23 ); XSetForeground( dpy, gc, COLOR( DISP_PAD_BOT ) ); /* top lines */ - XDrawLine( dpy, keypad->pixmap, gc, 2, offset_y - 25, - ( int )( keypad->width - 4 ), offset_y - 25 ); - XDrawLine( dpy, keypad->pixmap, gc, 3, offset_y - 24, - ( int )( keypad->width - 5 ), offset_y - 24 ); + XDrawLine( dpy, keypad->pixmap, gc, 2, offset_y - 25, ( int )( keypad->width - 4 ), offset_y - 25 ); + XDrawLine( dpy, keypad->pixmap, gc, 3, offset_y - 24, ( int )( keypad->width - 5 ), offset_y - 24 ); /* left lines */ XDrawLine( dpy, keypad->pixmap, gc, 2, cut - 1, 2, offset_y - 24 ); @@ -2589,10 +1610,8 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { XSetForeground( dpy, gc, COLOR( PAD_BOT ) ); /* left lines */ - XDrawLine( dpy, keypad->pixmap, gc, 2, ( int )( keypad->height - 4 ), 2, - cut ); - XDrawLine( dpy, keypad->pixmap, gc, 3, ( int )( keypad->height - 5 ), 3, - cut ); + XDrawLine( dpy, keypad->pixmap, gc, 2, ( int )( keypad->height - 4 ), 2, cut ); + XDrawLine( dpy, keypad->pixmap, gc, 3, ( int )( keypad->height - 5 ), 3, cut ); /* * lower the keyboard @@ -2600,64 +1619,47 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { XSetForeground( dpy, gc, COLOR( PAD_TOP ) ); /* bottom lines */ - XDrawLine( dpy, keypad->pixmap, gc, 5, ( int )( keypad->height - 5 ), - ( int )( keypad->width - 3 ), ( int )( keypad->height - 5 ) ); - XDrawLine( dpy, keypad->pixmap, gc, 6, ( int )( keypad->height - 6 ), - ( int )( keypad->width - 4 ), ( int )( keypad->height - 6 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 5, ( int )( keypad->height - 5 ), ( int )( keypad->width - 3 ), ( int )( keypad->height - 5 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 6, ( int )( keypad->height - 6 ), ( int )( keypad->width - 4 ), ( int )( keypad->height - 6 ) ); /* right lines */ - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 5 ), - ( int )( keypad->height - 5 ), ( int )( keypad->width - 5 ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 5 ), ( int )( keypad->height - 5 ), ( int )( keypad->width - 5 ), cut + 1 ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 6 ), - ( int )( keypad->height - 6 ), ( int )( keypad->width - 6 ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 6 ), ( int )( keypad->height - 6 ), ( int )( keypad->width - 6 ), cut + 2 ); XSetForeground( dpy, gc, COLOR( DISP_PAD_BOT ) ); /* top lines */ - XDrawLine( dpy, keypad->pixmap, gc, 4, cut, ( int )( keypad->width - 6 ), - cut ); - XDrawLine( dpy, keypad->pixmap, gc, 5, cut + 1, - ( int )( keypad->width - 7 ), cut + 1 ); + XDrawLine( dpy, keypad->pixmap, gc, 4, cut, ( int )( keypad->width - 6 ), cut ); + XDrawLine( dpy, keypad->pixmap, gc, 5, cut + 1, ( int )( keypad->width - 7 ), cut + 1 ); XSetForeground( dpy, gc, COLOR( PAD_BOT ) ); /* left lines */ - XDrawLine( dpy, keypad->pixmap, gc, 4, ( int )( keypad->height - 6 ), 4, - cut + 1 ); - XDrawLine( dpy, keypad->pixmap, gc, 5, ( int )( keypad->height - 7 ), 5, - cut + 2 ); + XDrawLine( dpy, keypad->pixmap, gc, 4, ( int )( keypad->height - 6 ), 4, cut + 1 ); + XDrawLine( dpy, keypad->pixmap, gc, 5, ( int )( keypad->height - 7 ), 5, cut + 2 ); /* * round off the bottom edge */ XSetForeground( dpy, gc, COLOR( PAD_TOP ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 7 ), - ( int )( keypad->height - 7 ), ( int )( keypad->width - 7 ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 7 ), ( int )( keypad->height - 7 ), ( int )( keypad->width - 7 ), ( int )( keypad->height - 14 ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 8 ), - ( int )( keypad->height - 8 ), ( int )( keypad->width - 8 ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 8 ), ( int )( keypad->height - 8 ), ( int )( keypad->width - 8 ), ( int )( keypad->height - 11 ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 7 ), - ( int )( keypad->height - 7 ), ( int )( keypad->width - 14 ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 7 ), ( int )( keypad->height - 7 ), ( int )( keypad->width - 14 ), ( int )( keypad->height - 7 ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 7 ), - ( int )( keypad->height - 8 ), ( int )( keypad->width - 11 ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )( keypad->width - 7 ), ( int )( keypad->height - 8 ), ( int )( keypad->width - 11 ), ( int )( keypad->height - 8 ) ); - XDrawPoint( dpy, keypad->pixmap, gc, ( int )( keypad->width - 9 ), - ( int )( keypad->height - 9 ) ); + XDrawPoint( dpy, keypad->pixmap, gc, ( int )( keypad->width - 9 ), ( int )( keypad->height - 9 ) ); - XDrawLine( dpy, keypad->pixmap, gc, 7, ( int )( keypad->height - 7 ), 13, - ( int )( keypad->height - 7 ) ); - XDrawLine( dpy, keypad->pixmap, gc, 8, ( int )( keypad->height - 8 ), 10, - ( int )( keypad->height - 8 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 7, ( int )( keypad->height - 7 ), 13, ( int )( keypad->height - 7 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 8, ( int )( keypad->height - 8 ), 10, ( int )( keypad->height - 8 ) ); XSetForeground( dpy, gc, COLOR( PAD_BOT ) ); - XDrawLine( dpy, keypad->pixmap, gc, 6, ( int )( keypad->height - 8 ), 6, - ( int )( keypad->height - 14 ) ); - XDrawLine( dpy, keypad->pixmap, gc, 7, ( int )( keypad->height - 9 ), 7, - ( int )( keypad->height - 11 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 6, ( int )( keypad->height - 8 ), 6, ( int )( keypad->height - 14 ) ); + XDrawLine( dpy, keypad->pixmap, gc, 7, ( int )( keypad->height - 9 ), 7, ( int )( keypad->height - 11 ) ); /* * insert the HP Logo @@ -2666,29 +1668,23 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { XSetBackground( dpy, gc, COLOR( LOGO_BACK ) ); XSetForeground( dpy, gc, COLOR( LOGO ) ); - pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp_bitmap, - hp_width, hp_height ); + pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp_bitmap, hp_width, hp_height ); x = opt_gx ? DISPLAY_OFFSET_X - 6 : DISPLAY_OFFSET_X; - XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, hp_width, hp_height, x, 10, - 1 ); + XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, hp_width, hp_height, x, 10, 1 ); XFreePixmap( dpy, pix ); if ( !opt_gx ) { XSetForeground( dpy, gc, COLOR( FRAME ) ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )DISPLAY_OFFSET_X, 9, - ( int )( DISPLAY_OFFSET_X + hp_width - 1 ), 9 ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - 1 ), 10, - ( int )( DISPLAY_OFFSET_X - 1 ), 10 + hp_height - 1 ); - XDrawLine( dpy, keypad->pixmap, gc, ( int )DISPLAY_OFFSET_X, - 10 + hp_height, ( int )( DISPLAY_OFFSET_X + hp_width - 1 ), + XDrawLine( dpy, keypad->pixmap, gc, ( int )DISPLAY_OFFSET_X, 9, ( int )( DISPLAY_OFFSET_X + hp_width - 1 ), 9 ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - 1 ), 10, ( int )( DISPLAY_OFFSET_X - 1 ), 10 + hp_height - 1 ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )DISPLAY_OFFSET_X, 10 + hp_height, ( int )( DISPLAY_OFFSET_X + hp_width - 1 ), 10 + hp_height ); - XDrawLine( dpy, keypad->pixmap, gc, - ( int )( DISPLAY_OFFSET_X + hp_width ), 10, - ( int )( DISPLAY_OFFSET_X + hp_width ), 10 + hp_height - 1 ); + XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + hp_width ), 10, ( int )( DISPLAY_OFFSET_X + hp_width ), + 10 + hp_height - 1 ); } /* @@ -2698,50 +1694,35 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { XSetForeground( dpy, gc, COLOR( LABEL ) ); if ( opt_gx ) { - x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + - gx_128K_ram_x_hot + 2; + x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + gx_128K_ram_x_hot + 2; y = 10 + gx_128K_ram_y_hot; - pix = XCreateBitmapFromData( dpy, keypad->pixmap, - ( char* )gx_128K_ram_bitmap, - gx_128K_ram_width, gx_128K_ram_height ); - XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, gx_128K_ram_width, - gx_128K_ram_height, x, y, 1 ); + pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )gx_128K_ram_bitmap, gx_128K_ram_width, gx_128K_ram_height ); + XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, gx_128K_ram_width, gx_128K_ram_height, x, y, 1 ); XFreePixmap( dpy, pix ); XSetForeground( dpy, gc, COLOR( LOGO ) ); x = DISPLAY_OFFSET_X + hp_width; y = hp_height + 8 - hp48gx_height; - pix = - XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp48gx_bitmap, - hp48gx_width, hp48gx_height ); - XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, hp48gx_width, - hp48gx_height, x, y, 1 ); + pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp48gx_bitmap, hp48gx_width, hp48gx_height ); + XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, hp48gx_width, hp48gx_height, x, y, 1 ); XFreePixmap( dpy, pix ); XSetFillStyle( dpy, gc, FillStippled ); - x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + - gx_silver_x_hot + 2; + x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + gx_silver_x_hot + 2; y = 10 + gx_silver_y_hot; - pix = XCreateBitmapFromData( dpy, keypad->pixmap, - ( char* )gx_silver_bitmap, gx_silver_width, - gx_silver_height ); + pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )gx_silver_bitmap, gx_silver_width, gx_silver_height ); XSetStipple( dpy, gc, pix ); XSetTSOrigin( dpy, gc, x, y ); - XFillRectangle( dpy, keypad->pixmap, gc, x, y, gx_silver_width, - gx_silver_height ); + XFillRectangle( dpy, keypad->pixmap, gc, x, y, gx_silver_width, gx_silver_height ); XFreePixmap( dpy, pix ); XSetForeground( dpy, gc, COLOR( RIGHT ) ); - x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + - gx_green_x_hot + 2; + x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + gx_green_x_hot + 2; y = 10 + gx_green_y_hot; - pix = XCreateBitmapFromData( dpy, keypad->pixmap, - ( char* )gx_green_bitmap, gx_green_width, - gx_green_height ); + pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )gx_green_bitmap, gx_green_width, gx_green_height ); XSetStipple( dpy, gc, pix ); XSetTSOrigin( dpy, gc, x, y ); - XFillRectangle( dpy, keypad->pixmap, gc, x, y, gx_green_width, - gx_green_height ); + XFillRectangle( dpy, keypad->pixmap, gc, x, y, gx_green_width, gx_green_height ); XFreePixmap( dpy, pix ); XSetTSOrigin( dpy, gc, 0, 0 ); @@ -2750,33 +1731,25 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) { x = DISPLAY_OFFSET_X; y = TOP_SKIP - DISP_FRAME - hp48sx_height - 3; - pix = - XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp48sx_bitmap, - hp48sx_width, hp48sx_height ); + pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )hp48sx_bitmap, hp48sx_width, hp48sx_height ); - XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, hp48sx_width, - hp48sx_height, x, y, 1 ); + XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, hp48sx_width, hp48sx_height, x, y, 1 ); XFreePixmap( dpy, pix ); x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - 1 - science_width; y = TOP_SKIP - DISP_FRAME - science_height - 4; - pix = - XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )science_bitmap, - science_width, science_height ); + pix = XCreateBitmapFromData( dpy, keypad->pixmap, ( char* )science_bitmap, science_width, science_height ); - XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, science_width, - science_height, x, y, 1 ); + XCopyPlane( dpy, pix, keypad->pixmap, gc, 0, 0, science_width, science_height, x, y, 1 ); } } -void DrawKeypad( x11_keypad_t* keypad ) { - XCopyArea( dpy, keypad->pixmap, mainW, gc, 0, 0, keypad->width, - keypad->height, 0, 0 ); -} +void DrawKeypad( x11_keypad_t* keypad ) { XCopyArea( dpy, keypad->pixmap, mainW, gc, 0, 0, keypad->width, keypad->height, 0, 0 ); } -void CreateIcon( void ) { +void CreateIcon( void ) +{ XSetWindowAttributes xswa; XWindowAttributes xwa; Pixmap tmp_pix; @@ -2787,31 +1760,25 @@ void CreateIcon( void ) { xswa.backing_store = Always; XChangeWindowAttributes( dpy, iconW, CWEventMask | CWBackingStore, &xswa ); - icon_pix = - XCreatePixmap( dpy, iconW, hp48_icon_width, hp48_icon_height, depth ); + icon_pix = XCreatePixmap( dpy, iconW, hp48_icon_width, hp48_icon_height, depth ); /* * draw the icon pixmap */ if ( icon_color_mode == COLOR_MODE_MONO ) { - tmp_pix = XCreateBitmapFromData( - dpy, iconW, ( char* )icon_maps[ ICON_MAP ].bits, - icon_maps[ ICON_MAP ].w, icon_maps[ ICON_MAP ].h ); + tmp_pix = + XCreateBitmapFromData( dpy, iconW, ( char* )icon_maps[ ICON_MAP ].bits, icon_maps[ ICON_MAP ].w, icon_maps[ ICON_MAP ].h ); XSetForeground( dpy, gc, COLOR( BLACK ) ); XSetBackground( dpy, gc, COLOR( WHITE ) ); - XCopyPlane( dpy, tmp_pix, icon_pix, gc, 0, 0, icon_maps[ ICON_MAP ].w, - icon_maps[ ICON_MAP ].h, 0, 0, 1 ); + XCopyPlane( dpy, tmp_pix, icon_pix, gc, 0, 0, icon_maps[ ICON_MAP ].w, icon_maps[ ICON_MAP ].h, 0, 0, 1 ); XFreePixmap( dpy, tmp_pix ); } else { XSetFillStyle( dpy, gc, FillStippled ); for ( p = FIRST_MAP; p <= LAST_MAP; p++ ) { - tmp_pix = - XCreateBitmapFromData( dpy, iconW, ( char* )icon_maps[ p ].bits, - icon_maps[ p ].w, icon_maps[ p ].h ); + tmp_pix = XCreateBitmapFromData( dpy, iconW, ( char* )icon_maps[ p ].bits, icon_maps[ p ].w, icon_maps[ p ].h ); XSetStipple( dpy, gc, tmp_pix ); XSetForeground( dpy, gc, COLOR( icon_maps[ p ].c ) ); - XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ p ].w, - icon_maps[ p ].h ); + XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ p ].w, icon_maps[ p ].h ); XFreePixmap( dpy, tmp_pix ); } XSetFillStyle( dpy, gc, FillSolid ); @@ -2820,47 +1787,41 @@ void CreateIcon( void ) { * draw frame around icon */ XSetForeground( dpy, gc, COLOR( BLACK ) ); - XDrawRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ ICON_MAP ].w - 1, - icon_maps[ ICON_MAP ].h - 1 ); + XDrawRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ ICON_MAP ].w - 1, icon_maps[ ICON_MAP ].h - 1 ); } /* * draw the display */ XSetFillStyle( dpy, gc, FillStippled ); - icon_disp_pix = XCreateBitmapFromData( - dpy, iconW, ( char* )icon_maps[ DISP_MAP ].bits, - icon_maps[ DISP_MAP ].w, icon_maps[ DISP_MAP ].h ); + icon_disp_pix = + XCreateBitmapFromData( dpy, iconW, ( char* )icon_maps[ DISP_MAP ].bits, icon_maps[ DISP_MAP ].w, icon_maps[ DISP_MAP ].h ); XSetStipple( dpy, gc, icon_disp_pix ); if ( icon_color_mode == COLOR_MODE_MONO ) XSetForeground( dpy, gc, COLOR( WHITE ) ); else XSetForeground( dpy, gc, COLOR( icon_maps[ DISP_MAP ].c ) ); - XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ DISP_MAP ].w, - icon_maps[ DISP_MAP ].h ); + XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ DISP_MAP ].w, icon_maps[ DISP_MAP ].h ); /* * draw the 'x48' string */ - icon_text_pix = - XCreateBitmapFromData( dpy, iconW, ( char* )icon_maps[ ON_MAP ].bits, - icon_maps[ ON_MAP ].w, icon_maps[ ON_MAP ].h ); + icon_text_pix = XCreateBitmapFromData( dpy, iconW, ( char* )icon_maps[ ON_MAP ].bits, icon_maps[ ON_MAP ].w, icon_maps[ ON_MAP ].h ); XSetStipple( dpy, gc, icon_text_pix ); if ( icon_color_mode == COLOR_MODE_MONO ) XSetForeground( dpy, gc, COLOR( BLACK ) ); else XSetForeground( dpy, gc, COLOR( icon_maps[ ON_MAP ].c ) ); - XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ ON_MAP ].w, - icon_maps[ ON_MAP ].h ); + XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ ON_MAP ].w, icon_maps[ ON_MAP ].h ); XSetFillStyle( dpy, gc, FillSolid ); } -void refresh_icon( void ) { +void refresh_icon( void ) +{ int icon_state; - icon_state = - ( ( display.on && !( ( ANN_IO & display.annunc ) == ANN_IO ) ) || - ( display.on && !( ( ANN_ALPHA & display.annunc ) == ANN_ALPHA ) ) ); + icon_state = ( ( display.on && !( ( ANN_IO & display.annunc ) == ANN_IO ) ) || + ( display.on && !( ( ANN_ALPHA & display.annunc ) == ANN_ALPHA ) ) ); if ( icon_state == last_icon_state ) return; @@ -2875,8 +1836,7 @@ void refresh_icon( void ) { XSetForeground( dpy, gc, COLOR( BLACK ) ); else XSetForeground( dpy, gc, COLOR( icon_maps[ ON_MAP ].c ) ); - XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ ON_MAP ].w, - icon_maps[ ON_MAP ].h ); + XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ ON_MAP ].w, icon_maps[ ON_MAP ].h ); } else { /* * clear the display @@ -2887,28 +1847,25 @@ void refresh_icon( void ) { XSetForeground( dpy, gc, COLOR( WHITE ) ); else XSetForeground( dpy, gc, COLOR( icon_maps[ DISP_MAP ].c ) ); - XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ DISP_MAP ].w, - icon_maps[ DISP_MAP ].h ); + XFillRectangle( dpy, icon_pix, gc, 0, 0, icon_maps[ DISP_MAP ].w, icon_maps[ DISP_MAP ].h ); } XSetFillStyle( dpy, gc, FillSolid ); if ( iconW ) { - XCopyArea( dpy, icon_pix, iconW, gc, 0, 0, hp48_icon_width, - hp48_icon_height, 0, 0 ); + XCopyArea( dpy, icon_pix, iconW, gc, 0, 0, hp48_icon_width, hp48_icon_height, 0, 0 ); } } -void DrawIcon( void ) { - XCopyArea( dpy, icon_pix, iconW, gc, 0, 0, hp48_icon_width, - hp48_icon_height, 0, 0 ); -} +void DrawIcon( void ) { XCopyArea( dpy, icon_pix, iconW, gc, 0, 0, hp48_icon_width, hp48_icon_height, 0, 0 ); } -int handle_xerror( Display* the_dpy, XErrorEvent* eev ) { +int handle_xerror( Display* the_dpy, XErrorEvent* eev ) +{ xerror_flag = 1; return 0; } -void CreateLCDWindow( void ) { +void CreateLCDWindow( void ) +{ XSetWindowAttributes xswa; XGCValues val; unsigned long gc_mask; @@ -2917,17 +1874,15 @@ void CreateLCDWindow( void ) { /* * create the display subwindow */ - lcd.win = XCreateSimpleWindow( - dpy, mainW, ( int )DISPLAY_OFFSET_X, ( int )DISPLAY_OFFSET_Y, - DISPLAY_WIDTH, DISPLAY_HEIGHT, 0, COLOR( BLACK ), COLOR( LCD ) ); + lcd.win = XCreateSimpleWindow( dpy, mainW, ( int )DISPLAY_OFFSET_X, ( int )DISPLAY_OFFSET_Y, DISPLAY_WIDTH, DISPLAY_HEIGHT, 0, + COLOR( BLACK ), COLOR( LCD ) ); mapped = 1; xswa.event_mask = ExposureMask | StructureNotifyMask; xswa.backing_store = Always; - XChangeWindowAttributes( dpy, lcd.win, CWEventMask | CWBackingStore, - &xswa ); + XChangeWindowAttributes( dpy, lcd.win, CWEventMask | CWBackingStore, &xswa ); /* * set up the gc @@ -2952,23 +1907,18 @@ void CreateLCDWindow( void ) { /* * create XShmImage for DISP */ - lcd.disp_image = XShmCreateImage( dpy, None, 1, XYBitmap, NULL, - &lcd.disp_info, 262, 128 ); + lcd.disp_image = XShmCreateImage( dpy, None, 1, XYBitmap, NULL, &lcd.disp_info, 262, 128 ); if ( lcd.disp_image == NULL ) { shm_flag = 0; if ( verbose ) - fprintf( stderr, - "XShm error in CreateImage(DISP), disabling.\n" ); + fprintf( stderr, "XShm error in CreateImage(DISP), disabling.\n" ); goto shm_error; } /* * get ID of shared memory block for DISP */ - lcd.disp_info.shmid = - shmget( IPC_PRIVATE, - ( lcd.disp_image->bytes_per_line * lcd.disp_image->height ), - IPC_CREAT | 0777 ); + lcd.disp_info.shmid = shmget( IPC_PRIVATE, ( lcd.disp_image->bytes_per_line * lcd.disp_image->height ), IPC_CREAT | 0777 ); if ( lcd.disp_info.shmid < 0 ) { XDestroyImage( lcd.disp_image ); lcd.disp_image = NULL; @@ -2997,25 +1947,20 @@ void CreateLCDWindow( void ) { /* * create XShmImage for MENU */ - lcd.menu_image = XShmCreateImage( dpy, None, 1, XYBitmap, NULL, - &lcd.menu_info, 262, 128 ); + lcd.menu_image = XShmCreateImage( dpy, None, 1, XYBitmap, NULL, &lcd.menu_info, 262, 128 ); if ( lcd.menu_image == NULL ) { XDestroyImage( lcd.disp_image ); lcd.disp_image = NULL; shm_flag = 0; if ( verbose ) - fprintf( stderr, - "XShm error in CreateImage(MENU), disabling.\n" ); + fprintf( stderr, "XShm error in CreateImage(MENU), disabling.\n" ); goto shm_error; } /* * get ID of shared memory block for MENU */ - lcd.menu_info.shmid = - shmget( IPC_PRIVATE, - ( lcd.menu_image->bytes_per_line * lcd.menu_image->height ), - IPC_CREAT | 0777 ); + lcd.menu_info.shmid = shmget( IPC_PRIVATE, ( lcd.menu_image->bytes_per_line * lcd.menu_image->height ), IPC_CREAT | 0777 ); if ( lcd.menu_info.shmid < 0 ) { XDestroyImage( lcd.disp_image ); lcd.disp_image = NULL; @@ -3063,12 +2008,8 @@ void CreateLCDWindow( void ) { shmctl( lcd.menu_info.shmid, IPC_RMID, 0 ); } - memset( lcd.disp_image->data, 0, - ( size_t )( lcd.disp_image->bytes_per_line * - lcd.disp_image->height ) ); - memset( lcd.menu_image->data, 0, - ( size_t )( lcd.menu_image->bytes_per_line * - lcd.menu_image->height ) ); + memset( lcd.disp_image->data, 0, ( size_t )( lcd.disp_image->bytes_per_line * lcd.disp_image->height ) ); + memset( lcd.menu_image->data, 0, ( size_t )( lcd.menu_image->bytes_per_line * lcd.menu_image->height ) ); if ( verbose ) printf( "using XShm extension.\n" ); @@ -3089,7 +2030,8 @@ shm_error: } } -void DrawSerialDevices( char* wire, char* ir ) { +void DrawSerialDevices( char* wire, char* ir ) +{ char name[ 128 ]; int x, y, w, h; int conn_top; @@ -3107,8 +2049,7 @@ void DrawSerialDevices( char* wire, char* ir ) { conn_top = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 18; - XTextExtents( finfo, "TEST", ( int )strlen( "TEST" ), &dir, &fa, &fd, - &xchar ); + XTextExtents( finfo, "TEST", ( int )strlen( "TEST" ), &dir, &fa, &fd, &xchar ); w = DISPLAY_WIDTH; h = fa + fd; @@ -3133,8 +2074,7 @@ void DrawSerialDevices( char* wire, char* ir ) { x = DISPLAY_OFFSET_X; y = conn_top; - XCopyArea( dpy, pix, keypad.pixmap, gc, 0, 0, w, h, x, - y ); /* FIXME keypad? */ + XCopyArea( dpy, pix, keypad.pixmap, gc, 0, 0, w, h, x, y ); /* FIXME keypad? */ DrawKeypad( &keypad ); @@ -3142,7 +2082,8 @@ void DrawSerialDevices( char* wire, char* ir ) { XFreeFont( dpy, finfo ); } -int CreateWindows( int argc, char** argv ) { +int CreateWindows( int argc, char** argv ) +{ XSizeHints hint, ih; XWMHints wmh; XClassHint clh; @@ -3183,11 +2124,9 @@ int CreateWindows( int argc, char** argv ) { visual = get_visual_resource( dpy, &depth ); if ( visual != DefaultVisual( dpy, screen ) ) { if ( visual->class == DirectColor ) - cmap = XCreateColormap( dpy, RootWindow( dpy, screen ), visual, - AllocAll ); + cmap = XCreateColormap( dpy, RootWindow( dpy, screen ), visual, AllocAll ); else - cmap = XCreateColormap( dpy, RootWindow( dpy, screen ), visual, - AllocNone ); + cmap = XCreateColormap( dpy, RootWindow( dpy, screen ), visual, AllocNone ); } else cmap = DefaultColormap( dpy, screen ); @@ -3233,8 +2172,7 @@ int CreateWindows( int argc, char** argv ) { if ( name == ( char* )0 ) fatal_exit( "malloc failed.\n", "" ); - sprintf( name, "%s-%d.%d.%d", progname, saturn.version[ 0 ], - saturn.version[ 1 ], saturn.version[ 2 ] ); + sprintf( name, "%s-%d.%d.%d", progname, saturn.version[ 0 ], saturn.version[ 1 ], saturn.version[ 2 ] ); } if ( !XStringListToTextProperty( &name, 1, &wname ) ) @@ -3253,12 +2191,10 @@ int CreateWindows( int argc, char** argv ) { if ( netbook ) { height = KEYBOARD_HEIGHT; } else { - height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP + - KEYBOARD_HEIGHT + BOTTOM_SKIP; + height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP + KEYBOARD_HEIGHT + BOTTOM_SKIP; } - mainW = XCreateWindow( dpy, RootWindow( dpy, screen ), 0, 0, width, height, - 0, ( int )depth, class, visual, mask, &xswa ); + mainW = XCreateWindow( dpy, RootWindow( dpy, screen ), 0, 0, width, height, 0, ( int )depth, class, visual, mask, &xswa ); if ( mainW == 0 ) return -1; @@ -3280,8 +2216,7 @@ int CreateWindows( int argc, char** argv ) { sprintf( def_geom, "%ux%u", width, height ); user_geom = geometry; // get_string_resource( "geometry", "Geometry" ); - info = XWMGeometry( dpy, screen, user_geom, def_geom, 0, &hint, &x, &y, &w, - &h, &hint.win_gravity ); + info = XWMGeometry( dpy, screen, user_geom, def_geom, 0, &hint, &x, &y, &w, &h, &hint.win_gravity ); if ( info & ( XValue | YValue ) ) { if ( info & XValue ) @@ -3309,11 +2244,9 @@ int CreateWindows( int argc, char** argv ) { xswa.backing_store = Always; xswa.win_gravity = hint.win_gravity; xswa.bit_gravity = NorthWestGravity; - xswa.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | - ButtonReleaseMask | ExposureMask | KeymapStateMask | + xswa.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | KeymapStateMask | EnterWindowMask | StructureNotifyMask | FocusChangeMask; - mask = CWBackPixel | CWBorderPixel | CWBackingStore | CWEventMask | - CWBitGravity | CWWinGravity; + mask = CWBackPixel | CWBorderPixel | CWBackingStore | CWEventMask | CWBitGravity | CWWinGravity; XChangeWindowAttributes( dpy, mainW, mask, &xswa ); XMoveWindow( dpy, mainW, hint.x, hint.y ); @@ -3322,9 +2255,8 @@ int CreateWindows( int argc, char** argv ) { */ xswa.colormap = cmap; mask = CWColormap; - iconW = XCreateWindow( dpy, RootWindow( dpy, screen ), 0, 0, - hp48_icon_width, hp48_icon_height, 0, ( int )depth, - class, visual, mask, &xswa ); + iconW = XCreateWindow( dpy, RootWindow( dpy, screen ), 0, 0, hp48_icon_width, hp48_icon_height, 0, ( int )depth, class, visual, mask, + &xswa ); if ( iconW == 0 ) return -1; @@ -3363,15 +2295,13 @@ int CreateWindows( int argc, char** argv ) { xswa.backing_store = NotUseful; xswa.win_gravity = ih.win_gravity; xswa.bit_gravity = NorthWestGravity; - mask = CWBackPixel | CWBorderPixel | CWBackingStore | CWBitGravity | - CWWinGravity; + mask = CWBackPixel | CWBorderPixel | CWBackingStore | CWBitGravity | CWWinGravity; XChangeWindowAttributes( dpy, iconW, mask, &xswa ); /* * tell window manager all the stuff we dug out */ - XSetWMProperties( dpy, mainW, &wname, &iname, argv, argc, &hint, &wmh, - &clh ); + XSetWMProperties( dpy, mainW, &wname, &iname, argv, argc, &hint, &wmh, &clh ); /* * turn on WM_DELETE_WINDOW @@ -3389,8 +2319,7 @@ int CreateWindows( int argc, char** argv ) { ol_decor_icon_name = XInternAtom( dpy, "_OL_DECOR_ICON_NAME", 0 ); ol_decor_del = XInternAtom( dpy, "_OL_DECOR_DEL", 0 ); atom_type = XInternAtom( dpy, "ATOM", 0 ); - XChangeProperty( dpy, mainW, ol_decor_del, atom_type, 32, PropModeReplace, - ( unsigned char* )&ol_decor_icon_name, 1 ); + XChangeProperty( dpy, mainW, ol_decor_del, atom_type, 32, PropModeReplace, ( unsigned char* )&ol_decor_icon_name, 1 ); /* * set up the GC's @@ -3423,8 +2352,7 @@ int CreateWindows( int argc, char** argv ) { keypad.pixmap = XCreatePixmap( dpy, mainW, width, height, depth ); if ( netbook ) { - int cut = - buttons[ BUTTON_MTH ].y - ( small_ascent + small_descent + 6 + 4 ); + int cut = buttons[ BUTTON_MTH ].y - ( small_ascent + small_descent + 6 + 4 ); CreateBackground( width / 2, height, width, height, &keypad ); DrawMore( KEYBOARD_OFFSET_Y, &keypad ); CreateBezel( &keypad ); @@ -3457,7 +2385,8 @@ int CreateWindows( int argc, char** argv ) { return 0; } -int key_event( int b, XEvent* xev ) { +int key_event( int b, XEvent* xev ) +{ int code; int i, r, c; @@ -3496,45 +2425,43 @@ int key_event( int b, XEvent* xev ) { return 0; } -void refresh_display( void ) { +void refresh_display( void ) +{ if ( !shm_flag ) return; if ( lcd.display_update & UPDATE_DISP ) { - XShmPutImage( dpy, lcd.win, lcd.gc, lcd.disp_image, 2 * display.offset, - 0, 5, 20, 262, + XShmPutImage( dpy, lcd.win, lcd.gc, lcd.disp_image, 2 * display.offset, 0, 5, 20, 262, ( unsigned int )( ( 2 * display.lines ) + 2 ), 0 ); } - if ( ( ( 2 * display.lines ) < 126 ) && - ( lcd.display_update & UPDATE_MENU ) ) { - XShmPutImage( dpy, lcd.win, lcd.gc, lcd.menu_image, 0, 0, 5, - ( int )( ( 2 * display.lines ) + 22 ), 262, + if ( ( ( 2 * display.lines ) < 126 ) && ( lcd.display_update & UPDATE_MENU ) ) { + XShmPutImage( dpy, lcd.win, lcd.gc, lcd.menu_image, 0, 0, 5, ( int )( ( 2 * display.lines ) + 22 ), 262, ( unsigned int )( 126 - ( 2 * display.lines ) ), 0 ); } lcd.display_update = 0; } -void redraw_display( void ) { +void redraw_display( void ) +{ XClearWindow( dpy, lcd.win ); memset( disp_buf, 0, sizeof( disp_buf ) ); memset( lcd_buffer, 0, sizeof( lcd_buffer ) ); x11_update_LCD(); } -void redraw_annunc( void ) { +void redraw_annunc( void ) +{ last_annunc_state = -1; x11_draw_annunc(); } -void DrawDisp( void ) { +void DrawDisp( void ) +{ if ( shm_flag ) { - XShmPutImage( dpy, lcd.win, lcd.gc, lcd.disp_image, 2 * display.offset, - 0, 5, 20, 262, + XShmPutImage( dpy, lcd.win, lcd.gc, lcd.disp_image, 2 * display.offset, 0, 5, 20, 262, ( unsigned int )( ( 2 * display.lines ) + 2 ), 0 ); if ( display.lines < 63 ) { - XShmPutImage( dpy, lcd.win, lcd.gc, lcd.menu_image, 0, - ( 2 * display.lines ) - 110, 5, - 22 + ( 2 * display.lines ), 262, + XShmPutImage( dpy, lcd.win, lcd.gc, lcd.menu_image, 0, ( 2 * display.lines ) - 110, 5, 22 + ( 2 * display.lines ), 262, ( unsigned int )( 126 - ( 2 * display.lines ) ), 0 ); } lcd.display_update = 0; @@ -3545,7 +2472,8 @@ void DrawDisp( void ) { redraw_annunc(); } -void get_Window_geometry_string( Window win, char* s, int allow_off_screen ) { +void get_Window_geometry_string( Window win, char* s, int allow_off_screen ) +{ XWindowAttributes xwa; Window root, parent, window; Window* children = ( Window* )0; @@ -3591,11 +2519,11 @@ void get_Window_geometry_string( Window win, char* s, int allow_off_screen ) { } XGetWindowAttributes( dpy, win, &xwa ); - sprintf( s, "%ux%u%s%d%s%d", xwa.width, xwa.height, ( x_s > 0 ) ? "+" : "-", - x, ( y_s > 0 ) ? "+" : "-", y ); + sprintf( s, "%ux%u%s%d%s%d", xwa.width, xwa.height, ( x_s > 0 ) ? "+" : "-", x, ( y_s > 0 ) ? "+" : "-", y ); } -void save_options( int argc, char** argv ) { +void save_options( int argc, char** argv ) +{ int l; saved_argc = argc; @@ -3616,7 +2544,8 @@ void save_options( int argc, char** argv ) { } } -void save_command_line( void ) { +void save_command_line( void ) +{ int wm_argc = 0; char** wm_argv = ( char** )malloc( ( saved_argc + 5 ) * sizeof( char* ) ); @@ -3630,7 +2559,8 @@ void save_command_line( void ) { XSetCommand( dpy, mainW, wm_argv, wm_argc ); } -int decode_key( XEvent* xev, KeySym sym, char* buf, int buflen ) { +int decode_key( XEvent* xev, KeySym sym, char* buf, int buflen ) +{ int wake = 0; if ( buflen == 1 ) @@ -3939,7 +2869,8 @@ int decode_key( XEvent* xev, KeySym sym, char* buf, int buflen ) { return wake; } -int x11_button_pressed( int b ) { +int x11_button_pressed( int b ) +{ int code; int i, r, c; @@ -3972,7 +2903,8 @@ int x11_button_pressed( int b ) { return 0; } -int x11_button_released( int b ) { +int x11_button_released( int b ) +{ int code; // Check not already released (not critical) @@ -3996,7 +2928,8 @@ int x11_button_released( int b ) { return 0; } -void button_release_all( void ) { +void button_release_all( void ) +{ for ( int b = FIRST_BUTTON; b <= LAST_BUTTON; b++ ) if ( buttons[ b ].pressed ) { int code = buttons[ b ].code; @@ -4014,7 +2947,8 @@ void button_release_all( void ) { } } -static inline void draw_nibble( int c, int r, int val ) { +static inline void draw_nibble( int c, int r, int val ) +{ int x, y; x = ( c * 8 ) + 5; @@ -4023,13 +2957,13 @@ static inline void draw_nibble( int c, int r, int val ) { y = ( r * 2 ) + 20; val &= 0x0f; if ( val != lcd_buffer[ r ][ c ] ) { - XCopyPlane( dpy, nibble_maps[ val ], lcd.win, lcd.gc, 0, 0, 8, 2, x, y, - 1 ); + XCopyPlane( dpy, nibble_maps[ val ], lcd.win, lcd.gc, 0, 0, 8, 2, x, y, 1 ); lcd_buffer[ r ][ c ] = val; } } -static inline void draw_row( long addr, int row ) { +static inline void draw_row( long addr, int row ) +{ int i, v; int line_length; @@ -4045,18 +2979,18 @@ static inline void draw_row( long addr, int row ) { } } -static inline void init_annunc( void ) { +static inline void init_annunc( void ) +{ for ( int i = 0; ann_tbl[ i ].bit; i++ ) - ann_tbl[ i ].pixmap = - XCreateBitmapFromData( dpy, lcd.win, ( char* )ann_tbl[ i ].bits, - ann_tbl[ i ].width, ann_tbl[ i ].height ); + ann_tbl[ i ].pixmap = XCreateBitmapFromData( dpy, lcd.win, ( char* )ann_tbl[ i ].bits, ann_tbl[ i ].width, ann_tbl[ i ].height ); } /**********/ /* public */ /**********/ -int x11_get_event( void ) { +int x11_get_event( void ) +{ XEvent xev; XClientMessageEvent* cm; int i, wake, bufs = 2; @@ -4174,8 +3108,7 @@ int x11_get_event( void ) { char c = *p++; switch ( c ) { case '.': - paste[ paste_size++ ] = - BUTTON_PERIOD; + paste[ paste_size++ ] = BUTTON_PERIOD; break; case '0': paste[ paste_size++ ] = BUTTON_0; @@ -4209,34 +3142,27 @@ int x11_get_event( void ) { break; case '\n': paste[ paste_size++ ] = BUTTON_SHR; - paste[ paste_size++ ] = - BUTTON_PERIOD; + paste[ paste_size++ ] = BUTTON_PERIOD; break; case '!': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_DEL; break; case '+': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; paste[ paste_size++ ] = BUTTON_PLUS; break; case '-': - paste[ paste_size++ ] = - BUTTON_ALPHA; - paste[ paste_size++ ] = - BUTTON_MINUS; + paste[ paste_size++ ] = BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_MINUS; break; case '*': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; paste[ paste_size++ ] = BUTTON_MUL; break; case '/': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; paste[ paste_size++ ] = BUTTON_DIV; break; case ' ': @@ -4252,19 +3178,14 @@ int x11_get_event( void ) { break; case '<': if ( x > 1 && *p == '<' ) { - paste[ paste_size++ ] = - BUTTON_SHL; - paste[ paste_size++ ] = - BUTTON_MINUS; + paste[ paste_size++ ] = BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_MINUS; x--; p++; } else { - paste[ paste_size++ ] = - BUTTON_ALPHA; - paste[ paste_size++ ] = - BUTTON_SHL; - paste[ paste_size++ ] = - BUTTON_2; + paste[ paste_size++ ] = BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_2; } break; case '{': @@ -4274,26 +3195,19 @@ int x11_get_event( void ) { case ')': case ']': case '}': - paste[ paste_size++ ] = - BUTTON_RIGHT; + paste[ paste_size++ ] = BUTTON_RIGHT; break; case '>': if ( x > 1 && *p == '>' ) { - paste[ paste_size++ ] = - BUTTON_RIGHT; - paste[ paste_size++ ] = - BUTTON_RIGHT; - paste[ paste_size++ ] = - BUTTON_RIGHT; + paste[ paste_size++ ] = BUTTON_RIGHT; + paste[ paste_size++ ] = BUTTON_RIGHT; + paste[ paste_size++ ] = BUTTON_RIGHT; x--; p++; } else { - paste[ paste_size++ ] = - BUTTON_ALPHA; - paste[ paste_size++ ] = - BUTTON_SHR; - paste[ paste_size++ ] = - BUTTON_2; + paste[ paste_size++ ] = BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_SHR; + paste[ paste_size++ ] = BUTTON_2; } break; case '#': @@ -4307,276 +3221,213 @@ int x11_get_event( void ) { case '"': if ( flag & 1 ) { flag &= ~1; - paste[ paste_size++ ] = - BUTTON_RIGHT; + paste[ paste_size++ ] = BUTTON_RIGHT; } else { flag |= 1; - paste[ paste_size++ ] = - BUTTON_SHR; - paste[ paste_size++ ] = - BUTTON_MINUS; + paste[ paste_size++ ] = BUTTON_SHR; + paste[ paste_size++ ] = BUTTON_MINUS; } break; case ':': if ( flag & 2 ) { flag &= ~2; - paste[ paste_size++ ] = - BUTTON_RIGHT; + paste[ paste_size++ ] = BUTTON_RIGHT; } else { flag |= 2; - paste[ paste_size++ ] = - BUTTON_SHR; - paste[ paste_size++ ] = - BUTTON_PLUS; + paste[ paste_size++ ] = BUTTON_SHR; + paste[ paste_size++ ] = BUTTON_PLUS; } break; case '\'': if ( flag & 4 ) { flag &= ~4; - paste[ paste_size++ ] = - BUTTON_RIGHT; + paste[ paste_size++ ] = BUTTON_RIGHT; } else { flag |= 4; - paste[ paste_size++ ] = - BUTTON_COLON; + paste[ paste_size++ ] = BUTTON_COLON; } break; case 'a': case 'A': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_A; break; case 'b': case 'B': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_B; break; case 'c': case 'C': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_C; break; case 'd': case 'D': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_D; break; case 'e': case 'E': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_E; break; case 'f': case 'F': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_F; break; case 'g': case 'G': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_MTH; break; case 'h': case 'H': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_PRG; break; case 'i': case 'I': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_CST; break; case 'j': case 'J': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_VAR; break; case 'k': case 'K': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_UP; break; case 'l': case 'L': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_NXT; break; case 'm': case 'M': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; - paste[ paste_size++ ] = - BUTTON_COLON; + paste[ paste_size++ ] = BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_COLON; break; case 'n': case 'N': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_STO; break; case 'o': case 'O': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_EVAL; break; case 'p': case 'P': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_LEFT; break; case 'q': case 'Q': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_DOWN; break; case 'r': case 'R': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; - paste[ paste_size++ ] = - BUTTON_RIGHT; + paste[ paste_size++ ] = BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_RIGHT; break; case 's': case 'S': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_SIN; break; case 't': case 'T': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_COS; break; case 'u': case 'U': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_TAN; break; case 'v': case 'V': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_SQRT; break; case 'w': case 'W': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; - paste[ paste_size++ ] = - BUTTON_POWER; + paste[ paste_size++ ] = BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_POWER; break; case 'x': case 'X': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_INV; break; case 'y': case 'Y': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_NEG; break; case 'z': case 'Z': - paste[ paste_size++ ] = - BUTTON_ALPHA; + paste[ paste_size++ ] = BUTTON_ALPHA; if ( islower( c ) ) - paste[ paste_size++ ] = - BUTTON_SHL; + paste[ paste_size++ ] = BUTTON_SHL; paste[ paste_size++ ] = BUTTON_EEX; break; default: @@ -4592,12 +3443,9 @@ int x11_get_event( void ) { } } } else { - if ( xev.xbutton.button == Button1 || - xev.xbutton.button == Button2 || - xev.xbutton.button == Button3 ) { + if ( xev.xbutton.button == Button1 || xev.xbutton.button == Button2 || xev.xbutton.button == Button3 ) { for ( i = FIRST_BUTTON; i <= LAST_BUTTON; i++ ) { - if ( xev.xbutton.subwindow == - buttons[ i ].xwin ) { + if ( xev.xbutton.subwindow == buttons[ i ].xwin ) { if ( buttons[ i ].pressed ) { if ( xev.xbutton.button == Button3 ) { x11_button_released( i ); @@ -4689,7 +3537,8 @@ int x11_get_event( void ) { return wake; } -void x11_adjust_contrast( void ) { +void x11_adjust_contrast( void ) +{ int gray = 0; int r = 0, g = 0, b = 0; unsigned long old; @@ -4714,8 +3563,7 @@ void x11_adjust_contrast( void ) { default: r = ( 0x13 - contrast ) * ( colors[ LCD ].r / 0x10 ); g = ( 0x13 - contrast ) * ( colors[ LCD ].g / 0x10 ); - b = 128 - - ( ( 0x13 - contrast ) * ( ( 128 - colors[ LCD ].b ) / 0x10 ) ); + b = 128 - ( ( 0x13 - contrast ) * ( ( 128 - colors[ LCD ].b ) / 0x10 ) ); colors[ PIXEL ].xcolor.red = r << 8; colors[ PIXEL ].xcolor.green = g << 8; colors[ PIXEL ].xcolor.blue = b << 8; @@ -4752,7 +3600,8 @@ void x11_adjust_contrast( void ) { } } -void x11_init_LCD( void ) { +void x11_init_LCD( void ) +{ display.on = ( int )( saturn.disp_io & 0x8 ) >> 3; display.disp_start = ( saturn.disp_addr & 0xffffe ); @@ -4763,14 +3612,11 @@ void x11_init_LCD( void ) { display.lines = 63; if ( display.offset > 3 ) - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset + 2 ) & 0xfff; else - display.nibs_per_line = - ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; + display.nibs_per_line = ( NIBBLES_PER_ROW + saturn.line_offset ) & 0xfff; - display.disp_end = - display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); + display.disp_end = display.disp_start + ( display.nibs_per_line * ( display.lines + 1 ) ); display.menu_start = saturn.menu_addr; display.menu_end = saturn.menu_addr + 0x110; @@ -4785,8 +3631,7 @@ void x11_init_LCD( void ) { /* init nibble_maps */ for ( int i = 0; i < 16; i++ ) - nibble_maps[ i ] = - XCreateBitmapFromData( dpy, lcd.win, ( char* )nibbles[ i ], 8, 2 ); + nibble_maps[ i ] = XCreateBitmapFromData( dpy, lcd.win, ( char* )nibbles[ i ], 8, 2 ); if ( !shm_flag ) return; @@ -4828,7 +3673,8 @@ void x11_init_LCD( void ) { } } -void x11_update_LCD( void ) { +void x11_update_LCD( void ) +{ int i, j; long addr; static int old_offset = -1; @@ -4855,8 +3701,7 @@ void x11_update_LCD( void ) { for ( j = 0; j < line_length; j++ ) { val = read_nibble( addr++ ); lcd.disp_image->data[ data_addr++ ] = nibble_bitmap[ val ]; - lcd.disp_image->data[ data_addr_2++ ] = - nibble_bitmap[ val ]; + lcd.disp_image->data[ data_addr_2++ ] = nibble_bitmap[ val ]; } addr += addr_pad; data_addr += line_pad; @@ -4865,19 +3710,13 @@ void x11_update_LCD( void ) { lcd.display_update |= UPDATE_DISP; } else { if ( display.offset != old_offset ) { - memset( - disp_buf, 0xf0, - ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); - memset( - lcd_buffer, 0xf0, - ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); + memset( disp_buf, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); + memset( lcd_buffer, 0xf0, ( size_t )( ( display.lines + 1 ) * NIBS_PER_BUFFER_ROW ) ); old_offset = display.offset; } if ( display.lines != old_lines ) { - memset( &disp_buf[ 56 ][ 0 ], 0xf0, - ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); - memset( &lcd_buffer[ 56 ][ 0 ], 0xf0, - ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); + memset( &disp_buf[ 56 ][ 0 ], 0xf0, ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); + memset( &lcd_buffer[ 56 ][ 0 ], 0xf0, ( size_t )( 8 * NIBS_PER_BUFFER_ROW ) ); old_lines = display.lines; } for ( i = 0; i <= display.lines; i++ ) { @@ -4894,10 +3733,8 @@ void x11_update_LCD( void ) { for ( ; i < DISP_ROWS; i++ ) { for ( j = 0; j < NIBBLES_PER_ROW; j++ ) { val = read_nibble( addr++ ); - lcd.menu_image->data[ data_addr++ ] = - nibble_bitmap[ val ]; - lcd.menu_image->data[ data_addr_2++ ] = - nibble_bitmap[ val ]; + lcd.menu_image->data[ data_addr++ ] = nibble_bitmap[ val ]; + lcd.menu_image->data[ data_addr_2++ ] = nibble_bitmap[ val ]; } data_addr += line_pad; data_addr_2 += line_pad; @@ -4912,12 +3749,8 @@ void x11_update_LCD( void ) { } } else { if ( shm_flag ) { - memset( lcd.disp_image->data, 0, - ( size_t )( lcd.disp_image->bytes_per_line * - lcd.disp_image->height ) ); - memset( lcd.menu_image->data, 0, - ( size_t )( lcd.menu_image->bytes_per_line * - lcd.menu_image->height ) ); + memset( lcd.disp_image->data, 0, ( size_t )( lcd.disp_image->bytes_per_line * lcd.disp_image->height ) ); + memset( lcd.menu_image->data, 0, ( size_t )( lcd.menu_image->bytes_per_line * lcd.menu_image->height ) ); lcd.display_update = UPDATE_DISP | UPDATE_MENU; } else { memset( disp_buf, 0xf0, sizeof( disp_buf ) ); @@ -4933,12 +3766,14 @@ void x11_update_LCD( void ) { refresh_display(); } -void x11_refresh_LCD( void ) { +void x11_refresh_LCD( void ) +{ if ( lcd.display_update ) refresh_display(); } -void x11_disp_draw_nibble( word_20 addr, word_4 val ) { +void x11_disp_draw_nibble( word_20 addr, word_4 val ) +{ long offset; int shm_addr; int x, y; @@ -4954,8 +3789,7 @@ void x11_disp_draw_nibble( word_20 addr, word_4 val ) { if ( shm_flag ) { shm_addr = ( 2 * y * lcd.disp_image->bytes_per_line ) + x; lcd.disp_image->data[ shm_addr ] = nibble_bitmap[ val ]; - lcd.disp_image->data[ shm_addr + lcd.disp_image->bytes_per_line ] = - nibble_bitmap[ val ]; + lcd.disp_image->data[ shm_addr + lcd.disp_image->bytes_per_line ] = nibble_bitmap[ val ]; lcd.display_update |= UPDATE_DISP; } else { if ( val != disp_buf[ y ][ x ] ) { @@ -4984,19 +3818,17 @@ void x11_disp_draw_nibble( word_20 addr, word_4 val ) { } } -void x11_menu_draw_nibble( word_20 addr, word_4 val ) { +void x11_menu_draw_nibble( word_20 addr, word_4 val ) +{ long offset; int shm_addr; int x, y; offset = ( addr - display.menu_start ); if ( shm_flag ) { - shm_addr = - 2 * ( offset / NIBBLES_PER_ROW ) * lcd.menu_image->bytes_per_line + - ( offset % NIBBLES_PER_ROW ); + shm_addr = 2 * ( offset / NIBBLES_PER_ROW ) * lcd.menu_image->bytes_per_line + ( offset % NIBBLES_PER_ROW ); lcd.menu_image->data[ shm_addr ] = nibble_bitmap[ val ]; - lcd.menu_image->data[ shm_addr + lcd.menu_image->bytes_per_line ] = - nibble_bitmap[ val ]; + lcd.menu_image->data[ shm_addr + lcd.menu_image->bytes_per_line ] = nibble_bitmap[ val ]; lcd.display_update |= UPDATE_MENU; } else { x = offset % NIBBLES_PER_ROW; @@ -5008,7 +3840,8 @@ void x11_menu_draw_nibble( word_20 addr, word_4 val ) { } } -void x11_draw_annunc( void ) { +void x11_draw_annunc( void ) +{ int val; val = display.annunc; @@ -5019,17 +3852,16 @@ void x11_draw_annunc( void ) { for ( int i = 0; ann_tbl[ i ].bit; i++ ) { if ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) - XCopyPlane( dpy, ann_tbl[ i ].pixmap, lcd.win, lcd.gc, 0, 0, - ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].x, + XCopyPlane( dpy, ann_tbl[ i ].pixmap, lcd.win, lcd.gc, 0, 0, ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].x, ann_tbl[ i ].y, 1 ); else - XClearArea( dpy, lcd.win, ann_tbl[ i ].x, ann_tbl[ i ].y, - ann_tbl[ i ].width, ann_tbl[ i ].height, False ); + XClearArea( dpy, lcd.win, ann_tbl[ i ].x, ann_tbl[ i ].y, ann_tbl[ i ].width, ann_tbl[ i ].height, False ); } refresh_icon(); } -void init_x11_ui( int argc, char** argv ) { +void init_x11_ui( int argc, char** argv ) +{ /* * save command line options */