Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_30.ADF » P/+Form1

P/+Form1

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_30.ADF
Filename: P/+Form1
Read OK:
File size: 09C9 bytes
Load address: 2B206576
Exec address: 6D726F46
File contents
Controlling a printer from BASIC

In my job one of the things I have to do is to test installations and make
out a form to a prescribed format with all of the details.

The sample layout in the IEE manual has a number of lines in condensed
print as well as a lot of spacing and symbols incorporating subscript and
super script. 

I initially designed a form with spaces so that I could fill in the
details later. I then designed some simple INPUT routines so that the
computer would fill in the details for me.

If you LOAD and LIST the program you can see how I controlled the printer.
Most printer manuals have details of how to achieve the various effects
but these consist of expressions such as < ESC > and "l" for example. The
format in BBC BASIC that each command is preceded by VDU. < ESC >
represents 27 and any other character enclosed by < > should be
interpreted literally in this way. So < BEL > is VDU 7. A full list of all
the VDU codes with their names which will be used is in your computer
manual. Characters enclosed by " " should have their ASCII value used so
"l" will equal 49. The quickest way to find an ASCII value is to type in
ASC"l" <ret> this will print 49 on the screen.

One more point which is very important. Every character sent to the
printer should be preceded by a 1. So if the printer for example says
that to select slash zero the command is:

< ESC >  " ~ "  < 1 > 

you will need to enter 

VDU 1,27,1,126,1,1

The idea of using BASIC to design and print a form seems quite a good one.
If anyone would like to improve this one I would be grateful.

Some of the improvements I have in mind include:

being able to alter an input after pressing return

being able to use a comma in a text INPUT routine. When entering addresses
no commas can be used.

having the format of the printed layout controlled so that I can for
example avoid words split at the end of a line and have a word starting on
a new line. For example:

25 Bertie Road South 
sea Hampshire PO4 8J
X

If you are looking at this text in 40 column mode the above problem may
not look as bad as it is intended.

being able to SAVE the DATA which has been input so that copies can be
reprinted later without having to laboriously reenter all the details.
This page is actually only about 1/6 of the total form and the number of
details which need to be entered total over a hundred each time.

I haven't had a chance to try the INPUT routines which are included in
this EUG but these may be useful.

