BootLoad

Used Exports

BUILTINS: DEC INC INTEGER LED LSL ROR
SYSTEM: BIT GET LDREG PUT REG

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;
0000b(E7000151): B 337 [0152H]
0001a(00000000): MOV R0, R0, R0
0002a(00000000): MOV R0, R0, R0
0003a(00000000): MOV R0, R0, R0
0004a(00000000): MOV R0, R0, R0
0005a(00000000): MOV R0, R0, R0
0006a(00000000): MOV R0, R0, R0
0007a(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
0008c(4EE90014): SUB SP, SP, 14H
0009c(AFE00000): STR LNK, SP, 0H
000Ac(A0E00004): STR R0, SP, 4H
000Bd(40000000): MOV R0, R0, 0H
000Cd(A0E00008): STR R0, SP, 8H
000De(40000004): MOV R0, R0, 4H
000Ee(A0E00010): STR R0, SP, 10H
REPEAT i := i-1;f
000Ff(80E00010): LDR R0, SP, 10H
0010f(40090001): SUB R0, R0, 1H
0011f(A0E00010): STR R0, SP, 10H
REPEAT UNTIL SYSTEM.BIT(rsCtrl, 0);g
0012g(5000FFCC): MOV R0, R0, FFFFFFCCH
0013g(80000000): LDR R0, R0, 0H
0014g(40030001): ROR R0, R0, 1H
0015g(E8FFFFFC): BPL -4 [0012H]
SYSTEM.GET(rsData, y);h z := ROR(z+y,i 8)
0016h(5000FFC8): MOV R0, R0, FFFFFFC8H
0017h(80000000): LDR R0, R0, 0H
0018h(A0E0000C): STR R0, SP, CH
0019i(80E00008): LDR R0, SP, 8H
001Ai(81E0000C): LDR R1, SP, CH
001Bi(00080001): ADD R0, R0, R1
UNTILj i = 0;k
001Cj(40030008): ROR R0, R0, 8H
001Dj(A0E00008): STR R0, SP, 8H
001Ek(80E00010): LDR R0, SP, 10H
001Fk(E9FFFFEF): BNE -17 [000FH]
x := z
ENDl RecInt;
0020l(80E00008): LDR R0, SP, 8H
0021l(81E00004): LDR R1, SP, 4H
0022l(A0100000): STR R0, R1, 0H
0023l(8FE00000): LDR LNK, SP, 0H
0024l(4EE80014): ADD SP, SP, 14H
0025l(C700000F): B LNK
PROCEDURE LoadFromLine;
VAR len, adr, dat: INTEGER;
BEGINm RecInt(len)n;o
0026m(4EE90010): SUB SP, SP, 10H
0027m(AFE00000): STR LNK, SP, 0H
0028n(40E80004): ADD R0, SP, 4H
0029o(F7FFFFDE): BL -34 [0008H]
WHILE len > 0 DOp
002Ap(80E00004): LDR R0, SP, 4H
002Bp(40090000): SUB R0, R0, 0H
002Cp(E6000012): BLE 18 [003FH]
RecInt(adr)q;r
002Dq(40E80008): ADD R0, SP, 8H
002Er(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
002Fs(40E8000C): ADD R0, SP, CH
0030t(F7FFFFD7): BL -41 [0008H]
0031u(80E00008): LDR R0, SP, 8H
0032u(81E0000C): LDR R1, SP, CH
0033u(A1000000): STR R1, R0, 0H
0034v(80E00008): LDR R0, SP, 8H
0035v(40080004): ADD R0, R0, 4H
0036v(A0E00008): STR R0, SP, 8H
0037w(80E00004): LDR R0, SP, 4H
0038w(40090004): SUB R0, R0, 4H
0039w(A0E00004): STR R0, SP, 4H
003Ax(80E00004): LDR R0, SP, 4H
003Bx(E9FFFFF3): BNE -13 [002FH]
RecInt(len)y
003Cy(40E80004): ADD R0, SP, 4H
ENDz
003Dz(F7FFFFCA): BL -54 [0008H]
003Ez(E7FFFFEB): B -21 [002AH]
ENDa LoadFromLine;
003Fa(8FE00000): LDR LNK, SP, 0H
0040a(4EE80010): ADD SP, SP, 10H
0041a(C700000F): B LNK
(* ---------- disk ------------*)
PROCEDURE SPIIdle(n: INTEGER); (*send n FFs slowly with no card selected*)
BEGINb SYSTEM.PUT(spiCtrl, 0);c
0042b(4EE90008): SUB SP, SP, 8H
0043b(AFE00000): STR LNK, SP, 0H
0044b(A0E00004): STR R0, SP, 4H
0045c(5000FFD4): MOV R0, R0, FFFFFFD4H
0046c(41000000): MOV R1, R0, 0H
0047c(A1000000): STR R1, R0, 0H
WHILE n > 0 DOd DEC(n);e SYSTEM.PUT(spiData, -1);f
0048d(80E00004): LDR R0, SP, 4H
0049d(40090000): SUB R0, R0, 0H
004Ad(E600000B): BLE 11 [0056H]
004Be(80E00004): LDR R0, SP, 4H
004Ce(40090001): SUB R0, R0, 1H
004De(A0E00004): STR R0, SP, 4H
004Ef(5000FFD0): MOV R0, R0, FFFFFFD0H
004Ff(5100FFFF): MOV R1, R0, FFFFFFFFH
0050f(A1000000): STR R1, R0, 0H
REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0)
ENDg
0051g(5000FFD4): MOV R0, R0, FFFFFFD4H
0052g(80000000): LDR R0, R0, 0H
0053g(40030001): ROR R0, R0, 1H
0054g(E8FFFFFC): BPL -4 [0051H]
0055g(E7FFFFF2): B -14 [0048H]
ENDh SPIIdle;
0056h(8FE00000): LDR LNK, SP, 0H
0057h(4EE80008): ADD SP, SP, 8H
0058h(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
0059i(4EE90008): SUB SP, SP, 8H
005Ai(AFE00000): STR LNK, SP, 0H
005Bi(A0E00004): STR R0, SP, 4H
005Cj(5000FFD4): MOV R0, R0, FFFFFFD4H
005Dj(41000001): MOV R1, R0, 1H
005Ej(A1000000): STR R1, R0, 0H
005Fk(5000FFD0): MOV R0, R0, FFFFFFD0H
0060k(81E00004): LDR R1, SP, 4H
0061k(A1000000): STR R1, R0, 0H
REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0)
ENDl SPI;
0062l(5000FFD4): MOV R0, R0, FFFFFFD4H
0063l(80000000): LDR R0, R0, 0H
0064l(40030001): ROR R0, R0, 1H
0065l(E8FFFFFC): BPL -4 [0062H]
0066l(8FE00000): LDR LNK, SP, 0H
0067l(4EE80008): ADD SP, SP, 8H
0068l(C700000F): B LNK
PROCEDURE SPICmd(n, arg: INTEGER);
VAR i, data, crc: INTEGER;
BEGINm (*send cmd*)
0069m(4EE90018): SUB SP, SP, 18H
006Am(AFE00000): STR LNK, SP, 0H
006Bm(A0E00004): STR R0, SP, 4H
006Cm(A1E00008): STR R1, SP, 8H
REPEAT SPIIdle(1)n;o SYSTEM.GET(spiData, data) UNTILp data = 255;q (*flush while unselected*)
006Dn(40000001): MOV R0, R0, 1H
006Eo(F7FFFFD3): BL -45 [0042H]
006Fp(5000FFD0): MOV R0, R0, FFFFFFD0H
0070p(80000000): LDR R0, R0, 0H
0071p(A0E00010): STR R0, SP, 10H
0072q(80E00010): LDR R0, SP, 10H
0073q(400900FF): SUB R0, R0, FFH
0074q(E9FFFFF8): BNE -8 [006DH]
REPEAT SPI(255)r;s SYSTEM.GET(spiData, data) UNTILt data = 255;u (*flush while selected*)
0075r(400000FF): MOV R0, R0, FFH
0076s(F7FFFFE2): BL -30 [0059H]
0077t(5000FFD0): MOV R0, R0, FFFFFFD0H
0078t(80000000): LDR R0, R0, 0H
0079t(A0E00010): STR R0, SP, 10H
007Au(80E00010): LDR R0, SP, 10H
007Bu(400900FF): SUB R0, R0, FFH
007Cu(E9FFFFF8): BNE -8 [0075H]
IF n = 8 THENv crc := 135 ELSIFw nx = 0 THENy crc := 149 ELSEz crca := 255 ENDb;
007Dv(80E00004): LDR R0, SP, 4H
007Ev(40090008): SUB R0, R0, 8H
007Fv(E9000003): BNE 3 [0083H]
0080w(40000087): MOV R0, R0, 87H
0081w(A0E00014): STR R0, SP, 14H
0082x(E7000007): B 7 [008AH]
0083y(80E00004): LDR R0, SP, 4H
0084y(E9000003): BNE 3 [0088H]
0085z(40000095): MOV R0, R0, 95H
0086z(A0E00014): STR R0, SP, 14H
0087a(E7000002): B 2 [008AH]
0088b(400000FF): MOV R0, R0, FFH
0089b(A0E00014): STR R0, SP, 14H
SPI(n MOD 64 +c 64)d;e (*send command*)
008Ac(80E00004): LDR R0, SP, 4H
008Bc(4004003F): AND R0, R0, 3FH
008Cd(40080040): ADD R0, R0, 40H
008De(F7FFFFCB): BL -53 [0059H]
FOR i := 24 TOf 0 BY -8 DO SPIg(ROR(arg, i))h ENDi;j (*send arg*)
008Ef(40000018): MOV R0, R0, 18H
008Fg(41090000): SUB R1, R0, 0H
0090g(E5000008): BLT 8 [0099H]
0091g(A0E0000C): STR R0, SP, CH
0092h(80E00008): LDR R0, SP, 8H
0093h(81E0000C): LDR R1, SP, CH
0094h(00030001): ROR R0, R0, R1
0095i(F7FFFFC3): BL -61 [0059H]
0096j(80E0000C): LDR R0, SP, CH
0097j(5008FFF8): ADD R0, R0, FFFFFFF8H
0098j(E7FFFFF6): B -10 [008FH]
SPI(crc)k;l i := 32;m
0099k(80E00014): LDR R0, SP, 14H
009Al(F7FFFFBE): BL -66 [0059H]
009Bm(40000020): MOV R0, R0, 20H
009Cm(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
009Dn(400000FF): MOV R0, R0, FFH
009Eo(F7FFFFBA): BL -70 [0059H]
009Fp(5000FFD0): MOV R0, R0, FFFFFFD0H
00A0p(80000000): LDR R0, R0, 0H
00A1p(A0E00010): STR R0, SP, 10H
00A2q(80E0000C): LDR R0, SP, CH
00A3q(40090001): SUB R0, R0, 1H
00A4q(A0E0000C): STR R0, SP, CH
00A5r(80E00010): LDR R0, SP, 10H
00A6r(40090080): SUB R0, R0, 80H
00A7s(E5000002): BLT 2 [00AAH]
00A8t(80E0000C): LDR R0, SP, CH
ENDu SPICmd;
00A9u(E9FFFFF3): BNE -13 [009DH]
00AAu(8FE00000): LDR LNK, SP, 0H
00ABu(4EE80018): ADD SP, SP, 18H
00ACu(C700000F): B LNK
PROCEDURE InitSPI;
VAR res, data: INTEGER;
BEGINv SPIIdle(9)w;x (*first, idle for at least 80 clks*)
00ADv(4EE9000C): SUB SP, SP, CH
00AEv(AFE00000): STR LNK, SP, 0H
00AFw(40000009): MOV R0, R0, 9H
00B0x(F7FFFF91): BL -111 [0042H]
SPICmd(0,y 0)z;a (*CMD0 when card selected, sets MMC SPI mode*)
00B1y(40000000): MOV R0, R0, 0H
00B2z(41000000): MOV R1, R0, 0H
00B3a(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*)
00B4b(40000008): MOV R0, R0, 8H
00B5c(410001AA): MOV R1, R0, 1AAH
00B6d(F7FFFFB2): BL -78 [0069H]
00B7e(5000FFFF): MOV R0, R0, FFFFFFFFH
00B8f(F7FFFFA0): BL -96 [0059H]
00B9g(5000FFFF): MOV R0, R0, FFFFFFFFH
00BAh(F7FFFF9E): BL -98 [0059H]
00BBi(5000FFFF): MOV R0, R0, FFFFFFFFH
00BCj(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*)
00BDk(40000037): MOV R0, R0, 37H
00BEl(41000000): MOV R1, R0, 0H
00BFm(F7FFFFA9): BL -87 [0069H]
SPICmd(41,n LSL(1(*HCS*), 30))o;p
00C0n(40000029): MOV R0, R0, 29H
00C1o(41000001): MOV R1, R0, 1H
00C2o(4111001E): LSL R1, R1, 1EH
00C3p(F7FFFFA5): BL -91 [0069H]
SYSTEM.GET(spiData, res);q
00C4q(5000FFD0): MOV R0, R0, FFFFFFD0H
00C5q(80000000): LDR R0, R0, 0H
00C6q(A0E00004): STR R0, SP, 4H
SPI(-1)r;s SPI(-1)t;u SPI(-1)v;w (*flush response*)
00C7r(5000FFFF): MOV R0, R0, FFFFFFFFH
00C8s(F7FFFF90): BL -112 [0059H]
00C9t(5000FFFF): MOV R0, R0, FFFFFFFFH
00CAu(F7FFFF8E): BL -114 [0059H]
00CBv(5000FFFF): MOV R0, R0, FFFFFFFFH
00CCw(F7FFFF8C): BL -116 [0059H]
SPIIdle(10000)x
00CDx(40002710): MOV R0, R0, 2710H
UNTILy res = 0;z
00CEy(F7FFFF73): BL -141 [0042H]
00CFz(80E00004): LDR R0, SP, 4H
00D0z(E9FFFFEC): BNE -20 [00BDH]
(*CMD16 set block size as a precaution (should default)*)
SPICmd(16,a 512)b;c SPIIdle(1)d
00D1a(40000010): MOV R0, R0, 10H
00D2b(41000200): MOV R1, R0, 200H
00D3c(F7FFFF95): BL -107 [0069H]
00D4d(40000001): MOV R0, R0, 1H
ENDe InitSPI;
00D5e(F7FFFF6C): BL -148 [0042H]
00D6e(8FE00000): LDR LNK, SP, 0H
00D7e(4EE8000C): ADD SP, SP, CH
00D8e(C700000F): B LNK
PROCEDURE SDShift(VAR n: INTEGER);
VAR data: INTEGER;
BEGINf SPICmd(58,g 0)h;i (*CMD58 get card capacity bit*)
00D9f(4EE9000C): SUB SP, SP, CH
00DAf(AFE00000): STR LNK, SP, 0H
00DBf(A0E00004): STR R0, SP, 4H
00DCg(4000003A): MOV R0, R0, 3AH
00DDh(41000000): MOV R1, R0, 0H
00DEi(F7FFFF8A): BL -118 [0069H]
SYSTEM.GET(spiData, data);j SPI(-1)k;l
00DFj(5000FFD0): MOV R0, R0, FFFFFFD0H
00E0j(80000000): LDR R0, R0, 0H
00E1j(A0E00008): STR R0, SP, 8H
00E2k(5000FFFF): MOV R0, R0, FFFFFFFFH
00E3l(F7FFFF75): BL -139 [0059H]
IF (data # 0)m OR ~nSYSTEM.BIT(spiData, 6) THENo n := n * 512 ENDp ; (*non-SDHC card*)
00E4m(80E00008): LDR R0, SP, 8H
00E5n(E9000004): BNE 4 [00EAH]
00E6o(5000FFD0): MOV R0, R0, FFFFFFD0H
00E7o(80000000): LDR R0, R0, 0H
00E8o(40030007): ROR R0, R0, 7H
00E9o(E0000005): BMI 5 [00EFH]
00EAp(80E00004): LDR R0, SP, 4H
00EBp(80000000): LDR R0, R0, 0H
00ECp(40010009): LSL R0, R0, 9H
00EDp(81E00004): LDR R1, SP, 4H
00EEp(A0100000): STR R0, R1, 0H
SPI(-1)q;r SPI(-1)s;t SPIIdle(1)u (*flush response*)
00EFq(5000FFFF): MOV R0, R0, FFFFFFFFH
00F0r(F7FFFF68): BL -152 [0059H]
00F1s(5000FFFF): MOV R0, R0, FFFFFFFFH
00F2t(F7FFFF66): BL -154 [0059H]
00F3u(40000001): MOV R0, R0, 1H
ENDv SDShift;
00F4v(F7FFFF4D): BL -179 [0042H]
00F5v(8FE00000): LDR LNK, SP, 0H
00F6v(4EE8000C): ADD SP, SP, CH
00F7v(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*)
00F8w(4EE90014): SUB SP, SP, 14H
00F9w(AFE00000): STR LNK, SP, 0H
00FAw(A0E00004): STR R0, SP, 4H
00FBw(A1E00008): STR R1, SP, 8H
00FCx(40E80004): ADD R0, SP, 4H
00FDy(F7FFFFDB): BL -37 [00D9H]
00FEz(40000011): MOV R0, R0, 11H
00FFa(81E00004): LDR R1, SP, 4H
0100b(F7FFFF68): BL -152 [0069H]
i := 0;c (*wait for start data marker*)
0101c(40000000): MOV R0, R0, 0H
0102c(A0E0000C): STR R0, SP, CH
REPEAT SPI(-1)d;e SYSTEM.GET(spiData, data);f INC(i) UNTILg data = 254;h
0103d(5000FFFF): MOV R0, R0, FFFFFFFFH
0104e(F7FFFF54): BL -172 [0059H]
0105f(5000FFD0): MOV R0, R0, FFFFFFD0H
0106f(80000000): LDR R0, R0, 0H
0107f(A0E00010): STR R0, SP, 10H
0108g(80E0000C): LDR R0, SP, CH
0109g(40080001): ADD R0, R0, 1H
010Ag(A0E0000C): STR R0, SP, CH
010Bh(80E00010): LDR R0, SP, 10H
010Ch(400900FE): SUB R0, R0, FEH
010Dh(E9FFFFF5): BNE -11 [0103H]
SYSTEM.PUT(spiCtrl, SPIFAST + CARD0);i
010Ei(5000FFD4): MOV R0, R0, FFFFFFD4H
010Fi(41000005): MOV R1, R0, 5H
0110i(A1000000): STR R1, R0, 0H
FOR i := 0 TOj 508 BY 4 DO
0111j(40000000): MOV R0, R0, 0H
SYSTEMk.PUT(spiData, -1);l
0112k(410901FC): SUB R1, R0, 1FCH
0113k(EE000014): BGT 20 [0128H]
0114k(A0E0000C): STR R0, SP, CH
0115l(5000FFD0): MOV R0, R0, FFFFFFD0H
0116l(5100FFFF): MOV R1, R0, FFFFFFFFH
0117l(A1000000): STR R1, R0, 0H
REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0);m
0118m(5000FFD4): MOV R0, R0, FFFFFFD4H
0119m(80000000): LDR R0, R0, 0H
011Am(40030001): ROR R0, R0, 1H
011Bm(E8FFFFFC): BPL -4 [0118H]
SYSTEM.GET(spiData, data);n SYSTEM.PUT(dst, data);o INC(dst, 4)
011Cn(5000FFD0): MOV R0, R0, FFFFFFD0H
011Dn(80000000): LDR R0, R0, 0H
011En(A0E00010): STR R0, SP, 10H
011Fo(80E00008): LDR R0, SP, 8H
0120o(81E00010): LDR R1, SP, 10H
0121o(A1000000): STR R1, R0, 0H
ENDp;q
0122p(80E00008): LDR R0, SP, 8H
0123p(40080004): ADD R0, R0, 4H
0124p(A0E00008): STR R0, SP, 8H
0125q(80E0000C): LDR R0, SP, CH
0126q(40080004): ADD R0, R0, 4H
0127q(E7FFFFEA): B -22 [0112H]
SPI(255)r;s SPI(255)t;u SPIIdle(1)v (*may be a checksum; deselect card*)
0128r(400000FF): MOV R0, R0, FFH
0129s(F7FFFF2F): BL -209 [0059H]
012At(400000FF): MOV R0, R0, FFH
012Bu(F7FFFF2D): BL -211 [0059H]
012Cv(40000001): MOV R0, R0, 1H
ENDw ReadSD;
012Dw(F7FFFF14): BL -236 [0042H]
012Ew(8FE00000): LDR LNK, SP, 0H
012Fw(4EE80014): ADD SP, SP, 14H
0130w(C700000F): B LNK
PROCEDURE LoadFromDisk;
VAR src, dst, adr, lim: INTEGER;
BEGINx src := FSoffset + 4;y (*start at boot block*)
0131x(4EE90014): SUB SP, SP, 14H
0132x(AFE00000): STR LNK, SP, 0H
0133y(60000008): MOV' R0, R0, 8H
0134y(40060004): IOR R0, R0, 4H
0135y(A0E00004): STR R0, SP, 4H
ReadSD(src,z 0)a;b SYSTEM.GET(16, lim);c
0136z(80E00004): LDR R0, SP, 4H
0137a(41000000): MOV R1, R0, 0H
0138b(F7FFFFBF): BL -65 [00F8H]
0139c(40000010): MOV R0, R0, 10H
013Ac(80000000): LDR R0, R0, 0H
013Bc(A0E00010): STR R0, SP, 10H
INC(src);d dst := 512;e
013Cd(80E00004): LDR R0, SP, 4H
013Dd(40080001): ADD R0, R0, 1H
013Ed(A0E00004): STR R0, SP, 4H
013Fe(40000200): MOV R0, R0, 200H
0140e(A0E00008): STR R0, SP, 8H
WHILE dst < lim DOf ReadSD(src,g dst)h;i INC(src);j INC(dst, 512) ENDk
0141f(80E00008): LDR R0, SP, 8H
0142f(81E00010): LDR R1, SP, 10H
0143f(00090001): SUB R0, R0, R1
0144f(ED00000A): BGE 10 [014FH]
0145g(80E00004): LDR R0, SP, 4H
0146h(81E00008): LDR R1, SP, 8H
0147i(F7FFFFB0): BL -80 [00F8H]
0148j(80E00004): LDR R0, SP, 4H
0149j(40080001): ADD R0, R0, 1H
014Aj(A0E00004): STR R0, SP, 4H
014Bk(80E00008): LDR R0, SP, 8H
014Ck(40080200): ADD R0, R0, 200H
014Dk(A0E00008): STR R0, SP, 8H
014Ek(E7FFFFF2): B -14 [0141H]
ENDl LoadFromDisk;
014Fl(8FE00000): LDR LNK, SP, 0H
0150l(4EE80014): ADD SP, SP, 14H
0151l(C700000F): B LNK
BEGINm SYSTEM.LDREG(SP, stackOrg);n SYSTEM.LDREG(MT, MTOrg);o
0152m .PROC 0
0152m .ENTRYPOINT
0152m(4D000000): MOV SB, R0, 0H
0153m(5E00FFC0): MOV SP, R0, FFFFFFC0H
0154n(60000008): MOV' R0, R0, 8H
0155n(0E000000): MOV SP, R0, R0
0156o(4C000020): MOV MT, R0, 20H
IF SYSTEM.REG(LNK) =p 0 THENq (*cold start*)
0157p(0000000F): MOV R0, R0, LNK
0158q(40090000): SUB R0, R0, 0H
0159q(E9000012): BNE 18 [016CH]
LED(80H);r InitSPI;s
015Ar(40000080): MOV R0, R0, 80H
015Br(5100FFC4): MOV R1, R0, FFFFFFC4H
015Cr(A0100000): STR R0, R1, 0H
015Ds(F7FFFF4F): BL -177 [00ADH]
IF SYSTEM.BIT(swi, 0) THENt LED(81H);u LoadFromLine ELSEv LEDw(82H);x LoadFromDisk ENDy ;
015Et(5000FFC4): MOV R0, R0, FFFFFFC4H
015Ft(80000000): LDR R0, R0, 0H
0160t(40030001): ROR R0, R0, 1H
0161t(E8000005): BPL 5 [0167H]
0162u(40000081): MOV R0, R0, 81H
0163u(5100FFC4): MOV R1, R0, FFFFFFC4H
0164u(A0100000): STR R0, R1, 0H
0165v(F7FFFEC0): BL -320 [0026H]
0166w(E7000004): B 4 [016BH]
0167x(40000082): MOV R0, R0, 82H
0168x(5100FFC4): MOV R1, R0, FFFFFFC4H
0169x(A0100000): STR R0, R1, 0H
016Ay(F7FFFFC6): BL -58 [0131H]
ELSIF SYSTEMz.BIT(swi, 0) THENa LED(81H);b LoadFromLine
016Bz(E7000008): B 8 [0174H]
016Ca(5000FFC4): MOV R0, R0, FFFFFFC4H
016Da(80000000): LDR R0, R0, 0H
016Ea(40030001): ROR R0, R0, 1H
016Fa(E8000004): BPL 4 [0174H]
0170b(40000081): MOV R0, R0, 81H
0171b(5100FFC4): MOV R1, R0, FFFFFFC4H
0172b(A0100000): STR R0, R1, 0H
ENDc ;
0173c(F7FFFEB2): BL -334 [0026H]
SYSTEM.PUT(12, MemLim);d SYSTEM.PUT(24, stackOrg);e LED(84H)
0174d(4000000C): MOV R0, R0, CH
0175d(6100000E): MOV' R1, R0, EH
0176d(41167EF0): IOR R1, R1, 7EF0H
0177d(A1000000): STR R1, R0, 0H
0178e(40000018): MOV R0, R0, 18H
0179e(61000008): MOV' R1, R0, 8H
017Ae(A1000000): STR R1, R0, 0H
ENDf BootLoad.g
017Bf(40000084): MOV R0, R0, 84H
017Cf(5100FFC4): MOV R1, R0, FFFFFFC4H
017Df(A0100000): STR R0, R1, 0H
017Eg(40000000): MOV R0, R0, 0H
017Fg(C7000000): B R0