Jump to content
IGNORED

Effectus suggestions and bug reports


Recommended Posts

OK, I fixed this issue https://github.com/Gury8/effectus/pull/6

            if System.Pos('{DIV}', params[1]) > 0 then begin
              params[1] := ReplaceStr(params[1],'{DIV}',' div ');
            end;
            if System.Pos('{MOD}', params[1]) > 0 then begin
              params[1] := ReplaceStr(params[1],'{MOD}',' MOD ');
            end;
            if System.Pos('{AND}', params[1]) > 0 then begin
              params[1] := ReplaceStr(params[1],'{AND}',' AND ');
            end;
            if System.Pos('{OR}', params[1]) > 0 then begin
              params[1] := ReplaceStr(params[1],'{OR}',' OR ');
            end;
            if System.Pos('{LSH}', params[1]) > 0 then begin
              params[1] := ReplaceStr(params[1],'{SHL}',' SHL ');
            end;
            if System.Pos('{RSH}', params[1]) > 0 then begin
              params[1] := ReplaceStr(params[1],'{RSH}',' RSH ');
            end;
            if System.Pos('{XOR}', params[1]) > 0 then begin
              params[1] := ReplaceStr(params[1],'{XOR}',' XOR ');
            end;

nescroll.eff nescroll.xex

Edited by zbyti
it's fine now
  • Thanks 1
Link to comment
Share on other sites

[BUG ERROR 5.0.1] fixed https://github.com/Gury8/effectus/pull/7

Fix provided by me work in some cases but in other break things... I look closer to this code:

 

              temp04 := '';
              for i := 0 to High(paramsEx) do begin
                if System.Pos('(', paramsEx[i]) > 0 then begin
                  // Assignment is ARRAY BYTE or ARRAY CARD variable
                  temp03 := Extract(1, paramsEx[i], '(');
                  if (vars.IndexOfName(temp03) >= 0) and
                     (VarValue(2, vars.IndexOfName(temp03), _VAR_BYTE_ARRAY) or
                      VarValue(2, vars.IndexOfName(temp03), _VAR_CARD_ARRAY)) then
                  begin
                    paramsEx[i] := ReplaceStr(paramsEx[i], '(', '[');
                    paramsEx[i] := ReplaceStr(paramsEx[i], ')', ']');
                  end;
                end;
                temp04 += paramsEx[i];
                if i < High(paramsEx) then begin
                  temp04 += op[i]; // this is not correct in all cases
                end;
              end;
              params[1] := temp04;
            end;

EDIT: I'm working on that, for now some revert https://github.com/Gury8/effectus/pull/7

 

"+1" worked by coincidence :D

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

It's a mess :D

 

              // Check operators in the operand
              CheckOper('+', params[1]);
              CheckOper('-', params[1]);
              CheckOper('*', params[1]);
              CheckOper('DIV', params[1]);  // Integer division, not float number division ('/')
              CheckOper('MOD', params[1]);
              CheckOper('AND', params[1]);
              CheckOper('OR', params[1]);
              CheckOper('XOR', params[1]);
              CheckOper('RSH', params[1]);
              CheckOper('LSH', params[1]);
              if oper.Count > 0 then begin
                for j := 0 to 255 do begin
                  for i := 0 to oper.Count - 1 do begin
                    if StrToInt(ExtractDelimited(1, oper.ValueFromIndex[i], [';'])) = j then begin
                      op.Add(oper.Names[i]);
                      break;
                    end;
                  end;
                end;
              end;
;........................              
                temp04 += paramsEx[i];
                if i < High(paramsEx) then begin
                  temp04 += op[i];
                end;              
      A=(RANDOM&15)*31
      B=(RANDOM%15)+32
      C=(RANDOM!15)-33

;---goes to---

  A := (RANDOM AND 15) AND 31;
  B := (RANDOM AND 15) OR 32;
  C := (RANDOM AND 15) XOR 33;

{AND}
{AND}
*
{AND}
{OR}
+
{AND}
{XOR}
{OR}

;---should be---

{AND}
*
{OR}
+
{XOR}
-
{------------------------------------------------------------------------------
 Description: Count operator occurrences in an expression
 -----------------------------------------------------------------------------}
procedure CheckOper(op, expr : string);
var
  x, y : integer;