00000000  43 6f 6e 74 72 6f 6c 6c  69 6e 67 20 61 20 70 72  |Controlling a pr|
00000010  69 6e 74 65 72 20 66 72  6f 6d 20 42 41 53 49 43  |inter from BASIC|
00000020  0d 0d 49 6e 20 6d 79 20  6a 6f 62 20 6f 6e 65 20  |..In my job one |
00000030  6f 66 20 74 68 65 20 74  68 69 6e 67 73 20 49 20  |of the things I |
00000040  68 61 76 65 20 74 6f 20  64 6f 20 69 73 20 74 6f  |have to do is to|
00000050  20 74 65 73 74 20 69 6e  73 74 61 6c 6c 61 74 69  | test installati|
00000060  6f 6e 73 20 61 6e 64 20  6d 61 6b 65 0d 6f 75 74  |ons and make.out|
00000070  20 61 20 66 6f 72 6d 20  74 6f 20 61 20 70 72 65  | a form to a pre|
00000080  73 63 72 69 62 65 64 20  66 6f 72 6d 61 74 20 77  |scribed format w|
00000090  69 74 68 20 61 6c 6c 20  6f 66 20 74 68 65 20 64  |ith all of the d|
000000a0  65 74 61 69 6c 73 2e 0d  0d 54 68 65 20 73 61 6d  |etails...The sam|
000000b0  70 6c 65 20 6c 61 79 6f  75 74 20 69 6e 20 74 68  |ple layout in th|
000000c0  65 20 49 45 45 20 6d 61  6e 75 61 6c 20 68 61 73  |e IEE manual has|
000000d0  20 61 20 6e 75 6d 62 65  72 20 6f 66 20 6c 69 6e  | a number of lin|
000000e0  65 73 20 69 6e 20 63 6f  6e 64 65 6e 73 65 64 0d  |es in condensed.|
000000f0  70 72 69 6e 74 20 61 73  20 77 65 6c 6c 20 61 73  |print as well as|
00000100  20 61 20 6c 6f 74 20 6f  66 20 73 70 61 63 69 6e  | a lot of spacin|
00000110  67 20 61 6e 64 20 73 79  6d 62 6f 6c 73 20 69 6e  |g and symbols in|
00000120  63 6f 72 70 6f 72 61 74  69 6e 67 20 73 75 62 73  |corporating subs|
00000130  63 72 69 70 74 20 61 6e  64 0d 73 75 70 65 72 20  |cript and.super |
00000140  73 63 72 69 70 74 2e 20  0d 0d 49 20 69 6e 69 74  |script. ..I init|
00000150  69 61 6c 6c 79 20 64 65  73 69 67 6e 65 64 20 61  |ially designed a|
00000160  20 66 6f 72 6d 20 77 69  74 68 20 73 70 61 63 65  | form with space|
00000170  73 20 73 6f 20 74 68 61  74 20 49 20 63 6f 75 6c  |s so that I coul|
00000180  64 20 66 69 6c 6c 20 69  6e 20 74 68 65 0d 64 65  |d fill in the.de|
00000190  74 61 69 6c 73 20 6c 61  74 65 72 2e 20 49 20 74  |tails later. I t|
000001a0  68 65 6e 20 64 65 73 69  67 6e 65 64 20 73 6f 6d  |hen designed som|
000001b0  65 20 73 69 6d 70 6c 65  20 49 4e 50 55 54 20 72  |e simple INPUT r|
000001c0  6f 75 74 69 6e 65 73 20  73 6f 20 74 68 61 74 20  |outines so that |
000001d0  74 68 65 0d 63 6f 6d 70  75 74 65 72 20 77 6f 75  |the.computer wou|
000001e0  6c 64 20 66 69 6c 6c 20  69 6e 20 74 68 65 20 64  |ld fill in the d|
000001f0  65 74 61 69 6c 73 20 66  6f 72 20 6d 65 2e 0d 0d  |etails for me...|
00000200  49 66 20 79 6f 75 20 4c  4f 41 44 20 61 6e 64 20  |If you LOAD and |
00000210  4c 49 53 54 20 74 68 65  20 70 72 6f 67 72 61 6d  |LIST the program|
00000220  20 79 6f 75 20 63 61 6e  20 73 65 65 20 68 6f 77  | you can see how|
00000230  20 49 20 63 6f 6e 74 72  6f 6c 6c 65 64 20 74 68  | I controlled th|
00000240  65 20 70 72 69 6e 74 65  72 2e 0d 4d 6f 73 74 20  |e printer..Most |
00000250  70 72 69 6e 74 65 72 20  6d 61 6e 75 61 6c 73 20  |printer manuals |
00000260  68 61 76 65 20 64 65 74  61 69 6c 73 20 6f 66 20  |have details of |
00000270  68 6f 77 20 74 6f 20 61  63 68 69 65 76 65 20 74  |how to achieve t|
00000280  68 65 20 76 61 72 69 6f  75 73 20 65 66 66 65 63  |he various effec|
00000290  74 73 0d 62 75 74 20 74  68 65 73 65 20 63 6f 6e  |ts.but these con|
000002a0  73 69 73 74 20 6f 66 20  65 78 70 72 65 73 73 69  |sist of expressi|
000002b0  6f 6e 73 20 73 75 63 68  20 61 73 20 3c 20 45 53  |ons such as < ES|
000002c0  43 20 3e 20 61 6e 64 20  22 6c 22 20 66 6f 72 20  |C > and "l" for |
000002d0  65 78 61 6d 70 6c 65 2e  20 54 68 65 0d 66 6f 72  |example. The.for|
000002e0  6d 61 74 20 69 6e 20 42  42 43 20 42 41 53 49 43  |mat in BBC BASIC|
000002f0  20 74 68 61 74 20 65 61  63 68 20 63 6f 6d 6d 61  | that each comma|
00000300  6e 64 20 69 73 20 70 72  65 63 65 64 65 64 20 62  |nd is preceded b|
00000310  79 20 56 44 55 2e 20 3c  20 45 53 43 20 3e 0d 72  |y VDU. < ESC >.r|
00000320  65 70 72 65 73 65 6e 74  73 20 32 37 20 61 6e 64  |epresents 27 and|
00000330  20 61 6e 79 20 6f 74 68  65 72 20 63 68 61 72 61  | any other chara|
00000340  63 74 65 72 20 65 6e 63  6c 6f 73 65 64 20 62 79  |cter enclosed by|
00000350  20 3c 20 3e 20 73 68 6f  75 6c 64 20 62 65 0d 69  | < > should be.i|
00000360  6e 74 65 72 70 72 65 74  65 64 20 6c 69 74 65 72  |nterpreted liter|
00000370  61 6c 6c 79 20 69 6e 20  74 68 69 73 20 77 61 79  |ally in this way|
00000380  2e 20 53 6f 20 3c 20 42  45 4c 20 3e 20 69 73 20  |. So < BEL > is |
00000390  56 44 55 20 37 2e 20 41  20 66 75 6c 6c 20 6c 69  |VDU 7. A full li|
000003a0  73 74 20 6f 66 20 61 6c  6c 0d 74 68 65 20 56 44  |st of all.the VD|
000003b0  55 20 63 6f 64 65 73 20  77 69 74 68 20 74 68 65  |U codes with the|
000003c0  69 72 20 6e 61 6d 65 73  20 77 68 69 63 68 20 77  |ir names which w|
000003d0  69 6c 6c 20 62 65 20 75  73 65 64 20 69 73 20 69  |ill be used is i|
000003e0  6e 20 79 6f 75 72 20 63  6f 6d 70 75 74 65 72 0d  |n your computer.|
000003f0  6d 61 6e 75 61 6c 2e 20  43 68 61 72 61 63 74 65  |manual. Characte|
00000400  72 73 20 65 6e 63 6c 6f  73 65 64 20 62 79 20 22  |rs enclosed by "|
00000410  20 22 20 73 68 6f 75 6c  64 20 68 61 76 65 20 74  | " should have t|
00000420  68 65 69 72 20 41 53 43  49 49 20 76 61 6c 75 65  |heir ASCII value|
00000430  20 75 73 65 64 20 73 6f  0d 22 6c 22 20 77 69 6c  | used so."l" wil|
00000440  6c 20 65 71 75 61 6c 20  34 39 2e 20 54 68 65 20  |l equal 49. The |
00000450  71 75 69 63 6b 65 73 74  20 77 61 79 20 74 6f 20  |quickest way to |
00000460  66 69 6e 64 20 61 6e 20  41 53 43 49 49 20 76 61  |find an ASCII va|
00000470  6c 75 65 20 69 73 20 74  6f 20 74 79 70 65 20 69  |lue is to type i|
00000480  6e 0d 41 53 43 22 6c 22  20 3c 72 65 74 3e 20 74  |n.ASC"l" <ret> t|
00000490  68 69 73 20 77 69 6c 6c  20 70 72 69 6e 74 20 34  |his will print 4|
000004a0  39 20 6f 6e 20 74 68 65  20 73 63 72 65 65 6e 2e  |9 on the screen.|
000004b0  0d 0d 4f 6e 65 20 6d 6f  72 65 20 70 6f 69 6e 74  |..One more point|
000004c0  20 77 68 69 63 68 20 69  73 20 76 65 72 79 20 69  | which is very i|
000004d0  6d 70 6f 72 74 61 6e 74  2e 20 45 76 65 72 79 20  |mportant. Every |
000004e0  63 68 61 72 61 63 74 65  72 20 73 65 6e 74 20 74  |character sent t|
000004f0  6f 20 74 68 65 0d 70 72  69 6e 74 65 72 20 73 68  |o the.printer sh|
00000500  6f 75 6c 64 20 62 65 20  70 72 65 63 65 64 65 64  |ould be preceded|
00000510  20 62 79 20 61 20 31 2e  20 53 6f 20 69 66 20 74  | by a 1. So if t|
00000520  68 65 20 70 72 69 6e 74  65 72 20 66 6f 72 20 65  |he printer for e|
00000530  78 61 6d 70 6c 65 20 73  61 79 73 0d 74 68 61 74  |xample says.that|
00000540  20 74 6f 20 73 65 6c 65  63 74 20 73 6c 61 73 68  | to select slash|
00000550  20 7a 65 72 6f 20 74 68  65 20 63 6f 6d 6d 61 6e  | zero the comman|
00000560  64 20 69 73 3a 0d 0d 3c  20 45 53 43 20 3e 20 20  |d is:..< ESC >  |
00000570  22 20 7e 20 22 20 20 3c  20 31 20 3e 20 0d 0d 79  |" ~ "  < 1 > ..y|
00000580  6f 75 20 77 69 6c 6c 20  6e 65 65 64 20 74 6f 20  |ou will need to |
00000590  65 6e 74 65 72 20 0d 0d  56 44 55 20 31 2c 32 37  |enter ..VDU 1,27|
000005a0  2c 31 2c 31 32 36 2c 31  2c 31 0d 0d 54 68 65 20  |,1,126,1,1..The |
000005b0  69 64 65 61 20 6f 66 20  75 73 69 6e 67 20 42 41  |idea of using BA|
000005c0  53 49 43 20 74 6f 20 64  65 73 69 67 6e 20 61 6e  |SIC to design an|
000005d0  64 20 70 72 69 6e 74 20  61 20 66 6f 72 6d 20 73  |d print a form s|
000005e0  65 65 6d 73 20 71 75 69  74 65 20 61 20 67 6f 6f  |eems quite a goo|
000005f0  64 20 6f 6e 65 2e 0d 49  66 20 61 6e 79 6f 6e 65  |d one..If anyone|
00000600  20 77 6f 75 6c 64 20 6c  69 6b 65 20 74 6f 20 69  | would like to i|
00000610  6d 70 72 6f 76 65 20 74  68 69 73 20 6f 6e 65 20  |mprove this one |
00000620  49 20 77 6f 75 6c 64 20  62 65 20 67 72 61 74 65  |I would be grate|
00000630  66 75 6c 2e 0d 0d 53 6f  6d 65 20 6f 66 20 74 68  |ful...Some of th|
00000640  65 20 69 6d 70 72 6f 76  65 6d 65 6e 74 73 20 49  |e improvements I|
00000650  20 68 61 76 65 20 69 6e  20 6d 69 6e 64 20 69 6e  | have in mind in|
00000660  63 6c 75 64 65 3a 0d 0d  62 65 69 6e 67 20 61 62  |clude:..being ab|
00000670  6c 65 20 74 6f 20 61 6c  74 65 72 20 61 6e 20 69  |le to alter an i|
00000680  6e 70 75 74 20 61 66 74  65 72 20 70 72 65 73 73  |nput after press|
00000690  69 6e 67 20 72 65 74 75  72 6e 0d 0d 62 65 69 6e  |ing return..bein|
000006a0  67 20 61 62 6c 65 20 74  6f 20 75 73 65 20 61 20  |g able to use a |
000006b0  63 6f 6d 6d 61 20 69 6e  20 61 20 74 65 78 74 20  |comma in a text |
000006c0  49 4e 50 55 54 20 72 6f  75 74 69 6e 65 2e 20 57  |INPUT routine. W|
000006d0  68 65 6e 20 65 6e 74 65  72 69 6e 67 20 61 64 64  |hen entering add|
000006e0  72 65 73 73 65 73 0d 6e  6f 20 63 6f 6d 6d 61 73  |resses.no commas|
000006f0  20 63 61 6e 20 62 65 20  75 73 65 64 2e 0d 0d 68  | can be used...h|
00000700  61 76 69 6e 67 20 74 68  65 20 66 6f 72 6d 61 74  |aving the format|
00000710  20 6f 66 20 74 68 65 20  70 72 69 6e 74 65 64 20  | of the printed |
00000720  6c 61 79 6f 75 74 20 63  6f 6e 74 72 6f 6c 6c 65  |layout controlle|
00000730  64 20 73 6f 20 74 68 61  74 20 49 20 63 61 6e 20  |d so that I can |
00000740  66 6f 72 0d 65 78 61 6d  70 6c 65 20 61 76 6f 69  |for.example avoi|
00000750  64 20 77 6f 72 64 73 20  73 70 6c 69 74 20 61 74  |d words split at|
00000760  20 74 68 65 20 65 6e 64  20 6f 66 20 61 20 6c 69  | the end of a li|
00000770  6e 65 20 61 6e 64 20 68  61 76 65 20 61 20 77 6f  |ne and have a wo|
00000780  72 64 20 73 74 61 72 74  69 6e 67 20 6f 6e 0d 61  |rd starting on.a|
00000790  20 6e 65 77 20 6c 69 6e  65 2e 20 46 6f 72 20 65  | new line. For e|
000007a0  78 61 6d 70 6c 65 3a 0d  0d 32 35 20 42 65 72 74  |xample:..25 Bert|
000007b0  69 65 20 52 6f 61 64 20  53 6f 75 74 68 20 0d 73  |ie Road South .s|
000007c0  65 61 20 48 61 6d 70 73  68 69 72 65 20 50 4f 34  |ea Hampshire PO4|
000007d0  20 38 4a 0d 58 0d 0d 49  66 1a 20 79 6f 75 1a 20  | 8J.X..If. you. |
000007e0  61 72 65 1a 20 6c 6f 6f  6b 69 6e 67 20 61 74 20  |are. looking at |
000007f0  74 68 69 73 20 74 65 78  74 20 69 6e 20 34 30 20  |this text in 40 |
00000800  63 6f 6c 75 6d 6e 20 6d  6f 64 65 20 74 68 65 20  |column mode the |
00000810  61 62 6f 76 65 20 70 72  6f 62 6c 65 6d 20 6d 61  |above problem ma|
00000820  79 0d 6e 6f 74 20 6c 6f  6f 6b 20 61 73 20 62 61  |y.not look as ba|
00000830  64 20 61 73 20 69 74 20  69 73 20 69 6e 74 65 6e  |d as it is inten|
00000840  64 65 64 2e 0d 0d 62 65  69 6e 67 20 61 62 6c 65  |ded...being able|
00000850  20 74 6f 20 53 41 56 45  20 74 68 65 20 44 41 54  | to SAVE the DAT|
00000860  41 20 77 68 69 63 68 20  68 61 73 20 62 65 65 6e  |A which has been|
00000870  20 69 6e 70 75 74 20 73  6f 20 74 68 61 74 20 63  | input so that c|
00000880  6f 70 69 65 73 20 63 61  6e 20 62 65 0d 72 65 70  |opies can be.rep|
00000890  72 69 6e 74 65 64 20 6c  61 74 65 72 20 77 69 74  |rinted later wit|
000008a0  68 6f 75 74 20 68 61 76  69 6e 67 20 74 6f 20 6c  |hout having to l|
000008b0  61 62 6f 72 69 6f 75 73  6c 79 20 72 65 65 6e 74  |aboriously reent|
000008c0  65 72 20 61 6c 6c 20 74  68 65 20 64 65 74 61 69  |er all the detai|
000008d0  6c 73 2e 0d 54 68 69 73  20 70 61 67 65 20 69 73  |ls..This page is|
000008e0  20 61 63 74 75 61 6c 6c  79 20 6f 6e 6c 79 20 61  | actually only a|
000008f0  62 6f 75 74 20 31 2f 36  20 6f 66 20 74 68 65 20  |bout 1/6 of the |
00000900  74 6f 74 61 6c 20 66 6f  72 6d 20 61 6e 64 20 74  |total form and t|
00000910  68 65 20 6e 75 6d 62 65  72 20 6f 66 0d 64 65 74  |he number of.det|
00000920  61 69 6c 73 20 77 68 69  63 68 20 6e 65 65 64 20  |ails which need |
00000930  74 6f 20 62 65 20 65 6e  74 65 72 65 64 20 74 6f  |to be entered to|
00000940  74 61 6c 20 6f 76 65 72  20 61 20 68 75 6e 64 72  |tal over a hundr|
00000950  65 64 20 65 61 63 68 20  74 69 6d 65 2e 0d 0d 49  |ed each time...I|
00000960  20 68 61 76 65 6e 27 74  20 68 61 64 20 61 20 63  | haven't had a c|
00000970  68 61 6e 63 65 20 74 6f  20 74 72 79 20 74 68 65  |hance to try the|
00000980  20 49 4e 50 55 54 20 72  6f 75 74 69 6e 65 73 20  | INPUT routines |
00000990  77 68 69 63 68 20 61 72  65 20 69 6e 63 6c 75 64  |which are includ|
000009a0  65 64 20 69 6e 0d 74 68  69 73 20 45 55 47 20 62  |ed in.this EUG b|
000009b0  75 74 20 74 68 65 73 65  20 6d 61 79 20 62 65 20  |ut these may be |
000009c0  75 73 65 66 75 6c 2e 0d  0d                       |useful...|
000009c9
P/+Form1.m0
P/+Form1.m1
P/+Form1.m2
P/+Form1.m4
P/+Form1.m5