X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_head.c;h=d337d6b7fe22cc0831c4af12291cd39b1b380538;hb=69116cfff2e915ad9d2f95268432fe4bd0e007d9;hp=7f46743e44644c2f9fb9d722358f8b72c9f6620b;hpb=4293b0d061a726cba49d65a75b53de1f3617ffc5;p=16.git diff --git a/src/lib/16_head.c b/src/lib/16_head.c index 7f46743e..d337d6b7 100755 --- a/src/lib/16_head.c +++ b/src/lib/16_head.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * Copyright (C) 2012-2019 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -22,6 +22,15 @@ #include "src/lib/16_head.h" +//cpu reg stuff for _AX, _BX, _CX, _DX +#ifdef __WATCOMC__ +union regs CPURegs; +#endif + +// big global status text buffer +char global_temp_status_text[512]; +char global_temp_status_text2[512]; + long int filesize(FILE *fp) { @@ -34,6 +43,13 @@ filesize(FILE *fp) return(size_of_file); } +// clrstdin() clear any leftover chars tha may be in stdin stream // +void clrstdin() +{ + int ch = 0; + while( ( ch = getchar() ) != '\n' && ch != EOF ); +} + //from http://stackoverflow.com/questions/2736753/how-to-remove-extension-from-file-name // remove_ext: removes the "extension" from a file spec. // mystr is the string to process. @@ -49,10 +65,9 @@ char *remove_ext (char* mystr, char dot, char sep) { char *retstr, *lastdot, *lastsep; // Error checks and allocate string. - if (mystr == NULL) return NULL; - if ((retstr = malloc (strlen (mystr) + 1)) == NULL) + if ((retstr = malloc(strlen (mystr) + 1)) == NULL) return NULL; // Make a copy and find the relevant characters. @@ -80,10 +95,11 @@ char *remove_ext (char* mystr, char dot, char sep) { } // Return the modified string. - + free(mystr); return retstr; } + //from http://quiz.geeksforgeeks.org/c-program-cyclically-rotate-array-one/ void rotateR(byte *arr, byte n) { @@ -146,7 +162,7 @@ US_CheckParm(char *parm,char **strings) return(-1); } - +// for input test // byte dirchar(byte in) { byte out; @@ -170,3 +186,172 @@ byte dirchar(byte in) } return out; } + +//from: http://stackoverflow.com/questions/5349896/print-a-struct-in-c +void print_mem(void const *vp, size_t n) +{ + size_t i; + unsigned char const *p = vp; + for (i=0; i>8), BYTE_TO_BINARY(_cflag)); +#else +// printf(" ip=%04x\n\n", _IP); +// 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: %016x\n",(_cflag)); + printf(" ahl=%016x", _al|(_ah<<4)); +#endif + printf("testing\n"); +// printf("dx: "NIBBLE_TO_BINARY_PATTERN""NIBBLE_TO_BINARY_PATTERN"\n", NIBBLE_TO_BINARY(_dx>>4), NIBBLE_TO_BINARY(_dx)); +// printf("dx: "BYTE_TO_BINARY_PATTERN""BYTE_TO_BINARY_PATTERN"\n", BYTE_TO_BINARY(_dx>>8), BYTE_TO_BINARY(_dx)); + printf("dx: "WORD_TO_BINARY_PATTERN"\n", WORD_TO_BINARY(_dx)); + printf(" ---------------------------------------\n"); +#endif +#endif + + printf("for more info see\n http://stackoverflow.com/questions/9130349/how-many-registers-are-there-in-8086-8088\n"); + printf("================================================================================"); +}