begin
  y := 1;
  repeat
    x := nPos(op, expr, y);
    if x > 0 then begin
      if Length(op) = 1 then begin
        oper.Add(op + '=' + IntToStr(x) + ';0');
      end else begin
        oper.Add('{' + op + '}=' + IntToStr(x) + ';0');
        writeln(expr);
        writeln('x=', x,' y=', y);
        writeln('CheckOper: ', op);
      end;
    end;
    inc(y);
  until x = 0;
end;
(RANDOM{AND}15)*31+1
x=3 y=1
CheckOper: AND
(RANDOM{AND}15)*31+1
x=9 y=2
CheckOper: AND

(RANDOM{OR}15)+32+1
x=3 y=1
CheckOper: AND
(RANDOM{OR}15)+32+1
x=9 y=1
CheckOper: OR

(RANDOM{XOR}15)-33+1
x=3 y=1
CheckOper: AND
(RANDOM{XOR}15)-33+1
x=10 y=1
CheckOper: OR
(RANDOM{XOR}15)-33+1
x=9 y=1

FIX IS:

              // Check operators in the operand
              CheckOper('+', params[1]);
              CheckOper('-', params[1]);
              CheckOper('*', params[1]);
              CheckOper('{DIV}', params[1]);  // Integer division, not float number division ('/')
              CheckOper('{MOD}', params[1]);
              CheckOper('{AND}', params[1]);
              CheckOper('{OR}', params[1]);
              CheckOper('{XOR}', params[1]);
              CheckOper('{RSH}', params[1]);
              CheckOper('{LSH}', params[1]);
              
{------------------------------------------------------------------------------
 Description: Count operator occurrences in an expression
 -----------------------------------------------------------------------------}
procedure CheckOper(op, expr : string);
var
  x, y : integer;
begin
  y := 1;
  repeat
    x := nPos(op, expr, y);
    if x > 0 then begin
      oper.Add(op + '=' + IntToStr(x) + ';0')
    end;
    inc(y);
  until x = 0;
end;              

:D :D :D 

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

@Gury

I think we can combine this code:

              CheckOper('{DIV}', params[1]);  // Integer division, not float number division ('/')
              CheckOper('{MOD}', params[1]);
              CheckOper('{AND}', params[1]);
              CheckOper('{OR}', params[1]);
              CheckOper('{XOR}', params[1]);
              CheckOper('{RSH}', params[1]);
              CheckOper('{LSH}', params[1]);

            params[1] := ReplaceStr(params[1],'{DIV}',' div ');
            params[1] := ReplaceStr(params[1],'{MOD}',' MOD ');
            params[1] := ReplaceStr(params[1],'{AND}',' AND ');
            params[1] := ReplaceStr(params[1],'{OR}',' OR ');
            params[1] := ReplaceStr(params[1],'{LSH}',' SHL ');
            params[1] := ReplaceStr(params[1],'{RSH}',' SHR ');
            params[1] := ReplaceStr(params[1],'{XOR}',' XOR ');

 

  • Like 1
Link to comment
Share on other sites

12 hours ago, zbyti said:

@Gury

I think we can combine this code:


              CheckOper('{DIV}', params[1]);  // Integer division, not float number division ('/')
              CheckOper('{MOD}', params[1]);
              CheckOper('{AND}', params[1]);
              CheckOper('{OR}', params[1]);
              CheckOper('{XOR}', params[1]);
              CheckOper('{RSH}', params[1]);
              CheckOper('{LSH}', params[1]);

            params[1] := ReplaceStr(params[1],'{DIV}',' div ');
            params[1] := ReplaceStr(params[1],'{MOD}',' MOD ');
            params[1] := ReplaceStr(params[1],'{AND}',' AND ');
            params[1] := ReplaceStr(params[1],'{OR}',' OR ');
            params[1] := ReplaceStr(params[1],'{LSH}',' SHL ');
            params[1] := ReplaceStr(params[1],'{RSH}',' SHR ');
            params[1] := ReplaceStr(params[1],'{XOR}',' XOR ');

 

We can. Take into consideration that such changes need testing of other inner working of Effectus. You can test this with your test suit or with package examples (run with batch file test.bat). After batch is finished with compiling the code, you can check the file effectus.txt for errors by searching the word "errors". Btw, I do this everytime I include any new feature.

  • Like 1
Link to comment
Share on other sites

Hi good afternoon.

can you just tinker with it?

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

effectus.exe man_anim.eff -b:3600

-------------------------------------------
determine the start of the code yourself.

thank you.
greeting

 

this is it works:

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

