Changeset 42 for branches/simple/Forms


Ignore:
Timestamp:
Sep 8, 2023, 11:20:27 PM (15 months ago)
Author:
chronos
Message:
  • Modified: Improved simple virtual machine.
Location:
branches/simple/Forms
Files:
11 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/simple/Forms/FormConsole.pas

    r41 r42  
    44
    55uses
    6   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
     6  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Device;
    77
    88type
     
    1010  { TFormConsole }
    1111
    12   TFormConsole = class(TForm)
     12  TFormConsole = class(TFormDevice)
    1313    Memo1: TMemo;
    1414  public
  • branches/simple/Forms/FormMain.pas

    r41 r42  
    4343{$R *.lfm}
    4444
     45uses
     46  Screen, Channel;
     47
    4548{ TFormMain }
    4649
     
    4952  FormScreen := TFormScreen.Create(nil);
    5053  FormConsole := TFormConsole.Create(nil);
    51   InitMachine16;
     54  InitMachine8;
    5255end;
    5356
     
    6669  FreeAndNil(FormScreen);
    6770  FreeAndNil(FormConsole);
    68   FreeAndNil(Machine8);
     71  if Assigned(Machine8) then FreeAndNil(Machine8);
     72  if Assigned(Machine16) then FreeAndNil(Machine16);
    6973end;
    7074
     
    8084    Console.OnWrite := FormConsole.ConsoleWrite;
    8185    Screen.OnChange := FormScreen.ScreenChange;
    82     FormScreen.Machine := Machine8;
     86    FormScreen.Screen := TScreen.Create(bw8, Machine8.Screen, nil);
    8387    with Memory do begin
    8488      // LD A8, 'A'
     
    9094      // LD A8, 'A'
    9195      WritePos8(Byte(inLoadImmediate8));
    92       WritePos8(Ord('H'));
    93       // OUT (0), A8
    94       WritePos8(Byte(inOutput8));
    95       WritePos8(1);
     96      WritePos8(Ord('B'));
    9697      // OUT (0), A8
    9798      WritePos8(Byte(inOutput8));
     
    110111    Console.OnWrite := FormConsole.ConsoleWrite;
    111112    Screen.OnChange := FormScreen.ScreenChange;
    112     FormScreen.Machine := Machine16;
     113    FormScreen.Screen := TScreen.Create(bw16, nil, Machine16.Screen);
    113114    with Memory do begin
    114115      // LD A8, 'A'
     
    122123      WritePos16(Ord('H'));
    123124      // OUT8 (0), A8
    124       WritePos8(Byte(inOutput8));
     125      WritePos8(Byte(inOutput16));
    125126      WritePos16(1);
    126127      // HALT
  • branches/simple/Forms/FormScreen.pas

    r41 r42  
    44
    55uses
    6   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Machine;
     6  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Screen,
     7  Channel, Device;
    78
    89type
     
    1011  { TFormScreen }
    1112
    12   TFormScreen = class(TForm)
     13  TFormScreen = class(TFormDevice)
    1314    Image1: TImage;
    1415    TimerDraw: TTimer;
     
    1718    DrawPending: Boolean;
    1819  public
    19     Machine: TMachine;
     20    Screen: TScreen;
    2021    procedure ScreenChange(Sender: TObject);
    2122  end;
     
    3637  if DrawPending then begin
    3738    DrawPending := False;
    38     if Machine is TMachine16 then
    39     with TMachine16(Machine).Screen do begin
     39    if Screen.BitWidth = bw8 then
     40    with Screen.Screen8 do begin
    4041      Image1.Picture.Bitmap.SetSize(Width * CharSize, Height * CharSize);
    4142      Image1.Picture.Bitmap.Canvas.FillRect(0, 0, Image1.Picture.Bitmap.Width,
     
    4647            Chr(Memory.Read8(Y * Width + X)));
    4748    end else
    48     if Machine is TMachine8 then
    49     with TMachine8(Machine).Screen do begin
     49    if Screen.BitWidth = bw16 then
     50    with Screen.Screen16 do begin
    5051      Image1.Picture.Bitmap.SetSize(Width * CharSize, Height * CharSize);
    5152      Image1.Picture.Bitmap.Canvas.FillRect(0, 0, Image1.Picture.Bitmap.Width,
Note: See TracChangeset for help on using the changeset viewer.