Jump to content
IGNORED

Going into Action! - A noob perspective


Recommended Posts

Little explanatory of two useful directives:

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

$E holds address of our code base (our code start here after compilation)

$491 sets LOMEM. The other words our XEX will be written (monitor W "H1:FILE.XEX") from that address to the end of our compiled code.

 

In most of the cases above addresses should be the same.

 

EDIT: Absolutely must to read:

 

https://atariwiki.org/wiki/Wiki.jsp?page=Getting in on the Action 1

https://atariwiki.org/wiki/Wiki.jsp?page=Getting in on the Action 2

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

CMC music in Action!

;------------------------------------------------------------------------------
; CMC VBLANK ROUTINE
;------------------------------------------------------------------------------

DEFINE
  ADDRMUS="$2000",ADDRPLA="$2696",
  JMP="$4C",XITVBV="$E462"

SET $E=ADDRMUS
SET $491=ADDRMUS

; Andrzej Kidaj - Acces
PROC MUSIC=*()[
  ; DATA
]

SET $E=ADDRPLA
PROC PLAYER=*()[
  ; DATA
]

PROC COMM=ADDRPLA+3(BYTE A, CARD XY)
PROC TRACK=ADDRPLA+6()
PROC SETVBLV=$E45C(BYTE A,X,Y)

PROC VPLAY=*()
  TRACK()
[JMP XITVBV]


PROC SETVPLAY(CARD ADDR)
  BYTE POINTER P=0

  SETVBLV(7,P(@ADDR+1),P(@ADDR))
RETURN

PROC MAIN=*()
  BYTE CH=$2FC

  COMM($70,MUSIC)
  COMM(0,0)
  SETVPLAY(VPLAY)

  WHILE CH=$FF DO OD

  SETVPLAY(XITVBV)    ; STOP
  COMM($40,0)         ; VBLK MUSIC
RETURN

 

 

Edited by zbyti
template only
  • Thanks 1
Link to comment
Share on other sites

MPT in Action! Adam Bienias - Vroom Intro

DEFINE
  ADDRPLA="$2000",ADDRMUS="$3000",
  RBARON="[$A9$E$8D$0A$D4$8D$1A$D0]",RBAROFF="[$A9$0$8D$1A$D0]"

SET $E=ADDRPLA
SET $491=ADDRPLA

PROC PLAYER=*()[
  ; DATA
]

; Adam Bienias - Vroom Intro
SET $E=ADDRMUS
PROC MUSIC=*()[
  ; DATA
]

PROC COMM=ADDRPLA(BYTE A)
PROC TAKT=ADDRPLA+3()

PROC MAIN()
  BYTE CH=$2FC,VCOUNT=$D40B

  COMM(0) ; INIT
  DO
    IF VCOUNT=$10 THEN
      RBARON TAKT() RBAROFF
    FI
    UNTIL CH#255
  OD
  COMM(1) ; STOP
RETURN

 

MPTMUSIC.ACT MPTMUSIC.XEX

Edited by zbyti
MPT Player 2
  • Thanks 1
Link to comment
Share on other sites

Refactored SYSOFF :) 

 

;------------------------------------------------------------------------------
; System Off in Action!
; by @zbyti
;------------------------------------------------------------------------------
;   STABLE     APPMHI      CODEBASE         CODEOFF
SET $495=8 SET $E=$1000 SET $491=$1000 ;SET $B5=$FA00
;   offset for F0x Dos set CODEBASE to $0A00
;------------------------------------------------------------------------------

DEFINE
  PHR="[$48$8A$48$98$48]",PLR="[$68$A8$68$AA$68]",
  PHA="[$48]",PLA="[$68]",SEI="[$78]",
  RTI="[$40]",RTS="[$60]",OFFJMP="NMI+21"

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

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

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

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

MODULE

BYTE
  COLPF2=$D018,PORTB=$D301,
  WSYNC=$D40A,NMIEN=$D40E,
  CARTOFF=$D508,RTCLOK2=$14

CARD
  DLIST=$D402,NMIVEC=$FFFA,LMS=$E000,
  VDSLST=NMI+6,VBIVEC=NMI+19

PROC SYSTEMOFF=*()
  SEI
  NMIEN=0 PORTB=$FE
  NMIVEC=NMI NMIEN=$40
RTS

;------------------------------------------------------------------------------
; some example of display list and interrupts
;------------------------------------------------------------------------------

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

PROC DLI2=*()
  PHA
  COLPF2=RTCLOK2
  PLA
RTI

PROC DLI1=*()
  PHA
  COLPF2=$DE
  WSYNC=$DE
  VDSLST=DLI2
  PLA
RTI

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

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

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

 

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

can you please do that in source asm?
I do not understand what you are writing.

 

greeting

 

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

BYTE FUNC Peek=*(CARD a)
[$85$A2$86$A3$A0$00$B1$A2$85$A0$60]

 

