Jump to content
IGNORED

Going into Action! - A noob perspective


Recommended Posts

  • 1 month later...
10 hours ago, zbyti said:

@pedgarcia hey! What's up in the Action! world? ;) 

Hey @zbyti, I've been busy with some other stuff (TRS-80 little game), but i have already an article 90% ready, and I am starting to think the next steps. Hopefully in a few days, I can post it!

 

Thanks for the "incentive" btw :) That helps me keep on track!

 

Cheers

 

 

  • Like 1
Link to comment
Share on other sites

5 minutes ago, zbyti said:

Nice article. But if you mentioned includes as libraries you must say something about MODULE, this KEY WORD allow declare global variables in the middle of the code ;) 

Oh, yeah. I missed that! Good call. I will update it as soon as possible. Thanks!

Link to comment
Share on other sites

Hey @zbyti

 

I was thinking about the MODULE keyword and trying to find a good example of when use it. I can see its use is more for something like this:

 

PROC FUNC1()
  ....
RETURN

MODULE

CARD THIS_IS_GLOBAL=[10]

FUNC MAIN()
...
RETURN

 

But can you think in a good example to use it when using includes? Only doing the above seems not enough to justify its use, don't you agree?

 

Thanks

 

 

 

Link to comment
Share on other sites

1 hour ago, zbyti said:

If you write your library good practices is starts and ends file with MODULE to be sure your variables compiles.

 

https://github.com/zbyti/a8-action-playground/blob/master/src/LIGHTSPE/SRC/STDIO.ACT

Ah, perfect! Now I get it - I wanted to come up with a problem if we don't do what you just said. Perfect! THanks!

 

  • Like 1
Link to comment
Share on other sites

Quote

The MODULE keyword is used to indicate that everything declared after this keyword and the next PROC/FUNC will be considered a global variable. 

The MODULE keyword is used to indicate that everything declared after this keyword UNTIL the next PROC/FUNC will be considered a global variable. 

Edited by zbyti
correction to the article
Link to comment
Share on other sites

  • 1 year later...

Whats is Action! doing with B?  Seems to be overriding to BYTE not adding to CARD.  Is this a bug, or do I just don't understand LSH?

 

PROC MAIN()
 CARD A,B,C
 A=193+(2*32)
 B=193+(2 LSH 5)
 C=(2 LSH 5)
 PRINTF(" A = %U %E",A)
 PRINTF(" B = %U %E",B)
 PRINTF(" C = %U %E",C)
RETURN

 

Output:

A = 257
B = 1
C = 64

 

 

 

Link to comment
Share on other sites

On 10/29/2022 at 6:44 PM, rsh said:

Whats is Action! doing with B?  Seems to be overriding to BYTE not adding to CARD.  Is this a bug, or do I just don't understand LSH?

 

PROC MAIN()
 CARD A,B,C
 A=193+(2*32)
 B=193+(2 LSH 5)
 C=(2 LSH 5)
 PRINTF(" A = %U %E",A)
 PRINTF(" B = %U %E",B)
 PRINTF(" C = %U %E",C)
RETURN

 

Output:

A = 257
B = 1
C = 64

 

 

 

see to the machine code that Action! compile and then you will know what it is: bug or feature ;) 

Link to comment
Share on other sites

On 10/29/2022 at 12:44 PM, rsh said:

Whats is Action! doing with B?  Seems to be overriding to BYTE not adding to CARD.  Is this a bug, or do I just don't understand LSH?

 

PROC MAIN()
 CARD A,B,C
 A=193+(2*32)
 B=193+(2 LSH 5)
 C=(2 LSH 5)
 PRINTF(" A = %U %E",A)
 PRINTF(" B = %U %E",B)
 PRINTF(" C = %U %E",C)
RETURN

 

Output:

A = 257
B = 1
C = 64

 

 

 

It seems the bitwise operator are assuming all BYte before assigning it to B (CARD). 

 

Other than looking at the machine code, you could try something else.

 

Instead of using the literal 193, try to assign it to a CARD. for example:

CARD D = 193

B = D + (2 LSH 5)

....

 

