Jump to content
IGNORED

Effectus - Action! cross-compiler using Mad-Assembler (MADS)


Gury

Recommended Posts

Here is my solution for Ubuntu Linux:

 

1. Go to the src/mads_mp/ and compile:

fpc -Mdelphi -vh -O3 mads.pas

fpc -Mdelphi -vh -O3 mp.pas

 

Move binary (mp, mads) to Effectus root folder.

 

2. In src/effectus/effectus.pas comment

  {*
  Writeln('Compiling to native code...');
  if Compile(FilenameSrc) then begin
    Writeln('Compile error!');
  end
  else begin
    Writeln('Compilation is successful!');
  end;
  if isInfo then ShellInfo;
  DestroyLists;
  *}

and compile it: fpc -Mdelphi -vh -O3 effectus.pas

Move effectus binary file to Effectus root folder.

 

3. Create bash file effectus.sh and make it executable (mod -x effectus.sh)

 

#!/bin/bash
export EFFECTUS_HOME="$HOME/Programs/Effectus"

if [ -z "$1" ]; then
  echo -e "\nPlease call '$0 <argument>' to run this command!\n"
  exit 1
fi

dir=$(pwd -P)

"${EFFECTUS_HOME}"/effectus $1

name=${1::-4}
filePAS="${name}.pas"
fileAsm="${name}.a65"


if [ -f $namePas ]; then
  [ ! -d "output" ] && mkdir output
  mv "${dir}/$filePAS" output/
  cd output
  "${EFFECTUS_HOME}"/mp $filePAS -o
else
  exit 1
fi

if [ -f $fileAsm ]; then
  "${EFFECTUS_HOME}"/mads $fileAsm -x -i:"${EFFECTUS_HOME}"/base -o:$name.xex
  cd ..
else
  exit 1
fi

if [ ! -z "$2" ]; then
  atari800 "${dir}"/output/$name.xex
fi

Set  $EFFECTUS_HOME to your proper location and save effectus.sh.

 

4. Add $EFFECTUS_HOME/effectus and $EFFECTUS_HOME/effectus.sh (as effectus-build) to your path:

 

~/bin$ ln -s  $EFFECTUS_HOME/effectus.sh effectus-build

~/bin$ ln -s  $EFFECTUS_HOME/effectus effectus

 

5. Now you can do this:

~$ effectus file.eff ---> compile to file.pas

~$ effectus-build file.eff --> create output directory with file.xex

~$ effectus-build file.eff run --> create output directory with file.xex and run with atari800

 

6. Enjoy :] Compilation for 64-bit Linux ready to download below.

 

Effectus-x64-Linux.zip

Edited by zbyti
  • Like 2
Link to comment
Share on other sites

Now i prepare some benchmarks for: Mad Pascal, Action!, Effectus with delivered MP&MADS and last MP&MADS builds from github.

 

1. SIEVE with SETBLOCK (and try variables on page zero)

2. Another SIEVE

3. CHESSBOARD

4. YOSHPLUS

 

Stay tuned :]

 

In the meantime, I simplified the build script for Linux.

 

#!/bin/bash
EFFECTUS_HOME="$HOME/Programs/Effectus"

if [ -z "$1" ]; then
  echo -e "\nPlease call '$0 <argument>' to run this command!\n"
  exit 1
fi

dir=$(pwd -P)

"${EFFECTUS_HOME}"/effectus $1

name=${1::-4}
filePAS="${name}.pas"
fileAsm="${name}.a65"


if [ -f $namePas ]; then
  [ ! -d "output" ] && mkdir output
  mv $filePAS output/
  cd output
  "${EFFECTUS_HOME}"/mp $filePAS -o
else
  exit 1
fi

if [ -f $fileAsm ]; then
  "${EFFECTUS_HOME}"/mads $fileAsm -x -i:"${EFFECTUS_HOME}"/base -o:$name.xex
  cd ..
else
  exit 1
fi

if [ ! -z "$2" ]; then
  atari800 output/$name.xex
fi

 

Edited by zbyti
new build script
  • Like 1
Link to comment
Share on other sites

Great work with script, zbyti. I suppose there were some troubles with the code in commented lines? I will look what can be done to fix this.

In meantime, I suggest you to uncomment last statement DestroyLists; because this command disposes all created string lists.

 

Edited by Gury
  • Like 1
Link to comment
Share on other sites

57 minutes ago, Gury said:

Great work with script, zbyti. I suppose there were some troubles with the code in commented lines? I will look what can be done to fix this.

In meantime, I suggest you to uncomment last statement DestroyLists; because this command dispose all created string lists.

 

