Jump to content
pedgarcia

Going into Action! - A noob perspective

Recommended Posts

Wow, this is gorgeous. I am finishing the 3rd part but I wonder if it is ok to use this in an upcoming part?

 

there are interesting concepts there like the way you declare OpenMode and drawTo. Is this standard in the native Actiion! ? (I am assuming you are using Effectus)

 

 

cheers

Share this post


Link to post
Share on other sites

@pedgarcia

 

It's completely Action! way match functions to memory address, Effectus can't do that for that moment properly. Landscape was compiled under Action! env. on A8 and write to H1 as binary xex.

 

From my part you can use this code in your upcoming tutorial but you can ask @ilmenit about this too.

 

Edited by zbyti
Action! way :]

Share this post


Link to post
Share on other sites

Very nice! Actually on a side-note, I think a chapter using an external editor is necessary. I've been doing everything using the Action! editor and I really think it is powerful, but the it gets hard to see the whole source code...

 

 

Share this post


Link to post
Share on other sites

I am not sure if I followed what happened in there? I tried the program on Atari800MacX and it crashed, but looking at your video is that expected?

 

Thanks

Share this post


Link to post
Share on other sites
;------------------------------------------------------------------------------
; System Off in Action!
; by @zbyti
;------------------------------------------------------------------------------

DEFINE
  DLADDR="$2100",DLI1ADDR="$2140",DLI2ADDR="$2180",
  PHR="[$48$8A$48$98$48]",PLR="[$68$A8$68$AA$68]",
  PHA="[$48]",PLA="[$68]",SEI="[$78]",
  RTI="[$40]",RTS="[$60]"

SET $E=$2000
SET $491=$2000

BYTE
  COLPF2=$D018,PORTB=$D301,
  WSYNC=$D40A,NMIEN=$D40E,
  RTIVEC=$15,RTCLOK2=$14

CARD
  DLIST=$D402,NMIVEC=$FFFA,
  VBIVEC=$10,VDSLST=$16,
  LMS=$E000,CARTOFF=$D508

PROC NMI=*()[
 $2C $0F $D4  ;BIT $D40F   ;NMIST
 $10 $03      ;BPL
 $6C VDSLST 0 ;JMP ($0016) ;BUFADR+1
 $E6 $14      ;INC $14     ;RTCLOK+2
 $D0 $06      ;BNE
 $E6 $13      ;INC $13     ;RTCLOK+1
 $D0 $02      ;BNE
 $E6 $12      ;INC $12     ;RTCLOK
 $6C VBIVEC 0 ;JMP ($0010) ;POKMSK
]

PROC SYSTEMOFF=*()
  SEI
  NMIEN=0 PORTB=$FE RTIVEC=$40
  [email protected] [email protected]
  NMIVEC=NMI NMIEN=$40
RTS

PROC VBI=*()
  PHR
  COLPF2=RTCLOK2
  PLR
RTI

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

SET $E=DLADDR
PROC DL=*()[
  $70 $70 $70
  $42 LMS
  2 2 $F0 2 2 2 $F0 2 2 2
  $41 DL
]

SET $E=DLI1ADDR
PROC DLI1=*()
  PHR
  COLPF2=$DE
  WSYNC=$DE
  VDSLST=DLI2ADDR
  PLR
RTI

SET $E=DLI2ADDR
PROC DLI2=*()
  PHR
  COLPF2=RTCLOK2
  VDSLST=DLI1ADDR
  PLR
RTI

PROC MAIN=*()
  SYSTEMOFF()
  ; CARTOFF=1 disable Action! 3.6 cartridge
  WAIT(50) DLIST=DL
  WAIT(100) VBIVEC=VBI
  WAIT(100) VDSLST=DLI1
  NMIEN=$C0
  DO OD
RTS

@pedgarcia I tested XEX with Atari800 and Altirra, it works. You have problem running this program after compilation on your computer/emulator?

 

