| MODULE Fractions; (*NW 10.10.07; Tabulate fractions 1/n*) |
| .MODULE Fractions (KEY 94BFA2E6, VERSION 1, SIZE 00000354) |
| .IMPORT Texts (KEY 0B9E9984) |
| .IMPORT Fonts (KEY F4C9F557) |
| .IMPORT Files (KEY 73F5D686) |
| .IMPORT Oberon (KEY A89CCEE2) |
| .IMPORT Display (KEY 4C08D3EA) |
| .IMPORT Viewers (KEY 25ABF199) |
| .DATA 28H |
| .POINTER_REFERENCES 0H 4H 24H 18H |
| .FIXUP T 0H |
| IMPORT Texts, Oberon; |
| |
| CONST Base = 10; N = 32; |
| VAR W: Texts.Writer; |
| |
| PROCEDURE Generate*; |
| VAR i, j, m, r: INTEGER; |
| d: ARRAY N OF INTEGER; (*digits*) |
| x: ARRAY N OF INTEGER; (*index*) |
| S: Texts.Scanner; |
| BEGINa Texts.OpenScanner(S,b Oberon.Par.text,c Oberon.Par.pos)d;e Texts.Scan(S)f;g |
0000 | a .PROC 1 |
0000 | a .COMMAND Generate |
0000 | a(4EE90188): SUB SP, SP, 188H |
0001 | a(AFE00000): STR LNK, SP, 0H |
0002 | b(40E80114): ADD R0, SP, 114H |
0003 | b .FIXUP D |
0003 | b(8D100003): LDR SB, MT, MOD1 [Texts] |
0004 | b(41D80003): ADD R1, SB, VAR3 |
0005 | c .FIXUP D |
0005 | c(8D400002): LDR SB, MT, MOD4 [Oberon] |
0006 | c(42D8000E): ADD R2, SB, VAR14 |
0007 | c(82200008): LDR R2, R2, 8H |
0008 | d .FIXUP D |
0008 | d(8D400003): LDR SB, MT, MOD4 [Oberon] |
0009 | d(43D8000E): ADD R3, SB, VAR14 |
000A | d(8330000C): LDR R3, R3, CH |
000B | e .FIXUP P |
000B | e(F711500B): BL MOD1 [Texts] PROC21 |
000C | f(40E80114): ADD R0, SP, 114H |
000D | f .FIXUP D |
000D | f(8D100005): LDR SB, MT, MOD1 [Texts] |
000E | f(41D80003): ADD R1, SB, VAR3 |
000F | g .FIXUP P |
000F | g(F7116004): BL MOD1 [Texts] PROC22 |
| IF (S.class = Texts.Int)h & (iS.i < N)j THENk |
0010 | h(80E00150): LDR R0, SP, 150H |
0011 | h(40090003): SUB R0, R0, 3H |
0012 | i(E9000099): BNE 153 [00ACH] |
0013 | j(80E00154): LDR R0, SP, 154H |
0014 | j(40090020): SUB R0, R0, 20H |
0015 | k(ED000096): BGE 150 [00ACH] |
| i := 2;l |
0016 | l(40000002): MOV R0, R0, 2H |
0017 | l(A0E00004): STR R0, SP, 4H |
| WHILE i <= S.i DOm j := 0;n |
0018 | m(80E00004): LDR R0, SP, 4H |
0019 | m(81E00154): LDR R1, SP, 154H |
001A | m(00090001): SUB R0, R0, R1 |
001B | m(EE000090): BGT 144 [00ACH] |
001C | n(40000000): MOV R0, R0, 0H |
001D | n(A0E00008): STR R0, SP, 8H |
| WHILE j < i DOo x[j]p := 0;q INC(j) ENDr ; |
001E | o(80E00008): LDR R0, SP, 8H |
001F | o(81E00004): LDR R1, SP, 4H |
0020 | o(00090001): SUB R0, R0, R1 |
0021 | o(ED00000B): BGE 11 [002DH] |
0022 | p(80E00008): LDR R0, SP, 8H |
0023 | p(41090020): SUB R1, R0, 20H |
0024 | p(DA01EF1C): BLCC MT [trap=1, pos=495] |
0025 | p(40010002): LSL R0, R0, 2H |
0026 | p(00E80000): ADD R0, SP, R0 |
0027 | q(41000000): MOV R1, R0, 0H |
0028 | q(A1000094): STR R1, R0, 94H |
0029 | r(80E00008): LDR R0, SP, 8H |
002A | r(40080001): ADD R0, R0, 1H |
002B | r(A0E00008): STR R0, SP, 8H |
002C | r(E7FFFFF1): B -15 [001EH] |
| m := 0;s r := 1;t |
002D | s(40000000): MOV R0, R0, 0H |
002E | s(A0E0000C): STR R0, SP, CH |
002F | t(40000001): MOV R0, R0, 1H |
0030 | t(A0E00010): STR R0, SP, 10H |
| WHILE x[r]u = 0 DOv |
0031 | u(80E00010): LDR R0, SP, 10H |
0032 | u(41090020): SUB R1, R0, 20H |
0033 | u(DA022D1C): BLCC MT [trap=1, pos=557] |
0034 | u(40010002): LSL R0, R0, 2H |
0035 | u(00E80000): ADD R0, SP, R0 |
0036 | v(80000094): LDR R0, R0, 94H |
0037 | v(E900001E): BNE 30 [0056H] |
| x[r]w := m;x r := Base*r;y d[m]z := r DIV i;a r := r MOD i;b INC(m) |
0038 | w(80E00010): LDR R0, SP, 10H |
0039 | w(41090020): SUB R1, R0, 20H |
003A | w(DA02431C): BLCC MT [trap=1, pos=579] |
003B | w(40010002): LSL R0, R0, 2H |
003C | w(00E80000): ADD R0, SP, R0 |
003D | x(81E0000C): LDR R1, SP, CH |
003E | x(A1000094): STR R1, R0, 94H |
003F | y(80E00010): LDR R0, SP, 10H |
0040 | y(400A000A): MUL R0, R0, AH |
0041 | y(A0E00010): STR R0, SP, 10H |
0042 | z(80E0000C): LDR R0, SP, CH |
0043 | z(41090020): SUB R1, R0, 20H |
0044 | z(DA025B1C): BLCC MT [trap=1, pos=603] |
0045 | z(40010002): LSL R0, R0, 2H |
0046 | z(00E80000): ADD R0, SP, R0 |
0047 | a(81E00004): LDR R1, SP, 4H |
0048 | a(D602676C): BLLE MT [trap=6, pos=615] |
0049 | a(82E00010): LDR R2, SP, 10H |
004A | a(012B0001): DIV R1, R2, R1 |
004B | a(A1000014): STR R1, R0, 14H |
004C | b(80E00004): LDR R0, SP, 4H |
004D | b(D602756C): BLLE MT [trap=6, pos=629] |
004E | b(81E00010): LDR R1, SP, 10H |
004F | b(001B0000): DIV R0, R1, R0 |
0050 | b(20000000): MOV' R0, R0, R0 |
0051 | b(A0E00010): STR R0, SP, 10H |
| ENDc ; |
0052 | c(80E0000C): LDR R0, SP, CH |
0053 | c(40080001): ADD R0, R0, 1H |
0054 | c(A0E0000C): STR R0, SP, CH |
0055 | c(E7FFFFDB): B -37 [0031H] |
| Texts.WriteInt(W,d i,e 5)f;g Texts.Write(W,h 9X)i;j Texts.Write(W,k ".")l;m j := 0;n |
0056 | d .FIXUP D |
0056 | d(8D000049): LDR SB, MT, MOD0 [Fractions] |
0057 | d(40D80000): ADD R0, SB, 0H [data] |
0058 | d .FIXUP D |
0058 | d(8D100002): LDR SB, MT, MOD1 [Texts] |
0059 | d(41D80005): ADD R1, SB, VAR5 |
005A | e(82E00004): LDR R2, SP, 4H |
005B | f(43000005): MOV R3, R0, 5H |
005C | g .FIXUP P |
005C | g(F711E04D): BL MOD1 [Texts] PROC30 |
005D | h .FIXUP D |
005D | h(8D000005): LDR SB, MT, MOD0 [Fractions] |
005E | h(40D80000): ADD R0, SB, 0H [data] |
005F | h .FIXUP D |
005F | h(8D100002): LDR SB, MT, MOD1 [Texts] |
0060 | h(41D80005): ADD R1, SB, VAR5 |
0061 | i(42000009): MOV R2, R0, 9H |
0062 | j .FIXUP P |
0062 | j(F711B006): BL MOD1 [Texts] PROC27 |
0063 | k .FIXUP D |
0063 | k(8D000004): LDR SB, MT, MOD0 [Fractions] |
0064 | k(40D80000): ADD R0, SB, 0H [data] |
0065 | k .FIXUP D |
0065 | k(8D100002): LDR SB, MT, MOD1 [Texts] |
0066 | k(41D80005): ADD R1, SB, VAR5 |
0067 | l(4200002E): MOV R2, R0, 2EH |
0068 | m .FIXUP P |
0068 | m(F711B006): BL MOD1 [Texts] PROC27 |
0069 | n(40000000): MOV R0, R0, 0H |
006A | n(A0E00008): STR R0, SP, 8H |
| WHILE j < x[r]o DOp Texts.Write(W,q CHR(d[j]r + 48)s);t INC(j) ENDu ; |
006B | o(80E00010): LDR R0, SP, 10H |
006C | o(41090020): SUB R1, R0, 20H |
006D | o(DA02F31C): BLCC MT [trap=1, pos=755] |
006E | o(40010002): LSL R0, R0, 2H |
006F | o(00E80000): ADD R0, SP, R0 |
0070 | p(81E00008): LDR R1, SP, 8H |
0071 | p(80000094): LDR R0, R0, 94H |
0072 | p(01190000): SUB R1, R1, R0 |
0073 | p(ED000010): BGE 16 [0084H] |
0074 | q .FIXUP D |
0074 | q(8D00000F): LDR SB, MT, MOD0 [Fractions] |
0075 | q(40D80000): ADD R0, SB, 0H [data] |
0076 | q .FIXUP D |
0076 | q(8D100002): LDR SB, MT, MOD1 [Texts] |
0077 | q(41D80005): ADD R1, SB, VAR5 |
0078 | r(82E00008): LDR R2, SP, 8H |
0079 | r(43290020): SUB R3, R2, 20H |
007A | r(DA030E1C): BLCC MT [trap=1, pos=782] |
007B | r(42210002): LSL R2, R2, 2H |
007C | r(02E80002): ADD R2, SP, R2 |
007D | s(82200014): LDR R2, R2, 14H |
007E | s(42280030): ADD R2, R2, 30H |
007F | t .FIXUP P |
007F | t(F711B017): BL MOD1 [Texts] PROC27 |
0080 | u(80E00008): LDR R0, SP, 8H |
0081 | u(40080001): ADD R0, R0, 1H |
0082 | u(A0E00008): STR R0, SP, 8H |
0083 | u(E7FFFFE7): B -25 [006BH] |
| Texts.Write(W,v "'")w;x |
0084 | v .FIXUP D |
0084 | v(8D00000E): LDR SB, MT, MOD0 [Fractions] |
0085 | v(40D80000): ADD R0, SB, 0H [data] |
0086 | v .FIXUP D |
0086 | v(8D100002): LDR SB, MT, MOD1 [Texts] |
0087 | v(41D80005): ADD R1, SB, VAR5 |
0088 | w(42000027): MOV R2, R0, 27H |
0089 | x .FIXUP P |
0089 | x(F711B00A): BL MOD1 [Texts] PROC27 |
| WHILE j < m DOy Texts.Write(W,z CHR(d[j]a + 48)b);c INC(j) ENDd ; |
008A | y(80E00008): LDR R0, SP, 8H |
008B | y(81E0000C): LDR R1, SP, CH |
008C | y(00090001): SUB R0, R0, R1 |
008D | y(ED000010): BGE 16 [009EH] |
008E | z .FIXUP D |
008E | z(8D000008): LDR SB, MT, MOD0 [Fractions] |
008F | z(40D80000): ADD R0, SB, 0H [data] |
0090 | z .FIXUP D |
0090 | z(8D100002): LDR SB, MT, MOD1 [Texts] |
0091 | z(41D80005): ADD R1, SB, VAR5 |
0092 | a(82E00008): LDR R2, SP, 8H |
0093 | a(43290020): SUB R3, R2, 20H |
0094 | a(DA036F1C): BLCC MT [trap=1, pos=879] |
0095 | a(42210002): LSL R2, R2, 2H |
0096 | a(02E80002): ADD R2, SP, R2 |
0097 | b(82200014): LDR R2, R2, 14H |
0098 | b(42280030): ADD R2, R2, 30H |
0099 | c .FIXUP P |
0099 | c(F711B010): BL MOD1 [Texts] PROC27 |
009A | d(80E00008): LDR R0, SP, 8H |
009B | d(40080001): ADD R0, R0, 1H |
009C | d(A0E00008): STR R0, SP, 8H |
009D | d(E7FFFFEC): B -20 [008AH] |
| Texts.WriteLn(W)e;f Texts.Append(Oberon.Log,g W.buf)h;i INC(i) |
009E | e .FIXUP D |
009E | e(8D00000E): LDR SB, MT, MOD0 [Fractions] |
009F | e(40D80000): ADD R0, SB, 0H [data] |
00A0 | e .FIXUP D |
00A0 | e(8D100002): LDR SB, MT, MOD1 [Texts] |
00A1 | e(41D80005): ADD R1, SB, VAR5 |
00A2 | f .FIXUP P |
00A2 | f(F711C009): BL MOD1 [Texts] PROC28 |
00A3 | g .FIXUP D |
00A3 | g(8D400003): LDR SB, MT, MOD4 [Oberon] |
00A4 | g(80D0000D): LDR R0, SB, VAR13 |
00A5 | h .FIXUP D |
00A5 | h(8D000002): LDR SB, MT, MOD0 [Fractions] |
00A6 | h(81D00000): LDR R1, SB, 0H [data] |
00A7 | i .FIXUP P |
00A7 | i(F710E005): BL MOD1 [Texts] PROC14 |
| ENDj |
00A8 | j(80E00004): LDR R0, SP, 4H |
00A9 | j(40080001): ADD R0, R0, 1H |
00AA | j(A0E00004): STR R0, SP, 4H |
00AB | j(E7FFFF6C): B -148 [0018H] |
| END |
| ENDk Generate; |
00AC | k(8FE00000): LDR LNK, SP, 0H |
00AD | k(4EE80188): ADD SP, SP, 188H |
00AE | k(C700000F): B LNK |
| |
| BEGINl Texts.OpenWriter(W)m |
00AF | l .PROC 0 |
00AF | l .ENTRYPOINT |
00AF | l(4EE90004): SUB SP, SP, 4H |
00B0 | l(AFE00000): STR LNK, SP, 0H |
00B1 | m .FIXUP D |
00B1 | m(8D00000C): LDR SB, MT, MOD0 [Fractions] |
00B2 | m(40D80000): ADD R0, SB, 0H [data] |
00B3 | m .FIXUP D |
00B3 | m(8D100002): LDR SB, MT, MOD1 [Texts] |
00B4 | m(41D80005): ADD R1, SB, VAR5 |
| ENDn Fractions.o |
00B5 | n .FIXUP P |
00B5 | n(F711700E): BL MOD1 [Texts] PROC23 |
00B6 | o(8FE00000): LDR LNK, SP, 0H |
00B7 | o(4EE80004): ADD SP, SP, 4H |
00B8 | o(C700000F): B LNK |