I don't have access to Action! right now so I can't test it. What do you see ?

 

Cheers

 

 

 

Link to comment
Share on other sites

It's a bug. The code does the left shift and stores the result in the low byte but then it just stores zero for the second byte, rather than doing ADC #0. I think the earlier guess is right, it sees the 193 as a byte operand and for some reason thinks the output will also be a byte, which isn't true in this case.

Link to comment
Share on other sites

Yeah that what I had to do.  To get around it more cycles lol. 

15 hours ago, zbyti said:

Yep its a bug.

 

image.thumb.png.d9243e451773b442b7d52299a6d021c4.png

 

workaround above

Thanks everyone.  Maybe this should be posted in the bug appendix...  I wasted some time trying to find my problem until I figured this bug out in my program.  I did do a change like above to get around it more cycles lol!  ...     

Link to comment
Share on other sites

@zbyti   I was looking at your systemoff code compared to the " Using extended RAM in XL and XE Computer" https://atariwiki.org/wiki/Wiki.jsp?page=Use RAM under ROM on XL-XE machines

And It claims to free ram at  $C000 - ($CFFF or should  it be $CEFF ) and $D800 - $FFFF.   But, don't we still need an OS swap in at some point.   What memory does yours specifically free up?

 

I'm little confused on how a Action program runs without an OS or does it need the OS once you create your com file?  

 

I found this mentioned in Mapping The Atari Appendix 12... https://www.atariarchives.org/mapping/appendix12.php Which still takes some of RAM but it won't crash since the OS is still there?? ,  You get $C000 - $CEFF  and another 768 + 256 bytes some other locations and you can overlay the characters set in OSRAM without dup.   

     ;Move XL OS ROM into RAM
     ;
     ;RAMROM--Installs the XL ROM-based
     ;  OS in RAM at the same address
     ;  space. This is useful for
     ;  making small patches to the
     ;  OS or for experimenting with
     ;  new design concepts, such as
     ;  multitasking, window
     ;  management, etc.
     ;
     ;    By Joe Miller.
     ;
     ;This version is configured
     ;as an AUTORUN.SYS file.
     ;
     SOURCE  EQU     $CB             ;zero page usage
     DEST    EQU     SOURCE+2
     START   EQU     $0600           ;START address
     OSROM   EQU     $C000           ;address of OS ROM start
     OSRAM   EQU     $4000           ;address of ROM
                                     destination
     NMIEN   EQU     $D40E           ;NMI enable register
     PORTB   EQU     $D301           ;memory mgt control
                                     latch
             ORG     START
             LDA     #low OSROM
             STA     SOURCE
             STA     DEST            ;initialize copy addrs
             LDA     #high OSROM
             STA     SOURCE+1
             LDA     #high OSRAM
             STA     DEST+l
             LDY     #0
                                     ;Repeat
     Pass1   LDA     (SOURCE),Y      ;copy ROM to RAM
             STA     (DEST),Y
             INY
             BNE     Pass1 
             INC     DEST+1
             INC     SOURCE+1
             BEQ     Swap            ;If done
             LDA     SOURCE+l
             CMP     #$D0
             BNE     Pass1           ;skip 2K block at $D000
             LDA     #$D8
             STA     SOURCE+1
             BNE     Pass1           ;Until SOURCE = $0000
     Swap    PHP                     ;save processor status
             SEI                     ;disable IRQs
             LDA     NMIEN
             PHA                     ;save NMIEN
             LDA     #0
             STA     NMIEN           ;disable NMIs
             LDA     PORTB
             AND     #$FE            ;turn off ROMs
             STA     PORTB           ;(leaving BASIC
                                     unchanged!)
             LDA     #high OSROM
             STA     DEST+1          ;set up block copy
             LDA     #high OSRAM
             STA     SOURCE+1
                                     ;Repeat
     Pass2   LDA     (SOURCE),Y      ;move RAM OS to proper
                                     address
             STA     (DEST),Y
             INY
             BNE     Pass2
             INC     SOURCE+1        ;move to next page
             INC     DEST+1
             BEQ     Enable          ;If complete
             LDA     DEST+1 
             CMP     #$D0
             BNE     Pass2           ;skip block at $D000
             LDA     #$D8
             STA     DEST+1
             BNE     Pass2           ;Until DEST = $000
     Enable  PLA
             STA     NMIEN           ;reestablish NMI mask
             PLP                     ;reenable IRQs
             RTS
             END     START