OK. I uncomment DestroyLists and compile Effectus again.

 

I think the first problem is in shell.pas, here:

 

  AProcess.Executable := GetCurrentDir + PathDelim + 'mp';

  //  AProcess.Parameters.Add(AnsiQuotedStr(GetCurrentDir + '\bin\roto.pas', '"'));
  AProcess.Parameters.Add(AnsiQuotedStr(filename, '"'));

  //  if isMadPascal_o then AProcess.Parameters.Add('-o');
  //  if isMadPascal_d then AProcess.Parameters.Add('-d');
  //SetParams(AProcess, propMadPascal, propFlagMadPascal);

  AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes, poStdErrToOutPut];
  AProcess.Execute;

 

I fixed the last bug in the script:

#!/bin/bash
EFFECTUS_HOME="$HOME/Programs/Effectus"

if [ -z "$1" ]; then
  echo -e "\nPlease call '$0 <argument>' to run this command!\n"
  exit 1
fi

dir=$(pwd -P)

"${EFFECTUS_HOME}"/effectus $1

name=${1::-4}
filePAS="${name}.pas"
fileAsm="${name}.a65"


if [ -f $filePAS ]; then
  [ ! -d "output" ] && mkdir output
  mv $filePAS output/
  cd output
  "${EFFECTUS_HOME}"/mp $filePAS -o
else
  exit 1
fi

if [ -f $fileAsm ]; then
  "${EFFECTUS_HOME}"/mads $fileAsm -x -i:"${EFFECTUS_HOME}"/base -o:$name.xex
  cd ..
else
  exit 1
fi

if [ ! -z "$2" ]; then
  atari800 output/$name.xex
fi

 

Ok. New compilation is ready to download.

effectus-x64-linux.zip

Edited by zbyti
new effectus compilation with proper build script
  • Thanks 1
Link to comment
Share on other sites

effectus-build-new sieve.eff run
Reading Action! source file...sieve.eff
Generating code...
Mad Pascal Compiler version 1.6.4 [2020/05/01] for 6502
Compiling sieve.pas
64 lines compiled, 0.77 sec, 8664 tokens, 821 idents, 273 blocks, 7 types
ZPAGE: $0080..$00DA
RTLIB: $2032..$2163
SYSTEM: $21A0..$21A3
CODE: $2000..$2341
DATA: $2342..$4358
Writing listing file...
Writing object file...
7567 lines of source assembled in 6 pass
852 bytes written to the object file

Current master version of Mad Pascal speed up Effectus in Sieve benchmark (without SetBlock) :]

 

atari000.png

Edited by zbyti
Link to comment
Share on other sites

[BUG Report]

 

Sieve with SetBlock after some correction is close to the same code written (and optimized) in Mad Pascal (~620 Jiffies)!

Original Mad Pascal Code included.

 

Screenshot_2020-05-01_11-54-52.png

 

