| MODULE* BootLoad; (*NW 20.10.2013 / PR 4.2.2014; boot from SDHC disk or line*) |
| .MODULE BootLoad (KEY 00000000, VERSION 0, SIZE 0000060C) |
| .FIXUP T 0H |
| IMPORT SYSTEM; |
| (* sw0: init SD; sw1: line|disk*) |
| CONSTa MT = 12; SP = 14; LNK = 15; |
0000 | b(E7000151): B 337 [0152H] |
0001 | a(00000000): MOV R0, R0, R0 |
0002 | a(00000000): MOV R0, R0, R0 |
0003 | a(00000000): MOV R0, R0, R0 |
0004 | a(00000000): MOV R0, R0, R0 |
0005 | a(00000000): MOV R0, R0, R0 |
0006 | a(00000000): MOV R0, R0, R0 |
0007 | a(00000000): MOV R0, R0, R0 |
| MTOrg = 20H; MemLim = 0E7EF0H; stackOrg = 80000H; |
| swi = -60; led = -60; rsData = -56; rsCtrl = -52; |
| b spiData = -48; spiCtrl = -44; |
| CARD0 = 1; SPIFAST = 4; |
| FSoffset = 80000H; (*block offset*) |
| |
| PROCEDURE RecInt(VAR x: INTEGER); |
| VAR z, y, i: INTEGER; |
| BEGINc z := 0;d i := 4;e |
0008 | c(4EE90014): SUB SP, SP, 14H |
0009 | c(AFE00000): STR LNK, SP, 0H |
000A | c(A0E00004): STR R0, SP, 4H |
000B | d(40000000): MOV R0, R0, 0H |
000C | d(A0E00008): STR R0, SP, 8H |
000D | e(40000004): MOV R0, R0, 4H |
000E | e(A0E00010): STR R0, SP, 10H |
| REPEAT i := i-1;f |
000F | f(80E00010): LDR R0, SP, 10H |
0010 | f(40090001): SUB R0, R0, 1H |
0011 | f(A0E00010): STR R0, SP, 10H |
| REPEAT UNTIL SYSTEM.BIT(rsCtrl, 0);g |
0012 | g(5000FFCC): MOV R0, R0, FFFFFFCCH |
0013 | g(80000000): LDR R0, R0, 0H |
0014 | g(40030001): ROR R0, R0, 1H |
0015 | g(E8FFFFFC): BPL -4 [0012H] |
| SYSTEM.GET(rsData, y);h z := ROR(z+y,i 8) |
0016 | h(5000FFC8): MOV R0, R0, FFFFFFC8H |
0017 | h(80000000): LDR R0, R0, 0H |
0018 | h(A0E0000C): STR R0, SP, CH |
0019 | i(80E00008): LDR R0, SP, 8H |
001A | i(81E0000C): LDR R1, SP, CH |
001B | i(00080001): ADD R0, R0, R1 |
| UNTILj i = 0;k |
001C | j(40030008): ROR R0, R0, 8H |
001D | j(A0E00008): STR R0, SP, 8H |
001E | k(80E00010): LDR R0, SP, 10H |
001F | k(E9FFFFEF): BNE -17 [000FH] |
| x := z |
| ENDl RecInt; |
0020 | l(80E00008): LDR R0, SP, 8H |
0021 | l(81E00004): LDR R1, SP, 4H |
0022 | l(A0100000): STR R0, R1, 0H |
0023 | l(8FE00000): LDR LNK, SP, 0H |
0024 | l(4EE80014): ADD SP, SP, 14H |
0025 | l(C700000F): B LNK |
| |
| PROCEDURE LoadFromLine; |
| VAR len, adr, dat: INTEGER; |
| BEGINm RecInt(len)n;o |
0026 | m(4EE90010): SUB SP, SP, 10H |
0027 | m(AFE00000): STR LNK, SP, 0H |
0028 | n(40E80004): ADD R0, SP, 4H |
0029 | o(F7FFFFDE): BL -34 [0008H] |
| WHILE len > 0 DOp |
002A | p(80E00004): LDR R0, SP, 4H |
002B | p(40090000): SUB R0, R0, 0H |
002C | p(E6000012): BLE 18 [003FH] |
| RecInt(adr)q;r |
002D | q(40E80008): ADD R0, SP, 8H |
002E | r(F7FFFFD9): BL -39 [0008H] |
| REPEAT RecInt(dat)s;t SYSTEM.PUT(adr, dat);u adr := adr + 4;v len := len - 4 UNTILw len = 0;x |
002F | s(40E8000C): ADD R0, SP, CH |
0030 | t(F7FFFFD7): BL -41 [0008H] |
0031 | u(80E00008): LDR R0, SP, 8H |
0032 | u(81E0000C): LDR R1, SP, CH |
0033 | u(A1000000): STR R1, R0, 0H |
0034 | v(80E00008): LDR R0, SP, 8H |
0035 | v(40080004): ADD R0, R0, 4H |
0036 | v(A0E00008): STR R0, SP, 8H |
0037 | w(80E00004): LDR R0, SP, 4H |
0038 | w(40090004): SUB R0, R0, 4H |
0039 | w(A0E00004): STR R0, SP, 4H |
003A | x(80E00004): LDR R0, SP, 4H |
003B | x(E9FFFFF3): BNE -13 [002FH] |
| RecInt(len)y |
003C | y(40E80004): ADD R0, SP, 4H |
| ENDz |
003D | z(F7FFFFCA): BL -54 [0008H] |
003E | z(E7FFFFEB): B -21 [002AH] |
| ENDa LoadFromLine; |
003F | a(8FE00000): LDR LNK, SP, 0H |
0040 | a(4EE80010): ADD SP, SP, 10H |
0041 | a(C700000F): B LNK |
| |
| (* ---------- disk ------------*) |
| |
| PROCEDURE SPIIdle(n: INTEGER); (*send n FFs slowly with no card selected*) |
| BEGINb SYSTEM.PUT(spiCtrl, 0);c |
0042 | b(4EE90008): SUB SP, SP, 8H |
0043 | b(AFE00000): STR LNK, SP, 0H |
0044 | b(A0E00004): STR R0, SP, 4H |
0045 | c(5000FFD4): MOV R0, R0, FFFFFFD4H |
0046 | c(41000000): MOV R1, R0, 0H |
0047 | c(A1000000): STR R1, R0, 0H |
| WHILE n > 0 DOd DEC(n);e SYSTEM.PUT(spiData, -1);f |
0048 | d(80E00004): LDR R0, SP, 4H |
0049 | d(40090000): SUB R0, R0, 0H |
004A | d(E600000B): BLE 11 [0056H] |
004B | e(80E00004): LDR R0, SP, 4H |
004C | e(40090001): SUB R0, R0, 1H |
004D | e(A0E00004): STR R0, SP, 4H |
004E | f(5000FFD0): MOV R0, R0, FFFFFFD0H |
004F | f(5100FFFF): MOV R1, R0, FFFFFFFFH |
0050 | f(A1000000): STR R1, R0, 0H |
| REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0) |
| ENDg |
0051 | g(5000FFD4): MOV R0, R0, FFFFFFD4H |
0052 | g(80000000): LDR R0, R0, 0H |
0053 | g(40030001): ROR R0, R0, 1H |
0054 | g(E8FFFFFC): BPL -4 [0051H] |
0055 | g(E7FFFFF2): B -14 [0048H] |
| ENDh SPIIdle; |
0056 | h(8FE00000): LDR LNK, SP, 0H |
0057 | h(4EE80008): ADD SP, SP, 8H |
0058 | h(C700000F): B LNK |
| |
| PROCEDURE SPI(n: INTEGER); (*send&rcv byte slowly with card selected*) |
| BEGINi SYSTEM.PUT(spiCtrl, CARD0);j SYSTEM.PUT(spiData, n);k |
0059 | i(4EE90008): SUB SP, SP, 8H |
005A | i(AFE00000): STR LNK, SP, 0H |
005B | i(A0E00004): STR R0, SP, 4H |
005C | j(5000FFD4): MOV R0, R0, FFFFFFD4H |
005D | j(41000001): MOV R1, R0, 1H |
005E | j(A1000000): STR R1, R0, 0H |
005F | k(5000FFD0): MOV R0, R0, FFFFFFD0H |
0060 | k(81E00004): LDR R1, SP, 4H |
0061 | k(A1000000): STR R1, R0, 0H |
| REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0) |
| ENDl SPI; |
0062 | l(5000FFD4): MOV R0, R0, FFFFFFD4H |
0063 | l(80000000): LDR R0, R0, 0H |
0064 | l(40030001): ROR R0, R0, 1H |
0065 | l(E8FFFFFC): BPL -4 [0062H] |
0066 | l(8FE00000): LDR LNK, SP, 0H |
0067 | l(4EE80008): ADD SP, SP, 8H |
0068 | l(C700000F): B LNK |
| |
| PROCEDURE SPICmd(n, arg: INTEGER); |
| VAR i, data, crc: INTEGER; |
| BEGINm (*send cmd*) |
0069 | m(4EE90018): SUB SP, SP, 18H |
006A | m(AFE00000): STR LNK, SP, 0H |
006B | m(A0E00004): STR R0, SP, 4H |
006C | m(A1E00008): STR R1, SP, 8H |
| REPEAT SPIIdle(1)n;o SYSTEM.GET(spiData, data) UNTILp data = 255;q (*flush while unselected*) |
006D | n(40000001): MOV R0, R0, 1H |
006E | o(F7FFFFD3): BL -45 [0042H] |
006F | p(5000FFD0): MOV R0, R0, FFFFFFD0H |
0070 | p(80000000): LDR R0, R0, 0H |
0071 | p(A0E00010): STR R0, SP, 10H |
0072 | q(80E00010): LDR R0, SP, 10H |
0073 | q(400900FF): SUB R0, R0, FFH |
0074 | q(E9FFFFF8): BNE -8 [006DH] |
| REPEAT SPI(255)r;s SYSTEM.GET(spiData, data) UNTILt data = 255;u (*flush while selected*) |
0075 | r(400000FF): MOV R0, R0, FFH |
0076 | s(F7FFFFE2): BL -30 [0059H] |
0077 | t(5000FFD0): MOV R0, R0, FFFFFFD0H |
0078 | t(80000000): LDR R0, R0, 0H |
0079 | t(A0E00010): STR R0, SP, 10H |
007A | u(80E00010): LDR R0, SP, 10H |
007B | u(400900FF): SUB R0, R0, FFH |
007C | u(E9FFFFF8): BNE -8 [0075H] |
| IF n = 8 THENv crc := 135 ELSIFw nx = 0 THENy crc := 149 ELSEz crca := 255 ENDb; |
007D | v(80E00004): LDR R0, SP, 4H |
007E | v(40090008): SUB R0, R0, 8H |
007F | v(E9000003): BNE 3 [0083H] |
0080 | w(40000087): MOV R0, R0, 87H |
0081 | w(A0E00014): STR R0, SP, 14H |
0082 | x(E7000007): B 7 [008AH] |
0083 | y(80E00004): LDR R0, SP, 4H |
0084 | y(E9000003): BNE 3 [0088H] |
0085 | z(40000095): MOV R0, R0, 95H |
0086 | z(A0E00014): STR R0, SP, 14H |
0087 | a(E7000002): B 2 [008AH] |
0088 | b(400000FF): MOV R0, R0, FFH |
0089 | b(A0E00014): STR R0, SP, 14H |
| SPI(n MOD 64 +c 64)d;e (*send command*) |
008A | c(80E00004): LDR R0, SP, 4H |
008B | c(4004003F): AND R0, R0, 3FH |
008C | d(40080040): ADD R0, R0, 40H |
008D | e(F7FFFFCB): BL -53 [0059H] |
| FOR i := 24 TOf 0 BY -8 DO SPIg(ROR(arg, i))h ENDi;j (*send arg*) |
008E | f(40000018): MOV R0, R0, 18H |
008F | g(41090000): SUB R1, R0, 0H |
0090 | g(E5000008): BLT 8 [0099H] |
0091 | g(A0E0000C): STR R0, SP, CH |
0092 | h(80E00008): LDR R0, SP, 8H |
0093 | h(81E0000C): LDR R1, SP, CH |
0094 | h(00030001): ROR R0, R0, R1 |
0095 | i(F7FFFFC3): BL -61 [0059H] |
0096 | j(80E0000C): LDR R0, SP, CH |
0097 | j(5008FFF8): ADD R0, R0, FFFFFFF8H |
0098 | j(E7FFFFF6): B -10 [008FH] |
| SPI(crc)k;l i := 32;m |
0099 | k(80E00014): LDR R0, SP, 14H |
009A | l(F7FFFFBE): BL -66 [0059H] |
009B | m(40000020): MOV R0, R0, 20H |
009C | m(A0E0000C): STR R0, SP, CH |
| REPEAT SPI(255)n;o SYSTEM.GET(spiData, data);p DEC(i) UNTILq (data < 80H)r OR (si = 0)t |
009D | n(400000FF): MOV R0, R0, FFH |
009E | o(F7FFFFBA): BL -70 [0059H] |
009F | p(5000FFD0): MOV R0, R0, FFFFFFD0H |
00A0 | p(80000000): LDR R0, R0, 0H |
00A1 | p(A0E00010): STR R0, SP, 10H |
00A2 | q(80E0000C): LDR R0, SP, CH |
00A3 | q(40090001): SUB R0, R0, 1H |
00A4 | q(A0E0000C): STR R0, SP, CH |
00A5 | r(80E00010): LDR R0, SP, 10H |
00A6 | r(40090080): SUB R0, R0, 80H |
00A7 | s(E5000002): BLT 2 [00AAH] |
00A8 | t(80E0000C): LDR R0, SP, CH |
| ENDu SPICmd; |
00A9 | u(E9FFFFF3): BNE -13 [009DH] |
00AA | u(8FE00000): LDR LNK, SP, 0H |
00AB | u(4EE80018): ADD SP, SP, 18H |
00AC | u(C700000F): B LNK |
| |
| PROCEDURE InitSPI; |
| VAR res, data: INTEGER; |
| BEGINv SPIIdle(9)w;x (*first, idle for at least 80 clks*) |
00AD | v(4EE9000C): SUB SP, SP, CH |
00AE | v(AFE00000): STR LNK, SP, 0H |
00AF | w(40000009): MOV R0, R0, 9H |
00B0 | x(F7FFFF91): BL -111 [0042H] |
| SPICmd(0,y 0)z;a (*CMD0 when card selected, sets MMC SPI mode*) |
00B1 | y(40000000): MOV R0, R0, 0H |
00B2 | z(41000000): MOV R1, R0, 0H |
00B3 | a(F7FFFFB5): BL -75 [0069H] |
| SPICmd(8,b 1AAH)c;d SPI(-1)e;f SPI(-1)g;h SPI(-1)i;j (*CMD8 for SD cards*) |
00B4 | b(40000008): MOV R0, R0, 8H |
00B5 | c(410001AA): MOV R1, R0, 1AAH |
00B6 | d(F7FFFFB2): BL -78 [0069H] |
00B7 | e(5000FFFF): MOV R0, R0, FFFFFFFFH |
00B8 | f(F7FFFFA0): BL -96 [0059H] |
00B9 | g(5000FFFF): MOV R0, R0, FFFFFFFFH |
00BA | h(F7FFFF9E): BL -98 [0059H] |
00BB | i(5000FFFF): MOV R0, R0, FFFFFFFFH |
00BC | j(F7FFFF9C): BL -100 [0059H] |
| REPEAT (*until card becomes ready*) |
| (*ACMD41, optionally with high-capacity (HCS) bit set, starts init*) |
| SPICmd(55,k 0)l;m (*APP cmd follows*) |
00BD | k(40000037): MOV R0, R0, 37H |
00BE | l(41000000): MOV R1, R0, 0H |
00BF | m(F7FFFFA9): BL -87 [0069H] |
| SPICmd(41,n LSL(1(*HCS*), 30))o;p |
00C0 | n(40000029): MOV R0, R0, 29H |
00C1 | o(41000001): MOV R1, R0, 1H |
00C2 | o(4111001E): LSL R1, R1, 1EH |
00C3 | p(F7FFFFA5): BL -91 [0069H] |
| SYSTEM.GET(spiData, res);q |
00C4 | q(5000FFD0): MOV R0, R0, FFFFFFD0H |
00C5 | q(80000000): LDR R0, R0, 0H |
00C6 | q(A0E00004): STR R0, SP, 4H |
| SPI(-1)r;s SPI(-1)t;u SPI(-1)v;w (*flush response*) |
00C7 | r(5000FFFF): MOV R0, R0, FFFFFFFFH |
00C8 | s(F7FFFF90): BL -112 [0059H] |
00C9 | t(5000FFFF): MOV R0, R0, FFFFFFFFH |
00CA | u(F7FFFF8E): BL -114 [0059H] |
00CB | v(5000FFFF): MOV R0, R0, FFFFFFFFH |
00CC | w(F7FFFF8C): BL -116 [0059H] |
| SPIIdle(10000)x |
00CD | x(40002710): MOV R0, R0, 2710H |
| UNTILy res = 0;z |
00CE | y(F7FFFF73): BL -141 [0042H] |
00CF | z(80E00004): LDR R0, SP, 4H |
00D0 | z(E9FFFFEC): BNE -20 [00BDH] |
| (*CMD16 set block size as a precaution (should default)*) |
| SPICmd(16,a 512)b;c SPIIdle(1)d |
00D1 | a(40000010): MOV R0, R0, 10H |
00D2 | b(41000200): MOV R1, R0, 200H |
00D3 | c(F7FFFF95): BL -107 [0069H] |
00D4 | d(40000001): MOV R0, R0, 1H |
| ENDe InitSPI; |
00D5 | e(F7FFFF6C): BL -148 [0042H] |
00D6 | e(8FE00000): LDR LNK, SP, 0H |
00D7 | e(4EE8000C): ADD SP, SP, CH |
00D8 | e(C700000F): B LNK |
| |
| PROCEDURE SDShift(VAR n: INTEGER); |
| VAR data: INTEGER; |
| BEGINf SPICmd(58,g 0)h;i (*CMD58 get card capacity bit*) |
00D9 | f(4EE9000C): SUB SP, SP, CH |
00DA | f(AFE00000): STR LNK, SP, 0H |
00DB | f(A0E00004): STR R0, SP, 4H |
00DC | g(4000003A): MOV R0, R0, 3AH |
00DD | h(41000000): MOV R1, R0, 0H |
00DE | i(F7FFFF8A): BL -118 [0069H] |
| SYSTEM.GET(spiData, data);j SPI(-1)k;l |
00DF | j(5000FFD0): MOV R0, R0, FFFFFFD0H |
00E0 | j(80000000): LDR R0, R0, 0H |
00E1 | j(A0E00008): STR R0, SP, 8H |
00E2 | k(5000FFFF): MOV R0, R0, FFFFFFFFH |
00E3 | l(F7FFFF75): BL -139 [0059H] |
| IF (data # 0)m OR ~nSYSTEM.BIT(spiData, 6) THENo n := n * 512 ENDp ; (*non-SDHC card*) |
00E4 | m(80E00008): LDR R0, SP, 8H |
00E5 | n(E9000004): BNE 4 [00EAH] |
00E6 | o(5000FFD0): MOV R0, R0, FFFFFFD0H |
00E7 | o(80000000): LDR R0, R0, 0H |
00E8 | o(40030007): ROR R0, R0, 7H |
00E9 | o(E0000005): BMI 5 [00EFH] |
00EA | p(80E00004): LDR R0, SP, 4H |
00EB | p(80000000): LDR R0, R0, 0H |
00EC | p(40010009): LSL R0, R0, 9H |
00ED | p(81E00004): LDR R1, SP, 4H |
00EE | p(A0100000): STR R0, R1, 0H |
| SPI(-1)q;r SPI(-1)s;t SPIIdle(1)u (*flush response*) |
00EF | q(5000FFFF): MOV R0, R0, FFFFFFFFH |
00F0 | r(F7FFFF68): BL -152 [0059H] |
00F1 | s(5000FFFF): MOV R0, R0, FFFFFFFFH |
00F2 | t(F7FFFF66): BL -154 [0059H] |
00F3 | u(40000001): MOV R0, R0, 1H |
| ENDv SDShift; |
00F4 | v(F7FFFF4D): BL -179 [0042H] |
00F5 | v(8FE00000): LDR LNK, SP, 0H |
00F6 | v(4EE8000C): ADD SP, SP, CH |
00F7 | v(C700000F): B LNK |
| |
| PROCEDURE ReadSD(src, dst: INTEGER); |
| VAR i, data: INTEGER; |
| BEGINw SDShift(src)x;y SPICmd(17,z src)a;b (*CMD17 read one block*) |
00F8 | w(4EE90014): SUB SP, SP, 14H |
00F9 | w(AFE00000): STR LNK, SP, 0H |
00FA | w(A0E00004): STR R0, SP, 4H |
00FB | w(A1E00008): STR R1, SP, 8H |
00FC | x(40E80004): ADD R0, SP, 4H |
00FD | y(F7FFFFDB): BL -37 [00D9H] |
00FE | z(40000011): MOV R0, R0, 11H |
00FF | a(81E00004): LDR R1, SP, 4H |
0100 | b(F7FFFF68): BL -152 [0069H] |
| i := 0;c (*wait for start data marker*) |
0101 | c(40000000): MOV R0, R0, 0H |
0102 | c(A0E0000C): STR R0, SP, CH |
| REPEAT SPI(-1)d;e SYSTEM.GET(spiData, data);f INC(i) UNTILg data = 254;h |
0103 | d(5000FFFF): MOV R0, R0, FFFFFFFFH |
0104 | e(F7FFFF54): BL -172 [0059H] |
0105 | f(5000FFD0): MOV R0, R0, FFFFFFD0H |
0106 | f(80000000): LDR R0, R0, 0H |
0107 | f(A0E00010): STR R0, SP, 10H |
0108 | g(80E0000C): LDR R0, SP, CH |
0109 | g(40080001): ADD R0, R0, 1H |
010A | g(A0E0000C): STR R0, SP, CH |
010B | h(80E00010): LDR R0, SP, 10H |
010C | h(400900FE): SUB R0, R0, FEH |
010D | h(E9FFFFF5): BNE -11 [0103H] |
| SYSTEM.PUT(spiCtrl, SPIFAST + CARD0);i |
010E | i(5000FFD4): MOV R0, R0, FFFFFFD4H |
010F | i(41000005): MOV R1, R0, 5H |
0110 | i(A1000000): STR R1, R0, 0H |
| FOR i := 0 TOj 508 BY 4 DO |
0111 | j(40000000): MOV R0, R0, 0H |
| SYSTEMk.PUT(spiData, -1);l |
0112 | k(410901FC): SUB R1, R0, 1FCH |
0113 | k(EE000014): BGT 20 [0128H] |
0114 | k(A0E0000C): STR R0, SP, CH |
0115 | l(5000FFD0): MOV R0, R0, FFFFFFD0H |
0116 | l(5100FFFF): MOV R1, R0, FFFFFFFFH |
0117 | l(A1000000): STR R1, R0, 0H |
| REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0);m |
0118 | m(5000FFD4): MOV R0, R0, FFFFFFD4H |
0119 | m(80000000): LDR R0, R0, 0H |
011A | m(40030001): ROR R0, R0, 1H |
011B | m(E8FFFFFC): BPL -4 [0118H] |
| SYSTEM.GET(spiData, data);n SYSTEM.PUT(dst, data);o INC(dst, 4) |
011C | n(5000FFD0): MOV R0, R0, FFFFFFD0H |
011D | n(80000000): LDR R0, R0, 0H |
011E | n(A0E00010): STR R0, SP, 10H |
011F | o(80E00008): LDR R0, SP, 8H |
0120 | o(81E00010): LDR R1, SP, 10H |
0121 | o(A1000000): STR R1, R0, 0H |
| ENDp;q |
0122 | p(80E00008): LDR R0, SP, 8H |
0123 | p(40080004): ADD R0, R0, 4H |
0124 | p(A0E00008): STR R0, SP, 8H |
0125 | q(80E0000C): LDR R0, SP, CH |
0126 | q(40080004): ADD R0, R0, 4H |
0127 | q(E7FFFFEA): B -22 [0112H] |
| SPI(255)r;s SPI(255)t;u SPIIdle(1)v (*may be a checksum; deselect card*) |
0128 | r(400000FF): MOV R0, R0, FFH |
0129 | s(F7FFFF2F): BL -209 [0059H] |
012A | t(400000FF): MOV R0, R0, FFH |
012B | u(F7FFFF2D): BL -211 [0059H] |
012C | v(40000001): MOV R0, R0, 1H |
| ENDw ReadSD; |
012D | w(F7FFFF14): BL -236 [0042H] |
012E | w(8FE00000): LDR LNK, SP, 0H |
012F | w(4EE80014): ADD SP, SP, 14H |
0130 | w(C700000F): B LNK |
| |
| PROCEDURE LoadFromDisk; |
| VAR src, dst, adr, lim: INTEGER; |
| BEGINx src := FSoffset + 4;y (*start at boot block*) |
0131 | x(4EE90014): SUB SP, SP, 14H |
0132 | x(AFE00000): STR LNK, SP, 0H |
0133 | y(60000008): MOV' R0, R0, 8H |
0134 | y(40060004): IOR R0, R0, 4H |
0135 | y(A0E00004): STR R0, SP, 4H |
| ReadSD(src,z 0)a;b SYSTEM.GET(16, lim);c |
0136 | z(80E00004): LDR R0, SP, 4H |
0137 | a(41000000): MOV R1, R0, 0H |
0138 | b(F7FFFFBF): BL -65 [00F8H] |
0139 | c(40000010): MOV R0, R0, 10H |
013A | c(80000000): LDR R0, R0, 0H |
013B | c(A0E00010): STR R0, SP, 10H |
| INC(src);d dst := 512;e |
013C | d(80E00004): LDR R0, SP, 4H |
013D | d(40080001): ADD R0, R0, 1H |
013E | d(A0E00004): STR R0, SP, 4H |
013F | e(40000200): MOV R0, R0, 200H |
0140 | e(A0E00008): STR R0, SP, 8H |
| WHILE dst < lim DOf ReadSD(src,g dst)h;i INC(src);j INC(dst, 512) ENDk |
0141 | f(80E00008): LDR R0, SP, 8H |
0142 | f(81E00010): LDR R1, SP, 10H |
0143 | f(00090001): SUB R0, R0, R1 |
0144 | f(ED00000A): BGE 10 [014FH] |
0145 | g(80E00004): LDR R0, SP, 4H |
0146 | h(81E00008): LDR R1, SP, 8H |
0147 | i(F7FFFFB0): BL -80 [00F8H] |
0148 | j(80E00004): LDR R0, SP, 4H |
0149 | j(40080001): ADD R0, R0, 1H |
014A | j(A0E00004): STR R0, SP, 4H |
014B | k(80E00008): LDR R0, SP, 8H |
014C | k(40080200): ADD R0, R0, 200H |
014D | k(A0E00008): STR R0, SP, 8H |
014E | k(E7FFFFF2): B -14 [0141H] |
| ENDl LoadFromDisk; |
014F | l(8FE00000): LDR LNK, SP, 0H |
0150 | l(4EE80014): ADD SP, SP, 14H |
0151 | l(C700000F): B LNK |
| |
| BEGINm SYSTEM.LDREG(SP, stackOrg);n SYSTEM.LDREG(MT, MTOrg);o |
0152 | m .PROC 0 |
0152 | m .ENTRYPOINT |
0152 | m(4D000000): MOV SB, R0, 0H |
0153 | m(5E00FFC0): MOV SP, R0, FFFFFFC0H |
0154 | n(60000008): MOV' R0, R0, 8H |
0155 | n(0E000000): MOV SP, R0, R0 |
0156 | o(4C000020): MOV MT, R0, 20H |
| IF SYSTEM.REG(LNK) =p 0 THENq (*cold start*) |
0157 | p(0000000F): MOV R0, R0, LNK |
0158 | q(40090000): SUB R0, R0, 0H |
0159 | q(E9000012): BNE 18 [016CH] |
| LED(80H);r InitSPI;s |
015A | r(40000080): MOV R0, R0, 80H |
015B | r(5100FFC4): MOV R1, R0, FFFFFFC4H |
015C | r(A0100000): STR R0, R1, 0H |
015D | s(F7FFFF4F): BL -177 [00ADH] |
| IF SYSTEM.BIT(swi, 0) THENt LED(81H);u LoadFromLine ELSEv LEDw(82H);x LoadFromDisk ENDy ; |
015E | t(5000FFC4): MOV R0, R0, FFFFFFC4H |
015F | t(80000000): LDR R0, R0, 0H |
0160 | t(40030001): ROR R0, R0, 1H |
0161 | t(E8000005): BPL 5 [0167H] |
0162 | u(40000081): MOV R0, R0, 81H |
0163 | u(5100FFC4): MOV R1, R0, FFFFFFC4H |
0164 | u(A0100000): STR R0, R1, 0H |
0165 | v(F7FFFEC0): BL -320 [0026H] |
0166 | w(E7000004): B 4 [016BH] |
0167 | x(40000082): MOV R0, R0, 82H |
0168 | x(5100FFC4): MOV R1, R0, FFFFFFC4H |
0169 | x(A0100000): STR R0, R1, 0H |
016A | y(F7FFFFC6): BL -58 [0131H] |
| ELSIF SYSTEMz.BIT(swi, 0) THENa LED(81H);b LoadFromLine |
016B | z(E7000008): B 8 [0174H] |
016C | a(5000FFC4): MOV R0, R0, FFFFFFC4H |
016D | a(80000000): LDR R0, R0, 0H |
016E | a(40030001): ROR R0, R0, 1H |
016F | a(E8000004): BPL 4 [0174H] |
0170 | b(40000081): MOV R0, R0, 81H |
0171 | b(5100FFC4): MOV R1, R0, FFFFFFC4H |
0172 | b(A0100000): STR R0, R1, 0H |
| ENDc ; |
0173 | c(F7FFFEB2): BL -334 [0026H] |
| SYSTEM.PUT(12, MemLim);d SYSTEM.PUT(24, stackOrg);e LED(84H) |
0174 | d(4000000C): MOV R0, R0, CH |
0175 | d(6100000E): MOV' R1, R0, EH |
0176 | d(41167EF0): IOR R1, R1, 7EF0H |
0177 | d(A1000000): STR R1, R0, 0H |
0178 | e(40000018): MOV R0, R0, 18H |
0179 | e(61000008): MOV' R1, R0, 8H |
017A | e(A1000000): STR R1, R0, 0H |
| ENDf BootLoad.g |
017B | f(40000084): MOV R0, R0, 84H |
017C | f(5100FFC4): MOV R1, R0, FFFFFFC4H |
017D | f(A0100000): STR R0, R1, 0H |
017E | g(40000000): MOV R0, R0, 0H |
017F | g(C7000000): B R0 |