I recommend to run Action! from cartridge instead of using disk version and compile from file not from editor.

 

Edited by zbyti
I recommend...

Share this post


Link to post
Share on other sites

Ah ok. With the cartridge version and compiling from disk works. Interesting effect.

 

What the SystemOFF() function is actually doing?

Share this post


Link to post
Share on other sites

Ah, gotcha. That is pretty cool. I've already bookmarked your repo. 

 

BTW I am finishing the part 3, but went talking about POINTERS and I am not sure if it is too deep too soon for the idea of targeting who is learning Action like I am doing... Anyway , the part 3 is going to be out hopefully today. 

 

 

Share this post


Link to post
Share on other sites
5 minutes ago, pedgarcia said:

BTW I am finishing the part 3, but went talking about POINTERS and I am not sure if it is too deep too soon for the idea of targeting who is learning Action like I am doing...

I don't think so, pointers are substantial for 8-bit programmers.

Edited by zbyti

Share this post


Link to post
Share on other sites
1 minute ago, zbyti said:

I don't think so, pointers are substantial for 8-bit programmers.

Thanks, I agree. As far I could see so far, Action! in particular use the concept very often. Hopefully my "noob" explanation will reach those that don't understand it (as long I understood :) )

  • Like 1

Share this post


Link to post
Share on other sites

In BLOCK CODE we can easily use pointers but we must remember about one nasty exception, even if we declare CARD variable on ZERO PAGE Action! don't respect that and we must explicitly add 0 do address, like this:

CARD
  VBIVEC=$10,VDSLST=$16

PROC NMI=*()[
 $2C $0F $D4  ;BIT $D40F   ;NMIST
 $10 $03      ;BPL
 $6C VDSLST 0 ;JMP ($0016) ;BUFADR+1
 $E6 $14      ;INC $14     ;RTCLOK+2
 $D0 $06      ;BNE
 $E6 $13      ;INC $13     ;RTCLOK+1
 $D0 $02      ;BNE
 $E6 $12      ;INC $12     ;RTCLOK
 $6C VBIVEC 0 ;JMP ($0010) ;POKMSK
]

 

Edited by zbyti
nasty exception

Share this post


Link to post
Share on other sites

Another try to program without Action! RUNTIME and system calls. Multiplication and Shift Left bit operation not allowed.

DEFINE
  DLADDR="$2000",RTS="[$60]",LMS="$6010"

SET $E=$2100
SET $491=$2100

BYTE ARRAY BASE=[
  170 150 144 144 122 122 110 110 94 94 86 86 82 80
]

BYTE
  SDMCTL=$22F,GPRIOR=$26F,
  COLOR4=$2C8,RND=$D20A,TMP=$CA

CARD SDLSTL=$230
CARD POINTER DL=DLADDR

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

PROC GR9=*()
  FOR TMP=0 TO 100 DO DL(TMP)=$0F0F OD
  DL(0)=$7070 DL(1)=$4F70 DL(2)=LMS
  DL(50)=$4F0F DL(51)=LMS+$FF0
  DL(99)=$410F DL(100)=DL
  SDLSTL=DL GPRIOR=$40 COLOR4=$B0
RTS

PROC LANDSCAPE()
  BYTE ARRAY COLHEIGHT(14)
  BYTE
    START=$55,STOP=$56,
    X,C=$CB,I=$CC
  BYTE POINTER P=$CD

  X=40 SDMCTL=0 WAIT(1)
  FOR TMP=0 TO 13 DO
    COLHEIGHT(TMP)=BASE(TMP)
  OD
  WHILE X#0 DO
    X==-1
    FOR I=0 TO 1 DO
      P=LMS+X START=0 C=14
      WHILE C#0 DO
        C==-1 STOP=COLHEIGHT(C)
        IF START>STOP THEN
          TMP=START-STOP
          WHILE TMP#0 DO P==-40 TMP==-1 OD
          STOP=START
          START=COLHEIGHT(C)
        FI
        WHILE START<STOP DO
          IF I THEN
            [$A5 C $A $A $A $A $85 TMP]
            P^=(P^&15)%TMP
           ELSE
            P^=C
          FI
          P==+40 START==+1
        OD
        START=STOP
        IF RND&1 THEN COLHEIGHT(C)==-1 FI
        IF RND&1 THEN COLHEIGHT(C)==+1 FI
      OD
    OD
  OD
  WAIT(1) SDMCTL=$22
  WAIT(150)
