Changeset 14 for trunk/Z80/Z80.pas
- Timestamp:
- Apr 21, 2026, 3:52:53 PM (6 days ago)
- File:
-
- 1 edited
-
trunk/Z80/Z80.pas (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Z80/Z80.pas
r13 r14 4 4 5 5 uses 6 Classes, SysUtils, MemoryTypes, Base, Z80Instructions, Generics.Collections,7 Generics. Defaults;6 Classes, SysUtils, SyncObjs, MemoryTypes, Base, Z80Instructions, 7 Generics.Collections, Generics.Defaults; 8 8 9 9 type … … 58 58 InstructionAddress: Word; 59 59 MessageText: string; 60 FEvent: TEvent; 61 FPaused: Boolean; 60 62 procedure Error(Message: string); 61 63 function GetCarry: Boolean; … … 65 67 procedure SetCarry(AValue: Boolean); 66 68 procedure SetParityOverflow(AValue: Boolean); 69 procedure SetPaused(AValue: Boolean); 67 70 procedure SetSignNegative(AValue: Boolean); 68 71 procedure SetZero(AValue: Boolean); … … 837 840 property SignNegative: Boolean read GetSignNegative write SetSignNegative; 838 841 property Thread: TCpuThread read FThread; 842 property Paused: Boolean read FPaused write SetPaused; 839 843 property Running: Boolean read FRunning write SetRunning; 840 844 property OnRead: TReadEvent read FOnRead write FOnRead; … … 856 860 begin 857 861 while not Terminated do begin 862 Cpu.FEvent.WaitFor(INFINITE); 858 863 Cpu.Step; 859 864 end; … … 900 905 end; 901 906 907 procedure TCpuZ80.SetPaused(AValue: Boolean); 908 begin 909 if not Running then Exit; 910 911 if FPaused = AValue then Exit; 912 if FPaused then begin 913 FPaused := False; 914 FEvent.SetEvent; 915 end; 916 FPaused := AValue; 917 if FPaused then begin 918 FPaused := True; 919 FEvent.ResetEvent; 920 end; 921 end; 922 902 923 procedure TCpuZ80.SetSignNegative(AValue: Boolean); 903 924 begin … … 912 933 procedure TCpuZ80.SetRunning(AValue: Boolean); 913 934 begin 935 if FRunning and FPaused then Paused := False; 936 914 937 if FRunning = AValue then Exit; 915 938 if FRunning then begin 916 939 FThread.Terminate; 940 if FPaused then Paused := False; 917 941 FThread.WaitFor; 918 942 FreeAndNil(FThread); … … 5497 5521 var 5498 5522 Opcode: Byte; 5499 Proc: T Event;5523 Proc: TBaseEvent; 5500 5524 begin 5501 5525 InstructionAddress := PC; … … 5537 5561 begin 5538 5562 PC := 0; 5563 SP := 0; 5564 IX := 0; 5565 IY := 0; 5539 5566 AF.Value := 0; 5540 5567 BC.Value := 0; 5541 5568 DE.Value := 0; 5542 5569 HL.Value := 0; 5543 SP := 0;5544 5570 InterruptEnabled := True; 5545 5571 InterruptMode := 0; … … 5549 5575 constructor TCpuZ80.Create; 5550 5576 begin 5577 FRunning := False; 5578 FPaused := False; 5579 FEvent := TEvent.Create(nil, True, True, ''); 5551 5580 InitInstructions; 5552 5581 Reset; … … 5556 5585 begin 5557 5586 Running := False; 5587 FreeAndNil(FEvent); 5558 5588 inherited; 5559 5589 end;
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/mzxemu/chrome/site/your_project_logo.png)