Jump to content
IGNORED

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


Gury

Recommended Posts

16 hours ago, zbyti said:

@tebe Great! We have to convince @Gury to do something like pas {some pascal code} and the ability to import Mad Pascal libraries :D anyway I'll check yours library.

I will think about this, it would be great feature to have. We must consider the ways to accomplish this efficiently. What directives to call and what kind of Mad Pascal code to include, directly including custom *.pas listing files and also considering reading Mad Pascal units. Just a thought.

 

  • Like 1
Link to comment
Share on other sites

BYTE I

PROC PRINTYO()
  PRINT("yO!") PUTE()
RETURN


PROC MAIN=()

    PAS{
      FOR I := 30 DOWNTO 0 DO EFF_PRINTYO();
    }

    PAS{
      FOR I := 30 DOWNTO 0 DO
    }
        PRINTYO()
    PAS{
      ;
    }

    ASM{
      lda #0
      sta $14
    }

RETURN

EFF_ prefix for our Effectus PROC/FUNC to make sure that the namespaces not collide with Pascal (you do this during translation anyway).

 

ASM{} should work out of the box.

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

To make things simpler, I think it would be better to make eff_ prefix for Effectus procedures and functions for any possible combination. It will be done before compilation phase anyway.

 

I reconsidered what you described above with the listing code and yes, you are right, it will be better to just prefix PROCs and FUNCs with EFF_ (eff_, _eff_, etc.) inside PAS directive. Outside code calling remains the same as original. Only PAS directive must differentiate between routines.

Is this ok?

 

Edited by Gury
Minor correction... zbyti, you are right :)
  • Like 1
Link to comment
Share on other sites

@Gury

 

Use of ASM{} and PAS{} is the responsibility of the developer not Effectus translator ;) 

 

Yes, if we absolutely want to use our procedure written in Action! without breaking {} then let's use its name as it gets during translation - let's assume it will be EFF_ in other cases it should work as usual.

 

------------------

 

With PAS{} I can use for example Mad Pascal procedures:

PAS{
	SetIntVec(iVBL, @eff_vbl_procedure);
}

or create "proxy/decorator" like libraries ;) this will be greatly enhance of Effectus :]

Edited by zbyti
typos - as usual ;)
  • Like 1
Link to comment
Share on other sites

Refactored Action! version:

 

SET $E=$2000

; INCLUDE "H6:RUNTIME.ACT"

DEFINE
  DEC="[$C6",CED="]",INC="[$E6",CNI="]",
  PHR="[$48$8A$48$98$48]",PLR="[$68$A8$68$AA$68]",
  SETVBV="$E45C",JMP="$6C"

;------------------------------------------------------------------------------

BYTE ARRAY DL=[$70$70$70$42$E0$00$41$00$20]

BYTE
  CHBAS=$2F4,LSB,MSB,
  A=$E0,B=$E1,C=$E2,D=$E3,E=$E4,
  N1=$CA,N2=$CB,I=$CC,SIZE=$CD,TMP=$CE

BYTE ARRAY SORTTABLE(255)

CARD
  VVBLKD=$224,SDLSTL=$230,OLDVBL

;------------------------------------------------------------------------------

PROC WAIT=*(BYTE F)[$18$65$14$C5$14$D0$FC$60]

PROC SETVBLK=SETVBV(BYTE WHICH,MSB,LSB)

;------------------------------------------------------------------------------

SET $E=$3000
PROC VBLANKD=*()
  PHR
  INC E CNI
  IF E=10 THEN INC D CNI E=0 FI
  IF D=10 THEN INC C CNI D=0 FI
  IF C=10 THEN INC B CNI C=0 FI
  IF B=10 THEN INC A CNI B=0 FI
  PLR
  [JMP OLDVBL]

;------------------------------------------------------------------------------

PROC INITCOUNTER=*()
  MOVEBLOCK($4000,$E080,80)
  SETBLOCK($E0,$28,$FF)
  A=0 B=0 C=0 D=0 E=0
  CHBAS=$40 SDLSTL=DL OLDVBL=VVBLKD
RETURN

PROC STARTCOUNTER=*()
  WAIT(1)
  SETVBLK(7,$30,0)
RETURN

PROC STOPCOUNTER=*()
  LSB=PEEK(@OLDVBL) MSB=PEEK(@OLDVBL+1)
  SETVBLK(7,MSB,LSB)
RETURN

;------------------------------------------------------------------------------

PROC MAIN=*()
  SIZE=254 TMP=255

  FOR I=0 TO 254 DO
    SORTTABLE(I)=TMP
    DEC TMP CED
  OD
  FOR I=0 TO 254 DO PRINTB(SORTTABLE(I)) PUT(32) OD
  WAIT(100)

  INITCOUNTER() STARTCOUNTER()

  WHILE SIZE#0 DO
    FOR I=0 TO 253 DO
      N1=SORTTABLE(I) N2=SORTTABLE(I+1)
      IF N1>N2 THEN
          SORTTABLE(I)=N2
          SORTTABLE(I+1)=N1
      FI
    OD
    DEC SIZE CED
  OD

  STOPCOUNTER() WAIT(100)

  GRAPHICS(0)
  FOR I=0 TO 254 DO PRINTB(SORTTABLE(I)) PUT(32) OD
  DO OD
RETURN

 

BSORT.ACT

Link to comment
Share on other sites

New version 0.5.2

