Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_34.ADF » P/+Mtext4

P/+Mtext4

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_34.ADF
Filename: P/+Mtext4
Read OK:
File size: 08C2 bytes
Load address: 2B204556
Exec address: 7865744D
File contents
The next line is a means of formatting a printout so that it will be
printed in columns, so many items long then a second column will start
from the top again but shifted right.

Then comes a line,
IF INKEY(-99) REPEAT:u%=u%+1:SOUND&11,-4,d%(f%),(u%/4):UNTIL NOT
INKEY(-99):PRINTTAB(x,y);(u%DIV4);" ";d%(f%)

INKEY(-99) will wait for the SPACE BAR to be pressed. So long as it is
pressed a REPEAT UNTIL loop will cycle. This loop is nested within the
first REPEAT UNTIL loop.

1 will be added to u% and the SOUND command will play the note defined by
the pitch stored in the array box d%(f%). Since this is the first cycle
the pitch value will be stored in box d%(1). The duration of this note
will be 1/4 as defined by (u%/4).If the SPACE BAR is still pressed u% will
= 2 and the note will continue. For as long as the SPACE BAR is pressed
the note will continue playing, each time 1 will be added to u%. When the
SPACE BAR is released the note will stop. The accumulated value of u% will
be divided by 4, without a remainder, and printed beside the value of
d%(1), ie the note which was played.

This accumulated value of u% divided by 4 will also be put into the array
t% which stores the values of the duration of each note and which
originally had all of its values set to 6. 

The next line will check if e%=f%, if it does not the loop will cycle back
to the first REPEAT. 1 will be added to f% making the next note to be
played d%(2), u% will be reset back to 0 and the program will wait for the
SPACE BAR to be pressed again.

When e%=f% ie when all of the notes composed have been edited the
procedure will finish and jump to PROCmenu. Here you have the option to
repeat the editing procedure, playback the tune with the new values for
duration or to reenter the compose section and re-do the tune from
scratch.

And that is all there is to it. 

If anyone can improve on any aspects of this program then please do
and send it in.

I originally wrote this program and text for EUG33 but held it back so
that I could sort out the bugs. All except the one in PROCedit(e%) have
been sorted. Some minor alterations have been made to the program but the
text is still relevant. If I try to rewrite the text now I might be here
forever.