CARD FUNC PeekC=*(CARD a)
[$85$A2$86$A3$A0$00$B1$A2$85$A0$C8$B1
$A2$85$A1$60]

 

PROC Poke=*(CARD a BYTE v)
[$85$A0$86$A1$98$A0$00$91$A0$60]

 

PROC PokeC=*(CARD a, v)
[$20 Poke $C8$A5$A3$91$A0$60]

 

PROC MoveBlock=*(BYTE POINTER d,s CARD l)
[$A085$A186$A284$A0$0$A5A5$16F0$A2B1$A091$C8$F9D0
$A1E6$A3E6$A5C6$F1D0$5F0$A2B1$A091$C8$A4C4$F7D0$60]

 

PROC SetBlock=*(BYTE POINTER a CARD s BYTE v)
[$A085$A186$A284$A0$0$A4A5$A3A6$10F0$A091$C8$FBD0
$A1E6$A3C6$F5D0$3F0$A091$C8$A2C4$F9D0$60]
--------------------------------

 

 

Link to comment
Share on other sites

On 10/11/2020 at 7:20 AM, zbyti said:

Compile program and use ? PROCNAME in monitor then read the address of the procedure and check memory:

 

 

 

@zbyti I was looking at the video . When you launch the atari800 emulator, the command "C H:program.act" is injected automatically or you are typing it? If the first, how are you doing that. I couldn't find a way to do that with Atari800...

 

Thanks

 

Link to comment
Share on other sites

@pedgarcia I'm using the emulator save state with typed C "H6:MAIN.ACT".

 

In Sublime syntax highlighting package I have action.sublime-build:

{
	"shell_cmd": "xfce4-terminal -x atari800 -H1 . -state /home/zbyti/Retro/Atari/a8s/action-compile.a8s",
	"selector": "source.action"
}

I can compile only MAIN.ACT from given folder, in other case I run (custom key binding) Action! and type in filename by hand.

Edited by zbyti
action.sublime-build
  • Like 1
Link to comment
Share on other sites

I started using Action! (April this year) due to one of his last evangelists. He claimed that Action! in many cases it is as fast as ML. My many tests shows that the single-pass Action! compiler reaches at most half the speed of the ML.

 

Here is an example of code (fire effect) that should be executed in one frame. Frame synchronization turned off.

;------------------------------------------------------------------------------
; Fire by koalka/bbsl/karzelki
; Action! version by zbyti
;------------------------------------------------------------------------------
;   APPMHI       CODEBASE
SET $E=$2000 SET $491=$2000
;------------------------------------------------------------------------------

DEFINE
  CHARSET="$6000",CHARSETH="$60",SCREEN="$6400",
  LDA="$A5",STA="$85",LSR="$4A",RTS="[$60]"

BYTE
  SDMCTL=$22F,GPRIOR=$26F,COLOR4=$2C8,
  COLBK=$D01A,RANDOM=$D20A

BYTE
  B0I=$CA,B1I=$CB,TMP=$CC

BYTE POINTER
  P=0,PCHARSET=CHARSET


CARD
  VDSLST=$200,SDLSTL=$230,CHBAS=$2F4

PROC DL=*()[
  $42 SCREEN
  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
  $41 DL
]

PROC PAUSE=*()[$A5$14$C5$14$F0$FC$60]

PROC MAIN=*()

  COLOR4=$20 TMP=0
  SDLSTL=DL CHBAS=CHARSETH
  GPRIOR=$40 SDMCTL=$21


  B0I=0 DO
    P(SCREEN+B0I)=0
    P(SCREEN+$100+B0I)=0
    P(SCREEN+$200+B0I)=0
    P(SCREEN+$300+B0I)=0
    B0I==+1 UNTIL B0I=0
  OD



  B0I=0 DO
    B1I=0 DO
      PCHARSET(B1I)=TMP
      B1I==+1 UNTIL B1I=8
    OD
    PCHARSET==+8 TMP==+$11
    B0I==+1 UNTIL B0I=$10
  OD

  DO
    B0I=0 DO
      TMP=P(SCREEN-1+B0I)
      TMP==+P(SCREEN+B0I)
      TMP==+P(SCREEN+1+B0I)
      TMP==+P(SCREEN+32+B0I)
      [LDA TMP LSR LSR STA TMP]
      P(SCREEN-31+B0I)=TMP

      TMP=P(SCREEN-1+$100+B0I)
      TMP==+P(SCREEN+$100+B0I)
      TMP==+P(SCREEN+1+$100+B0I)
      TMP==+P(SCREEN+32+$100+B0I)
      [LDA TMP LSR LSR STA TMP]
      P(SCREEN-31+$100+B0I)=TMP

      TMP=P(SCREEN-1+$200+B0I)
      TMP==+P(SCREEN+$200+B0I)
      TMP==+P(SCREEN+1+$200+B0I)
      TMP==+P(SCREEN+32+$200+B0I)
      [LDA TMP LSR LSR STA TMP]
      P(SCREEN-31+$200+B0I)=TMP

      B0I==+1 UNTIL B0I=0
    OD

    ;COLBK=10
    ;PAUSE()

    B0I=$1F DO
      P(SCREEN+$2E0+B0I)=RANDOM&15
      B0I==-1 UNTIL B0I=$FF
    OD
  OD

