Ignore:
Timestamp:
May 1, 2019, 9:48:46 PM (6 years ago)
Author:
chronos
Message:
  • Added: Assembler labels reference address calculation.
  • Fixed: Displaying address/data hex numbers in opcode and instruction.
Location:
branches/virtualcpu4/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/virtualcpu4/Forms/UFormAssembler.lfm

    r184 r185  
    11object FormAssembler: TFormAssembler
    22  Left = 474
    3   Height = 540
     3  Height = 648
    44  Top = 313
    5   Width = 705
     5  Width = 846
    66  Caption = 'Assembler'
    7   ClientHeight = 540
    8   ClientWidth = 705
    9   DesignTimePPI = 120
     7  ClientHeight = 648
     8  ClientWidth = 846
     9  DesignTimePPI = 144
    1010  OnCreate = FormCreate
    1111  OnDestroy = FormDestroy
    12   LCLVersion = '2.0.2.0'
     12  LCLVersion = '2.0.0.4'
    1313  object MemoSource: TMemo
    14     Left = 8
    15     Height = 383
    16     Top = 8
    17     Width = 691
     14    Left = 10
     15    Height = 459
     16    Top = 10
     17    Width = 829
    1818    Anchors = [akTop, akLeft, akRight, akBottom]
    1919    Lines.Strings = (
    20       'LD R1, R2'
    21       'LDI R1, 10'
     20      '  // Print Hello world text'
     21      '  LDI R1, HelloWorld'
     22      '  LDI R2, 13'
     23      '  CALL Print'
     24      '  HALT'
     25      ''
     26      'Print:'
     27      '  PUSH R3'
     28      '  PUSH R2'
     29      '  PUSH R1'
     30      'PrintLoop:'
     31      '  DP8 ;LDM R3, R1'
     32      '  AP8; DP8; OUT (0), R3'
     33      '  INC R1'
     34      '  DEC R2'
     35      '  TEST R2'
     36      '  AP8; JRNZ PrintLoop'
     37      '  POP R1'
     38      '  POP R2'
     39      '  POP R3'
     40      '  RET'
     41      'HelloWorld:'
     42      '  STRING ''Hello_World!'''
    2243    )
     44    ParentFont = False
    2345    ScrollBars = ssAutoBoth
    2446    TabOrder = 0
    2547  end
    2648  object ButtonLoadFromFile: TButton
    27     Left = 8
    28     Height = 31
    29     Top = 502
    30     Width = 136
     49    Left = 10
     50    Height = 37
     51    Top = 603
     52    Width = 163
    3153    Anchors = [akLeft, akBottom]
    3254    Caption = 'Load from file'
    3355    OnClick = ButtonLoadFromFileClick
     56    ParentFont = False
    3457    TabOrder = 1
    3558  end
    3659  object ButtonSaveToFile: TButton
    37     Left = 160
    38     Height = 31
    39     Top = 502
    40     Width = 128
     60    Left = 192
     61    Height = 37
     62    Top = 603
     63    Width = 154
    4164    Anchors = [akLeft, akBottom]
    4265    Caption = 'Save to file'
    4366    OnClick = ButtonSaveToFileClick
     67    ParentFont = False
    4468    TabOrder = 2
    4569  end
    4670  object ButtonCompile: TButton
    47     Left = 297
    48     Height = 31
    49     Top = 502
    50     Width = 126
     71    Left = 356
     72    Height = 37
     73    Top = 603
     74    Width = 151
    5175    Anchors = [akLeft, akBottom]
    5276    Caption = 'Compile'
    5377    OnClick = ButtonCompileClick
     78    ParentFont = False
    5479    TabOrder = 3
    5580  end
    5681  object MemoMessages: TMemo
    57     Left = 8
    58     Height = 97
    59     Top = 402
    60     Width = 689
     82    Left = 10
     83    Height = 116
     84    Top = 483
     85    Width = 826
    6186    Anchors = [akLeft, akRight, akBottom]
     87    ParentFont = False
    6288    ReadOnly = True
    6389    ScrollBars = ssAutoBoth
     
    6591  end
    6692  object OpenDialog1: TOpenDialog
    67     left = 114
    68     top = 152
     93    left = 137
     94    top = 182
    6995  end
    7096  object SaveDialog1: TSaveDialog
    71     left = 379
    72     top = 152
     97    left = 455
     98    top = 182
    7399  end
    74100end
  • branches/virtualcpu4/Forms/UFormMain.lfm

    r184 r185  
    11object FormMain: TFormMain
    22  Left = 780
    3   Height = 224
     3  Height = 269
    44  Top = 527
    5   Width = 549
     5  Width = 659
    66  Caption = 'VirtCpu4'
    7   ClientHeight = 224
    8   ClientWidth = 549
    9   DesignTimePPI = 120
     7  ClientHeight = 269
     8  ClientWidth = 659
     9  DesignTimePPI = 144
    1010  OnCreate = FormCreate
    1111  OnDestroy = FormDestroy
    1212  OnShow = FormShow
    13   LCLVersion = '2.0.2.0'
     13  LCLVersion = '2.0.0.4'
    1414  object ButtonStart: TButton
    15     Left = 191
    16     Height = 31
    17     Top = 14
    18     Width = 94
     15    Left = 229
     16    Height = 37
     17    Top = 17
     18    Width = 113
    1919    Caption = 'Start'
    2020    OnClick = ButtonStartClick
     
    2323  end
    2424  object ButtonStop: TButton
    25     Left = 191
    26     Height = 31
    27     Top = 54
    28     Width = 94
     25    Left = 229
     26    Height = 37
     27    Top = 65
     28    Width = 113
    2929    Caption = 'Stop'
    3030    OnClick = ButtonStopClick
     
    3333  end
    3434  object ButtonDisassembler: TButton
    35     Left = 309
    36     Height = 32
    37     Top = 14
    38     Width = 154
     35    Left = 371
     36    Height = 38
     37    Top = 17
     38    Width = 185
    3939    Caption = 'Disassembler'
    4040    OnClick = ButtonDisassemblerClick
     
    4343  end
    4444  object ButtonMemory: TButton
    45     Left = 309
    46     Height = 32
    47     Top = 53
    48     Width = 154
     45    Left = 371
     46    Height = 38
     47    Top = 64
     48    Width = 185
    4949    Caption = 'Memory'
    5050    OnClick = ButtonMemoryClick
     
    5353  end
    5454  object ButtonCpuState: TButton
    55     Left = 309
    56     Height = 32
    57     Top = 92
    58     Width = 154
     55    Left = 371
     56    Height = 38
     57    Top = 110
     58    Width = 185
    5959    Caption = 'CPU state'
    6060    OnClick = ButtonCpuStateClick
     
    6363  end
    6464  object ButtonScreen: TButton
    65     Left = 20
    66     Height = 32
    67     Top = 13
    68     Width = 154
     65    Left = 24
     66    Height = 38
     67    Top = 16
     68    Width = 185
    6969    Caption = 'Screen'
    7070    OnClick = ButtonScreenClick
     
    7373  end
    7474  object ButtonConsole: TButton
    75     Left = 20
    76     Height = 32
    77     Top = 53
    78     Width = 154
     75    Left = 24
     76    Height = 38
     77    Top = 64
     78    Width = 185
    7979    Caption = 'Console'
    8080    OnClick = ButtonConsoleClick
     
    8383  end
    8484  object ButtonAssembler: TButton
    85     Left = 309
    86     Height = 32
    87     Top = 128
    88     Width = 154
     85    Left = 371
     86    Height = 38
     87    Top = 154
     88    Width = 185
    8989    Caption = 'Assembler'
    9090    OnClick = ButtonAssemblerClick
     
    9292    TabOrder = 7
    9393  end
     94  object ButtonClearMemory: TButton
     95    Left = 371
     96    Height = 38
     97    Top = 192
     98    Width = 185
     99    Caption = 'Clear memory'
     100    OnClick = ButtonClearMemoryClick
     101    ParentFont = False
     102    TabOrder = 8
     103  end
    94104end
  • branches/virtualcpu4/Forms/UFormMain.pas

    r184 r185  
    1515  TFormMain = class(TForm)
    1616    ButtonAssembler: TButton;
     17    ButtonClearMemory: TButton;
    1718    ButtonScreen: TButton;
    1819    ButtonDisassembler: TButton;
     
    2324    ButtonStop: TButton;
    2425    procedure ButtonAssemblerClick(Sender: TObject);
     26    procedure ButtonClearMemoryClick(Sender: TObject);
    2527    procedure ButtonConsoleClick(Sender: TObject);
    2628    procedure ButtonCpuStateClick(Sender: TObject);
     
    111113end;
    112114
     115procedure TFormMain.ButtonClearMemoryClick(Sender: TObject);
     116begin
     117  Machine.ClearMemory;
     118end;
     119
    113120procedure TFormMain.ButtonStopClick(Sender: TObject);
    114121begin
Note: See TracChangeset for help on using the changeset viewer.