Jump to content
IGNORED

Effectus - New Atari cross-compiler (Alpha stage)


Gury

Recommended Posts

Keep in mind, Action by default will try to create storage for variables local to a procedure/function at the start of where it compiles that proc/func to. In such case, the the info passed to it get stored there and not to the CPU registers and page 0. I think it's the @ symbol that instructs Action not to set up storage and instead use the registers and page 0. I would have to look that up though.

Link to comment
Share on other sites

  • 3 months later...

I haven't read this thread for a while so I need to read all 9 pages ... what's the reason this is dropped in the new release "Custom ASM functions: register y removed from the parameter list" ?

 

Hi, here is new version of Effectus (0.2.2). I have already fixed the problem with machine language routine parameters last year, but I didn't publish new version yet. Now it handles parameters correctly, at least for examples I tested. The thing which does not work correctly yet is calling extra routines inside machine language routines, which will be checked too, of course.

 

Here is an example of new feature:

post-7301-0-45974700-1453646544_thumb.png

; CODE BLOCK WITH PARAMETERS EXAMPLE

PROC TEST=*(BYTE CURSOR,BACK,BORDER,X,Y,UPDOWN)
[$8E 710  ; BACKGROUND COLOR
 $8C 712  ; BORDER COLOR
 $8D 752  ; CURSOR VISIBILITY 
 $A5 $A5 $8D 755  ; CHARACTERS UPSIDE DOWN? 
 $A5 $A3 $8D 85 0  ; COLUMN FOR TEXT
 $A5 $A4 $8D 84 0  ; ROW FOR TEXT
 $60]

BYTE FUNC ADD8=*(BYTE ADD3,ADD4)
[
$D8      ; CLD
$18      ; CLC
$86 $B1  ; STX $B1
$65 $B1  ; ADC $B1
$85 $A0  ; STA $A0
$60]     ; RTS

CARD FUNC ADD16=*(CARD ADD1,ADD2)
[
$D8      ; CLD
$18      ; CLC
$86 $B1  ; STX $B1
$84 $B2  ; STY $B2
$65 $B2  ; ADC $B2
$85 $A0  ; STA $A0
$A5 $B1  ; LDA $B1
$65 $A3  ; ADC $A3
$85 $A1  ; STA $A1
$60]     ; RTS

PROC MAIN()

BYTE X1
CARD NUM

PUT(125)
TEST(1,20,30,8,8,4)
PRINTE("LOOK, I AM UPSIDE DOWN!")

PutE()
PutE()
X1=ADD8(100,50)
Print("100 + 50 = ")
PRINTBE(X1)

NUM=ADD16(1100,34900)
Print("1100 + 34900 = ")
PRINTCE(NUM)

RETURN

Greblus... Linux version please. Thank you! :)

 

Greetings

func_asm.xex

Edited by Gury
Link to comment
Share on other sites

  • 5 weeks later...
  • 1 year later...

So I'm not sure if this forum is still being updated, but as I go through the code for effectus I think I've found a couple of bugs.

 

1) In core.pas, starting at line 475 (Arrays and pointer detection)

    for j := 1 to GVarCnt2 do begin
      if System.Pos(GVar2[j].VarType, 'T5T6T7T8T10') > 0 then Continue;
      n := System.Pos(UpperCase(GVar2[j].VarName), UpperCase(TextBuf[CurLine]));
      if (n > 0) and VarDeclCheck(TextBuf[CurLine]) then begin
        Buffer := Trim(TextBuf[CurLine]);
        
        // Comments
        if System.Pos(';', Buffer) > 0 then begin
          CodeBuf.Add('; ' + ExtractEx(Buffer, ';', 2, []));
          Buffer := ExtractEx(Buffer, ';', 1, []);
          n := System.Pos(UpperCase(VarTypes[j]) + ' ', UpperCase(Buffer));
          if (n < 1) then Continue; 
        end;

You can see that 'j' is iterating over the 'GVarCnt2' array, but then is used to reference VarTypes[j] on the third-to-last line. This looks like a cut/paste issue because the section immediately above (Scalar type variables) does iterate 'j' over VarTypes[] and has the same block of code. Perhaps the test for n ought instead to look like:

