Home » Archimedes archive » Acorn User » AU 1997-01 B.adf » Features » Arcade/!Popcorn/Hdr/Macros

Arcade/!Popcorn/Hdr/Macros

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 1997-01 B.adf » Features
Filename: Arcade/!Popcorn/Hdr/Macros
Read OK:
File size: 0463 bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
 MACRO
 LDRL $reg,$addr
	ADRL $reg,$addr
	LDR $reg,[$reg]
 MEND

 MACRO
 STRL $reg,$addr
	STMFD R13!,{R10}
	ADRL R10,$addr
	STR $reg,[R10]
 	LDMFD R13!,{R10}
 MEND

 MACRO
 DIV $divreg1,$divreg2,$divreg3,$divreg4
 ROUT
        STMFD R13!,{$divreg2,$divreg4}	; divreg1 / divreg2
	MOV $divreg4,$divreg2
	CMP $divreg4,$divreg1,LSR#1
1
	MOVLS $divreg4,$divreg4,LSL#1
	CMP $divreg4,$divreg1,LSR#1
	BLS %1
	MOV $divreg3,#0
2
	CMP $divreg1,$divreg4
	SUBCS $divreg1,$divreg1,$divreg4
	ADC $divreg3,$divreg3,$divreg3
	MOV $divreg4,$divreg4,LSR#1
	CMP $divreg4,$divreg2
	BHS %2
	LDMFD R13!,{$divreg2,$divreg4} ; divreg1 = MOD result
				       ; divreg3 = DIV result
 ROUT
 MEND

 MACRO
 RANDOM $reg_a, $reg_b, $reg_c
 	STMFD R13!,{$reg_b,$reg_c}
 	LDRL $reg_a,seed1
 	LDRL $reg_b,seed2
 	TST $reg_b,$reg_b,LSR#1
        MOVS $reg_c,$reg_a,RRX
        ADC $reg_b,$reg_b,$reg_b
        EOR $reg_c,$reg_c,$reg_a,LSL#12
        EOR $reg_a,$reg_c,$reg_c,LSR#20
        STRL $reg_a,seed1
        STRL $reg_b,seed2
        LDMFD R13!,{$reg_b,$reg_c}
 MEND
 
 MACRO
 HACKER
 SWI &82743 + 1<<17
 MEND
 

seed1 & 123456
seed2 & 789012

 END
