TINY11E Development

We document here our implementation for TINY Version 1.1.

We were already close to integration, as noted in our section on assemblers. MASM macros were invaluable; the (case sensitive) input, print and sval routines served perfectly. The sval routine converts a "signed string" such as 42 or -21 to an integer. Of course, Jack wrote the original code with the aim of assembly in mind, so the development was straightforward. The integration required only about 25 lines of new code.

TINY11E takes as input a file named src.txt and outputs temp.asm. Afterwards, the latter must be assembled and the resulting object file linked. The complete compilation is directed by this short batch file (named TINY11Ebatch.bat):

TINY11E
\masm32\bin\ml /c /Zd /coff temp.asm
\masm32\bin\Link /SUBSYSTEM:CONSOLE temp.obj 
temp

We made the development easier by running the batch file from an application designed to edit TINY11E source files. The TSynEdit editor is linked to a TSynAnySyn syntax highlighter. When the Markup property is False, keywords are highlighted appropriately. This code executes TINY11Ebatch.bat:

procedure TfrmEdit.Execute(Sender: TObject);
var
  Proc : TProcess;
begin
  Synedit1.Lines.SaveToFile(ExtractFilePath(Application.ExeName) + 'src.txt');
  Proc := TProcess.Create(nil);
  try
    Proc.CommandLine := 'TINY11Ebatch.bat';
    PRoc.Options := Proc.Options + [poWaitOnExit];
    PRoc.Execute;
  finally
    Proc.free;
  end;
end;
The following screenshots show the editor and the result of compiling the source file and running the resulting executable, temp.exe. The sample TINY program uses all of its keywords and contains nested constructs. (We set a maximum limit on the integer you can input to find its factorial because factorials of higher integers give an overflow error during multiplication. Additional code in the PopMul procedure reports an overflow error.
TINY IDE

TINY IDE

 
Execution

Execution

See on the next page the complete code of TINY11E, with the changes for MASM integration commented conspicuously.

Programming - a skill for life!

by PPS in association with Jack Crenshaw