Home » Archimedes archive » Acorn User » AU 1993-06.adf » !ArmCode/!Help

!ArmCode/!Help

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 » Archimedes archive » Acorn User » AU 1993-06.adf
Filename: !ArmCode/!Help
Read OK:
File size: 0525 bytes
Load address: FFFFFF44
Exec address: 8D8C7D78
File contents
Assembly Line
By Dave Lawrence

Run this application to open a directory containing six Basic programs.

Arm1 demonstrates how to multiply two real numbers in Arm code. When it is run, the program will ask for two numbers, and will display the result of multiplying them both in Basic and in assembler.

Arm2 shows how to implement integer division in assembler. The program asks for two integers: the first number will be divided by the second. The results are shown from Basic and assembler.

Arm3 provides a routine to calculate integer square roots in assembler. The program displays three columns of numbers: the first is an integer, the second is the square root of that number returned by the assembly routine, and the third is the square root calculated by Basic.

Arm4 demonstrates random number generation in assembler. The program fills the screen with black and white pixels, generated randomly.

Arm5 continues the theme of random numbers by colouring random points in random colours.

Arm6 shows how to determine the status flags on returning from a routine. When it is run, 'Z' and 'C' are displayed, showing that the Zero and Carry flags are set by the program. To experiment with the results, alter the line starting with MOVS.

For more details, see page 105 in the magazine.

