Backporting Amstrad CPC to spectrum
Backporting Amstrad CPC to spectrum
does anyone know the equivalent commands for locate, symbol and After?
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices

Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices

Re: Backporting Amstrad CPC to spectrum
AMSTRAD CPC BASIC
AFTER INSTRUCTIONS; AFTER X,[Y] GOSUB N
Calls a subroutine after waiting X fiftieths of a second. Y, optional, specifies which timer to use. There are four, numbered 0 through 3. If Y is not specified, it is assumed to be 0.
AUTO ; AUTO [N],[X]
Automatically numbers the lines of a program starting with line N with X as the increment. By default, N and X are 10.
BORDER ;BORDER X,[Y]
X and Y represent color numbers (0 to 26). Changes the color of the screen edge. If Y is specified, the two colors alternate at the speed determined by the SPEED INK command.
CALL CALL ADR[,parameter list]
Command used in Basic to call a machine language subroutine located at address ADR. A list of parameters can be passed to this subroutine.
CAT ;CAT
Reads the cassette and gives the names of the files found without erasing the program which is in central memory.
CHAIN ; CHAIN name[,N]
Loads a program from the cassette to central memory, deleting the one already there, then executes it starting with line number N, or if N is not specified, with the line with the lowest number.
CLEAR ;CLEAR
Clears the contents of all variables and files.
CLG ;CLG
Clears the graphics screen.
CLOSEIN ; CLOSEIN
Closes a cassette file opened as input.
CLOSEOUT ; CLOSEOUT
Closes an opened cassette file on output.
CLS ;CLS [#n]
Clears the screen or screen window and leaves it colored in the color defined by the last PAPER instruction, n is a channel number between 0 and 7 and corresponds to the screen defined by the WINDOW instruction.
CONT ; CONT
Continues execution of a program after STOP, END, or *break* as long as the program has not been modified.
DATA ;DATA data1,data2,data3,...
Allows you to store in a program a list of constants read by the READ function.
DEF FN ; DEF FNf[(X,..)]=expr
Allows you to define a user function; f represents the name of the function, (X,..) its formal parameters and expr its general expression.
DEFINT ; DEFINT XY ; DEFINT X,Y,...
Defining a set of variables in the range XY or following the list X,Y,... as being of type INTEGER.
DEFREAL; DEFREAL XY ; DEFREAL X,Y,...
Defining a set of variables in the range XY or following the list X,Y,... as being of type SIMPLE PRECISION.
DEFSTR; DEFSTR XY ; DEFSTR X,Y,...
Definition of a set of variables in the range XY or following the list X,Y,... as being of type ALPHANUMERIC (character strings).
DEG ; DEG
Sets the calculation mode to degrees. By default, the sine functions use radians for numeric data. The DEG command is disabled by the CLEAR and RAD commands or by loading another program.
DELETE ; DELETE (N1.N2,...) DELETE N1-N2
Deletes from the program contained in central memory either the series of lines (N1.N2,...), or the lines between the line bearing the number NI and the line bearing the number N2.
DI; Stop interrupts. All commands
generating interrupts, except BREAK, become inoperative.
SUN ; DIM var(n) DIM var{n1,n2,..),var(n1,n2,..)
Sizing an array (var) from 1 to N dimensions. By default, a variable is automatically sized to 10 (var(10)).
DRAW ; DRAW X,Y,A
Draws a line on the screen from the graphics cursor to the coordinate position (X,Y) with color number A.
DRAWR ;DRAWR X,Y,A
Draws a line on the screen from the graphics cursor to a relative position (+X,+Y) to that graphics cursor with color number A.
EDIT ; EDIT N
Switch to edit mode for line number N.
EI
Allows interrupts. Cancels the effect of the DI command.
END ;END
Instruction for ending execution of a program.
ENT ; ENT NE[,SE]
Tone envelope. Allows you to introduce vibratos on the note: NE represents the envelope number (from 0 to 15); SE includes three numbers per section (step count, step size in frequency, pause time), five sections can be described.
ENV ; ENV NE[,SE]
Volume envelope. Allows you to define the sound type: NE represents the envelope number (from 0 to 15); SE includes three numbers per section (number of steps, volume size of the step, time for each step), five sections can be described.
ERASE ; ERASE list of variable names
Allows you to free up the memory space held by the DIM command.
ERROR ; ERROR N
N represents an integer. Allows you to identify a specific type of error and decide on a specific action when it occurs.
EVERY ; EVERY N,M GOSUB NL
Means: every N hundredths of a second, counted on stopwatch number M, execute the subroutine located on line number NL. Four stopwatches are available and numbered from 0 to 3. This command allows you to call a subroutine at regular intervals.
FOR ; FOR var=D to F [STEP P]
Introduces a loop. All statements between FOR var=D to F [STEP P] and the corresponding NEXT var will be repeated for all war values from D to F in steps of P (if P is not specified, in steps of 1):
10 FOR I=1 TO 20 STEP 2
20 PRINT I," ",I*I
30 NEXT I
GOSUB ;GOSUB NL
Calls the subroutine located on line number NL.
GOTO ; GOTO NL
Performs a line break with the number NL.
IF; IF condition THEN statement
Performs the statement following the THEN if the condition following IF is met. IF A=3 THEN GOSUB 1000
INK ; INK ink,color[,color]
Depending on the MODE selected for the screen, a certain number of inks (e) are possible. INK allows you to change the ink color (ink) and the background color (color). If two background colors are specified, they will alternate every fiftieth of a second.
INPUT ; INPUT [#channel number,][; ][string; ]
; list of variables
; INPUT [#channel number,][;][string, ]
; list of variables
Reads data from the specified channel and assigns it to the named variables. The first [;] suppresses the line break at the end of what you type. The ";" after the string causes a ? to appear, while a "," causes the message "?redo from start" to appear when you typed something wrong. When a cassette channel is specified, there is no prompt. An item from the file will be assigned to each variable in the list.
KEY ; KEY integer,string
Allows you to define a new function key. The integer defines the key to which the string of characters will be assigned. 11 is 128 to 140, the 0 key on the keyboard is designated by the number 128, the 1 key by 129 ..., the 9 key by 137, the "." key by 138, the "ENTER" key by 139 and the "CTRL" and "ENTER" keys together by 140.
Example
KEY 132,"RUN"+CHR$(13)
Associates the RUN command followed by "ENTER" with the 4 key on the numeric keypad.
KEY DEF ; KEY DEF key number,repeat,character num
Changes the value produced by a key. KEY DEF 45,1,65 causes the J key to display A, allowing repetition when pressed further.
KEY DEF 46,0,63 causes the N key to display ?, without allowing repetition.
LET; LET variable=expression
Assigns the result of the expression to the right of the equal sign to a variable. LET A=500*3
In Basic AMSTRAD, you can of course simply write A=500*3. LET is only used when you want a program to remain compatible with older programs.
LINE INPUT ;LINE INPUT [#channel number,][;]
;[string;]variable
LINE INPUT "NAME";A$
Reads an entire line from the specified channel (default is 0). When a comma is in the variable, it remains included, whereas a simple INPUT would have split the variable at that point.
LIST ;LIST [line numbers][ ,#channel number]
Lists the program on the desired channel. 0 corresponds to the screen and 8 to the printer. You can stop the scrolling on the screen by pressing ESC once and continue by pressing another key. Pressing ESC twice returns you to direct mode.
LOAD ;LOAD [filename][.address]
Loads a Basic program from the cassette to main memory, replacing everything already there. In the case of a binary program, the load address can be specified.
LOCATE ;LOCATE [#channel number,]X,Y
Places the text cursor at the coordinate position (X,Y) relative to the origin of the screen window (WINDOW). The coordinate point (1,1) is the point in the upper-left corner of the window.
MEMORY ;MEMORY address
Allows you to redefine the address of the highest byte in the memory space used by Basic. By default, this byte is located at address AB7F.
MERGE ; MERGE ["filename"]
Same as LOAD, but does not perform a NEW before loading the program. If line numbers are identical, their contents become those of the new program. If the file name is not specified, the first program encountered will be read. A program on tape, preceded by the "!" sign, is protected and will not be read.
MODE ; MODE N
Allows you to change the screen mode (N=0, 1 or 2). Clears the screen and switches to INKO, regardless of the PAPER INK currently in use. During this command, all text and
graphs are returned to the full screen, while cursors return to their origin point.
MOVE ; MOVE X,Y
Positions the graphics cursor at the absolute position of coordinates (X,Y).
MOVER ; MOVER X,Y
Positions the graphics cursor at a coordinate position (X,Y) relative to the current position.
NEW ; Cleans memory.
Programs and variables disappear, but KEY definitions and the display remain.
NEXT ; FOR 1=1 TO 10: NEXT
Determines the end of a loop started by FOR.
ON...GOTO ; ON n GOTO list of line numbers
ON...GOSUB ;ON n GOSUB list of line numbers
For ON A GOTO 100,110,130,132,170,300,320,1000:
if A=1, the connection will be made at line 100
if A=2, the connection will be made at line 110
if A=7, the connection will be made at line 320,...
ON BREAK GOSUB ON BREAK GOSUB line number
Calls a subroutine when there is a BREAK in the program. A BREAK is performed by pressing the ESC key twice in a row.
ON BREAK STOP
Cancels the effect of the ON BREAK GOSUB instruction.
ON ERROR GOTO ON ERROR GOTO line number
Branches execution to the specified line when an error occurs.
ON SQ GOSUB ;ON SQ (n) GOSUB nl
Executes the subroutine located at line ni when the queue corresponding to the sound channel (n) is no longer full, (n) can only be 1, 2 or 4 corresponding to the respective channels A, B or C.
OPENIN; OPENIN “file name”
Opens a cassette file to allow the program in main memory to use the data in it. If the file name is preceded by a "!", the usual cassette handling messages do not appear and the program reads the first block of the file directly.
OPENOUT ; OPENOUT "filename"
Opens a file on tape to allow the program to deposit data into it. If the file name is preceded by a "!", the usual tape handling messages do not appear. The program immediately creates its first 2K transfer block (buffer) and nothing is written to the tape until the buffer is full or a CLOSE-OUT command has closed the file.
ORIGIN ORIGIN X,Y [,G,D,H,B]
Determines the coordinates (X,Y) of the starting point of the graphics cursor. The optional elements G,R,H,B are used to define a new window.
OUT ; OUT port number, integer
Sends the integer to the specified port. The integer can be between 0 and 255 and the port number can be between 0 and 65535.
PAPER ; PAPER [#channel#,] ink#
Sets the background color of the next characters that will be written on the screen.
PEN ;PEN [#channel#,] ink#
Sets the color of the next characters that will be written on the screen.
PLOT ;PLOT X,Y [,ink number]
Displays, on the screen, the point with coordinates (X,Y) in the color specified by ink number or, failing that, in the color used previously.
PLOTR ; PLOTR X,Y [,ink no.]
Displays on screen the point with coordinates (X,Y) relative to the cursor position. You can choose its color.
POKE ; POKE adr,data
Registered Iâ data at the specified address.
PRINT ; PRINT [channel number,] data
Prints data on the specified channel (0 = default screen).
PRINT USING allows you to specify different print formats.
RAD
Sets the mode to RADIANS.
RANDOMIZE ; RANDOMIZE [N]
Sets the sequence of pseudo-random numbers starting from N, where N is an integer between 0 and G5535. By default, N is 0.
READ ; READ variable list
Reads the data contained in the OATAs lines *and assigns them to the various variables specified.
RELEASE ; RELEASE sound channels
Allows you to release a sound channel in waiting state.
REM
Introduces a comment line.
RENUM; RENUM [nnl,][anl,][d]
Renumbers the lines of the program present in central memory, nnl = new line number, equals 10 by default; anl = old line number, equals the number of the first line of the program by default; d = difference between two lines, equals 10 by default.
RESTORE ; RESTORE [line number]
Sets the line at which DATA reading should begin. If no line number is specified, reading begins at the first line containing DATA.
RESUME RESUME [restart line number]
Allows program execution to continue from the restart line, after an error has been detected and corrected by an ON ERROR GOTO command.
RETURN
Return to the main program, after calling a subroutine, using the G05UB... instruction.
RUN ;RUN [line number]
Executes the program present in central memory starting from the line with the specified number or, failing that, from the line with the lowest number. RUN "program name"
Loads the specified program which is on cassette and begins its execution. If no program name is given (RUN ""), Basic loads and executes the first program encountered on the cassette.
SOUND ; SOUND channel,period[,duration[,volume[,volume envelope[,tone envelope]]]]
Produces the specified sound.
Channel: The three channels A, B and C can be selected together, in pairs or separately. For more information, see the explanations about the CHIPS AY3-8912. Period: Takes values between 0 and 4095. The frequency of the sound is obtained by dividing 125,000 by the period.
Duration: Can take values between -32768 and +32767. Takes the value 20 by default. If the duration has a positive value, it represents a number of hundredths of a second; if it has a negative value, it represents the number of repetitions of complete volume envelopes.
Volume: Takes a value between 0 and 15. By default, it takes the value 12 if an ENV command has been formulated and the value 4 otherwise.
Volume envelope: Can take a value between 0 and 15 (0 by default) and indicates the type of envelope defined by the ENV instruction.
Tone envelope: can take a value between 0 and 15 (default 0) and indicates the type of tone envelope defined by the ENT command.
SPEED INK ; SPEEK INK integer, integer
Allows you to modify the alternation speed of the two background colors in the case where two colors have been defined during the INK command: 10 INK 0,1,9 20 SPEED INK 100,20
SPEED KEY ; SPEED KEY wait, repeat period
Allows you to set the amount of time a key must be pressed for it to repeat (wait) and the repeat speed (repeat period). These settings are made to the fiftieth of a second with a default value of 10.10.
SPEED WRITE SPEED WRITE n
n = 1 or 0
Allows you to change the recording speed of a program on tape. At the time of reading (LOAD), the CPC464 automatically establishes the correct reading speed. For n = 0, the writing speed will be 1000 baud; for n = 1, it will be 2000 baud. By default, n = 0.
STOP
Allows you to stop the execution of a program while giving the user the possibility of continuing it using the C0NT command.
SYMBOL ; SYMBOL character number, character list
Allows you to redefine the character whose number is indicated. All characters between 240 and 255 can be redefining. If you want to redefine others, see the SYMBOL AFTER command.
SYMBOL AFTER SYMBOL AFTER integer
Sets the number of characters you want to redefine. Default is 240.
TAG ; TAG [#channel number]
Allows you to enter characters at the position of the graphics cursor. Texts can thus be mixed with graphics.
10 MOVE 200,300
20 PRINT "HELLO"
30 TAG
40 PRINT "HELLO"
"HELLO" will be entered at the position of the text cursor while "HELLO" will be entered at the position of the graphics cursor (200,300).
TAGOFF ;TAGOFF [#channel number]
Cancels the effects of the TAG command on the specified channel (default 0) and returns the text to where the text cursor was before the TAG command.
TRON ; TRACE mode validation
TROFF; TRACE mode devalidation
In TRACE mode, when a program is executed, all the line numbers that the execution passes through appear on the screen. This mode is very useful when debugging a program.
WAIT ;WAIT nPORT, mask byte, selection byte
Allows you to wait for a specific combination of bits present on a port to reach a specific value. This instruction reads the contents of the nPORT port, applies a LOGICAL AND function to it with the mask byte, then an EXCLUSIVE OR function with the selection byte and only returns control to the program when the result is different from 0. The mask function is used to isolate the bit(s) to be tested. The selection function is used to invert the state to be tested.
WEND
Ends the loop started by the WHILE command.
WHILE ; WHILE logical expression
WHILE X>2 will execute the program lines between WHILE and WEND as long as the logical expression is true (here, as long as X is greater than 2). The following program:
10 X=4:Y=0
20 WHILE X<>Y
30 INPUT "how much is 2 and 2 ";Y
40 WEND
50 PRINT "bravo":END
will do exactly the same thing as the program:
10 X=4
20 INPUT "how much is 2 and 2 ";Y
30 IF X<>Y THEN GOTO 20
40 PRINT "bravo":END
The usefulness of the WHILE and WEND instructions is only obvious if you practice structured programming. Indeed, one of the principles of this type of programming is to prohibit branching instructions (G0T0,..) in order to make programs more readable.
WIDTH ; WIDTH integer
Tells the Basic program the width of the printer lines in number of characters.
WINDOW ; WINDOW [#channel#,] left, right, up, down
Allows you to define a text window for a given channel on the screen. Channels 0 to 7 can be used to define text windows on the screen.
WINDOW SWAP ; WINDOW SWAP channel number, channel number
Allows you to swap the contents of two windows.
WRITE ;WRITE [#channel number,]
AFTER INSTRUCTIONS; AFTER X,[Y] GOSUB N
Calls a subroutine after waiting X fiftieths of a second. Y, optional, specifies which timer to use. There are four, numbered 0 through 3. If Y is not specified, it is assumed to be 0.
AUTO ; AUTO [N],[X]
Automatically numbers the lines of a program starting with line N with X as the increment. By default, N and X are 10.
BORDER ;BORDER X,[Y]
X and Y represent color numbers (0 to 26). Changes the color of the screen edge. If Y is specified, the two colors alternate at the speed determined by the SPEED INK command.
CALL CALL ADR[,parameter list]
Command used in Basic to call a machine language subroutine located at address ADR. A list of parameters can be passed to this subroutine.
CAT ;CAT
Reads the cassette and gives the names of the files found without erasing the program which is in central memory.
CHAIN ; CHAIN name[,N]
Loads a program from the cassette to central memory, deleting the one already there, then executes it starting with line number N, or if N is not specified, with the line with the lowest number.
CLEAR ;CLEAR
Clears the contents of all variables and files.
CLG ;CLG
Clears the graphics screen.
CLOSEIN ; CLOSEIN
Closes a cassette file opened as input.
CLOSEOUT ; CLOSEOUT
Closes an opened cassette file on output.
CLS ;CLS [#n]
Clears the screen or screen window and leaves it colored in the color defined by the last PAPER instruction, n is a channel number between 0 and 7 and corresponds to the screen defined by the WINDOW instruction.
CONT ; CONT
Continues execution of a program after STOP, END, or *break* as long as the program has not been modified.
DATA ;DATA data1,data2,data3,...
Allows you to store in a program a list of constants read by the READ function.
DEF FN ; DEF FNf[(X,..)]=expr
Allows you to define a user function; f represents the name of the function, (X,..) its formal parameters and expr its general expression.
DEFINT ; DEFINT XY ; DEFINT X,Y,...
Defining a set of variables in the range XY or following the list X,Y,... as being of type INTEGER.
DEFREAL; DEFREAL XY ; DEFREAL X,Y,...
Defining a set of variables in the range XY or following the list X,Y,... as being of type SIMPLE PRECISION.
DEFSTR; DEFSTR XY ; DEFSTR X,Y,...
Definition of a set of variables in the range XY or following the list X,Y,... as being of type ALPHANUMERIC (character strings).
DEG ; DEG
Sets the calculation mode to degrees. By default, the sine functions use radians for numeric data. The DEG command is disabled by the CLEAR and RAD commands or by loading another program.
DELETE ; DELETE (N1.N2,...) DELETE N1-N2
Deletes from the program contained in central memory either the series of lines (N1.N2,...), or the lines between the line bearing the number NI and the line bearing the number N2.
DI; Stop interrupts. All commands
generating interrupts, except BREAK, become inoperative.
SUN ; DIM var(n) DIM var{n1,n2,..),var(n1,n2,..)
Sizing an array (var) from 1 to N dimensions. By default, a variable is automatically sized to 10 (var(10)).
DRAW ; DRAW X,Y,A
Draws a line on the screen from the graphics cursor to the coordinate position (X,Y) with color number A.
DRAWR ;DRAWR X,Y,A
Draws a line on the screen from the graphics cursor to a relative position (+X,+Y) to that graphics cursor with color number A.
EDIT ; EDIT N
Switch to edit mode for line number N.
EI
Allows interrupts. Cancels the effect of the DI command.
END ;END
Instruction for ending execution of a program.
ENT ; ENT NE[,SE]
Tone envelope. Allows you to introduce vibratos on the note: NE represents the envelope number (from 0 to 15); SE includes three numbers per section (step count, step size in frequency, pause time), five sections can be described.
ENV ; ENV NE[,SE]
Volume envelope. Allows you to define the sound type: NE represents the envelope number (from 0 to 15); SE includes three numbers per section (number of steps, volume size of the step, time for each step), five sections can be described.
ERASE ; ERASE list of variable names
Allows you to free up the memory space held by the DIM command.
ERROR ; ERROR N
N represents an integer. Allows you to identify a specific type of error and decide on a specific action when it occurs.
EVERY ; EVERY N,M GOSUB NL
Means: every N hundredths of a second, counted on stopwatch number M, execute the subroutine located on line number NL. Four stopwatches are available and numbered from 0 to 3. This command allows you to call a subroutine at regular intervals.
FOR ; FOR var=D to F [STEP P]
Introduces a loop. All statements between FOR var=D to F [STEP P] and the corresponding NEXT var will be repeated for all war values from D to F in steps of P (if P is not specified, in steps of 1):
10 FOR I=1 TO 20 STEP 2
20 PRINT I," ",I*I
30 NEXT I
GOSUB ;GOSUB NL
Calls the subroutine located on line number NL.
GOTO ; GOTO NL
Performs a line break with the number NL.
IF; IF condition THEN statement
Performs the statement following the THEN if the condition following IF is met. IF A=3 THEN GOSUB 1000
INK ; INK ink,color[,color]
Depending on the MODE selected for the screen, a certain number of inks (e) are possible. INK allows you to change the ink color (ink) and the background color (color). If two background colors are specified, they will alternate every fiftieth of a second.
INPUT ; INPUT [#channel number,][; ][string; ]
; list of variables
; INPUT [#channel number,][;][string, ]
; list of variables
Reads data from the specified channel and assigns it to the named variables. The first [;] suppresses the line break at the end of what you type. The ";" after the string causes a ? to appear, while a "," causes the message "?redo from start" to appear when you typed something wrong. When a cassette channel is specified, there is no prompt. An item from the file will be assigned to each variable in the list.
KEY ; KEY integer,string
Allows you to define a new function key. The integer defines the key to which the string of characters will be assigned. 11 is 128 to 140, the 0 key on the keyboard is designated by the number 128, the 1 key by 129 ..., the 9 key by 137, the "." key by 138, the "ENTER" key by 139 and the "CTRL" and "ENTER" keys together by 140.
Example
KEY 132,"RUN"+CHR$(13)
Associates the RUN command followed by "ENTER" with the 4 key on the numeric keypad.
KEY DEF ; KEY DEF key number,repeat,character num
Changes the value produced by a key. KEY DEF 45,1,65 causes the J key to display A, allowing repetition when pressed further.
KEY DEF 46,0,63 causes the N key to display ?, without allowing repetition.
LET; LET variable=expression
Assigns the result of the expression to the right of the equal sign to a variable. LET A=500*3
In Basic AMSTRAD, you can of course simply write A=500*3. LET is only used when you want a program to remain compatible with older programs.
LINE INPUT ;LINE INPUT [#channel number,][;]
;[string;]variable
LINE INPUT "NAME";A$
Reads an entire line from the specified channel (default is 0). When a comma is in the variable, it remains included, whereas a simple INPUT would have split the variable at that point.
LIST ;LIST [line numbers][ ,#channel number]
Lists the program on the desired channel. 0 corresponds to the screen and 8 to the printer. You can stop the scrolling on the screen by pressing ESC once and continue by pressing another key. Pressing ESC twice returns you to direct mode.
LOAD ;LOAD [filename][.address]
Loads a Basic program from the cassette to main memory, replacing everything already there. In the case of a binary program, the load address can be specified.
LOCATE ;LOCATE [#channel number,]X,Y
Places the text cursor at the coordinate position (X,Y) relative to the origin of the screen window (WINDOW). The coordinate point (1,1) is the point in the upper-left corner of the window.
MEMORY ;MEMORY address
Allows you to redefine the address of the highest byte in the memory space used by Basic. By default, this byte is located at address AB7F.
MERGE ; MERGE ["filename"]
Same as LOAD, but does not perform a NEW before loading the program. If line numbers are identical, their contents become those of the new program. If the file name is not specified, the first program encountered will be read. A program on tape, preceded by the "!" sign, is protected and will not be read.
MODE ; MODE N
Allows you to change the screen mode (N=0, 1 or 2). Clears the screen and switches to INKO, regardless of the PAPER INK currently in use. During this command, all text and
graphs are returned to the full screen, while cursors return to their origin point.
MOVE ; MOVE X,Y
Positions the graphics cursor at the absolute position of coordinates (X,Y).
MOVER ; MOVER X,Y
Positions the graphics cursor at a coordinate position (X,Y) relative to the current position.
NEW ; Cleans memory.
Programs and variables disappear, but KEY definitions and the display remain.
NEXT ; FOR 1=1 TO 10: NEXT
Determines the end of a loop started by FOR.
ON...GOTO ; ON n GOTO list of line numbers
ON...GOSUB ;ON n GOSUB list of line numbers
For ON A GOTO 100,110,130,132,170,300,320,1000:
if A=1, the connection will be made at line 100
if A=2, the connection will be made at line 110
if A=7, the connection will be made at line 320,...
ON BREAK GOSUB ON BREAK GOSUB line number
Calls a subroutine when there is a BREAK in the program. A BREAK is performed by pressing the ESC key twice in a row.
ON BREAK STOP
Cancels the effect of the ON BREAK GOSUB instruction.
ON ERROR GOTO ON ERROR GOTO line number
Branches execution to the specified line when an error occurs.
ON SQ GOSUB ;ON SQ (n) GOSUB nl
Executes the subroutine located at line ni when the queue corresponding to the sound channel (n) is no longer full, (n) can only be 1, 2 or 4 corresponding to the respective channels A, B or C.
OPENIN; OPENIN “file name”
Opens a cassette file to allow the program in main memory to use the data in it. If the file name is preceded by a "!", the usual cassette handling messages do not appear and the program reads the first block of the file directly.
OPENOUT ; OPENOUT "filename"
Opens a file on tape to allow the program to deposit data into it. If the file name is preceded by a "!", the usual tape handling messages do not appear. The program immediately creates its first 2K transfer block (buffer) and nothing is written to the tape until the buffer is full or a CLOSE-OUT command has closed the file.
ORIGIN ORIGIN X,Y [,G,D,H,B]
Determines the coordinates (X,Y) of the starting point of the graphics cursor. The optional elements G,R,H,B are used to define a new window.
OUT ; OUT port number, integer
Sends the integer to the specified port. The integer can be between 0 and 255 and the port number can be between 0 and 65535.
PAPER ; PAPER [#channel#,] ink#
Sets the background color of the next characters that will be written on the screen.
PEN ;PEN [#channel#,] ink#
Sets the color of the next characters that will be written on the screen.
PLOT ;PLOT X,Y [,ink number]
Displays, on the screen, the point with coordinates (X,Y) in the color specified by ink number or, failing that, in the color used previously.
PLOTR ; PLOTR X,Y [,ink no.]
Displays on screen the point with coordinates (X,Y) relative to the cursor position. You can choose its color.
POKE ; POKE adr,data
Registered Iâ data at the specified address.
PRINT ; PRINT [channel number,] data
Prints data on the specified channel (0 = default screen).
PRINT USING allows you to specify different print formats.
RAD
Sets the mode to RADIANS.
RANDOMIZE ; RANDOMIZE [N]
Sets the sequence of pseudo-random numbers starting from N, where N is an integer between 0 and G5535. By default, N is 0.
READ ; READ variable list
Reads the data contained in the OATAs lines *and assigns them to the various variables specified.
RELEASE ; RELEASE sound channels
Allows you to release a sound channel in waiting state.
REM
Introduces a comment line.
RENUM; RENUM [nnl,][anl,][d]
Renumbers the lines of the program present in central memory, nnl = new line number, equals 10 by default; anl = old line number, equals the number of the first line of the program by default; d = difference between two lines, equals 10 by default.
RESTORE ; RESTORE [line number]
Sets the line at which DATA reading should begin. If no line number is specified, reading begins at the first line containing DATA.
RESUME RESUME [restart line number]
Allows program execution to continue from the restart line, after an error has been detected and corrected by an ON ERROR GOTO command.
RETURN
Return to the main program, after calling a subroutine, using the G05UB... instruction.
RUN ;RUN [line number]
Executes the program present in central memory starting from the line with the specified number or, failing that, from the line with the lowest number. RUN "program name"
Loads the specified program which is on cassette and begins its execution. If no program name is given (RUN ""), Basic loads and executes the first program encountered on the cassette.
SOUND ; SOUND channel,period[,duration[,volume[,volume envelope[,tone envelope]]]]
Produces the specified sound.
Channel: The three channels A, B and C can be selected together, in pairs or separately. For more information, see the explanations about the CHIPS AY3-8912. Period: Takes values between 0 and 4095. The frequency of the sound is obtained by dividing 125,000 by the period.
Duration: Can take values between -32768 and +32767. Takes the value 20 by default. If the duration has a positive value, it represents a number of hundredths of a second; if it has a negative value, it represents the number of repetitions of complete volume envelopes.
Volume: Takes a value between 0 and 15. By default, it takes the value 12 if an ENV command has been formulated and the value 4 otherwise.
Volume envelope: Can take a value between 0 and 15 (0 by default) and indicates the type of envelope defined by the ENV instruction.
Tone envelope: can take a value between 0 and 15 (default 0) and indicates the type of tone envelope defined by the ENT command.
SPEED INK ; SPEEK INK integer, integer
Allows you to modify the alternation speed of the two background colors in the case where two colors have been defined during the INK command: 10 INK 0,1,9 20 SPEED INK 100,20
SPEED KEY ; SPEED KEY wait, repeat period
Allows you to set the amount of time a key must be pressed for it to repeat (wait) and the repeat speed (repeat period). These settings are made to the fiftieth of a second with a default value of 10.10.
SPEED WRITE SPEED WRITE n
n = 1 or 0
Allows you to change the recording speed of a program on tape. At the time of reading (LOAD), the CPC464 automatically establishes the correct reading speed. For n = 0, the writing speed will be 1000 baud; for n = 1, it will be 2000 baud. By default, n = 0.
STOP
Allows you to stop the execution of a program while giving the user the possibility of continuing it using the C0NT command.
SYMBOL ; SYMBOL character number, character list
Allows you to redefine the character whose number is indicated. All characters between 240 and 255 can be redefining. If you want to redefine others, see the SYMBOL AFTER command.
SYMBOL AFTER SYMBOL AFTER integer
Sets the number of characters you want to redefine. Default is 240.
TAG ; TAG [#channel number]
Allows you to enter characters at the position of the graphics cursor. Texts can thus be mixed with graphics.
10 MOVE 200,300
20 PRINT "HELLO"
30 TAG
40 PRINT "HELLO"
"HELLO" will be entered at the position of the text cursor while "HELLO" will be entered at the position of the graphics cursor (200,300).
TAGOFF ;TAGOFF [#channel number]
Cancels the effects of the TAG command on the specified channel (default 0) and returns the text to where the text cursor was before the TAG command.
TRON ; TRACE mode validation
TROFF; TRACE mode devalidation
In TRACE mode, when a program is executed, all the line numbers that the execution passes through appear on the screen. This mode is very useful when debugging a program.
WAIT ;WAIT nPORT, mask byte, selection byte
Allows you to wait for a specific combination of bits present on a port to reach a specific value. This instruction reads the contents of the nPORT port, applies a LOGICAL AND function to it with the mask byte, then an EXCLUSIVE OR function with the selection byte and only returns control to the program when the result is different from 0. The mask function is used to isolate the bit(s) to be tested. The selection function is used to invert the state to be tested.
WEND
Ends the loop started by the WHILE command.
WHILE ; WHILE logical expression
WHILE X>2 will execute the program lines between WHILE and WEND as long as the logical expression is true (here, as long as X is greater than 2). The following program:
10 X=4:Y=0
20 WHILE X<>Y
30 INPUT "how much is 2 and 2 ";Y
40 WEND
50 PRINT "bravo":END
will do exactly the same thing as the program:
10 X=4
20 INPUT "how much is 2 and 2 ";Y
30 IF X<>Y THEN GOTO 20
40 PRINT "bravo":END
The usefulness of the WHILE and WEND instructions is only obvious if you practice structured programming. Indeed, one of the principles of this type of programming is to prohibit branching instructions (G0T0,..) in order to make programs more readable.
WIDTH ; WIDTH integer
Tells the Basic program the width of the printer lines in number of characters.
WINDOW ; WINDOW [#channel#,] left, right, up, down
Allows you to define a text window for a given channel on the screen. Channels 0 to 7 can be used to define text windows on the screen.
WINDOW SWAP ; WINDOW SWAP channel number, channel number
Allows you to swap the contents of two windows.
WRITE ;WRITE [#channel number,]
- Writes the desired expressions to the specified channel (0 by default) without changing the punctuation.
WRITE "HELLO", 23, 5 will write on the screen: "HELLO", 23, 5
XPOS
Gives the abscissa (horizontal position) of the graphics cursor.
YPOS
Gives the ordinate (vertical position) of the graphics cursor.
ZONE ;ZONE integer
Allows you to change the space between two automatic tabs obtained by a comma. This tab is 13 by default. ZONE 2:PRINT 1,2,3
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: Backporting Amstrad CPC to spectrum
RTFM !
locate:
PRINT AT Y,X;
symbol: (SYMBOL ASC"a",1,2,3,4,5,6,7,8):
DATA 1,2,3,4,5,6,7,8
FOR A=USR"a" TO USR"a"+7
READ SYMBOL
POKE A,SYMBOL
NEXT A
After:
PAUSE 100
GOSUB 1000
("SYMBOL AFTER" reserve memory room to the UDG, can't be used on the SPECTRUM, only 20 or 21 chars in the range UDG `a' to `u' (`t' and `u' will only have the desired effect if the program is run on a 48k speccy or in 48k mode, though)
All chars (96) can be redefined in ASM:(Spectrum 48k only)
Spectrum script generated by "UDG's Factory" (select "dec listing" in the export window): http://dskcenter.free.fr/udgs/
locate:
PRINT AT Y,X;
symbol: (SYMBOL ASC"a",1,2,3,4,5,6,7,8):
DATA 1,2,3,4,5,6,7,8
FOR A=USR"a" TO USR"a"+7
READ SYMBOL
POKE A,SYMBOL
NEXT A
After:
PAUSE 100
GOSUB 1000
("SYMBOL AFTER" reserve memory room to the UDG, can't be used on the SPECTRUM, only 20 or 21 chars in the range UDG `a' to `u' (`t' and `u' will only have the desired effect if the program is run on a 48k speccy or in 48k mode, though)
All chars (96) can be redefined in ASM:(Spectrum 48k only)
Code: Select all
10 RESTORE 110
20 FOR i = 0 To 769: READ a: POKE 64583 + i, a: NEXT i
30 RESTORE 50: For i = 0 To 13: READ a: POKE 23353 + i, a: Next i:GO TO 110
40 Rem == ROUTINE LM UDG ==
50 DATA 42,71,252,34,54,92,201,42,128,61,34,54,92,201
60 Rem = ROUTINE UDG ON ==
70 POKE 23692,1:RANDOMIZE USR 23353: POKE 23692, 255: RETURN
80 Rem = ROUTINE UDG OFF ==
90 RANDOMIZE USR 23360: RETURN
100 Rem ==== DATAS UDG ====
110 DATA 73,251
120 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,170,170,125,198,75,210,99,190,85,255,85,170,85,170,85,170,85
130 DATA 170,85,170,85,170,85,170,255,171,85,171,85,171,85,171,85,170,213,170,213,170,213,170,213,255,85,170,85,170,85,170,255
140 DATA 0,0,0,48,76,146,68,255,131,7,14,28,56,112,224,193,0,0,6,27,255,29,15,255,0,0,1,11,191,246,248,191
150 DATA 31,59,31,241,31,223,192,192,0,128,0,224,4,110,100,106,0,2,2,62,63,97,45,12,0,0,96,120,254,194,216,24
160 DATA 120,102,102,102,102,102,126,0,24,24,24,24,24,24,24,0,126,6,6,126,96,96,126,0,126,6,6,30,6,6,126,0
170 DATA 96,96,96,126,6,6,6,0,126,96,96,126,6,6,126,0,96,96,96,126,102,102,126,0,126,6,6,6,6,6,6,0
180 DATA 126,102,102,126,102,102,126,0,126,102,102,126,6,6,6,0,128,64,32,17,15,3,1,0,0,0,0,0,0,171,0,0
190 DATA 0,3,5,127,5,3,0,0,120,188,62,255,62,188,120,0,0,28,62,127,127,34,20,8,8,0,8,28,8,20,0,0
200 DATA 0,2,4,8,16,32,64,0,56,124,226,226,226,254,226,0,248,228,248,252,226,226,252,0,60,102,224,224,224,102,60,0
210 DATA 252,230,226,226,226,230,252,0,254,224,252,224,224,224,254,0,254,224,224,252,224,224,224,0,60,102,224,224,238,102,60,0
220 DATA 226,226,226,254,226,226,226,0,124,56,56,56,56,56,124,0,62,28,28,28,28,156,120,0,228,232,240,240,232,228,226,0
230 DATA 224,224,224,224,224,224,254,0,226,246,234,226,226,226,226,0,226,242,234,230,226,226,226,0,56,100,226,226,226,100,56,0
240 DATA 252,226,226,226,252,224,224,0,56,100,226,226,234,100,58,0,252,226,226,252,228,226,226,0,124,224,124,14,14,14,124,0
250 DATA 254,56,56,56,56,56,56,0,226,226,226,226,226,226,124,0,226,226,226,226,114,60,24,0,0,8,12,11,22,28,32,255
260 DATA 129,226,244,248,16,200,192,255,226,226,116,56,56,56,56,0,254,14,28,56,112,224,254,0,0,0,0,0,0,0,0,255
270 DATA 0,0,15,28,42,73,136,255,0,0,240,8,4,2,129,255,0,0,0,31,17,31,4,255,192,48,15,2,127,192,101,63
280 DATA 0,112,240,16,254,1,74,252,1,15,19,255,255,207,48,48,255,255,255,255,255,50,204,204,110,211,169,213,122,24,24,60
290 DATA 129,82,44,89,16,16,16,255,1,3,7,12,28,62,103,193,5,175,253,51,217,142,46,60,128,192,96,48,56,204,158,65
300 DATA 7,0,14,0,28,0,56,0,0,0,7,25,35,255,4,3,3,7,252,255,252,255,32,48,0,0,0,52,109,52,0,0
310 DATA 0,0,0,16,56,16,40,255,0,0,7,9,127,255,127,0,0,0,255,255,221,255,255,255,7,63,255,255,255,248,228,131
320 DATA 0,0,255,136,136,255,254,255,0,0,255,136,136,255,254,255,127,255,155,155,251,251,255,255,0,0,0,52,109,52,0,0
330 DATA 16,254,254,254,16,56,84,146,255,0,0,0,0,0,0,0,0,0,99,101,179,36,82,129,127,241,251,251,255,153,102,102
340 DATA 255,24,90,104,255,128,0,0,255,255,255,195,199,137,134,6,159,157,157,31,255,57,198,198,17,10,68,188,28,19,36,82
350 DATA 130,16,1,64,0,2,128,5,170,85,170,85,170,85,170,85,0,0,192,254,159,254,192,0,0,4,4,8,56,24,0,0
360 DATA 80,0,0,0,0,0,0,0,15,15,15,15,0,0,0,0,240,240,240,240,0,0,0,0,255,255,255,255,0,0,0,0
370 Rem ==== TEST UDG ====
380 GO SUB 70:PRINT: FOR a = 32 TO 143: PRINT CHR$(a); " ";: Next a
390 GO TO 390
400 Go Sub 90
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: Backporting Amstrad CPC to spectrum
I apologize for testing your patience, took me a bit to get to this. I understand if you are pissed off
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices

Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
