Jump to content
  • entries
    39
  • comments
    57
  • views
    124,777

OSS Action!


DanBoris

2,250 views

One of my favorite programming languages for the Atari 8-bit computers is OSS Action!. Action is a compiled, structured programming language similar to C or Pascal. One of the impressive features of Action is it’s very fast an efficient compiler. Not only does it compile programs quickly, it produced pretty tight machine code executables. I thought it would be interesting to take a look at some of the machine code that the compiler produces.

 

First lets look at the classic “Hello World” program. This Action code simply prints HELLO WORLD:

 

PROC MAIN()
  PRINTE("HELLO WORLD")
RETURN

 

The resulting assembly code would look like this:

 

246E: JMP  $2471	  
2471: JMP  $2480	  

2474: .byte #$0B
2475: .string	"HELLO WORLD"
2480: LDX  #$24	 
2482: LDA  #$74	 
2484: JSR  $A46C	  
2487: RTS

 

The program starts with two JMP instructions. Although this isn’t very efficient, it’s at the start of the program so isn’t a big problem. The first JMP jumps to the MAIN procedure which is the starting point for all Action programs. The second JMP is the start of the MAIN procedure and it needs to jump over the static text that stored before the procedure.

 

Next we have the static text we will be printing. The first byte contains the length of the string and the rest the actual string data. After the string we have the actual code for the procedure. It simply loads the address of the string into the X and A registers and calls a library subroutine to do the printing.

2 Comments


Recommended Comments

The C= 128 had a slick KERNEL subroutine, PRint IMMediate that let you inline your text. You could print over 256 characters with a single call, but you couldn't have a NULL as part of the output data.

 

   jsr PRIMM
  .byte "text to output", 0
 ;program resumes here

Link to comment
Guest
Add a comment...

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