From f888d29c0ceaa48568b15f3269df70e6498c9dbc Mon Sep 17 00:00:00 2001 From: sparky4 Date: Tue, 19 Jun 2018 10:36:56 -0500 Subject: [PATCH] removed some junk --- src/inputest.c | 4 -- src/lib/16_head.c | 1 + src/lib/16_head.h | 7 ++++ src/lib/16_tail.c | 98 ----------------------------------------------- src/lib/16_tail.h | 8 ---- src/lib/doslib | 2 +- 6 files changed, 9 insertions(+), 111 deletions(-) diff --git a/src/inputest.c b/src/inputest.c index 08c5745f..1bb0d78c 100755 --- a/src/inputest.c +++ b/src/inputest.c @@ -67,10 +67,6 @@ main(int argc, char *argv[]) gvar.player[0].enti.d=2; gvar.player[0].enti.spt=4; -// wordtest(); - bytetest(); -//0000 nibbletest(); -//0000 booleantest(); //printf("dbg_testkeyin=%u dbg_testcontrolnoisy=%u dbg_nogvar.playerinpu=%u\nloop if this is not responsive then please KILL or reset machine sorry!!\n", dbg_testkeyin, dbg_testcontrolnoisy, dbg_nogvar.playerinpu); while(!gvar.in.inst->Keyboard[sc_Escape]) { diff --git a/src/lib/16_head.c b/src/lib/16_head.c index e5ddd6dc..4e8d3335 100755 --- a/src/lib/16_head.c +++ b/src/lib/16_head.c @@ -324,6 +324,7 @@ _dl=_DL; // printf(" cf=%04x\npf=%04x\naf=%04x\nzf=%04x\nsf=%04x\ntf=%04x\nif=%04x\ndf=%04x\nof=%04x\n", _CF, _PF, _AF, _ZF, _SF, _TF, _IF, _DF, _OF); printf("cflag: "BYTE_TO_BINARY_PATTERN""BYTE_TO_BINARY_PATTERN"\n", BYTE_TO_BINARY(_cflag>>8), BYTE_TO_BINARY(_cflag)); // printf("cflag: %s\n",(_cflag)); + printf("dx: "NIBBLE_TO_BINARY_PATTERN""NIBBLE_TO_BINARY_PATTERN"\n", NIBBLE_TO_BINARY(_dx>>4), NIBBLE_TO_BINARY(_dx)); #endif printf("dx: "BYTE_TO_BINARY_PATTERN""BYTE_TO_BINARY_PATTERN"\n", BYTE_TO_BINARY(_dx>>8), BYTE_TO_BINARY(_dx)); printf(" ---------------------------------------\n"); diff --git a/src/lib/16_head.h b/src/lib/16_head.h index 0a71c965..888773b9 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -217,6 +217,13 @@ void regidump(); (byte & 0x02 ? '1' : '0'), \ (byte & 0x01 ? '1' : '0') +#define NIBBLE_TO_BINARY_PATTERN "%c%c%c%c" +#define NIBBLE_TO_BINARY(byte) \ + (byte & 0x08 ? '1' : '0'), \ + (byte & 0x04 ? '1' : '0'), \ + (byte & 0x02 ? '1' : '0'), \ + (byte & 0x01 ? '1' : '0') + #define PRINT_OPAQUE_STRUCT(p) print_mem((p), sizeof(*(p))) #endif/*__16_HEAD_H__*/ diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index d8f18b94..9cb0e769 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -792,101 +792,3 @@ void turboXT(byte bakapee) } } #endif - -//from https://stackoverflow.com/questions/18327439/printing-binary-representation-of-a-char-in-c -const char *word_to_binary(int x) -{ - static char b[17]; - int z; - - b[0] = '\0'; - for (z = 256; z > 0; z >>= 1) - { -/// printf(" z=%u b=%u x=%u\n", z, b, x); - strcat(b, ((x & z) == z) ? "1" : "0"); - } - return b; -} - -const char *byte_to_binary(int x) -{ - static char b[9]; - int z; - - b[0] = '\0'; - for (z = 128; z > 0; z >>= 1) - { - strcat(b, ((x & z) == z) ? "1" : "0"); - } - return b; -} - -const char *nibble_to_binary(int x) -{ - static char b[9]; - int z; - - b[0] = '\0'; - for (z = 8; z > 0; z >>= 1) - { - strcat(b, ((x & z) == z) ? "1" : "0"); - } - return b; -} - -const char *boolean_to_binary(int x) -{ - static char b[3]; - int z; - - b[0] = '\0'; - for (z = 1; z > 0; z >>= 1) - { - strcat(b, ((x & z) == z) ? "1" : "0"); - } - return b; -} - -void wordtest() -{ - word pee; - printf("wordtest\n"); - /* word to binary string */ - for(pee=0;pee<280;pee++) - printf(" %u %s\n", pee, word_to_binary(pee)); - printf(" sizeof(word)=%s\n", word_to_binary(sizeof(word))); - printf("end of word test\n"); -} - -void bytetest() -{ - byte pee; - printf("bytetest\n"); - /* byte to binary string */ - for(pee=0;pee<18;pee++) - printf(" %u %s\n", pee, byte_to_binary(pee)); - printf(" sizeof(byte)=%s\n", byte_to_binary(sizeof(byte))); - printf("end of byte test\n"); -} - -void nibbletest() -{ - nibble pee; - printf("nibbletest\n"); - /* nibble to binary string */ - for(pee=0;pee<18;pee++) - printf(" %u %s\n", pee, nibble_to_binary(pee)); - printf(" sizeof(nibble)=%s\n", nibble_to_binary(sizeof(nibble))); - printf("end of nibble test\n"); -} - -void booleantest() -{ - boolean pee; - printf("booleantest\n"); - /* boolean to binary string */ - for(pee=0;pee<4;pee++) - printf(" %u %s\n", pee, boolean_to_binary(pee)); - printf(" sizeof(boolean)=%s\n", boolean_to_binary(sizeof(boolean))); - printf("end of boolean test\n"); -} diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index 9d6555ad..f0fa97b9 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -141,13 +141,5 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q); void ClearMemory (global_game_variables_t *gvar); void Quit (global_game_variables_t *gvar, char *error); void turboXT(byte bakapee); -const char *word_to_binary(int x); -const char *byte_to_binary(int x); -const char *nibble_to_binary(int x); -const char *boolean_to_binary(int x); -void wordtest(); -void bytetest(); -void nibbletest(); -void booleantest(); #endif /*__16_TAIL__ */ diff --git a/src/lib/doslib b/src/lib/doslib index 9a52516a..1c553707 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit 9a52516ac236cb67e1a8f0d9b06bd3f2120a8311 +Subproject commit 1c553707ed78522d5252677f94ddfcc31866d88f -- 2.39.2