From fb15f1aa9b00a6d8587ae47ac651a2259c940cc7 Mon Sep 17 00:00:00 2001
From: Fredrik Rambris instruction: set the size of the variable areaStoring variables
- SET BUFFER
+ SET BUFFER
Set Buffer number of kilobytesArrays
Professional the size of the table of variables needed for your array. There is a special command for
setting up this dimension.
instruction: dimension an array
Dim variable name(number,number,number...)
function: give the amount of free memory in the variable buffer area
memory=Free
structure: create a user-defined function
Def Fn name (list of variables)=expression
structure: call a user-defined function
Fn name(list of variables)
instruction: end the current program
End
instruction: interrupt the current program
Stop
instruction: leave current program and return to Edit Screen
Edit
instruction: leave current program and return to Direct Mode
Direct
structure: insert a reminder message into a program
Rem Typed in statement
' Typed in statement
function: return the leftmost characters of a string
destination$=Left$(source$,number)
Left$(destination$,number)=source$
Exactly the same processes can be performed with characters from the right-hand side of a string, by using the equivalent RIGHT$ function.
-function: return the rightmost characters of a string
destination$=Right$(source$,number)
Right$(destination$,number)=source$
function: return a number of characters from the middle of a string
destination$=Mid$(source$,offset,number)
Mid$(destination$,offset,number)=source$
function: search for occurrences of one string within another string
x=Instr(host$,guest$)
x=Instr(host$,guest$,start of search position)
function: convert a string of text to upper case
new$=Upper$(old$)
function: convert a string of text to lower case
new$=Lower$(old$)
function: convert a number into a string
s$=Str$(number)
function: convert a string of digits into a number
v=Val(x$)
v#=Val(x$)
function: create a new string from an existing string
new$=String$(existing$, number)
function: space out a string
s$=Space$(number of spaces)
function: invert a string
inverted$=Flip$(original$)
function: repeat a string
r$=Repeat$(text$,number)
function: return the character with a given ASCII code
s$=Chr$(code number)
function: Give the ASCII code of a character
code=Asc(a$)
function: give the length of a string
length=Len(a$)
To end this Chapter, here are a pair of useful instructions for manipulating arrays.
-instruction: sort all elements in an array
Sort a(0)
Sort a#(0)
@@ -356,7 +356,7 @@
function: search an array for a value
x=Match(array(0),value)
x=Match(array#(0),value#)
diff --git a/05-03-maths.html b/05-03-maths.html
index a92fbe5..461b341 100644
--- a/05-03-maths.html
+++ b/05-03-maths.html
@@ -133,7 +133,7 @@
There are three instructions that can be used to speedflip the process of simple calculations.
-instruction: increment an integer variable by 1
Inc variable
instruction: decrement an integer variable by 1
Dec variable
instruction: perform fast integer addition
Add variable,expression
Add variable,expression,base To top
function: return the maximum of two values
value=Max(a,b)
value#=Max(a#,b#)
@@ -215,7 +215,7 @@
function: return the minimum of two values
value=Min(a,b)
value#=Min(a#,b#)
@@ -237,7 +237,7 @@
Any number can have one of three values: negative, positive or zero, and these are represented by the "sign" of a number.
-function: return the sign of a number
sign=Sgn(value)
sign=Sgn(value#)
function: return an absolute value
a=Abs(value)
a=Abs(value#)
function: convert floating point number into an integer
integer=Int(number#)
instruction: fix precision of floating point
Fix(number)
instruction: engage double precision accuracy
Set Double Precision
function: calculate square root
square=Sqr(number)
square#=Sqr(number#)
function: calculate exponential
exponential#=Exp(value#)
function: return logarithm
a=Log(value)
a#=Log(value#)
function: return natural logarithm
a#=Ln(value#)
function: return a constant &pi
p#=Pi#
instruction: use degrees
Degree
instruction: use radians
Radian
If DEGREE has already been called, the RADIAN function returns to the default status, where all future angles are expected to be entered in radians.
-function: calculate sine of an angle
s#=Sin(angle)
s#=Sin(angle#)
function: calculate cosine of an angle
c#=Cos(angle)
c#=Cos(angle#)
function: calculate tangent of an angle
t#=Tan(angle)
t#=Tan(angle#)
function: calculate arc cosine
a#=Acos(number#)
function: calculate arc sine
a#=Asin(number#)
Similarly to ACOS, the ASIN function calculates the angle needed to generate a value with SIN. -
function: calculate arc tangent
a#=Atan(number#)
function: calculate hyperbolic sine
h#=Hsin(angle)
h#=Hsin(angle#)
The HSIN function calculates the hyperbolic sine of a given angle.
-function: calculate hyperbolic cosine
h#=Hcos(angle)
h#=Hcos(angle#)
Use this function to find the hyperbolic cosine of an angle.
-function: calculate hyperbolic tangent
h#=Htan(angle)
h#=Htan(angle#)
function: generate a random number
value=Rnd(number)
instruction: set the seed for a random number
Randomize seed
reserved variable: count in 50ths of a second
v=Timer
Timer=v
structure: jump to a specified place in the program
Goto label
Goto line number
@@ -88,7 +88,7 @@
structure: jump to a sub-routine
Gosub label
Gosub number
@@ -110,7 +110,7 @@
instruction: return from a sub-routine called by GOSUB
Return
instruction: remove RETURN information
Pop
structure: qualify a condition
If condition Then statement1 Else statement2
structure: terminate a structured test
If structured test End If
Note how each IF statement must be paired with a single END IF to inform AMOS Professional exactly which group of instructions is to be executed inside the test.
-structure: allow multiple structured tests
If condition Else If multiple conditions ... Else statement End If
structure: toggle binary digits
value=Not digits
Since -1 (True) can be expressed in binary as %1111111111111111, then NOT TRUE must be equal to FALSE, and a logical NOT operation is achieved.
-structure: swap the contents of two variables
Swap a,b
Swap a#,b#
@@ -416,7 +416,7 @@
structure: exit from a loop depending on a test
Exit If expression
Exit If expression,number
structure: control increment of index in a loop
For index=first number To last number Step size
structure: jump on recognising a variable
On variable Proc list of procedures
On variable Goto list of numbered lines or labels
@@ -640,7 +640,7 @@
instruction: call subroutine or procedure at regular intervals
Every time Gosub label
Every time Proc name
structure: place a list of data items in a program
Data list
structure: read data into a variable
Read list
structure: set the current READ pointer
Restore Label
Restore LABEL$
diff --git a/05-05-procedures.html b/05-05-procedures.html
index e18233e..0c646c2 100644
--- a/05-05-procedures.html
+++ b/05-05-procedures.html
@@ -38,11 +38,11 @@
structure: create a procedure
Procedure NAME [list of optional parameters]
structure: end a procedure
End Proc
instruction: set stack space
Set Stack number
structure: flag a procedure
Proc NAME
Normally, procedures will only return to the main program when the END PROC instruction is reached. But supposing you need to jump out of a procedure instantly.
-structure: leave a procedure immediately
Pop Proc
structure: jump to a procedure when break in program
On Break Proc NAME
structure: define a list of global variables
Shared list of variables
structure: declare a list of global variables for procedures
Global list of variables
function: return a parameter from a procedure
Param
Param#
diff --git a/05-06-text.html b/05-06-text.html
index 2b96749..8748e24 100644
--- a/05-06-text.html
+++ b/05-06-text.html
@@ -41,7 +41,7 @@
The PRINT instruction is one of the most familiar command words in most Basic languages.
-instruction: print items on screen
Print items
instruction: set the colour of text
Pen index number
function: return a control index number to set the pen colour
p$=Pen$(index number)
instruction: set colour of text background
Paper index number
function: return a control index number to set background colour
b$=PAPER$(index number)
instruction: set the style of a text font
Set Text style number
Set the appropriate bits in the form of a style number from 0 to 7, as in the last example.
-function: return current text style
s=Text Styles
For even more flexibility in presenting your text on screen, you can select the way it is combined with other screen data.
-instruction: select text writing mode of subsequent text
Writing value1
Writing value1,optional value2
instruction: position the text cursor
Locate x,
Locate ,y
@@ -313,7 +313,7 @@
instruction: force text cursor home
Home
instruction: move text cursor
Cmove width
Cmove height
@@ -348,7 +348,7 @@
function: return control string to move text cursor
a$=Cmove$(x,y)
function: return a string to position the text cursor
a$=At(x,y)
instruction: print text centrally on current line
Centre a$
function: move text cursor to next Tab
t$=Tab$
The default setting for this is four characters, which can be changed as follows:
-instruction: change Tab setting
Set Tab number
instruction: move text cursor down
Cdown
function: return control character to move text cursor down
c$=Cdown$
instruction: move text cursor one line up
Cup
instruction: move text cursor one character left
Cleft
instruction: move text cursor one character right
Cright
These three commands are self-explanatory, and work in exactly the same way as CDOWN. their equivalent functions are listed below, and work in the same way as CDOWN$:
-function: return control character (30) to move cursor up one line
x$=Cup$
function: return control character (29) to move cursor left one character
x$=Cleft$
function: return control character (28) to move cursor right one character
x$=Cright$
instruction: clear some or all text on current cursor line
Cline
Cline number
instruction: select colour of text cursor
Curs Pen index number
instruction: set the shape of the text cursor
Set Curs L1,L2,L3,L4,L5,L6,L7,L8
function: create a zone around text
z$=ZONE$(text$,zone number)
function: create a border around text
b$=Border$(text$, border number)
instruction: scroll text horizontally
Hscroll number
instruction: scroll text vertical
Vscroll number
instruction: format printed output
Print Using format$;variable list
instruction: output a list of variables to a printer
Lprint variable list
instruction: create a window
Wind Open number,x,y,width,height
Wind Open number,x,y,width,height,border
instruction: change the current window
Window number
The active window is host to the flashing text cursor, unless it has been made invisible with a CURS OFF command.
-instruction: change window border
Border number,paper, pen
instruction: set title at top of current window
Title Top title$
instruction: set title at bottom of current window
Title Bottom title$
function: return the value of the current window
w=Windon
instruction: save the contents of the current window
Wind Save
instruction: close the current window
Wind Close
instruction: move the current window
Wind Move x,y
instruction: change the size of the current window
Wind Size width, height
instruction: clear the current window
Clw
One of the standard uses of windows is to create interactive slider bars, like the one at the right- hand side of your AMOS Professional Edit Screen.
-instruction: draw a horizontal slider bar
Hslider x1 ,y1 To x2,y2, units, position, length
instruction: draw a vertical slider
Vslider x1 ,y1 To x2,y2,units,position,length
instruction: set fill pattern for slider bar
Set Slider ink1,paper1,outline1,pattern1,ink2,paper2,outline2,pattern2
instruction: display a text window on screen
Read Text$ name$
Read Text$ name$,address, length
function: read status of joystick
status=Joy(port number)
function: test for joystick movement towards the left
x=Jleft(port number)
The three other function in this family are self-evident, as follows:
-function: test for joystick movement towards the right
x=Jright(port number)
function: test for joystick movement upwards
x=Jup(port number)
function: test for joystick movement downwards
x=Jdown(port number)
function: test status of fire-button
x=Fire(port number)
instruction: change the shape of the mouse pointer
Change Mouse number
instruction: remove the mouse pointer from the screen
Hide
Hide On
instruction: reveal the mouse pointer back on screen
Show
Show On
reserved variable: report or set the x-co-ordinate of the mouse pointer
X Mouse
x=X Mouse
reserved variable: report or set the y-coordinate of the mouse pointer
Y Mouse
y=Y Mouse
function: read status of mouse buttons
k=Mouse Key
function: check for click of mouse button
c=Mouse Click
instruction: limit mouse pointer to part of the screen
Limit Mouse x1 ,y1 To x2,y2
Limit Mouse
function: check which screen the mouse pointer is occupying
screen number=Mouse Screen
instruction: reserve a new data bank
Reserve As Data bank number,length
instruction: reserve a new work bank
Reserve as Work bank number,length
instruction: reserve a new chip data bank
Reserve As Chip Data bank number,length
Once a bank has been defined by this command, it will be saved automatically, along with your AMOS Professional Basic program.
-instruction: reserve a new chip work bank
Reserve As Chip Work bank number,length
AMOS Professional provides the simplest of instructions for saving memory banks.
-instruction: save one or more memory banks onto disc
Save "filename.abk"
Save "filename.abk",bank number
Once saved, memory banks need to be retrieved and loaded, ready for use. AMOS Professional makes this process very easy too.
-instruction: load one or more banks into memory
Load "filename"
Load "filename",bank number
instruction: save an unformatted memory block
Bsave file$,start To end
instruction: load block of binary data into bank or address
Bload file$,bank number
Bload file$, address
instruction: clear a single memory bank
Erase bank number
instruction: clear all current memory banks
Erase All
instruction: clear temporary memory banks
Erase Temp
instruction: reduce the size of a bank to new length
Bank Shrink bank number To length
instruction: swap over two memory banks
Bank Swap first bank number, second bank number
instruction: list all current banks in memory
List Bank
AMOS Professional provides a full range of memory bank functions, which are used to provide information about the status of available banks.
-function: return the length of a memory bank
length=Length(bank number)
function: return the address of a memory bank
address=Start(bank number)
function: return the length of a memory bank from a previous program
length=Blength(bank number)
function: return the address of a memory bank from a previous program
address=BSTART(bank number)
Similarly, the BSTART function will give the address of the specified memory bank from a previous program, if possible. An error will be returned if no such bank has been reserved.
-instruction: grab a memory bank used by the previous program
Bgrab bank number
instruction: transfer a memory bank from the current program to the previous program
Bsend bank number
function: get screen table
address=Screen Base
This function returns the base address of the internal table that is used to hold the number and position of AMOS Professional screens.
-function: get Icon base
address=Icon Base(number)
ICON BASE returns the address of the Icon whose number is specified in brackets. The format of this information is exactly the same as for the SPRITE BASE function, explained below.
-function: get Sprite table
n=Sprite Base(number)
instruction: open a new screen
Screen Open number,width,height,colours,pixel mode
function: set screen mode to 320 pixels wide
Screen Open number,width,height,colours,Lowres
function: set screen mode to 640 pixels wide
Screen Open number,width,height,colours,Hires
instruction: erase a screen
Screen Close number
instruction: re-set to the default screen
Default
instruction: display current screen setting
View
instruction: position a screen
Screen Display number
Screen Display number,x,y, width,height
instruction: offset screen at hardware coordinates
Screen Offset number,x,y
instruction: clone a screen
Screen Clone number
instruction: combine two screens
Dual Playfield first screen,second screen
When using SCREEN OFFSET to position a dual playfield screen, always specify the first screen, and never set screen offsets for both dual playfield screens to zero.
-instruction: reverse order of dual playfield screens
Dual Priority first screen, second screen
instruction: clear current screen
Cls
Cls colour number
@@ -418,12 +418,12 @@
instruction: hide a screen
Screen Hide
Screen Hide number
instruction: show a screen
Screen Show
Screen Show number
instruction: move screen to front of display
Screen To Front
Screen To Front number
instruction: move screen to back of display
Screen To Back
Screen To Back number
instruction: set current screen
Screen number
instruction: define standard palette
Default Palette $1,$2,$3 ... $32
instruction: copy palette from a screen
Get Palette number
Get Palette number,mask
AMOS Professional provides a full range of screen functions, to monitor and exploit the current status of your screens.
-function: give current screen number
screen number=Screen
function: give current screen height
height=Screen Height
height=Screen Height number
function: give current screen width
height=Screen Width
height=Screen Width (number)
function: give maximum number of colours
number=Screen Colour
function: give screen number at hardware coordinates
number=SCIN(x,y)
instruction: load an IFF screen from disc
Load Iff "filename"
Load Iff "filename",screen number
instruction: save an IFF screen to disc
Save Iff "filename"
Save Iff "filename"
@@ -719,7 +719,7 @@
Interlaced mode is perfect for displaying pictures, but is not recommended for much else.
-reserved variable: return a value in conjunction with screen resolution
Screen Open number,width,height,colours,Laced+resolution
function: return screen mode
value=Screen Mode
instruction: copy an area of a screen
Screen Copy source number To destination number
Screen Copy source number,x1,y1,x2,y2 To destination number,x3,y3
@@ -118,7 +118,7 @@
instruction: define a scrolling screen zone
Def Scroll number,x1,y1 To x2,y2,horizontal value, vertical value
instruction: scroll a screen zone
Scroll zone number
instruction: change size of part of screen
Zoom source number, x1 ,y1 ,x2,y2 To destination number,x3,y3,x4,y4
instruction: swap over logical and, physical screens
Screen Swap
Screen Swap number
function: return the address of logical screen bit-plane
address=Logbase(plane)
function: return the address of the current screen
address=Phybase(plane)
function: return identification number for physical screen
number=Physic
number=Physic(screen number)
@@ -236,7 +236,7 @@
function: return identification number for logical screen
number=Logic
number=Logic(screen number)
instruction: wait for next vertical blank period
Wait Vbl
@@ -287,7 +287,7 @@
picture compactor extension: pack a screen
Spack screen number To bank number
Spack screen number To bank number xl,y1,x2,y2
picture compactor extension: pack screen data
Pack screen number To bank number
Pack screen number To bank number xl,y1,x2,y2
picture compactor extension: unpack a compacted screen
Unpack bank number
Unpack bank number,x,y
diff --git a/06-03-screen-effects.html b/06-03-screen-effects.html
index 5ee94c1..29e4adc 100644
--- a/06-03-screen-effects.html
+++ b/06-03-screen-effects.html
@@ -31,7 +31,7 @@
When the image of one screen dissolves and melts into the image of another screen, various "fade" effects are produced.
-instruction: fade between two screens
Appear source screen To destination screen, pixels
Appear source screen To destination screen, number pixels, range
instruction: blend colours to new values
Fade speed
Fade speed,colour list
@@ -153,7 +153,7 @@
instruction: set flashing colour sequence
Flash index number,"(colour,delay)(colour,delay)(colour,delay)..."
Flash Off
instruction: rotate colour values upwards
Shift Up delay,first,last,flag
instruction: rotate colour values downwards
Shift Down delay,first,last,flag
instruction: turn off all colour shifts for current screen
Shift Off
instruction: define a rainbow
Set Rainbow number,index,height,red$,green$,blue$
instruction: display a rainbow
Rainbow number,offset,vertical position,height
instruction: delete a rainbow
Rainbow Del
Rainbow Del number
function: change the colour of a rainbow line
Rain(number,line)=colour
instruction: plot a single point
Plot x,y
Plot x,y,colour
function: return the colour of a point
c=Point(x,y)
instruction: position the graphics cursor
Gr Locate x,y>
@@ -114,7 +114,7 @@
instruction: draw a line
Draw x1 ,y1 To x2,y2
Draw To x,y
%01111111111111111-
instruction: set a line style
Set Line binary mask
Here is a range of AMOS Professional short-cuts for drawing outline shapes on the screen.
-instruction: draw multiple line
Polyline x1 ,y1 To x2,y2 To x3,y3
Polyline To x1 ,y1 To x2,y2
instruction: draw a rectangular outline
Box x1 ,y1 To x2,y2
instruction: draw a circular outline
Circle x,y,radius
instruction: draw an elliptical outline
Ellipse x,y,radius1,radius2
instruction: restrict drawing to a limited screen area
Clip
Clip x1 ,y1 To x2,y2
instruction: set drawing colour
Ink number
Ink number,pattern,border
function: read the colour assignment
c=Colour(index)
instruction: assign a colour to an index
Colour number,$RGB
instruction: set the current screen colours
Palette colour list
instruction: fill a screen area with colour
Paint x,y
Paint x,y,mode
instruction: draw a filled rectangle
Bar x1,y1 To x2,y2
instruction: draw a filled polygon
Polygon x1,y1 To x2,y2 To x3,y3
Polygon To x1,y1, To x2,y2
instruction: select a fill pattern
Set Pattern number
instruction: toggle outline mode
Set Paint mode
instruction: change graphic writing mode
Gr Writing bitpattern
instruction: set Temporary Raster
Set Tempras
Set Tempras buffer address,buffer size
instruction: activate a menu
Menu On