Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Atari BASIC
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Embedded machine language=== Atari BASIC can call machine code subroutines stored in strings or <code>POKE</code>ed into memory. The 256 byte area starting at address 1536 ($0600) is often used for this purpose. Machine code is invoked with the <code>USR</code> function. The first parameter is the address of the subroutine and the following values are parameters. If the code is stored in a string named <code>ROUTINE$</code> it can be called with two parameters as {{code|2=cbmbas|1=ANSWER=USR(ADR(ROUTINE$),VAR1,VAR2)}}. Parameters are pushed onto the hardware stack as 16-bit integers in the order specified in the <code>USR</code> call in low byte, high byte order. A final byte is pushed indicating the number of arguments. The machine language code must remove these values before returning via the <code>RTS</code> instruction. A 16-bit value can be returned to BASIC by placing it in addresses 212 and 213 ($D4 and $D5).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)