n := System.Pos(UpperCase(GVar2[j].VarType) + ' ', UpperCase(Buffer));

2) In common.pas, starting at line 191, we have:

          if (System.Pos('PROC ', UpperCase(TextBuf[CR_LF])) > 0) then begin
            Buffer := ExtractEx(TextBuf[CR_LF], 'PROC ', 2, []);
            if System.Pos('=', TextBuf[CR_LF]) > 0 then
              Buffer := ExtractEx(Buffer, '=', 1, [])
            else if System.Pos('=*', TextBuf[CR_LF]) > 0 then
              Buffer := ExtractEx(Buffer, '=*', 1, [])
            else begin
              Buffer := ExtractEx(Buffer, '(', 1, []);
            end;
            ProcBuf.Add('PROC' + Buffer);
          end {else begin}

It seems to me that the search for '=' on the third line will mean that the search for '=*' (on the fifth line) will never be called, because any occurence of '=*' would have been detected by the search for just '='. Perhaps the order these are tested for ought to be inverted ?

 

I'll also CC: to Gury's email address (I couldn't find anything on the effectus home page, but there's one on http://gury.atari8.info/my_projects.php)

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

Thanks, Spaced Cowboy, for pointing out an issue. I will look at it and make some other small updates, but anyway I plan to refactor and recode the whole project from scratch at some point. That's probably a small spoiler now :)

 

But I encourage you and everyone else to make tests and report bugs if you find them.

 

Greetings

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Here is experimental version of Effectus with integrated MADS - Mad-Assembler v2.0.8 code, so no extra MADS executable is needed for program to run. I included MADS source code as unit for Effectus and implemented a procedure to call it. I will include sources in next release bundle version.

 

This version is also a minor bug-fix release with my and Spaced Cowboy's fixes. It may be that some example programs in original releases will not work, but all will be fixed later.

 

I hope Tebe will not mind I did this ;-)

effmads.zip

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

Keep in mind, Action by default will try to create storage for variables local to a procedure/function at the start of where it compiles that proc/func to. In such case, the the info passed to it get stored there and not to the CPU registers and page 0. I think it's the @ symbol that instructs Action not to set up storage and instead use the registers and page 0. I would have to look that up though.

 

Not quite right. A/X/Y are always used to hold the first three bytes of parameter data. The rest are stored by the caller at $A3-$AF. Upon entry to the PROC/FUNC the internal procedure SARGS is called to copy the data from where the caller stored it to the local variables of the PROC/FUNC. Using the =* form for a procedure suppresses the call to SARGS and eliminates the initial JMP to the following instruction.

 

Code from the cartridge:

 

; handle procedure setup here

pla

bmi seg120 ; system proc

 

;

; IF IT'S NOT A 'SYSTEM' PROC THEN WE NEED TO GENERATE

; THE CODE TO COPY THE PASSED ARGS FROM ARGS TO THE

; BYTES JUST DECLARED.

;

; get beginning of arguments and

; save actual procedure address

lda #1 ; GO GET START ADDRESS

jsr cprop ; OF THE PROC

sta arg0

stx arg1

jsr gcdoff ; GET CURRENT QCODE

jsr stprop ; AND STORE IN SYMTAB

 

; get space for proc variable

lda #$4c ; JMP

jsr push1

jsr gcdoff ; fill in address

adc #2 ; SKIP THE 2 JMP BYTES

bcc seg090

inx

seg090 jsr push2 ; AND STORE IN QCODE

 

; qcode to transfer arguments to

; local frame

seg100 lda arbyts ; HOW MANY

beq seg140 ; no arguments

cmp #3

bcs seg130

cmp #2

lda #$8d ; STA addr16

ldx arg0

ldy arg1

bcc seg110

lda #$8e ; STX addr16

inx

bne seg110

iny

seg110 jsr push3 ; STORE THE CODE

dec arbyts

jmp seg100

 

seg120 jmp seg170 ; SKIP TO SYSTEM PROC

 

seg130 ldx #10 ; GENERATE THE JSR TO 'SARGS'

jsr jsrtbl

lda arg0 ; STORE THE BYTES

ldx arg1 ; INLINE AFTER THE

ldy arbyts ; 'JSR SARGS' CALL

dey

jsr push3

Edited by Alfred
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...