RTS

 

Even after replacing the body of extensively used loops by ML it is still insufficient and whole loop would have to be replaced with branch jump - DIY ;)

;------------------------------------------------------------------------------
; Fire by koalka/bbsl/karzelki
; Action! version by zbyti
;------------------------------------------------------------------------------
;   APPMHI       CODEBASE
SET $E=$2000 SET $491=$2000
;------------------------------------------------------------------------------

DEFINE
  CHARSET="$6000",CHARSETH="$60",SCREEN="$6400",RTS="[$60]",
  LDA="$AD",LDAX="$BD",STAX="$9D",LSR="$4A",CLC="$18",ANDI="$29",
  ADCX="$7D",LDX="$A6",INC="$E6",DEC="$C6"

BYTE
  SDMCTL=$22F,GPRIOR=$26F,COLOR4=$2C8,
  COLBK=$D01A,RANDOM=$D20A

BYTE
  B0I=$CA,B1I=$CB,TMP=$CC

BYTE POINTER
  P=0,PCHARSET=CHARSET


CARD
  VDSLST=$200,SDLSTL=$230,CHBAS=$2F4

PROC DL=*()[
  $42 SCREEN
  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
  $41 DL
]

PROC PAUSE=*()[$A5$14$C5$14$F0$FC$60]

PROC MAIN=*()

  COLOR4=$20 TMP=0
  SDLSTL=DL CHBAS=CHARSETH
  GPRIOR=$40 SDMCTL=$21


  B0I=0 DO
    P(SCREEN+B0I)=0
    P(SCREEN+$100+B0I)=0
    P(SCREEN+$200+B0I)=0
    P(SCREEN+$300+B0I)=0
    B0I==+1 UNTIL B0I=0
  OD



  B0I=0 DO
    B1I=0 DO
      PCHARSET(B1I)=TMP
      B1I==+1 UNTIL B1I=8
    OD
    PCHARSET==+8 TMP==+$11
    B0I==+1 UNTIL B0I=$10
  OD

  DO
    B0I=0 DO
      [
        LDX B0I
        LDAX $63FF CLC
        ADCX SCREEN ADCX $6401 ADCX $6420
        LSR LSR STAX $63E1

        LDAX $64FF CLC
        ADCX SCREEN+$100 ADCX $6501 ADCX $6520
        LSR LSR STAX $64E1

        LDAX $65FF CLC
        ADCX SCREEN+$200 ADCX $6601 ADCX $6620
        LSR LSR STAX $65E1

        INC B0I
      ]
      UNTIL B0I=0
    OD

    ;COLBK=10
    ;PAUSE()

    B0I=$1F DO
      [
        LDX B0I
        LDA RANDOM ANDI $F STAX $66E0
        DEC B0I
      ]
      UNTIL B0I=$FF
    OD
  OD

RTS

 

FIREFAST.XEX FIRESLOW.XEX

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

4 hours ago, Alfred said:

All those pointer references (P(Screen)) are killing you.

Do you know a faster way? Pointer produce huge code but peek&poke as subroutines are not a solution in speed department.

 

I know what's killing me but do you have the cure? :D 

 

If you can write a faster code, I'd love to see it :)

Edited by zbyti
faster code
Link to comment
Share on other sites

On 12/3/2019 at 1:14 PM, pedgarcia said:

Today, I decided to start looking into it again with the objective to write some articles for my website about it and also finally learn something about Atari 8-bit programming in general. 

Since your aim is to write some articles, how about something new, that has not been covered yet? 

 

If you are familiar with C, then I invite you to try 8bit-unity. Not only does it contain a super simple API, but also all the tools you need to create and package your assets (bitmaps, sprite, music). It also has some advantages, like ability to display 10 sprites (by VBI flicker), without requiring you to do anything. 

 

I posted some info here today:

 

  • Like 1
Link to comment
Share on other sites

On 10/16/2020 at 3:29 AM, zbyti said:

@pedgarcia I'm using the emulator save state with typed C "H6:MAIN.ACT".

 

In Sublime syntax highlighting package I have action.sublime-build:


{
	"shell_cmd": "xfce4-terminal -x atari800 -H1 . -state /home/zbyti/Retro/Atari/a8s/action-compile.a8s",
	"selector": "source.action"
}

I can compile only MAIN.ACT from given folder, in other case I run (custom key binding) Action! and type in filename by hand.

 

I am curious. Do you save the file like a regular text file? Doesn't Action! complain about the format?

 

 

 

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