� BBC Acorn User 1993
00000000  41 73 73 65 6d 62 6c 79  20 4c 69 6e 65 0a 42 79  |Assembly Line.By|
00000010  20 44 61 76 65 20 4c 61  77 72 65 6e 63 65 0a 0a  | Dave Lawrence..|
00000020  52 75 6e 20 74 68 69 73  20 61 70 70 6c 69 63 61  |Run this applica|
00000030  74 69 6f 6e 20 74 6f 20  6f 70 65 6e 20 61 20 64  |tion to open a d|
00000040  69 72 65 63 74 6f 72 79  20 63 6f 6e 74 61 69 6e  |irectory contain|
00000050  69 6e 67 20 73 69 78 20  42 61 73 69 63 20 70 72  |ing six Basic pr|
00000060  6f 67 72 61 6d 73 2e 0a  0a 41 72 6d 31 20 64 65  |ograms...Arm1 de|
00000070  6d 6f 6e 73 74 72 61 74  65 73 20 68 6f 77 20 74  |monstrates how t|
00000080  6f 20 6d 75 6c 74 69 70  6c 79 20 74 77 6f 20 72  |o multiply two r|
00000090  65 61 6c 20 6e 75 6d 62  65 72 73 20 69 6e 20 41  |eal numbers in A|
000000a0  72 6d 20 63 6f 64 65 2e  20 57 68 65 6e 20 69 74  |rm code. When it|
000000b0  20 69 73 20 72 75 6e 2c  20 74 68 65 20 70 72 6f  | is run, the pro|
000000c0  67 72 61 6d 20 77 69 6c  6c 20 61 73 6b 20 66 6f  |gram will ask fo|
000000d0  72 20 74 77 6f 20 6e 75  6d 62 65 72 73 2c 20 61  |r two numbers, a|
000000e0  6e 64 20 77 69 6c 6c 20  64 69 73 70 6c 61 79 20  |nd will display |
000000f0  74 68 65 20 72 65 73 75  6c 74 20 6f 66 20 6d 75  |the result of mu|
00000100  6c 74 69 70 6c 79 69 6e  67 20 74 68 65 6d 20 62  |ltiplying them b|
00000110  6f 74 68 20 69 6e 20 42  61 73 69 63 20 61 6e 64  |oth in Basic and|
00000120  20 69 6e 20 61 73 73 65  6d 62 6c 65 72 2e 0a 0a  | in assembler...|
00000130  41 72 6d 32 20 73 68 6f  77 73 20 68 6f 77 20 74  |Arm2 shows how t|
00000140  6f 20 69 6d 70 6c 65 6d  65 6e 74 20 69 6e 74 65  |o implement inte|
00000150  67 65 72 20 64 69 76 69  73 69 6f 6e 20 69 6e 20  |ger division in |
00000160  61 73 73 65 6d 62 6c 65  72 2e 20 54 68 65 20 70  |assembler. The p|
00000170  72 6f 67 72 61 6d 20 61  73 6b 73 20 66 6f 72 20  |rogram asks for |
00000180  74 77 6f 20 69 6e 74 65  67 65 72 73 3a 20 74 68  |two integers: th|
00000190  65 20 66 69 72 73 74 20  6e 75 6d 62 65 72 20 77  |e first number w|
000001a0  69 6c 6c 20 62 65 20 64  69 76 69 64 65 64 20 62  |ill be divided b|
000001b0  79 20 74 68 65 20 73 65  63 6f 6e 64 2e 20 54 68  |y the second. Th|
000001c0  65 20 72 65 73 75 6c 74  73 20 61 72 65 20 73 68  |e results are sh|
000001d0  6f 77 6e 20 66 72 6f 6d  20 42 61 73 69 63 20 61  |own from Basic a|
000001e0  6e 64 20 61 73 73 65 6d  62 6c 65 72 2e 0a 0a 41  |nd assembler...A|
000001f0  72 6d 33 20 70 72 6f 76  69 64 65 73 20 61 20 72  |rm3 provides a r|
00000200  6f 75 74 69 6e 65 20 74  6f 20 63 61 6c 63 75 6c  |outine to calcul|
00000210  61 74 65 20 69 6e 74 65  67 65 72 20 73 71 75 61  |ate integer squa|
00000220  72 65 20 72 6f 6f 74 73  20 69 6e 20 61 73 73 65  |re roots in asse|
00000230  6d 62 6c 65 72 2e 20 54  68 65 20 70 72 6f 67 72  |mbler. The progr|
00000240  61 6d 20 64 69 73 70 6c  61 79 73 20 74 68 72 65  |am displays thre|
00000250  65 20 63 6f 6c 75 6d 6e  73 20 6f 66 20 6e 75 6d  |e columns of num|
00000260  62 65 72 73 3a 20 74 68  65 20 66 69 72 73 74 20  |bers: the first |
00000270  69 73 20 61 6e 20 69 6e  74 65 67 65 72 2c 20 74  |is an integer, t|
00000280  68 65 20 73 65 63 6f 6e  64 20 69 73 20 74 68 65  |he second is the|
00000290  20 73 71 75 61 72 65 20  72 6f 6f 74 20 6f 66 20  | square root of |
000002a0  74 68 61 74 20 6e 75 6d  62 65 72 20 72 65 74 75  |that number retu|
000002b0  72 6e 65 64 20 62 79 20  74 68 65 20 61 73 73 65  |rned by the asse|
000002c0  6d 62 6c 79 20 72 6f 75  74 69 6e 65 2c 20 61 6e  |mbly routine, an|
000002d0  64 20 74 68 65 20 74 68  69 72 64 20 69 73 20 74  |d the third is t|
000002e0  68 65 20 73 71 75 61 72  65 20 72 6f 6f 74 20 63  |he square root c|
000002f0  61 6c 63 75 6c 61 74 65  64 20 62 79 20 42 61 73  |alculated by Bas|
00000300  69 63 2e 0a 0a 41 72 6d  34 20 64 65 6d 6f 6e 73  |ic...Arm4 demons|
00000310  74 72 61 74 65 73 20 72  61 6e 64 6f 6d 20 6e 75  |trates random nu|
00000320  6d 62 65 72 20 67 65 6e  65 72 61 74 69 6f 6e 20  |mber generation |
00000330  69 6e 20 61 73 73 65 6d  62 6c 65 72 2e 20 54 68  |in assembler. Th|
00000340  65 20 70 72 6f 67 72 61  6d 20 66 69 6c 6c 73 20  |e program fills |
00000350  74 68 65 20 73 63 72 65  65 6e 20 77 69 74 68 20  |the screen with |
00000360  62 6c 61 63 6b 20 61 6e  64 20 77 68 69 74 65 20  |black and white |
00000370  70 69 78 65 6c 73 2c 20  67 65 6e 65 72 61 74 65  |pixels, generate|
00000380  64 20 72 61 6e 64 6f 6d  6c 79 2e 0a 0a 41 72 6d  |d randomly...Arm|
00000390  35 20 63 6f 6e 74 69 6e  75 65 73 20 74 68 65 20  |5 continues the |
000003a0  74 68 65 6d 65 20 6f 66  20 72 61 6e 64 6f 6d 20  |theme of random |
000003b0  6e 75 6d 62 65 72 73 20  62 79 20 63 6f 6c 6f 75  |numbers by colou|
000003c0  72 69 6e 67 20 72 61 6e  64 6f 6d 20 70 6f 69 6e  |ring random poin|
000003d0  74 73 20 69 6e 20 72 61  6e 64 6f 6d 20 63 6f 6c  |ts in random col|
000003e0  6f 75 72 73 2e 0a 0a 41  72 6d 36 20 73 68 6f 77  |ours...Arm6 show|
000003f0  73 20 68 6f 77 20 74 6f  20 64 65 74 65 72 6d 69  |s how to determi|
00000400  6e 65 20 74 68 65 20 73  74 61 74 75 73 20 66 6c  |ne the status fl|
00000410  61 67 73 20 6f 6e 20 72  65 74 75 72 6e 69 6e 67  |ags on returning|
00000420  20 66 72 6f 6d 20 61 20  72 6f 75 74 69 6e 65 2e  | from a routine.|
00000430  20 57 68 65 6e 20 69 74  20 69 73 20 72 75 6e 2c  | When it is run,|
00000440  20 27 5a 27 20 61 6e 64  20 27 43 27 20 61 72 65  | 'Z' and 'C' are|
00000450  20 64 69 73 70 6c 61 79  65 64 2c 20 73 68 6f 77  | displayed, show|
00000460  69 6e 67 20 74 68 61 74  20 74 68 65 20 5a 65 72  |ing that the Zer|
00000470  6f 20 61 6e 64 20 43 61  72 72 79 20 66 6c 61 67  |o and Carry flag|
00000480  73 20 61 72 65 20 73 65  74 20 62 79 20 74 68 65  |s are set by the|
00000490  20 70 72 6f 67 72 61 6d  2e 20 54 6f 20 65 78 70  | program. To exp|
000004a0  65 72 69 6d 65 6e 74 20  77 69 74 68 20 74 68 65  |eriment with the|
000004b0  20 72 65 73 75 6c 74 73  2c 20 61 6c 74 65 72 20  | results, alter |
000004c0  74 68 65 20 6c 69 6e 65  20 73 74 61 72 74 69 6e  |the line startin|
000004d0  67 20 77 69 74 68 20 4d  4f 56 53 2e 0a 0a 46 6f  |g with MOVS...Fo|
000004e0  72 20 6d 6f 72 65 20 64  65 74 61 69 6c 73 2c 20  |r more details, |
000004f0  73 65 65 20 70 61 67 65  20 31 30 35 20 69 6e 20  |see page 105 in |
00000500  74 68 65 20 6d 61 67 61  7a 69 6e 65 2e 0a 0a a9  |the magazine....|
00000510  20 42 42 43 20 41 63 6f  72 6e 20 55 73 65 72 20  | BBC Acorn User |
00000520  31 39 39 33 0a                                    |1993.|
00000525