Jump to content
Sign in to follow this  
Starman

Is BASIC required for text output of assembler code?

Recommended Posts

Hi all,

I was looking to do something VERY simple for my first 8-bit assembler program (since 1984!). I wanted to do something like return the graphics mode or something very rudimentary. I was trying to figure out how to print output in assembler and every piece of sample code I found had it all wrapped into a BASIC program with DATA lines at the end which represented the assembled assembler code. Is this really the best way to do this? There isn't some kind of simple assembler routine for printing text onscreen in Gr.0?

 

Mike

Share this post


Link to post
Share on other sites

Most BASICs have no provision for embedded assembly (although this is a great feature in languages that have it), so machine language code is stored in DATA statements, or bizarre looking STRING variables, then usually copied into RAM somewhere and executed using a "jump to routine" instruction like USR or SYS.

 

-Bry

Share this post


Link to post
Share on other sites

I think you have two main ways to put text onscreen in assembly: put the bytes into the screen buffer yourself, call CIO to do that. Neither of these options requires BASIC.

Share this post


Link to post
Share on other sites

You have a couple of choices. The simplest way is to just write directly to the screen RAM. With this simplicity comes a few problems though. You have to handle the positioning and formatting, etc.

 

You could also use the built in OS routines for putting text on the screen. Mapping the Atari lists the locations for these routines, but unfortunately does not give an explanation of how to use them (i.e., register usage).

 

It has been a very long time since I did any 6502 coding, and when I did, it was basically subroutine calls from within BASIC.

 

Stephen Anderson

Share this post


Link to post
Share on other sites

Another thing is that you cannot usually call them directly from Atari Basic...since the stack will hold a value of how many bytes you are passing via USR (even if there are none). So generally, a USR jump pops this dead value off the stack using an unmatched PLA instruction. So the thing to do would be to set up a jump table in a free area of memory, or using a string variable to hold the PLA/JMP $OSsubroutine code (the RTS at the end of the OS subroutine then sends it back to Basic). Page 6 works well for this (since Basic leaves it alone). Then just use that address in the USR command instead.

 

Note: Advan Basic DOES support imbedded assembly code...but it's not fully compatable with Atari Basic (mostly though).

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...