Return to the Home Page...
Features on BBC BASIC programming...
Your questions and answers...
Buy or Sell an NC...
The NC200 manual and data sheets for BBC BASIC...
Information about BBC BASIC on the NC...
Free software for you to download...
 
Full index to software...
Applications...
Games...
Novelty programs...
Utilities...
Procedures...
Odds 'n' Ends...

Tim's Amstrad NC Users' Site

BBC BASIC Procedures to Download

The following Procedures are not programs themselves, but building-blocks which you can use as part of your own programs

---Procedures

OFNfull_date Sets a string variable to the date in full
OPROCtrue_alpha_placer Places a word into an ordered list
OPROCcircle Draws a circle
OPROCflood_fill Fills any shape
OPROCget_word Takes the next word from a sentence
OPROCrectangle Draws a rectangle
OPROCyellow_events Invoke a yellow-event from a program
OSorting Routines Bubble, Diminish and Exchange sorts

Programs marked 'From ANUW' are taken from Mark Ray's Amstrad Notepad Users Web.

FNfull_date

Written by: Peter Hopkins

For: NC100 NC200

FULLDATE.TXT ... 1.1kb

I use FNfull_date in my Auto program as it gives the date in a fuller form, programs some keys and also writes to a file called Date$.Dat which can be read in by other programs.

Within Protext you get the date such as "1 August 2000" by pressing the Control Symbol and D keys at the same time . FNfull_date sets the keys Shift Symbol and D to give the date as "Tuesday 1st August 2000".

X=OPENIN "Date$.Dat" : INPUT# X, date$ : CLOSE# X

The line above be used in programs to read Date$.Dat into a variable called date$

If you have my Accounts program, then by removing the REM on line 120 and deleting line 130 it will now display the date in the new form.

PROCtrue_alpha_placer

Written by: Tim Surtell

For: NC100 NC200

PLACER.TXT ... 1.7kb

This routine places a supplied word in to a supplied list at the correct position.
It is a true sorting program, since in an alphabetical list, all letters in the words are taken into account rather than just the first, meaning you get a list of the type seen in a dictionary.
The first part of the program removes punctuation, spaces, and converts lower case to upper case, but all these things are put back in the list at the end.

Inputs

sw$(n) -- This is the list of words.
num -- Total number of words in sw$(n)
sw$(0) -- Put the word that needs to be put in the list in the 0 cell of sw$.

Outputs

sw$(n) -- This is the revised list.
num -- This will be increased by one.

PROCcircle

Written by: Tim Surtell

For: NC100 NC200

CIRCLE.TXT ... 770 bytes

Simple procedure to draw a circle.

Inputs

X,Y -- The co-ordinates of the centre of the circle.
XR,YR -- The x radius and the y radius. If they are different an ellipse is produced.
IS,OS -- InSide colour and OutSide colour. 1-Black 2-White 3-Not filled.

PROCflood_fill

Written by: Unknown

For: NC100 NC200

FILL.TXT ... 1kb

Fills any type of shape in black. (Very slow!)

Inputs :-

startx%,starty% -- Any point inside the shape.

PROCget_word

Written by: Tim Surtell

For: NC100 NC200

GETWORD.TXT ... 911 bytes

This is a routine to take one word from a sentence at a time and is useful for programs that have command lines.

Inputs :-

sent$ -- This is the sentence that will be used.
start -- Make sure this is set to 1 before calling the procedure for the first time.

Outputs :-

word$ -- This is the next word found in the sentence, and will change each time the procedure is called, unless you alter 'start'. If 'word$' contains 'EMPTY' then the end of the sentence has been reached.

PROCrectangle

Written by: Tim Surtell

For: NC100 NC200

RECT.TXT ... 643 bytes

Simple procedure to draw a rectangle.

Inputs

X1,Y1 -- The co-ordinates of one corner of the rectangle.
X2,Y2 -- The co-ordinates of the other corner of the rectangle.
IS,OS -- InSide colour and OutSide colour. 1-Black 2-White 3-Not filled.

PROCyellow_events

Written by: Hans Bohling

For: NC100 NC200

YELLOW.TXT ... 1kb

A yellow event is so called because the FUNCTION key is coloured yellow. A yellow event occurs when the user has pressed one of the FUNCTION+key combinations that cause an immediate context switch (FN+red, FN+green, FN+blue, FN+menu...) or when the machine is powered up and (because the option to preserve context has not been set) needs to return to the main menu. When a yellow event occurs an open application exits normally as quickly as possible and any unsaved files will be saved automatically!

You can use yellow events from BBC BASIC to change into an built-in application by loading the variables B% and C% with the yellow event token and then calling the firmware routine 'kmsetyellow' at &B8D5:

10 ***** Call Editor ********
20 DEF PROC_Editor
30 B%=177:C%=3:CALL &B8D5
40 ENDPROC

Set B% and C% to the correct values as shown below to select a program to go to...

Yellow Event Token FUNCTION+key combination Immediate Context Switch to:
C% D%    
177 3 RED Wordprocessor
178 3 GREEN Calculator
179 3 BLUE Diary/Calender
180 3 MENU Password Entry
181 3   Wordprocessor
182 3 D Address Book
183 3 C Show Calender
184 3 T Clock
185 3 Z Timezone Setting
186 3 A Create new Diary Entry
187 3 N Create new Document
188 3 L File Selector
189 3 P Print File
190 3 B BBC BASIC
191 3 X Start a RAM card Program
192 3 S Serial Transfer Program
PROCbubble_sort
PROCdiminish_sort
PROCexchange_sort

Written by: Unknown

For: NC100 NC200

BUBBLE.TXT ... 479 bytes
DIMINISH.TXT ... 563 bytes
EXCHANGE.TXT ... 406 bytes

These are three routines that sort numbers into ascending order. They all use the same variables, but some are faster than the others in certain applications.

Inputs :-

a%(n) -- This is the array which contains the items to be sorted.
L% -- The total number of items to be sorted (ie., the length of the array.)

Outputs :-

a%(n) -- The array now contains the numbers in ascending order.

 
© 1997 – 2021 Tim Surtell

Tim's Amstrad NC Users Site
www.ncus.org.uk

Return to top of page...

| Home | Features | Data Sheets | Questions | BBC BASIC | Software |