New features

  • New extra, non-standard commands added:
    • PAS {} and ASM {} code blocks to use Mad Pascal and Mad Assembler code inside Effectus code directly (great idea by zbyti :)

      Calling PROCedures and FUNCtions, implemented in Effectus, must include appropriate string extension in PAS {} block, in particular, Proc or Func as extension depending on routine type. Variables or any other entities can be interchanged between Effectus and PAS {} block of code.

        Examples:      
          PAS {
            for i := 0 to 14 do begin
              SayHelloProc;
            end;
          }
          
          ASM {
            lda #0
            sta 710
          }
      
    • ODFOR and ODWHILE loop directives as substitutions for ending OD statements to compensate some remaining issues with FOR and WHILE branches inside ELSE and ELSEIF condition blocks
  • DO OD infinite loop code change (Mad Pascal condition code "until 0 = 1;" substituted with "until false;" code)

Bug fixes

  • Better handling of FOR, WHILE, DO, UNTIL, OD statements in nested loops
  • SetBlock routine bug fix supporting first parameter as pointer value
  • Command shell
    • Any text file is accepted as source code listing to compile, not just files with *.eff extension (f.e., you can use *.ACT files)

Misc

  • Code refactoring
    • branches.inc (condition and branch/loop logic)
    • extra.inc (PAS {} and ASM {} code block logic)
  • New examples by me and Zbyti (provided on AtariAge forum)
  • Code optimization

 

sunny_day.png.6d54e2e1ccad071cae35fe82b976a5c2.png drunk_man.png.1d67c0fe72434193a9c0597c0b5b5cdf.png sayyo.png.3039250012da4ffc4c78c0506cba2535.png


nescroll.png.225487ca480b6d74a10a75e124096b6b.png vscroll.png.2693d7d320b493172ddd1fb9d8d69c75.png

 

sunnyday.xex sunnyday.eff drunkman.xex drunkman.eff nescroll.xex nescroll.eff vscroll.xex vscroll.eff sayyo.xex sayyo.eff

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

PAS {} works fine! (with one little exception)

; Effectus example
; ----------------
; Vertical scrolling demo

pas {
const
  text = '...EFFECTUS RULEZ...'~;
  dl : array [0..9] of byte = (
    $70,$70,$70,$70,
    $67,lo(word(@text)+1),hi(word(@text)),
    $41,lo(word(@dl)),hi(word(@dl))
  );
}

byte
  ch=$2fc,
  vscrol=$d405
card
  sdlstl=$230

proc main()
  byte i=$e0

  i=$f
  pas {
    sdlstl := word(@dl);
  }
  while ch=$ff do
    while i do
      i==-1 vscrol=i
      pas {
        pause(3);
      }
    od
    pas {
      pause(50);
    }
    while i<$f do
      i==+1
      vscrol=i
      pas {
        pause(2);
      }
    od
  od
  graphics(0)
return

 

vscroll.eff vscroll.xex

Edited by zbyti
updated xex & eff
Link to comment
Share on other sites

  • 1 month later...

With some limitations we can use Effectus on C64 ;)

#!/bin/bash

mp="$HOME/Programs/MadPascal/mp"
mads="$HOME/Programs/mads/mads"
base="$HOME/Programs/MadPascal/base"
effectus="$HOME/Programs/Effectus/effectus"

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

$effectus -t $1

name=${1::-4}

if [ -f $name.pas ]; then
  [ ! -d "output" ] && mkdir output
  mv $name.pas output/
  $mp output/$name.pas -t c64 -z 10 -o
else
  exit 1
fi

if [ -f output/$name.a65 ]; then
  $mads output/$name.a65 -x -i:$base -o:output/$name.prg
else
  exit 1
fi

if [ ! -z "$2" ]; then
  x64 output/$name.prg
fi
; Effectus example
; ----------------
; Scrolling C64 demo

PROC Main()

BYTE ARRAY screen1=$400
BYTE ARRAY screen2=$500
BYTE ARRAY screen3=$600
BYTE ARRAY screen4=$700
BYTE ARRAY new_dir=[$D7 $D8 $D9 $FF 1 39 40 41]
BYTE ch, dir, i

dir = 1
screen = scrloc
DO
FOR i = 0 TO 255 DO
  screen1(i) = ch + i
  screen2(i) = ch + i
  screen3(i) = ch + i
  screen4(i) = ch + i
OD

IF Rand(10)=0 THEN
  dir = new_dir(Rand(8))
FI

ch = ch + dir
OD
RETURN

 

 

rscroll.eff rscroll.prg

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

  • 7 months later...

Hi!

 

You can download the latest version on GitHub here.

My only target is Atari 8-bit series of home computers. You can modify it and make it work to fit your needs in any way. Currently it supports other platforms as much as Mad Pascal does, which is the heart of the inner workings of the whole system. With the addition of Mad Assembler to compile resulting listing to object code. These two great compilers are provided, of course, by Tebe.

 

  • Thanks 1
Link to comment
Share on other sites

  • 6 months later...
  • 8 months later...

New version (0.5.4)

 

There are no changes to core syntax functionality, but it is the basis for future versions.

The main change is inclusion of Mad Pascal 1.6.6 and Mad Assembler 2.1.5 as core cross-languages. This led to directory structure changes to support them for proper functioning.

 

Highlights:

- Compiled with Free Pascal 3.2.2
- Updated to Mad Pascal 1.6.6 and Mad Assembler 2.1.5 build 3
- Support for Commodore 64, C16/Plus 4 and raw (supported by Mad Pascal)
- Changes in directory structure reflect the changes in Mad Pascal version 1.6.6 package
- Effectus source code clean-up and tab indentation instead of spaces (resulting in smaller file size)
- Shell color change for Effectus title name
- Little code optimization

 

The support for other systems is not tested and it is yet to be explored. Don't expect magic code for multiple platforms, this may only happen with your help.

 

Binaries can be downloaded below. The version for GitHub is not yet prepared.

 

effectus-0-5-4-x86_64-win64.zip

  • Like 1
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...