Edited by rsh
Link to comment
Share on other sites

7 hours ago, rsh said:

@zbyti   I was looking at your systemoff code compared to the " Using extended RAM in XL and XE Computer" https://atariwiki.org/wiki/Wiki.jsp?page=Use RAM under ROM on XL-XE machines

And It claims to free ram at  $C000 - ($CFFF or should  it be $CEFF ) and $D800 - $FFFF.   But, don't we still need an OS swap in at some point.   What memory does yours specifically free up?

 

I'm little confused on how a Action program runs without an OS or does it need the OS once you create your com file?  

my SYSTEM OFF need:

 

1. use Sublime Text (or VSC) to develop (don't use Atari memory for code)

2. don't use Action! runtime (include your own)

3. compile on Atari from file on H6

4. write OBJ to H1

5. turn off Action! cartridge (software) if you run code from memory (right after compiling)

 

then you can use $A000, $B000 and so on for SCREEN memory or other dynamic things because you turn off BASIC and KERNEL.  

Edited by zbyti
Link to comment
Share on other sites

7 hours ago, rsh said:

Yeah that what I had to do.  To get around it more cycles lol. 

Thanks everyone.  Maybe this should be posted in the bug appendix...  I wasted some time trying to find my problem until I figured this bug out in my program.  I did do a change like above to get around it more cycles lol!  ...     

Action! cannot perform mathematical operations on constants during compilation, all such operations take place in runtime.

 

If you know that you need 257 don't write it down as a math operation.

Edited by zbyti
Link to comment
Share on other sites

14 hours ago, rsh said:

@zbyti   I was looking at your systemoff code compared to the " Using extended RAM in XL and XE Computer" https://atariwiki.org/wiki/Wiki.jsp?page=Use RAM under ROM on XL-XE machines

And It claims to free ram at  $C000 - ($CFFF or should  it be $CEFF ) and $D800 - $FFFF.   But, don't we still need an OS swap in at some point.   What memory does yours specifically free up?

;------------------------------------------------------------------------------
; Brief Memory Map:
; $0200 - $07ff  later usage
; $0800 - $0bff  charset 1
; $0c00 - $0fff  charset 2
; $1000 - $92ff  main code (33535 bytes ~ 33 KB)
; $9300 - $cfff  later usage
; $d800 - $ffef  later usage
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
;   STABLE       CODEBASE         APPMHI
SET $495=8 : SET $491=$1000 : SET $E=$1000
;------------------------------------------------------------------------------

 

https://github.com/zbyti/a8-action-playground/blob/master/src/ZBYTI/OFFTEMPL/MAIN.ACT

Edited by zbyti
Link to comment
Share on other sites

7 hours ago, zbyti said:
;------------------------------------------------------------------------------
; Brief Memory Map:
; $0200 - $07ff  later usage
; $0800 - $0bff  charset 1
; $0c00 - $0fff  charset 2
; $1000 - $92ff  main code (33535 bytes ~ 33 KB)
; $9300 - $cfff  later usage
; $d800 - $ffef  later usage
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
;   STABLE       CODEBASE         APPMHI
SET $495=8 : SET $491=$1000 : SET $E=$1000
;------------------------------------------------------------------------------

 

https://github.com/zbyti/a8-action-playground/blob/master/src/ZBYTI/OFFTEMPL/MAIN.ACT

Thank you I will play around with it,  Your method seems way more elegant than the wiki.  Looks like with your version you don't need to swap PORTB OS bits.. cause your just there in main memory all the time..  Very cool!!  I am trying to free memory up and this looks like a real solution.  

 

I was trying to figure out how to compile into 130XE extended ram bank(s) and run code from there lol, but that seems like a real pain in axx..   Have you ever tried to do that, curious? 

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