Skip to content

Commit

Permalink
modified: OrionZEm.dof
Browse files Browse the repository at this point in the history
	modified:   OrionZEm.exe
	modified:   OrionZEm.res
	modified:   mainwin.dfm
	modified:   mainwin.pas
	modified:   modOrion.pas
	modified:   modSD.pas
	modified:   modZ80.pas
  • Loading branch information
serge-404 committed Nov 23, 2017
1 parent 88859eb commit 6592e09
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 64 deletions.
4 changes: 2 additions & 2 deletions OrionZEm.dof
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ AutoIncBuild=1
MajorVer=1
MinorVer=0
Release=9
Build=8
Build=9
Debug=0
PreRelease=0
Special=0
Expand All @@ -72,7 +72,7 @@ CodePage=1251
[Version Info Keys]
CompanyName=
FileDescription=Homebrew computer Orion/Z (Orion-128 + Z80-CARD-II) emulator
FileVersion=1.0.9.8
FileVersion=1.0.9.9
InternalName=OrionZEmu
LegalCopyright=Copyright (c) 2016 Sergey A.
LegalTrademarks=
Expand Down
Binary file modified OrionZEm.exe
Binary file not shown.
16 changes: 8 additions & 8 deletions OrionZEm.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ MAXRECENT=8
KEYDELAY=0
RESTOREODI=1
ODI_DRIVEA=C:\ALTAIR8255.ODI
ODI_DRIVEB=C:\PASCALMT.ODI
ODI_DRIVEB=C:\BORLAND\DELPHI5\PROJECTS\WORK\_PASCAL\EP.ODI
AUTOSNAPSHOT=0
F600Plugin=
F600Function=-1
ScrZoom=1
ScrTop=123
ScrLeft=348
ScrTop=280
ScrLeft=572
USE_DPBLESS_DISKS=0

[HARDWARE]
ROMDISK=.\ROM\romdisk8.rom
ROMF800=.\ROM\M34zrk.bin
ROMF800=C:\Borland\Delphi5\Projects\OriZEmu\ROM\m34zrk.bin
CPUSPEEDMODE=2
Z80CARDMODE=2
KEYRUSLAT=120
Expand All @@ -24,15 +24,15 @@ KEYBTYPE=0
KEYEXTEND=1
HDDPort=2
HDDMaster=C:\tty-sd.OHI
HDDSlave=
HDDSlave=D:\ATM\ATM_HDD.HDD
HDDMasterRO=0
HDDSlaveRO=0
FDD_HD=1
PRO_ROM1=.\ROM\ROM1-321.BIN
PRO_ROM2=c:\Borland\Delphi5\Projects\OriZEmu\ROM\MakeProROM\ROM2-321-ALTAIR3.ROM
PRO_DIPSW=135
*PRO_DIPSW=197
SDcard=C:\hddpro.ohi
SDcard=c:\uzix.ohi
SDcardRO=0
SDScheme=1
ComPortName=CNCB0
Expand All @@ -44,7 +44,7 @@ MC146818DD=0
RTCMODE=0
PortFErom=1
MEMSIZEMODE=4
ProMaster=c:\uzix.ohi
ProMaster=
ProSlave=
ProMasterRO=0
ProSlaveRO=0
Expand Down Expand Up @@ -75,11 +75,11 @@ MAC4=82
MAC5=71

