X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_head.c;h=d337d6b7fe22cc0831c4af12291cd39b1b380538;hb=69116cfff2e915ad9d2f95268432fe4bd0e007d9;hp=b371d10907ca3c7d8f2ec4cc20fb71a0489d4d3f;hpb=e646dd0bd9df6a064b2c7192eb675c2a4191c3b8;p=16.git diff --git a/src/lib/16_head.c b/src/lib/16_head.c index b371d109..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,11 @@ #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]; @@ -210,3 +215,143 @@ void hres (void) int 10h } } + +//#define REGIDUMP_HEX +#define REGIDUMP_DUMPFLAGS +//#define REGIDUMP_USE_CAPS //uncomment to use the assembly +//regester dump~ +void regidump() +{ + //GENERAL PURPOSE + unsigned short _ax,_bx,_cx,_dx; +#ifndef __BORLANDC__ + unsigned short _cflag; +#endif + unsigned char _al,_ah,_bl,_bh,_cl,_ch,_dl,_dh; + + unsigned short _bp,_si,_di,_sp; + + unsigned short _cs_,_ds_,_es_,_ss_; //SEGMENT +// unsigned short _ip; //SPECIAL PURPOSE + _ax=_bx=_cx=_dx=_si=_di=_bp=_sp=_cs_=_ds_=_es_=_ss_=0; +#ifndef __BORLANDC__ + _cflag=0; +#endif + _ah=_al=_bh=_bl=_ch=_cl=_dh=_dl=0; + +#ifndef REGIDUMP_USE_CAPS + __asm { + mov _ax,ax + mov _bx,bx + mov _cx,cx + mov _dx,dx + + mov _si,si + mov _di,di + + /*mov _ip,ip + + mov _cf,cf + mov _pf,pf + mov _af,af + mov _zf,zf + mov _sf,sf + mov _tf,tf + mov _if,if + mov _df,df + mov _of,of*/ + mov _ah,ah + mov _al,al + mov _bh,bh + mov _bl,bl + mov _ch,ch + mov _cl,cl + mov _dh,dh + mov _dl,dl + } +#else +_ax=_AX; +_bx=_BX; +_cx=_CX; +_dx=_DX; + +_si=_SI; +_di=_DI; + +_ah=_AH; +_al=_AL; +_bh=_BH; +_bl=_BL; +_ch=_CH; +_cl=_CL; +_dh=_DH; +_dl=_DL; +#endif +#ifndef __BORLANDC__ + _cflag=_CFLAG; +#endif + __asm { + mov _bp,bp + mov _sp,sp + + mov _cs_,cs + mov _ds_,ds + mov _es_,es + mov _ss_,ss + } +// printf("integer values: ax=%04d bx=%04d cx=%04d dx=%04d\n", a, b, c, d); +// printf("unsigned values:ax=%04u bx=%04u cx=%04u dx=%04u\n", a, b, c, d); + printf("================================================================================"); + printf("16 bit 8088 register values\n"); + printf("================================================================================"); + printf("general purpose:\n"); +#ifndef REGIDUMP_HEX + printf(" ax=%04u\n bx=%04u\n cx=%04u\n dx=%04u\n\n", _ax, _bx, _cx, _dx); + printf(" si=%04u\n di=%04u\n bp=%04u\n sp=%04u\n", _si, _di, _bp, _sp); +#else + printf(" ax=%04x\n bx=%04x\n cx=%04x\n dx=%04x\n\n", _ax, _bx, _cx, _dx); + printf(" si=%04x\n di=%04x\n bp=%04x\n sp=%04x\n", _si, _di, _bp, _sp); +#endif + printf(" ---------------------------------------\n"); + + + + printf("segment:\n"); +#ifndef REGIDUMP_HEX + //printf(" cs=%04u\n ds=%04u\n es=%04u\n ss=%04u\n", _cs_, _ds, _es_, _ss_); + printf(" cs=%04u\n", _cs_); printf(" ds=%04u\n", _ds_); printf(" es=%04u\n", _es_); printf(" ss=%04u\n", _ss_); +#else + //printf(" cs=%04x\n ds=%04x\n es=%04x\n ss=%04x\n", _cs_, _ds_, _es_, _ss_); + printf(" cs=%04x\n", _cs_); printf(" ds=%04x\n", _ds_); printf(" es=%04x\n", _es_); printf(" ss=%04x\n", _ss_); +#endif + printf(" ---------------------------------------\n"); + + +#ifndef __BORLANDC__ + printf("cflags:\n"); +/* printf(" ip=%04u\n\n", _ip); + printf(" cf=%04u\npf=%04u\naf=%04u\nzf=%04u\nsf=%04u\ntf=%04u\nif=%04u\ndf=%04u\nof=%04u\n", _cf, _pf, _af, _zf, _sf, _tf, _if, _df, _of); + printf(" ---------------------------------------\n");*/ +#ifdef REGIDUMP_DUMPFLAGS +#ifndef REGIDUMP_HEX +// printf(" ip=%04u\n\n", _IP); +// printf(" cf=%04u\npf=%04u\naf=%04u\nzf=%04u\nsf=%04u\ntf=%04u\nif=%04u\ndf=%04u\nof=%04u\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)); +#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("================================================================================"); +}