During translation SETBLOCK(FLAGS,8190,'T) in Action! goes to:

 

FillChar(FLAGS, 8190, 'T);

 

and I have to change this to:

 

FillChar(FLAGS, 8190, 84);

 

atari000.png

zp-sieve.eff zp-sieve.pas

 

sieve-mp.pas

 

I compiled Effectus code with Mad Pascal Compiler version 1.6.4 [2020/05/01] for 6502.

 

In native Action! this code have 746 Jiffies.

Edited by zbyti
  • Like 1
Link to comment
Share on other sites

I got it built on my Mac using zbyti's method, including commenting out the native compilation step from effectus.pas. I like make, so I made myself a Makefile instead of the shell script:

EFFECTUS_HOME=$(HOME)/build/effectus

EFFECTUS=$(EFFECTUS_HOME)/effectus
MADS=$(EFFECTUS_HOME)/mads
MP=$(EFFECTUS_HOME)/mp

executables := $(patsubst %.eff,%.xex,$(wildcard *.eff))
detritus := $(wildcard *.xex *.lst)

.PHONY: all clean
all: $(executables)
clean:
	$(RM) $(detritus)

%.pas : %.eff
	$(EFFECTUS) $<

%.a65 : %.pas
	$(MP) $<

%.xex : %.a65
	$(MADS) $< -x -i:$(EFFECTUS_HOME)/base -o:$@

 

effectus-darwin64.zip

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Wow, how much happened from the morning... Great test, zbyti, keep it coming. And new bug reports are coming :)

First I will look at the issue with setting procedure parameters (f.e. SETBLOCK(FLAGS,8190,'T) and next will be fixing pointer issue in chessboard.eff example.

 

I will create new discussion topic in programming section to follow bug report issues, so we can analyze and fix them.

 

I see first version for MacOS appeared, just great! I have one from Mariusz, but for older version. He will help with MacOS version released too.

 

Edited by Gury
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

effectus-build-new resieve.eff run
Reading Action! source file...resieve.eff
Generating code...
Mad Pascal Compiler version 1.6.4 [2020/05/01] for 6502
Compiling resieve.pas
59 lines compiled, 0.76 sec, 8634 tokens, 820 idents, 273 blocks, 7 types
ZPAGE: $0080..$00DA
RTLIB: $2030..$2185
SYSTEM: $21B5..$21D3
CODE: $2000..$234C
DATA: $234D..$4365
Writing listing file...
Writing object file...
7933 lines of source assembled in 6 pass
9062 bytes written to the object file

Sieve again but different algorithm. Some troubles...

atari000.png

atari001.png

resieve.eff RESIEVE.ACT

Edited by zbyti
bad result in effectus
Link to comment
Share on other sites

9 hours ago, zbyti said:

Ok. I modified shell.pas and now if You add to your ~/.bashrc local variable $EFFECTUS_HOME (modify path to your needs) like this:


export EFFECTUS_HOME="$HOME/Programs/Effectus"

effectus binary should works on Linux :]

new-effectus-x64-linux.zip 2.96 MB · 3 downloads

Nice work! I will add this to new version to differentiate between platforms.

  • Thanks 1
Link to comment
Share on other sites

7 hours ago, zbyti said:

effectus-build-new resieve.eff run
Reading Action! source file...resieve.eff
Generating code...
Mad Pascal Compiler version 1.6.4 [2020/05/01] for 6502
Compiling resieve.pas
59 lines compiled, 0.76 sec, 8634 tokens, 820 idents, 273 blocks, 7 types
ZPAGE: $0080..$00DA
RTLIB: $2030..$2185
SYSTEM: $21B5..$21D3
CODE: $2000..$234C
DATA: $234D..$4365
Writing listing file...
Writing object file...
7933 lines of source assembled in 6 pass
9062 bytes written to the object file

Sieve again but different algorithm. Some troubles...

atari000.png

atari001.png

resieve.eff 574 B · 1 download RESIEVE.ACT 574 B · 0 downloads

I found a bug. It is a problem with determining branch statements in some situations. IF condition does not follow FOR branch before it.

 

Lot of stuff to analyze and bringing new bug free version of Effectus.

 

  • Like 1
Link to comment
Share on other sites

Anybody interested is welcome to join as a contributor. Repository is under control of Boštjan and I hope he'll be in charge of reviewing and accepting any pull requests. 

 

If you'd like to create a feature please use feature/short-name-of-the-feature format for a branch name.

For all bug fixes please use bugfix/short-name-of-the-bugfix.

 

Pull requests should be created against master branch for current version.

 

I'd be happy to help if required.

Edited by mariusz-buk
  • Thanks 1
Link to comment
Share on other sites

New version 0.4.1 (64-bit Windows platform console version)

 

Bug fixes:

  • removed ASCII character 9 from processed Action! listing, which could break further compilation of the code
  • removed duplication code in variable declaration block of Mad Pascal listing
  • removed duplicated begin code blocks
  • proper handling of machine language following the PROC/FUNC declaration statement
  • PROC/FUNC parameters (automatic translation of character to ATASCII value in Mad Pascal listing code, f.e.: SetBlock(flags, 8190, 'T) <==> FillChar(FLAGS, 8190, 84);
  • branches:
    • proper handling of IF condition with brackets (f.e. IF (X+Y)<=RADIUS THEN BINGO==+1 FI)
    • better handling of WHILE and FOR closing OD statements
    • proper handling of logical expressions in Action! resulting to TRUE value in Mad Pascal (WHILE I DO <==> while I > 0 do begin)
  • proper handling of increments/decrements with BYTE ARRAY variables (f.e. DL(4)==+1)
  • PrintD, PrintDE proper comma (,) determination in text

New features:

  • BYTE ARRAY variable declaration with continuous bytes supported (f.e. BYTE ARRAY DL=[$70$70$70$56$C$20$41$1$20])
  • added # comparison operator (substitution for <>)

Misc:

  • some Mad Pascal listing code indentation corrections
  • added missing line ending character
  • added new examples by zbyti (resieve.eff, fillscr.eff)
  • removed some unused code
  • code optimization

resieve041.png.f9528c0bf7e8c0c7eb935529500e4408.png

 

effectus-0-4-1-x86_64-win64.zip fillscr.eff fillscr.xex resieve.eff resieve.xex

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...