effectus.exe man_anim.eff -nc
mp.exe man_anim.pas -code:3600
mads.exe man_anim.a65 -x -i:base -o:man_anim.xex

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

 

Bild2.jpg

Edited by funkheld
Link to comment
Share on other sites

error in the real !

 

String exceeds line >>>>  is this ?

 

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

Filename: real.pas
30.06.2020 12:55:52
Mad Pascal Compiler version 1.6.4 [2020/06/20] for 6502
Compiling real.pas
real.pas (155,7) Error: String exceeds line

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

 

greeting

 


TYPE REAL=[CARD R1,R2,R3] ;ATARI'S FP FORMAT IS 6 BYTES

BYTE CIX=$F2

INT  FR0INT=$D4

CARD INBUFF=$F3

REAL FR0=$D4, FR1=$E0

BYTE ARRAY LBUFF=$580

;************************************
;BUILT-IN FP ROUTINES
;************************************

PROC ROM_AFP=$D800()
PROC ROM_FASC=$D8E6()
PROC ROM_IFP=$D9AA()
PROC ROM_FPI=$D9D2()
PROC ROM_FSUB=$DA60()
PROC ROM_FADD=$DA66()
PROC ROM_FMULT=$DADB()
PROC ROM_FDIV=$DB28()
PROC ROM_EXP=$DDC0()
PROC ROM_EXP10=$DDCC()
PROC ROM_LOG=$DECD()
PROC ROM_LOG10=$DED1()
PROC ROM_INIT=$DA51()

;************************************
;A DUMMY PROCEDURE USED TO ACCESS THE
;FP ROUTINES
;************************************

PROC JUNK()
RETURN

;************************************
; MOVE REAL TO ANOTHER REAL
;************************************

PROC REALASSIGN(REAL POINTER A,B)

  B.R1=A.R1
  B.R2=A.R2
  B.R3=A.R3
RETURN

;************************************
; CONVERT INTEGER TO REAL
;************************************

PROC INTTOREAL(INT I  REAL POINTER R)

  FR0INT=I
  JUNK=ROM_IFP
  JUNK()
  REALASSIGN(FR0,R)
RETURN

;************************************
; CONVERT REAL TO INTEGER
;************************************

INT FUNC REALTOINT(REAL POINTER R)

  REALASSIGN(R,FR0)
  ROM_FPI()
RETURN(FR0INT)

;************************************
; SUBTRACT REALS
;************************************

PROC REALSUB(REAL POINTER A,B,C)

  REALASSIGN(A,FR0)
  REALASSIGN(B,FR1)
  ROM_FSUB()
  REALASSIGN(FR0,C)
RETURN

;************************************
; ADD REALS
;************************************

PROC REALADD(REAL POINTER A,B,C)

  REALASSIGN(A,FR0)
  REALASSIGN(B,FR1)
  ROM_FADD()
  REALASSIGN(FR0,C)
RETURN

;************************************
; MULTIPLY REALS
;************************************

PROC REALMULT(REAL POINTER A,B,C)

  REALASSIGN(A,FR0)
  REALASSIGN(B,FR1)
  ROM_FMULT()
  REALASSIGN(FR0,C)
RETURN

;************************************
; DIVIDE REALS
;************************************

PROC REALDIV(REAL POINTER A,B,C)

  REALASSIGN(A,FR0)
  REALASSIGN(B,FR1)
  ROM_FDIV()
  REALASSIGN(FR0,C)
RETURN

;************************************
; CONVERT REAL TO ASCII STRING
;************************************

PROC STRR(REAL POINTER R  BYTE ARRAY S)

  BYTE I,C

  BYTE POINTER PTR

  REALASSIGN(R,FR0)
  ROM_FASC()
  PTR=INBUFF
  WHILE PTR^='0
    DO
    PTR==+1
    OD
  I=0
  DO
    C=PTR(I)
    I==+1
    S(I)=C&$7F
  UNTIL C&$80
  OD
  S(0)=I
RETURN

;************************************
; CONVERT STRING TO REAL
;************************************

PROC VALR(BYTE ARRAY S  REAL POINTER R)

  BYTE I

  FOR I=1 TO S(0)
    DO
    LBUFF(I-1)=S(I)
    OD
  LBUFF(I-1)=0   ; AN INVALID VALUE
  INBUFF=LBUFF
  CIX=0
  ROM_AFP()
  REALASSIGN(FR0,R)
RETURN

