Wiki

Clone wiki

Super-Mon / Short_basics

SHORT: THE BASICS

THE MECHANICS OF CREATING A PROGRAM IN
SHORT ARE A LOT LIKE MAKING AN ASSEMBLY
PROGRAM IN SUPER-MON. EACH STATEMENT HAS
AN ADDRESS IN MEMORY. HERE'S A "HELLO
WORLD" PROGRAM TO ENTER INTO SUPER-MON:

#1C00<FSHORTR
#8000: PRSTR("HELLO WORLD")
# RTS

FIRST WE LOAD THE SHORT RUNTIME AT ITS
DEFAULT ADDRESS OF $1C00.

NEXT WE TELL PUT OUR PROGRAM AT ADDRESS
$8000. WE JUST PRINT A STRING, USING
"PRSTR", PART OF SHORT'S LIBRARY.

FINALLY WE RETURN FROM OUR LITTLE SUB-
ROUTINE. NOTE WE SIMPLY USE A 6502 "RTS"
OPCODE; THIS IS A GOOD EXAMPLE OF HOW
EASY IT IS TO MIX SHORT AND ASSMEMBLY
TOGETHER.

TO LIST THE PROGRAM:

#8000L

8000-G  PRSTR("HELLO WORLD")
8010-H  60        RTS
8011-I  FF        ???
...ETC...

NOW LET'S RUN THE PROGRAM:

#8000G
HELLO WORLD
#

HOUSEKEEPING IS IMPORTANT WHEN STARTING
A PROGRAM SO IT WILL BE EASY TO EDIT.
ESTABLISH THE AREA OF MEMORY TO USE FOR
YOUR PROGRAM, AND THEN CLEAR IT OUT.

#8000.8FFFP
#8000.8FFFZ

LET'S USE VARIABLES AND DO SOME MATH:

#NUMBER=80
#PRODUCT=82

THIS DEFINES TWO LABELS (IN SUPER-MON)
THAT WE CAN USE AS VARIABLES TO STORE
VALUES.

#8000: NUMBER=3251
# PRODUCT=NUMBER*2
# PRINTF("THE BEST IS %D",PRODUCT)
# RTS
#8000G
THE BEST IS 6502

NOW WE PUT VALUES IN THOSE VARIABLES,
INCLUDING A COMPUTATION, AND PRINT USING
THE "C"-LIKE PRINTF LIBRARY FUNCTION. IN
THIS, THE "%D" CODE GETS REPLACED BY THE
VALUE WE COMPUTED.

This page is from Super-mon's built-in help system.

Updated