[RECENT]
C:\BORLAND\DELPHI5\PROJECTS\WORK\_PASCAL\EP.ODI
C:\ALTAIR8255.ODI
C:\TEMP\JAMES.ODI
C:\DISK2.ODI
C:\PASCALMT.ODI
C:\TURBOPRO.ODI
C:\BORLAND\DELPHI5\PROJECTS\WORK\FAT\RELEASE\ALTAIRDOS\MAN\ALTAIR8255.ODI
C:\BORLAND\DELPHI5\PROJECTS\WORK\FAT\RELEASE\ALTAIRDOS\MAN\ALTAIR-PRO.ODI
D:\_C\DISKS\DISK1.ODI
Binary file modified OrionZEm.res
Binary file not shown.
Binary file modified mainwin.dfm
Binary file not shown.
105 changes: 68 additions & 37 deletions mainwin.pas
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ TfrmMain = class(TForm)
F9SP1: TMenuItem;
F9PC1: TMenuItem;
F9Ix2: TMenuItem;
ItemWrPause: TMenuItem;
ItemModiPause: TMenuItem;
procedure FormDestroy(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure pbDrawPaint(Sender: TObject);
Expand Down Expand Up @@ -204,6 +206,7 @@ TfrmMain = class(TForm)
procedure cbConditionsClick(Sender: TObject);
procedure F9Click(Sender: TObject);
procedure btnPageAddressClick(Sender: TObject);
procedure ItemWrPauseClick(Sender: TObject);
private
{ Private declarations }
DisSL: TStringList;
Expand All @@ -227,7 +230,7 @@ TfrmMain = class(TForm)
procedure InitRAMArr;
procedure InitEmulator;
procedure InitSGRegPort;
procedure InitDezSL;
procedure InitDizSL;
procedure AppKeyDown(var msg : TMsg; var Handled: Boolean);
procedure MyIdleHandler(Sender: TObject; var Done: Boolean);
procedure SaveSnapshot(Pages: integer; FName: string);
Expand Down Expand Up @@ -720,6 +723,7 @@ procedure TfrmMain.FormActivate(Sender: TObject);
{}
InitEthernet();
{}
FillChar(CheckPort, sizeof(CheckPort), 0);
InitEmulator();
IniManager.RecentFilesMenuItem:=ItemRecent;
IniManager.OnRecentFilesItemClick:=ItemRecentClick;
Expand Down Expand Up @@ -854,6 +858,18 @@ procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
end;

procedure TfrmMain.InitSGRegPort;
procedure PortDumpTitles(SG:TStringGrid; offs:integer);
var ii:integer;
begin
for ii:=0 to 6 do with SG do
begin
Cells[0, ii] := IntToHex(offs+ii,2);
if CheckPort[offs+ii]=1 then
Cells[0,ii]:=Cells[0,ii]+' @'
else if CheckPort[offs+ii]=2 then
Cells[0,ii]:=Cells[0,ii]+' #';
end;
end;
begin
with SGFlags do
begin
Expand Down Expand Up @@ -883,36 +899,9 @@ procedure TfrmMain.InitSGRegPort;
Cells[0, 5] := 'IY'+ConditionIY;
Cells[0, 6] := 'IR'+ConditionIR;
end;
With SGPortDump do
begin
Cells[0, 0] := 'F8';
Cells[0, 1] := 'F9';
Cells[0, 2] := 'FA';
Cells[0, 3] := 'FB';
Cells[0, 4] := 'FC';
Cells[0, 5] := 'FE';
Cells[0, 6] := 'FF';
end;
With SGPort1Dump do
begin
Cells[0, 0] := '00';
Cells[0, 1] := '01';
Cells[0, 2] := '02';
Cells[0, 3] := '03';
Cells[0, 4] := '04';
Cells[0, 5] := '05';
Cells[0, 6] := '06';
end;
With SGPort2Dump do
begin
Cells[0, 0] := '07';
Cells[0, 1] := '08';
Cells[0, 2] := '09';
Cells[0, 3] := '0A';
Cells[0, 4] := '0B';
Cells[0, 5] := '0C';
Cells[0, 6] := '0D';
end;
PortDumpTitles(SGPortDump,$F8);
PortDumpTitles(SGPort1Dump,0);
PortDumpTitles(SGPort2Dump,7);
end;

procedure TfrmMain.ShowSGReg;
Expand Down Expand Up @@ -959,8 +948,10 @@ procedure TfrmMain.ShowSGReg;
end;
With SGHistory do
begin
Cells[0, 0]:=Cells[0, 1];
Cells[1, 0]:=Cells[1, 1];
deltaPC:=Disasm(prevPC, DisStr)-prevPC;
Cells[0, 0]:=IntToHex(prevPC, 4)+' '+HexStr(prevPC, deltaPC);
Cells[1, 0]:=DisStr;

disPC:=RegPC;

deltaPC:=Disasm(disPC, DisStr)-disPC;
Expand Down Expand Up @@ -1503,7 +1494,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
InitRAMArr();
InitEmulator();
DisSL:=TStringList.Create;
InitDezSL();
InitDizSL();
Global_TStates := -glTstatesPerInterrupt;
end;

Expand All @@ -1519,7 +1510,7 @@ procedure TfrmMain.ActSettingsExecute(Sender: TObject);
end;
end;

procedure TfrmMain.InitDezSL;
procedure TfrmMain.InitDizSL;
var i: integer;
ss, sss: string;
begin
Expand Down Expand Up @@ -2047,8 +2038,6 @@ procedure TfrmMain.ActDbgExecute(Sender: TObject);
ShowSGReg;
ShowSGPort;
ShowMemDump(True);
SGHistory.Cells[0, 0]:=''; // why?
SGHistory.Cells[1, 0]:='';
end;

procedure TfrmMain.SetFormSize;
Expand Down Expand Up @@ -2276,6 +2265,8 @@ procedure TfrmMain.Savescreenpicture1Click(Sender: TObject);
procedure TfrmMain.DebuggerMenuPopup(Sender: TObject);
begin
ItemPause.Enabled:=not CPUPaused;
ItemWrPause.Enabled:=CPUPaused and (SGPortDump.Focused or SGPort1Dump.Focused or SGPort2Dump.Focused);
ItemModiPause.Enabled:=CPUPaused and (SGPortDump.Focused or SGPort1Dump.Focused or SGPort2Dump.Focused);
ItemModify.Enabled:=CPUPaused;
ItemSetCondition.Enabled:=CPUPaused and (not SGPortDump.Focused) and
(not SGPort1Dump.Focused) and (not SGPort2Dump.Focused);
Expand Down Expand Up @@ -2584,6 +2575,46 @@ procedure TfrmMain.MEDumpAddrChange(Sender: TObject);
ShowMemDump(True);
end;

procedure TfrmMain.ItemWrPauseClick(Sender: TObject);
procedure TriggerPortPause(SG: TStringGrid);
begin
with SG do begin
if Length(Cells[0,SG.Row])>3 then
Cells[0,SG.Row]:=copy(Cells[0,SG.Row],1,2)
else
if TMenuItem(Sender).tag=1 then
Cells[0,SG.Row]:=Cells[0,SG.Row]+' @'
else
Cells[0,SG.Row]:=Cells[0,SG.Row]+' #';
Update;
end;
end;
var PortOffset:integer;
begin
PortOffset:=-1;
if SGPortDump.Focused then
begin
PortOffset:=$F8+SGPortDump.Row;
TriggerPortPause(SGPortDump);
end
else if SGPort1Dump.Focused then
begin
PortOffset:=$00+SGPortDump.Row;
TriggerPortPause(SGPort1Dump);
end
else if SGPort2Dump.Focused then
begin
PortOffset:=$07+SGPortDump.Row;
TriggerPortPause(SGPort2Dump);
end;
if (PortOffset>=0) then begin
if CheckPort[Lo(PortOffset)]<>0 then
CheckPort[Lo(PortOffset)]:=0
else
CheckPort[Lo(PortOffset)]:=TMenuItem(Sender).tag;
end;
end;

initialization
FNE2kDevice:=nil;
GUIDList:=TStringList.Create;
Expand Down
41 changes: 24 additions & 17 deletions modOrion.pas
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ interface
OrionPRO_DIP_SW: integer;

MainPort: TMainPort;
CheckPort: TMainPort;

ScrWidth: integer = SCR_WIDTH_384; // 0=SCR_WIDTH_384, 1=SCR_WIDTH_400, 2=SCR_WIDTH_480, 3=SCR_WIDTH_512
ScrZoom: integer = SCR_ZOOM_X2; // 0=SCR_ZOOM_X1, 1=SCR_ZOOM_X2, 3=SCR_ZOOM_X25, 4=SCR_ZOOM_X3
Expand Down Expand Up @@ -341,6 +342,7 @@ interface
// Stack pointer and program counter
regSP: integer;
regPC: integer;
prevPC:integer;

// Interrupt registers and flip-flops, and refresh registers
intI: integer;
Expand Down Expand Up @@ -937,20 +939,22 @@ procedure RAMPORTSet(Index: Integer; const Value: byte);

procedure outb(port : integer; outbyte : integer);
var bb, pF9: byte;
dopause:boolean;
loport:integer;
begin
loport:=Lo(port);
if (Z80CardMode>=Z80CARD_MAXIMAL) then begin // Orion-PRO IDE-RTC card also available for advanced O-128 configuration
if (Z80CardMode>=Z80_ORIONPRO_v2) then begin // Orion-PRO
case Lo(Port) of
case LoPort of
$08: if outbyte>=RAMPagesCount then outbyte:=outbyte mod RAMPagesCount;
$10..$14: RAMPORTSet(FDC_ADDR1+Lo(Port), outbyte); // FDD
$18..$1B: RAMPORTSet(KBD_ADDR0+Lo(Port)-$18, outbyte); // BB55 (i8255) - keyboard
$28..$2B: RAMPORTSet(ROMD_ADDR0+Lo(Port)-$28, outbyte); // BB55 (i8255) - Rom-Disk
$10..$14: RAMPORTSet(FDC_ADDR1+LoPort, outbyte); // FDD
$18..$1B: RAMPORTSet(KBD_ADDR0+LoPort-$18, outbyte); // BB55 (i8255) - keyboard
$28..$2B: RAMPORTSet(ROMD_ADDR0+LoPort-$28, outbyte); // BB55 (i8255) - Rom-Disk
$3E: AYWriteReg(glSoundRegister, outbyte); // çàïèñü äàííûõ ìóç. ïðîöåññîðà
$3F: glSoundRegister := outbyte And $F; // çàïèñü íîìåðà ðåãèñòðà ìóç. ïðîöåññîðà
end;
end;
case Lo(Port) of
case LoPort of
FMC_DATA50: case RTCmode of
K512vi50: F146818[F146818.Addr]:=outbyte;
DS1307: ;
Expand All @@ -969,17 +973,16 @@ procedure outb(port : integer; outbyte : integer);
pro_cyl_msb, // st.bajt nom.cilindra - W // adr=5
pro_head, // registr golowki/ustrojstwa - W // adr=6
pro_command: // registr komand - W // adr=7
IdeProController.IdeReg[Lo(Port)]:=outbyte;
IdeProController.IdeReg[LoPort]:=outbyte;
end;
end
else if Z80CardMode=Z80CARD_MOSCOW then
begin
loport:=Lo(port);
if loport>=$F0 then pF9:=0
else pF9:=MainPort[$F9];
RAMArr[pF9, loport*256+loport] := outbyte; // â ñòàíäàðòíîì Îðèîíå ïîðòèòñÿ ÎÇÓ ïîä ïîðòàìè
end; // Orion-128, Orion-PRO
case Lo(Port) of
case LoPort of
$F8: begin
bb:=MainPort[$F8];
if bb<>outbyte then
Expand All @@ -1005,32 +1008,37 @@ procedure outb(port : integer; outbyte : integer);
end;
{$ENDIF}
end;
MainPort[Lo(Port)]:=outbyte;
dopause:=(CheckPort[LoPort]=1) or // port write
((CheckPort[LoPort]=2)and(MainPort[LoPort]<>outbyte)); // port modify
MainPort[LoPort]:=outbyte;
{$IFDEF USE_SOUND}
case port of
$FFFD: glSoundRegister := outbyte And $F;
$BFFD: AYWriteReg(glSoundRegister, outbyte);
$BEFD: AYWriteReg(glSoundRegister, outbyte);
end;
{$ENDIF}
if dopause then
frmMain.ActPauseExecute(frmMain);
End;

Function inb(port : integer) : integer;
var loport, pF9: integer;
begin
Result := $FF;
loport:=Lo(port);
if (Z80CardMode>=Z80CARD_MAXIMAL) then begin // Orion-PRO IDE-RTC card also available for advanced O-128 configuration
if Z80CardMode>=Z80_ORIONPRO_v2 then begin // Orion-PRO
case Lo(Port) of
case LoPort of
$0: Result:=lo(OrionPRO_DIP_SW);
$01..$0B: Result:=MainPort[Lo(Port)];
$10..$14: Result:=RAMPORTGet(FDC_ADDR1+Lo(Port)); // FDD
$18..$1B: Result:=RAMPORTGet(KBD_ADDR0+Lo(Port)); // BB55 (i8255) - keyboard
$28..$2B: Result:=RAMPORTGet(ROMD_ADDR0+Lo(Port)); // BB55 (i8255) - Rom-Disk
$01..$0B: Result:=MainPort[LoPort];
$10..$14: Result:=RAMPORTGet(FDC_ADDR1+LoPort); // FDD
$18..$1B: Result:=RAMPORTGet(KBD_ADDR0+LoPort); // BB55 (i8255) - keyboard
$28..$2B: Result:=RAMPORTGet(ROMD_ADDR0+LoPort); // BB55 (i8255) - Rom-Disk
$3F: Result := AYPSG.Regs[glSoundRegister]; // ÷òåíèå äàííûõ ìóç. ïðîöåññîðà
end;
end;
case Lo(Port) of
case LoPort of
FMC_DATA50: case RTCmode of
K512vi50: Result:=F146818[F146818.Addr];
DS1307: ;
Expand All @@ -1049,12 +1057,11 @@ procedure outb(port : integer; outbyte : integer);
pro_cyl_msb, // st.bajt nom.cilindra - W // adr=5
pro_head, // registr golowki/ustrojstwa - W // adr=6
pro_status: // registr sostoqniq - R // adr=7
Result:=IdeProController.IdeReg[Lo(Port)];
Result:=IdeProController.IdeReg[LoPort];
end;
end
else if Z80CardMode=Z80CARD_MOSCOW then
begin
loport:=Lo(port);
if loport>=$F0 then pF9:=0
else pF9:=MainPort[$F9];
Result:=RAMArr[pF9, loport*256+loport]; // â ñòàíäàðòíîì Îðèîíå ïîðòèòñÿ ÎÇÓ ïîä ïîðòàìè
Expand Down
Loading

0 comments on commit 6592e09

Please sign in to comment.