00000000  0d 54 68 65 20 6e 65 78  74 20 6c 69 6e 65 20 69  |.The next line i|
00000010  73 20 61 20 6d 65 61 6e  73 20 6f 66 20 66 6f 72  |s a means of for|
00000020  6d 61 74 74 69 6e 67 20  61 20 70 72 69 6e 74 6f  |matting a printo|
00000030  75 74 20 73 6f 20 74 68  61 74 20 69 74 20 77 69  |ut so that it wi|
00000040  6c 6c 20 62 65 0d 70 72  69 6e 74 65 64 20 69 6e  |ll be.printed in|
00000050  20 63 6f 6c 75 6d 6e 73  2c 20 73 6f 20 6d 61 6e  | columns, so man|
00000060  79 20 69 74 65 6d 73 20  6c 6f 6e 67 20 74 68 65  |y items long the|
00000070  6e 20 61 20 73 65 63 6f  6e 64 20 63 6f 6c 75 6d  |n a second colum|
00000080  6e 20 77 69 6c 6c 20 73  74 61 72 74 0d 66 72 6f  |n will start.fro|
00000090  6d 20 74 68 65 20 74 6f  70 20 61 67 61 69 6e 20  |m the top again |
000000a0  62 75 74 20 73 68 69 66  74 65 64 20 72 69 67 68  |but shifted righ|
000000b0  74 2e 0d 0d 54 68 65 6e  20 63 6f 6d 65 73 20 61  |t...Then comes a|
000000c0  20 6c 69 6e 65 2c 0d 49  46 20 49 4e 4b 45 59 28  | line,.IF INKEY(|
000000d0  2d 39 39 29 20 52 45 50  45 41 54 3a 75 25 3d 75  |-99) REPEAT:u%=u|
000000e0  25 2b 31 3a 53 4f 55 4e  44 26 31 31 2c 2d 34 2c  |%+1:SOUND&11,-4,|
000000f0  64 25 28 66 25 29 2c 28  75 25 2f 34 29 3a 55 4e  |d%(f%),(u%/4):UN|
00000100  54 49 4c 20 4e 4f 54 0d  49 4e 4b 45 59 28 2d 39  |TIL NOT.INKEY(-9|
00000110  39 29 3a 50 52 49 4e 54  54 41 42 28 78 2c 79 29  |9):PRINTTAB(x,y)|
00000120  3b 28 75 25 44 49 56 34  29 3b 22 20 22 3b 64 25  |;(u%DIV4);" ";d%|
00000130  28 66 25 29 0d 0d 49 4e  4b 45 59 28 2d 39 39 29  |(f%)..INKEY(-99)|
00000140  20 77 69 6c 6c 20 77 61  69 74 20 66 6f 72 20 74  | will wait for t|
00000150  68 65 20 53 50 41 43 45  20 42 41 52 20 74 6f 20  |he SPACE BAR to |
00000160  62 65 20 70 72 65 73 73  65 64 2e 20 53 6f 20 6c  |be pressed. So l|
00000170  6f 6e 67 20 61 73 20 69  74 20 69 73 0d 70 72 65  |ong as it is.pre|
00000180  73 73 65 64 20 61 20 52  45 50 45 41 54 20 55 4e  |ssed a REPEAT UN|
00000190  54 49 4c 20 6c 6f 6f 70  20 77 69 6c 6c 20 63 79  |TIL loop will cy|
000001a0  63 6c 65 2e 20 54 68 69  73 20 6c 6f 6f 70 20 69  |cle. This loop i|
000001b0  73 20 6e 65 73 74 65 64  20 77 69 74 68 69 6e 20  |s nested within |
000001c0  74 68 65 0d 66 69 72 73  74 20 52 45 50 45 41 54  |the.first REPEAT|
000001d0  20 55 4e 54 49 4c 20 6c  6f 6f 70 2e 0d 0d 31 20  | UNTIL loop...1 |
000001e0  77 69 6c 6c 20 62 65 20  61 64 64 65 64 20 74 6f  |will be added to|
000001f0  20 75 25 20 61 6e 64 20  74 68 65 20 53 4f 55 4e  | u% and the SOUN|
00000200  44 20 63 6f 6d 6d 61 6e  64 20 77 69 6c 6c 20 70  |D command will p|
00000210  6c 61 79 20 74 68 65 20  6e 6f 74 65 20 64 65 66  |lay the note def|
00000220  69 6e 65 64 20 62 79 0d  74 68 65 20 70 69 74 63  |ined by.the pitc|
00000230  68 20 73 74 6f 72 65 64  20 69 6e 20 74 68 65 20  |h stored in the |
00000240  61 72 72 61 79 20 62 6f  78 20 64 25 28 66 25 29  |array box d%(f%)|
00000250  2e 20 53 69 6e 63 65 20  74 68 69 73 20 69 73 20  |. Since this is |
00000260  74 68 65 20 66 69 72 73  74 20 63 79 63 6c 65 0d  |the first cycle.|
00000270  74 68 65 20 70 69 74 63  68 20 76 61 6c 75 65 20  |the pitch value |
00000280  77 69 6c 6c 20 62 65 20  73 74 6f 72 65 64 20 69  |will be stored i|
00000290  6e 20 62 6f 78 20 64 25  28 31 29 2e 20 54 68 65  |n box d%(1). The|
000002a0  20 64 75 72 61 74 69 6f  6e 20 6f 66 20 74 68 69  | duration of thi|
000002b0  73 20 6e 6f 74 65 0d 77  69 6c 6c 20 62 65 20 31  |s note.will be 1|
000002c0  2f 34 20 61 73 20 64 65  66 69 6e 65 64 20 62 79  |/4 as defined by|
000002d0  20 28 75 25 2f 34 29 2e  49 66 20 74 68 65 20 53  | (u%/4).If the S|
000002e0  50 41 43 45 20 42 41 52  20 69 73 20 73 74 69 6c  |PACE BAR is stil|
000002f0  6c 20 70 72 65 73 73 65  64 20 75 25 20 77 69 6c  |l pressed u% wil|
00000300  6c 0d 3d 20 32 20 61 6e  64 20 74 68 65 20 6e 6f  |l.= 2 and the no|
00000310  74 65 20 77 69 6c 6c 20  63 6f 6e 74 69 6e 75 65  |te will continue|
00000320  2e 20 46 6f 72 20 61 73  20 6c 6f 6e 67 20 61 73  |. For as long as|
00000330  20 74 68 65 20 53 50 41  43 45 20 42 41 52 20 69  | the SPACE BAR i|
00000340  73 20 70 72 65 73 73 65  64 0d 74 68 65 20 6e 6f  |s pressed.the no|
00000350  74 65 20 77 69 6c 6c 20  63 6f 6e 74 69 6e 75 65  |te will continue|
00000360  20 70 6c 61 79 69 6e 67  2c 20 65 61 63 68 20 74  | playing, each t|
00000370  69 6d 65 20 31 20 77 69  6c 6c 20 62 65 20 61 64  |ime 1 will be ad|
00000380  64 65 64 20 74 6f 20 75  25 2e 20 57 68 65 6e 20  |ded to u%. When |
00000390  74 68 65 0d 53 50 41 43  45 20 42 41 52 20 69 73  |the.SPACE BAR is|
000003a0  20 72 65 6c 65 61 73 65  64 20 74 68 65 20 6e 6f  | released the no|
000003b0  74 65 20 77 69 6c 6c 20  73 74 6f 70 2e 20 54 68  |te will stop. Th|
000003c0  65 20 61 63 63 75 6d 75  6c 61 74 65 64 20 76 61  |e accumulated va|
000003d0  6c 75 65 20 6f 66 20 75  25 20 77 69 6c 6c 0d 62  |lue of u% will.b|
000003e0  65 20 64 69 76 69 64 65  64 20 62 79 20 34 2c 20  |e divided by 4, |
000003f0  77 69 74 68 6f 75 74 20  61 20 72 65 6d 61 69 6e  |without a remain|
00000400  64 65 72 2c 20 61 6e 64  20 70 72 69 6e 74 65 64  |der, and printed|
00000410  20 62 65 73 69 64 65 20  74 68 65 20 76 61 6c 75  | beside the valu|
00000420  65 20 6f 66 0d 64 25 28  31 29 2c 20 69 65 20 74  |e of.d%(1), ie t|
00000430  68 65 20 6e 6f 74 65 20  77 68 69 63 68 20 77 61  |he note which wa|
00000440  73 20 70 6c 61 79 65 64  2e 0d 0d 54 68 69 73 20  |s played...This |
00000450  61 63 63 75 6d 75 6c 61  74 65 64 20 76 61 6c 75  |accumulated valu|
00000460  65 20 6f 66 20 75 25 20  64 69 76 69 64 65 64 20  |e of u% divided |
00000470  62 79 20 34 20 77 69 6c  6c 20 61 6c 73 6f 20 62  |by 4 will also b|
00000480  65 20 70 75 74 20 69 6e  74 6f 20 74 68 65 20 61  |e put into the a|
00000490  72 72 61 79 0d 74 25 20  77 68 69 63 68 20 73 74  |rray.t% which st|
000004a0  6f 72 65 73 20 74 68 65  20 76 61 6c 75 65 73 20  |ores the values |
000004b0  6f 66 20 74 68 65 20 64  75 72 61 74 69 6f 6e 20  |of the duration |
000004c0  6f 66 20 65 61 63 68 20  6e 6f 74 65 20 61 6e 64  |of each note and|
000004d0  20 77 68 69 63 68 0d 6f  72 69 67 69 6e 61 6c 6c  | which.originall|
000004e0  79 20 68 61 64 20 61 6c  6c 20 6f 66 20 69 74 73  |y had all of its|
000004f0  20 76 61 6c 75 65 73 20  73 65 74 20 74 6f 20 36  | values set to 6|
00000500  2e 20 0d 0d 54 68 65 20  6e 65 78 74 20 6c 69 6e  |. ..The next lin|
00000510  65 20 77 69 6c 6c 20 63  68 65 63 6b 20 69 66 20  |e will check if |
00000520  65 25 3d 66 25 2c 20 69  66 20 69 74 20 64 6f 65  |e%=f%, if it doe|
00000530  73 20 6e 6f 74 20 74 68  65 20 6c 6f 6f 70 20 77  |s not the loop w|
00000540  69 6c 6c 20 63 79 63 6c  65 20 62 61 63 6b 0d 74  |ill cycle back.t|
00000550  6f 20 74 68 65 20 66 69  72 73 74 20 52 45 50 45  |o the first REPE|
00000560  41 54 2e 20 31 20 77 69  6c 6c 20 62 65 20 61 64  |AT. 1 will be ad|
00000570  64 65 64 20 74 6f 20 66  25 20 6d 61 6b 69 6e 67  |ded to f% making|
00000580  20 74 68 65 20 6e 65 78  74 20 6e 6f 74 65 20 74  | the next note t|
00000590  6f 20 62 65 0d 70 6c 61  79 65 64 20 64 25 28 32  |o be.played d%(2|
000005a0  29 2c 20 75 25 20 77 69  6c 6c 20 62 65 20 72 65  |), u% will be re|
000005b0  73 65 74 20 62 61 63 6b  20 74 6f 20 30 20 61 6e  |set back to 0 an|
000005c0  64 20 74 68 65 20 70 72  6f 67 72 61 6d 20 77 69  |d the program wi|
000005d0  6c 6c 20 77 61 69 74 20  66 6f 72 20 74 68 65 0d  |ll wait for the.|
000005e0  53 50 41 43 45 20 42 41  52 20 74 6f 20 62 65 20  |SPACE BAR to be |
000005f0  70 72 65 73 73 65 64 20  61 67 61 69 6e 2e 0d 0d  |pressed again...|
00000600  57 68 65 6e 20 65 25 3d  66 25 20 69 65 20 77 68  |When e%=f% ie wh|
00000610  65 6e 20 61 6c 6c 20 6f  66 20 74 68 65 20 6e 6f  |en all of the no|
00000620  74 65 73 20 63 6f 6d 70  6f 73 65 64 20 68 61 76  |tes composed hav|
00000630  65 20 62 65 65 6e 20 65  64 69 74 65 64 20 74 68  |e been edited th|
00000640  65 0d 70 72 6f 63 65 64  75 72 65 20 77 69 6c 6c  |e.procedure will|
00000650  20 66 69 6e 69 73 68 20  61 6e 64 20 6a 75 6d 70  | finish and jump|
00000660  20 74 6f 20 50 52 4f 43  6d 65 6e 75 2e 20 48 65  | to PROCmenu. He|
00000670  72 65 20 79 6f 75 20 68  61 76 65 20 74 68 65 20  |re you have the |
00000680  6f 70 74 69 6f 6e 20 74  6f 0d 72 65 70 65 61 74  |option to.repeat|
00000690  20 74 68 65 20 65 64 69  74 69 6e 67 20 70 72 6f  | the editing pro|
000006a0  63 65 64 75 72 65 2c 20  70 6c 61 79 62 61 63 6b  |cedure, playback|
000006b0  20 74 68 65 20 74 75 6e  65 20 77 69 74 68 20 74  | the tune with t|
000006c0  68 65 20 6e 65 77 20 76  61 6c 75 65 73 20 66 6f  |he new values fo|
000006d0  72 0d 64 75 72 61 74 69  6f 6e 20 6f 72 20 74 6f  |r.duration or to|
000006e0  20 72 65 65 6e 74 65 72  20 74 68 65 20 63 6f 6d  | reenter the com|
000006f0  70 6f 73 65 20 73 65 63  74 69 6f 6e 20 61 6e 64  |pose section and|
00000700  20 72 65 2d 64 6f 20 74  68 65 20 74 75 6e 65 20  | re-do the tune |
00000710  66 72 6f 6d 0d 73 63 72  61 74 63 68 2e 0d 0d 41  |from.scratch...A|
00000720  6e 64 20 74 68 61 74 20  69 73 20 61 6c 6c 20 74  |nd that is all t|
00000730  68 65 72 65 20 69 73 20  74 6f 20 69 74 2e 20 0d  |here is to it. .|
00000740  0d 49 66 20 61 6e 79 6f  6e 65 20 63 61 6e 20 69  |.If anyone can i|
00000750  6d 70 72 6f 76 65 20 6f  6e 20 61 6e 79 20 61 73  |mprove on any as|
00000760  70 65 63 74 73 20 6f 66  20 74 68 69 73 20 70 72  |pects of this pr|
00000770  6f 67 72 61 6d 20 74 68  65 6e 20 70 6c 65 61 73  |ogram then pleas|
00000780  65 20 64 6f 0d 61 6e 64  20 73 65 6e 64 20 69 74  |e do.and send it|
00000790  20 69 6e 2e 0d 0d 49 20  6f 72 69 67 69 6e 61 6c  | in...I original|
000007a0  6c 79 20 77 72 6f 74 65  20 74 68 69 73 20 70 72  |ly wrote this pr|
000007b0  6f 67 72 61 6d 20 61 6e  64 20 74 65 78 74 20 66  |ogram and text f|
000007c0  6f 72 20 45 55 47 33 33  20 62 75 74 20 68 65 6c  |or EUG33 but hel|
000007d0  64 20 69 74 20 62 61 63  6b 20 73 6f 0d 74 68 61  |d it back so.tha|
000007e0  74 20 49 20 63 6f 75 6c  64 20 73 6f 72 74 20 6f  |t I could sort o|
000007f0  75 74 20 74 68 65 20 62  75 67 73 2e 20 41 6c 6c  |ut the bugs. All|
00000800  20 65 78 63 65 70 74 20  74 68 65 20 6f 6e 65 20  | except the one |
00000810  69 6e 20 50 52 4f 43 65  64 69 74 28 65 25 29 20  |in PROCedit(e%) |
00000820  68 61 76 65 0d 62 65 65  6e 20 73 6f 72 74 65 64  |have.been sorted|
00000830  2e 20 53 6f 6d 65 20 6d  69 6e 6f 72 20 61 6c 74  |. Some minor alt|
00000840  65 72 61 74 69 6f 6e 73  20 68 61 76 65 20 62 65  |erations have be|
00000850  65 6e 20 6d 61 64 65 20  74 6f 20 74 68 65 20 70  |en made to the p|
00000860  72 6f 67 72 61 6d 20 62  75 74 20 74 68 65 0d 74  |rogram but the.t|
00000870  65 78 74 20 69 73 20 73  74 69 6c 6c 20 72 65 6c  |ext is still rel|
00000880  65 76 61 6e 74 2e 20 49  66 20 49 20 74 72 79 20  |evant. If I try |
00000890  74 6f 20 72 65 77 72 69  74 65 20 74 68 65 20 74  |to rewrite the t|
000008a0  65 78 74 20 6e 6f 77 20  49 20 6d 69 67 68 74 20  |ext now I might |
000008b0  62 65 20 68 65 72 65 0d  66 6f 72 65 76 65 72 2e  |be here.forever.|
000008c0  0d 0d                                             |..|
000008c2
P/+Mtext4.m0
P/+Mtext4.m1
P/+Mtext4.m2
P/+Mtext4.m4
P/+Mtext4.m5