;************************************
; BASE E EXPONENTIATION
;************************************

PROC EXP(REAL POINTER A,B)

  REALASSIGN(A,FR0)
  ROM_EXP()
  REALASSIGN(FR0,B)
RETURN

;************************************
; BASE 10 EXPONENTIATION
;************************************

PROC EXP10(REAL POINTER A,B)

  REALASSIGN(A,FR0)
  ROM_EXP10()
  REALASSIGN(FR0,B)
RETURN

;************************************
; NATURAL LOGARITHM
;************************************

PROC LN(REAL POINTER A,B )

  REALASSIGN(A,FR0)
  ROM_LOG()
  REALASSIGN(FR0,B)
RETURN

;************************************
; BASE 10 LOGARITHM
;************************************

PROC LOG10(REAL POINTER A,B)

  REALASSIGN(A,FR0)
  ROM_LOG10()
  REALASSIGN(FR0,B)
RETURN

;************************************
; POWER FUNCTION
;************************************

PROC POWER(REAL POINTER A,B,C)

  LN(A,C)
  REALMULT(B,C,C)
  EXP(C,C)
RETURN

;************************************
;PRINT REAL TO DEVICE
;************************************

PROC PRINTRD(BYTE D  REAL POINTER A)

  BYTE ARRAY TEMP(20)

  STRR(A,TEMP)
  PRINTD(D,TEMP)
RETURN

;************************************
;PRINT REAL TO DEFAULT DEVICE
;************************************

PROC PRINTR(REAL POINTER A)

  PRINTRD(DEVICE,A)
RETURN

;************************************
;PRINT REAL TO DEVICE W/EOL
;************************************

PROC PRINTRDE(BYTE D  REAL POINTER A)

  PRINTRD(D,A)
  PUTDE(D)
RETURN

;************************************
;PRINT REAL TO DEFAULT DEVICE W/EOL
;************************************

PROC PRINTRE(REAL POINTER A)

  PRINTRDE(DEVICE,A)
RETURN

;************************************
;INPUT REAL FROM A DEVICE
;************************************

PROC INPUTRD(BYTE D  REAL POINTER A)

  BYTE ARRAY TEMP(128)

  INPUTMD(D,TEMP,126)
  VALR(TEMP,A)
RETURN

;************************************
;INPUT REAL FROM DEFAULT DEVICE
;************************************

PROC INPUTR(REAL POINTER A)

  INPUTRD(DEVICE,A)
RETURN

PROC Main()

REAL X,Y,Z

GRAPHICS(1)

DO
  PRINT("INPUT X: ")
  INPUTR(X)
  PUTE()
  PRINT("INPUT Y: ")
  INPUTR(Y)
  PUTE()
  PUTD(6,'})

  REALADD(X,Y,Z)
  PRINTD(6,"X+Y  :")
  PRINTRDE(6,Z)
  REALSUB(X,Y,Z)
  PRINTD(6,"X­Y  :")
  PRINTRDE(6,Z)
  REALMULT(X,Y,Z)
  PRINTD(6,"X*Y  :")
  PRINTRDE(6,Z)
  REALDIV(X,Y,Z)
  PRINTD(6,"X/Y  :")
  PRINTRDE(6,Z)
  EXP(X,Z)
  PRINTD(6,"EXP X:")
  PRINTRDE(6,Z)
  EXP10(X,Z)
  PRINTD(6,"EXP10 X:")
  PRINTRDE(6,Z)
  LN(X,Z)
  PRINTD(6,"LN X :")
  PRINTRDE(6,Z)
  LOG10(X,Z)
  PRINTD(6,"LOG10 X:")
  PRINTRDE(6,Z)

  PUTD(6,$9B)
OD
RETURN

Bild3.jpg

Edited by funkheld
Link to comment
Share on other sites

How much is going on when I am out from the forum :)

Of course I can wait, just go for it if time and motivation allow you that.

 

I will add additional important issue requests later to main repo, so we will have more control over what is important and what is not.

 

  • Like 1
Link to comment
Share on other sites

@Gury This PR it's not much but let it be a good start ;) tested :]

 

The history of commits is a bit messy because I chose the wrong command from the console history twice :D

 

The logic of core.pas will slowly need to be changed to step-by-step procedures. I don't know the code well enough to grasp the whole thing.

 

Maybe I will find something worth simplifying today but those changes from PR may be merged.

Edited by zbyti
add info
  • 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...