00000000  0a 20 4d 41 43 52 4f 0a  20 4c 44 52 4c 20 24 72  |. MACRO. LDRL $r|
00000010  65 67 2c 24 61 64 64 72  0a 09 41 44 52 4c 20 24  |eg,$addr..ADRL $|
00000020  72 65 67 2c 24 61 64 64  72 0a 09 4c 44 52 20 24  |reg,$addr..LDR $|
00000030  72 65 67 2c 5b 24 72 65  67 5d 0a 20 4d 45 4e 44  |reg,[$reg]. MEND|
00000040  0a 0a 20 4d 41 43 52 4f  0a 20 53 54 52 4c 20 24  |.. MACRO. STRL $|
00000050  72 65 67 2c 24 61 64 64  72 0a 09 53 54 4d 46 44  |reg,$addr..STMFD|
00000060  20 52 31 33 21 2c 7b 52  31 30 7d 0a 09 41 44 52  | R13!,{R10}..ADR|
00000070  4c 20 52 31 30 2c 24 61  64 64 72 0a 09 53 54 52  |L R10,$addr..STR|
00000080  20 24 72 65 67 2c 5b 52  31 30 5d 0a 20 09 4c 44  | $reg,[R10]. .LD|
00000090  4d 46 44 20 52 31 33 21  2c 7b 52 31 30 7d 0a 20  |MFD R13!,{R10}. |
000000a0  4d 45 4e 44 0a 0a 20 4d  41 43 52 4f 0a 20 44 49  |MEND.. MACRO. DI|
000000b0  56 20 24 64 69 76 72 65  67 31 2c 24 64 69 76 72  |V $divreg1,$divr|
000000c0  65 67 32 2c 24 64 69 76  72 65 67 33 2c 24 64 69  |eg2,$divreg3,$di|
000000d0  76 72 65 67 34 0a 20 52  4f 55 54 0a 20 20 20 20  |vreg4. ROUT.    |
000000e0  20 20 20 20 53 54 4d 46  44 20 52 31 33 21 2c 7b  |    STMFD R13!,{|
000000f0  24 64 69 76 72 65 67 32  2c 24 64 69 76 72 65 67  |$divreg2,$divreg|
00000100  34 7d 09 3b 20 64 69 76  72 65 67 31 20 2f 20 64  |4}.; divreg1 / d|
00000110  69 76 72 65 67 32 0a 09  4d 4f 56 20 24 64 69 76  |ivreg2..MOV $div|
00000120  72 65 67 34 2c 24 64 69  76 72 65 67 32 0a 09 43  |reg4,$divreg2..C|
00000130  4d 50 20 24 64 69 76 72  65 67 34 2c 24 64 69 76  |MP $divreg4,$div|
00000140  72 65 67 31 2c 4c 53 52  23 31 0a 31 0a 09 4d 4f  |reg1,LSR#1.1..MO|
00000150  56 4c 53 20 24 64 69 76  72 65 67 34 2c 24 64 69  |VLS $divreg4,$di|
00000160  76 72 65 67 34 2c 4c 53  4c 23 31 0a 09 43 4d 50  |vreg4,LSL#1..CMP|
00000170  20 24 64 69 76 72 65 67  34 2c 24 64 69 76 72 65  | $divreg4,$divre|
00000180  67 31 2c 4c 53 52 23 31  0a 09 42 4c 53 20 25 31  |g1,LSR#1..BLS %1|
00000190  0a 09 4d 4f 56 20 24 64  69 76 72 65 67 33 2c 23  |..MOV $divreg3,#|
000001a0  30 0a 32 0a 09 43 4d 50  20 24 64 69 76 72 65 67  |0.2..CMP $divreg|
000001b0  31 2c 24 64 69 76 72 65  67 34 0a 09 53 55 42 43  |1,$divreg4..SUBC|
000001c0  53 20 24 64 69 76 72 65  67 31 2c 24 64 69 76 72  |S $divreg1,$divr|
000001d0  65 67 31 2c 24 64 69 76  72 65 67 34 0a 09 41 44  |eg1,$divreg4..AD|
000001e0  43 20 24 64 69 76 72 65  67 33 2c 24 64 69 76 72  |C $divreg3,$divr|
000001f0  65 67 33 2c 24 64 69 76  72 65 67 33 0a 09 4d 4f  |eg3,$divreg3..MO|
00000200  56 20 24 64 69 76 72 65  67 34 2c 24 64 69 76 72  |V $divreg4,$divr|
00000210  65 67 34 2c 4c 53 52 23  31 0a 09 43 4d 50 20 24  |eg4,LSR#1..CMP $|
00000220  64 69 76 72 65 67 34 2c  24 64 69 76 72 65 67 32  |divreg4,$divreg2|
00000230  0a 09 42 48 53 20 25 32  0a 09 4c 44 4d 46 44 20  |..BHS %2..LDMFD |
00000240  52 31 33 21 2c 7b 24 64  69 76 72 65 67 32 2c 24  |R13!,{$divreg2,$|
00000250  64 69 76 72 65 67 34 7d  20 3b 20 64 69 76 72 65  |divreg4} ; divre|
00000260  67 31 20 3d 20 4d 4f 44  20 72 65 73 75 6c 74 0a  |g1 = MOD result.|
00000270  09 09 09 09 20 20 20 20  20 20 20 3b 20 64 69 76  |....       ; div|
00000280  72 65 67 33 20 3d 20 44  49 56 20 72 65 73 75 6c  |reg3 = DIV resul|
00000290  74 0a 20 52 4f 55 54 0a  20 4d 45 4e 44 0a 0a 20  |t. ROUT. MEND.. |
000002a0  4d 41 43 52 4f 0a 20 52  41 4e 44 4f 4d 20 24 72  |MACRO. RANDOM $r|
000002b0  65 67 5f 61 2c 20 24 72  65 67 5f 62 2c 20 24 72  |eg_a, $reg_b, $r|
000002c0  65 67 5f 63 0a 20 09 53  54 4d 46 44 20 52 31 33  |eg_c. .STMFD R13|
000002d0  21 2c 7b 24 72 65 67 5f  62 2c 24 72 65 67 5f 63  |!,{$reg_b,$reg_c|
000002e0  7d 0a 20 09 4c 44 52 4c  20 24 72 65 67 5f 61 2c  |}. .LDRL $reg_a,|
000002f0  73 65 65 64 31 0a 20 09  4c 44 52 4c 20 24 72 65  |seed1. .LDRL $re|
00000300  67 5f 62 2c 73 65 65 64  32 0a 20 09 54 53 54 20  |g_b,seed2. .TST |
00000310  24 72 65 67 5f 62 2c 24  72 65 67 5f 62 2c 4c 53  |$reg_b,$reg_b,LS|
00000320  52 23 31 0a 20 20 20 20  20 20 20 20 4d 4f 56 53  |R#1.        MOVS|
00000330  20 24 72 65 67 5f 63 2c  24 72 65 67 5f 61 2c 52  | $reg_c,$reg_a,R|
00000340  52 58 0a 20 20 20 20 20  20 20 20 41 44 43 20 24  |RX.        ADC $|
00000350  72 65 67 5f 62 2c 24 72  65 67 5f 62 2c 24 72 65  |reg_b,$reg_b,$re|
00000360  67 5f 62 0a 20 20 20 20  20 20 20 20 45 4f 52 20  |g_b.        EOR |
00000370  24 72 65 67 5f 63 2c 24  72 65 67 5f 63 2c 24 72  |$reg_c,$reg_c,$r|
00000380  65 67 5f 61 2c 4c 53 4c  23 31 32 0a 20 20 20 20  |eg_a,LSL#12.    |
00000390  20 20 20 20 45 4f 52 20  24 72 65 67 5f 61 2c 24  |    EOR $reg_a,$|
000003a0  72 65 67 5f 63 2c 24 72  65 67 5f 63 2c 4c 53 52  |reg_c,$reg_c,LSR|
000003b0  23 32 30 0a 20 20 20 20  20 20 20 20 53 54 52 4c  |#20.        STRL|
000003c0  20 24 72 65 67 5f 61 2c  73 65 65 64 31 0a 20 20  | $reg_a,seed1.  |
000003d0  20 20 20 20 20 20 53 54  52 4c 20 24 72 65 67 5f  |      STRL $reg_|
000003e0  62 2c 73 65 65 64 32 0a  20 20 20 20 20 20 20 20  |b,seed2.        |
000003f0  4c 44 4d 46 44 20 52 31  33 21 2c 7b 24 72 65 67  |LDMFD R13!,{$reg|
00000400  5f 62 2c 24 72 65 67 5f  63 7d 0a 20 4d 45 4e 44  |_b,$reg_c}. MEND|
00000410  0a 20 0a 20 4d 41 43 52  4f 0a 20 48 41 43 4b 45  |. . MACRO. HACKE|
00000420  52 0a 20 53 57 49 20 26  38 32 37 34 33 20 2b 20  |R. SWI &82743 + |
00000430  31 3c 3c 31 37 0a 20 4d  45 4e 44 0a 20 0a 0a 73  |1<<17. MEND. ..s|
00000440  65 65 64 31 20 26 20 31  32 33 34 35 36 0a 73 65  |eed1 & 123456.se|
00000450  65 64 32 20 26 20 37 38  39 30 31 32 0a 0a 20 45  |ed2 & 789012.. E|
00000460  4e 44 0a                                          |ND.|
00000463