RTS

PROC MAIN=*()
  GR9()
  DO LANDSCAPE() OD
RTS

 

SLIDESHO.XEX

Edited by zbyti
no runtime

Share this post


Link to post
Share on other sites

@pedgarcia nice article! But if you use DLADDR for variable name more proper will be:

PROC MAIN()
  CARD I
  BYTE POINTER SCR ; BEGINNING OF SCREEN POINTER
  CARD POINTER DLADDR ;DISPLAY LIST ADDR
  GRAPHICS(7+16)
  DLADDR=PEEKC(560)
  SCR=DLADDR(2)
  ; PLOT AN ARBITRARY PATTERN ON SCREEN
  FOR I=1 TO 3840
  DO
   SCR^=135
   SCR==+1
  OD
  FOR I=1 TO 33000 DO OD
RETURN

in other case for DLADDR=PEEKC(560)+4  more accurate will be LMSADDR=PEEKC(560)+4

Edited by zbyti
LMS

Share this post


Link to post
Share on other sites

Thanks @zbyti!

 

I hope you help me understand the differences (or if it is just more correctness).

 

DLADDR=PEEKC(560) is getting the beginning of the DLI and when you put SRC=DLADDR(2), it will be the same as "DLADDR==+2  and SRC=DLADDR^" correct ? In this case, wouldn't you getting the wrong information? (I know I am wrong, because your version also works :) ). Or when you use DLADDR(2) you are actually getting the 2nd CARD, i.e, 16-bit pair (aka same 4th byte)?

 

And why you say that "LMSADDR=PEEKC(560)+4" would be more accurate?

 

Thanks

 

Share this post


Link to post
Share on other sites

@pedgarcia You can use CARD POINTERS like CARD ARRAYS. DL probably looks like:

$70 $70 $70 $42 L_LMS H_LMS ...

then INDEX=2 points to CARD LMS. In arrays index start from 0.

 

ARRAY variable names are actually pointers (is possible because Action! also allocates a pointer to the ARRAY) to the ARRAY space and vice versa ;)

Edited by zbyti
CARD ARRAY

Share this post


Link to post
Share on other sites
3 minutes ago, zbyti said:

@pedgarcia You can use pointers as CARD arrays. DL probably looks like:

$70 $70 $70 $42 L_LMS H_LMS

then INDEX=2 points to CARD LMS.

Hm, interesting, so the arrays follows the datatype size....

 

When I first tried to understand the pointers I was also assuming that an increment of 1 would also jump 2 bytes at a time for a CARD type, but that is not the case. I see that using arrays does.

 

Based on that, the loop could also be:

 

FOR I=0 TO 3839
  DO
   SCR(I)=135
  OD

 

with the same performance, right?

 

Thanks

 

Share this post


Link to post
Share on other sites

@pedgarcia about performance - as far as I know if we not using byte array with fixed size <= BYTE there are no difference.

Edited by zbyti
byte array arr(256)

Share this post


Link to post
Share on other sites

@pedgarcia in Action! peoples use those tricks instead PEEK & POKE:

BYTE ARRAY MATRIX=0

for POKEC & PEEKC you know what to do ;) If you like POINTERS use them instead of ARRAYS in this case ;)

 

It's one drawback of this metod: produce much more code then calling JSR POKE.

Edited by zbyti
In other hand

Share this post


Link to post
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.

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...