📄 dbgzmtyp.pas
字号:
unit DbgZmTypy;
interface
uses WinTypes, WinProcs, WinDos, Objects, Strings, BWCC;
const
Wersja='1.9 beta';
Rejestry:array[0..27] of string[8]=( {adres,zawartosc,nazwa}
'D000PSW','E000ACC','F000B','8107SP','8300DPH','8200DPL','80FFP0','90FFP1','A0FFP2','B0FFP3',
'B800IPC','A800IEC','8900TMOD','8800TCON','8C00TH0','8A00TL0','8D00TH1','8B00TL1','9800SCON',
'9900SBUF','0000R0','0100R1','0200R2','0300R3','0400R4','0500R5','0600R6','0700R7');
RejBity:array[0..39] of string[6]=( {adres,nrbitu,nazwa}
'880IT0','881IE0','882IT1','883IE1','884TR0','885TF0','886TR1','887TF1',
'980RI','981TI','982RB8','983TB8','984REN','985SM2','986SM1','987SM0',
'A80EX0','A81ET0','A82EX1','A83ET1','A84ES','A85-','A86-','A87EA',
'B80PX0','B81PT0','B82PX1','B83PT1','B84PS','B85-','B86-','B87-',
'D00P','D01-','D02OV','D03RS0','D04RS1','D05F0','D06AC','D07CY');
RejBityA:array[0..4] of byte=($88,$98,$A8,$B8,$D0);
Maski:array[0..7] of byte=(1,2,4,8,16,32,64,128);
us_PierwszyTypOkna=150;
us_OstatniTypOkna=160;
us_OknoNr0=175;
us_PlikNr1=120;
us_ZmienRozmiary=984;
us_OdebranoZnak=985;
us_SkoczDoPC=986;
us_ZmienAktywnego=987;
us_ListaOkien=988;
us_PodajAdres1=989;
us_PodajAdres0=990;
us_ZmienPulapke=991;
us_OdnowCoTrzeba=992;
us_ZmianaAkt=993;
us_GetWinInfo=994;
us_PutWinInfo=995;
us_ZmianaJez=996;
us_OdnowWidok=997;
us_StopNow=998;
us_About=999;
type
String2=string[2];
String4=string[4];
PoAsm=string[6];
KodRozk=string[24];
TypFunName=function:PChar;
TypProcStop=procedure(i:THandle);
TypProcChange=function(i:THandle;o:HWnd;s1,s2,s3:word;apc:pointer):boolean;
TypProcUpdate=procedure;
PAdresy=^TAdresy;
TAdresy=array[1..20] of word;
PByteArr=^TByteArr;
TByteArr=array[0..65519] of byte;
PWordArr=^TWordArr;
TWordArr=array[0..32759] of word;
PLongArr=^TLongArr;
TLongArr=array[0..16379] of longint;
PCzcionkaInfo=^TCzcionkaInfo;
TCzcionkaInfo=record
fonts:PStrCollection;
bold:boolean;
numer,wielk:integer;
end;
var
OknoGlowne,Klient,OknoAktualne,OknoInstr,OknoTerm:HWnd;
MenuGlownePL,MenuGlowneEN,MenuStop:HMenu;
BlokPamROM,BlokPamRAM,BlokPamRAMInt:THandle;
selROM,selRAM,selRAMInt:word;
CzcionkaOEM:HFont;
FontOEMszer,FontOEMwys,RamkaSzer,RamkaWys,WindaSzer,WindaWys:word;
SymbROM,SymbRAM,SymbReg,SymbBit,SymbBrk:PStrCollection;
intflipflop,runprog,IleWtyczek:byte;
wynik:string[40];
wynik1,wynik2:string[10];
runto,RejPC:word;
codeconv:integer;
adrost,anim,aktual,jezykpl,bigmem:boolean;
poprz_int0,poprz_int1,poprz_t0,poprz_t1:boolean;
Wtyczki:array[0..31] of
record
h:THandle;
s:boolean;
end;
buforzn1,buforzn2:array[0..63] of char;
buford,buforzn3:array[0..15] of char;
licznikcykli,licznikcykliwewn:longint;
function Max(a,b:longint):longint;
function Min(a,b:longint):longint;
function GenPrzerwanie(j:word;pocichu:boolean):boolean;
function FunSymbol(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool; EXPORT;
function FunSymBit(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool; EXPORT;
function FunBajty(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool; EXPORT;
function FunOffset(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool; EXPORT;
function FunOffsetChg(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool; EXPORT;
function FunDialogu(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool; EXPORT;
function FunDlugosc(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool; EXPORT;
function FunFontSize(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool; EXPORT;
function BINtoW(co:string):word;
function WtoBIN(co:word):string;
function BtoHEX0(co:byte):String4;
function BtoHEX(co:byte):String2;
function WtoHEX(co:word):String4;
function HEXtoB(co:string):byte;
function HEXtoW(co:string):word;
function LoCaseStr(co:string):string;
function UpCaseStr(co:string):string;
function StrFunI(x:integer):string;
function StrFunW(x:word):string;
function ValFunI(txt:string):integer;
procedure AktualizujWtyczki(Okno:HWnd);
function Napis1(nr:word):PChar;
function Napis2(nr:word):PChar;
function Dial(nazwa:Pchar):PChar;
procedure DoWszystkich(typ,Kod_meldunku,wParam:word;LParam:longint);
procedure OdrysujWszystkie;
procedure OdrysujOkna(typ:word);
procedure OdrysujCoTrzeba;
function ZnajdzSymb(gdzie:PStrCollection;txtpocz:String4):integer;
procedure ListaOkien;
function PokazDialog(nazwa:Pchar;funkcja:TFarProc):integer;
function PokazDialogParam(nazwa:Pchar;funkcja:TFarProc;param:longint):integer;
function DialogSzer(x:word):word;
function DialogWys(y:word):word;
procedure WyliczCzcionkiF(gdzie:PStrCollection);
implementation
function Max(a,b:longint):longint;
begin
if a>b then Max:=a else Max:=b;
end;
function Min(a,b:longint):longint;
begin
if a<b then Min:=a else Min:=b;
end;
function GenPrzerwanie(j:word;pocichu:boolean):boolean; { false gdy sygn. b彻d, true gdy nie }
const
NazBit:array[0..4] of string[3]=('EX0','ET0','EX1','ET1','ES'); { przerwania: }
p:array[0..7] of byte=(1,2,1,3,2,2,3,3); { 0 - int0 }
var z,x,c,rejSP:byte; { 1 - timer0 }
n:array[0..39] of char; { 2 - int1 }
begin { 3 - timer1 }
GenPrzerwanie:=false; { 4 - TI }
z:=Mem[selRAMInt:$a8]; {IEC} { 5 - RI }
if (z and $80)=0 then
begin
if pocichu then Exit;
MessageBeep(mb_IconHand);
BWCCMessageBox(0,Napis1(10),Napis2(2),mb_OK or mb_TaskModal or mb_IconExclamation);
Exit;
end;
if j=5 then j:=4; { RI i TI to to samo }
if (z and Maski[j])=0 then
begin
if pocichu then Exit;
MessageBeep(mb_IconHand);
StrCopy(n,Napis1(11));
StrPCopy(@n[StrLen(n)],' (bit '+NazBit[j]+'=0)');
BWCCMessageBox(0,n,Napis2(2),mb_OK or mb_TaskModal or mb_IconExclamation);
Exit;
end;
x:=Mem[selRAMInt:$b8]; {IPC}
c:=p[intflipflop shl 1 +(x shr j) and 1];
if c=intflipflop then
begin
if pocichu then Exit;
MessageBeep(mb_IconHand);
BWCCMessageBox(0,Napis1(12),Napis2(2),mb_OK or mb_TaskModal or mb_IconExclamation);
Exit;
end;
intflipflop:=c;
rejSP:=Mem[selRAMInt:$81];
if bigmem and (rejSP>126) then Mem[selRAMInt:rejSP+129]:=Lo(RejPC) else
Mem[selRAMInt:rejSP+1]:=Lo(RejPC);
if bigmem and (rejSP>125) then Mem[selRAMInt:rejSP+130]:=Hi(RejPC) else
Mem[selRAMInt:rejSP+2]:=Hi(RejPC);
Mem[selRAMInt:$81]:=rejSP+2;
RejPC:=3+j*8;
if j=4 then Mem[selRAMInt:$98]:=Mem[selRAMInt:$98] or 2 else { TI=1 }
if j=5 then Mem[selRAMInt:$98]:=Mem[selRAMInt:$98] or 1; { RI=1 }
GenPrzerwanie:=true;
Inc(licznikcykli,2); { wywo砤nie przerwania }
Inc(licznikcykliwewn,2); { trwa 24 takty = 2 cykle }
if not pocichu then
begin
if OknoInstr<>0 then
SendMessage(GetWindow(OknoInstr,gw_Child),wm_Command,us_OdnowCoTrzeba,0);
OdrysujWszystkie;
end;
end;
function FunSymbol(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool;
var
R:TRect;
Bufor:array[0..40] of char;
begin
FunSymbol:=true;
case Kod_meldunku of
wm_InitDialog: begin
GetWindowRect(Dialog,R);
MoveWindow(Dialog,
(GetSystemMetrics(SM_CXSCREEN)-R.right+R.left) div 2,
(GetSystemMetrics(SM_CYSCREEN)-R.bottom+R.top) div 2,
R.right-R.left,R.bottom-R.top,false);
SetDlgItemText(Dialog,100,buforzn1);
SetDlgItemText(Dialog,101,buforzn2);
end;
wm_Command: case wParam of
1: begin
GetDlgItemText(Dialog,100,Bufor,40);
wynik:=StrPas(Bufor);
GetDlgItemText(Dialog,101,Bufor,10);
wynik1:=StrPas(Bufor);
EndDialog(Dialog,1);
end;
2: EndDialog(Dialog,2);
end;
else FunSymbol:=false;
end;
end;
function FunSymBit(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool;
var
R:TRect;
Bufor:array[0..40] of char;
begin
FunSymBit:=true;
case Kod_meldunku of
wm_InitDialog: begin
GetWindowRect(Dialog,R);
MoveWindow(Dialog,
(GetSystemMetrics(SM_CXSCREEN)-R.right+R.left) div 2,
(GetSystemMetrics(SM_CYSCREEN)-R.bottom+R.top) div 2,
R.right-R.left,R.bottom-R.top,false);
SetDlgItemText(Dialog,100,buforzn1);
SetDlgItemText(Dialog,101,buforzn2);
SetDlgItemText(Dialog,102,buforzn3);
end;
wm_Command: case wParam of
1: begin
GetDlgItemText(Dialog,100,Bufor,40);
wynik:=StrPas(Bufor);
GetDlgItemText(Dialog,101,Bufor,10);
wynik1:=StrPas(Bufor);
GetDlgItemText(Dialog,102,Bufor,10);
wynik2:=StrPas(Bufor);
EndDialog(Dialog,1);
end;
2: EndDialog(Dialog,2);
end;
else FunSymBit:=false;
end;
end;
function FunBajty(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool;
var
R:TRect;
Bufor:array[0..40] of char;
begin
FunBajty:=true;
case Kod_meldunku of
wm_InitDialog: begin
GetWindowRect(Dialog,R);
MoveWindow(Dialog,
(GetSystemMetrics(SM_CXSCREEN)-R.right+R.left) div 2,
(GetSystemMetrics(SM_CYSCREEN)-R.bottom+R.top) div 2,
R.right-R.left,R.bottom-R.top,false);
end;
wm_Command: case wParam of
1: begin
if GetDlgItemText(Dialog,100,Bufor,40)=0 then wynik:='' else
wynik:=StrPas(Bufor);
EndDialog(Dialog,1);
end;
2: EndDialog(Dialog,2);
end;
else FunBajty:=False;
end;
end;
function FunOffset(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool;
var
R:TRect;
Bufor:array[0..40] of char;
begin
FunOffset:=true;
case Kod_meldunku of
wm_InitDialog: begin
GetWindowRect(Dialog,R);
MoveWindow(Dialog,
(GetSystemMetrics(SM_CXSCREEN)-R.right+R.left) div 2,
(GetSystemMetrics(SM_CYSCREEN)-R.bottom+R.top) div 2,
R.right-R.left,R.bottom-R.top,false);
end;
wm_Command: case wParam of
1: begin
GetDlgItemText(Dialog,100,Bufor,40);
wynik:=StrPas(Bufor);
EndDialog(Dialog,1);
end;
2: EndDialog(Dialog,2);
end;
else FunOffset:=false;
end;
end;
function FunOffsetChg(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool;
var
R:TRect;
Bufor:array[0..40] of char;
begin
FunOffsetChg:=true;
case Kod_meldunku of
wm_InitDialog: begin
GetWindowRect(Dialog,R);
MoveWindow(Dialog,
(GetSystemMetrics(SM_CXSCREEN)-R.right+R.left) div 2,
(GetSystemMetrics(SM_CYSCREEN)-R.bottom+R.top) div 2,
R.right-R.left,R.bottom-R.top,false);
SetDlgItemText(Dialog,100,buforzn1);
end;
wm_Command: case wParam of
1: begin
GetDlgItemText(Dialog,100,Bufor,40);
wynik:=StrPas(Bufor);
EndDialog(Dialog,1);
end;
2: EndDialog(Dialog,2);
end;
else FunOffsetChg:=false;
end;
end;
function FunDialogu(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool;
var R:TRect;
begin
FunDialogu:=true;
case Kod_meldunku of
wm_InitDialog: begin
SetDlgItemText(Dialog,100,Wersja);
GetWindowRect(Dialog,R);
MoveWindow(Dialog,
(GetSystemMetrics(SM_CXSCREEN)-R.right+R.left) div 2,
(GetSystemMetrics(SM_CYSCREEN)-R.bottom+R.top) div 2,
R.right-R.left,R.bottom-R.top,false);
end;
wm_Command: if wParam=1 then EndDialog(Dialog,1);
else FunDialogu:=false;
end;
end;
function FunDlugosc(Dialog:HWnd;Kod_meldunku,WParam:Word;LParam:Longint):Bool;
var
R:TRect;
Bufor:array[0..30] of char;
begin
FunDlugosc:=true;
case Kod_meldunku of
wm_InitDialog: begin
GetWindowRect(Dialog,R);
MoveWindow(Dialog,
(GetSystemMetrics(SM_CXSCREEN)-R.right+R.left) div 2,
(GetSystemMetrics(SM_CYSCREEN)-R.bottom+R.top) div 2,
R.right-R.left,R.bottom-R.top,false);
end;
wm_Command: case wParam of
1: begin
GetDlgItemText(Dialog,100,Bufor,30);
wynik:=StrPas(Bufor);
if IsDlgButtonChecked(Dialog,101)=0 then
adrost:=true else adrost:=false;
EndDialog(Dialog,1);
end;
2: EndDialog(Dialog,2);
end;
else FunDlugosc:=false;
end;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -