Kernel

Used Exports

BUILTINS: ASSERT BOOLEAN BYTE DEC EXCL INC INCL INTEGER LED LONGINT ROR SET
SYSTEM: ADR BIT GET H PUT REG

MODULE Kernel; (*NW/PR 11.4.86 / 27.12.95 / 4.2.2014*)
.MODULE Kernel (KEY 97E012DD, VERSION 1, SIZE 000032C8)
.DATA 2034H
.FIXUP T 0H
IMPORT SYSTEM;
CONST SectorLength* = 1024;
timer = -64; spiData = -48; spiCtrl = -44;
CARD0 = 1; SPIFAST = 4;
FSoffset = 80000H; (*256MB in 512-byte blocks*)
mapsize = 10000H; (*1K sectors, 64MB*)
TYPE Sector* = ARRAY SectorLength OF BYTE;
VAR allocated*, NofSectors*: INTEGER;
heapOrg*, heapLim*: INTEGER;
stackOrg* , stackSize*, MemLim*: INTEGER;
clock: INTEGER;
list0, list1, list2, list3: INTEGER; (*lists of free blocks of size n*256, 128, 64, 32 bytes*)
data: INTEGER; (*SPI data in*)
sectorMap: ARRAY mapsize DIV 32 OF SET;
(* ---------- New: heap allocation ----------*)
PROCEDURE GetBlock(VAR p: LONGINT; len: LONGINT);
(*len is multiple of 256*)
VAR q0, q1, q2, size: LONGINT; done: BOOLEAN;
BEGINa q0 := 0;b q1 := list0;c done := FALSE;d
0000a .PROC 1
0000a(4EE90020): SUB SP, SP, 20H
0001a .PROC 2
0001a(AFE00000): STR LNK, SP, 0H
0002a .PROC 3
0002a(A0E00004): STR R0, SP, 4H
0003a .PROC 4
0003a(A1E00008): STR R1, SP, 8H
0004b .PROC 5
0004b(40000000): MOV R0, R0, 0H
0005b .PROC 6
0005b(A0E0000C): STR R0, SP, CH
0006c .PROC 7
0006c .FIXUP D
0006c(8D000006): LDR SB, MT, MOD0 [Kernel]
0007c(80D00020): LDR R0, SB, 20H [data]
0008c(A0E00010): STR R0, SP, 10H
0009d(40000000): MOV R0, R0, 0H
000Ad(B0E0001C): STR R0, SP, 1CH
WHILE ~done &e (fq1 # 0)g DOh
000Be(90E0001C): LDR R0, SP, 1CH
000Cf(E9000047): BNE 71 [0054H]
000Dg(80E00010): LDR R0, SP, 10H
000Eh(E1000045): BEQ 69 [0054H]
SYSTEM.GET(q1, size);i SYSTEM.GET(q1+8,j q2);k
000Fi(80E00010): LDR R0, SP, 10H
0010i(80000000): LDR R0, R0, 0H
0011i(A0E00018): STR R0, SP, 18H
0012j(80E00010): LDR R0, SP, 10H
0013j(40080008): ADD R0, R0, 8H
0014k(80000000): LDR R0, R0, 0H
0015k(A0E00014): STR R0, SP, 14H
IF size < len THENl (*no fit*) q0 := q1;m q1 := q2
0016l(80E00018): LDR R0, SP, 18H
0017l(81E00008): LDR R1, SP, 8H
0018l(00090001): SUB R0, R0, R1
0019l(ED000005): BGE 5 [001FH]
001Am(80E00010): LDR R0, SP, 10H
001Bm(A0E0000C): STR R0, SP, CH
ELSIFn sizeo = len THENp (*extract -> p*)
001Cn(80E00014): LDR R0, SP, 14H
001Dn(A0E00010): STR R0, SP, 10H
001Eo(E7000034): B 52 [0053H]
001Fp(80E00018): LDR R0, SP, 18H
0020p(81E00008): LDR R1, SP, 8H
0021p(00090001): SUB R0, R0, R1
0022p(E9000010): BNE 16 [0033H]
done := TRUE;q p := q1;r
0023q(40000001): MOV R0, R0, 1H
0024q(B0E0001C): STR R0, SP, 1CH
0025r(80E00010): LDR R0, SP, 10H
0026r(81E00004): LDR R1, SP, 4H
0027r(A0100000): STR R0, R1, 0H
IF q0 # 0 THENs SYSTEM.PUT(q0+8,t q2) ELSEu list0v := q2 ENDw
0028s(80E0000C): LDR R0, SP, CH
0029s(E1000005): BEQ 5 [002FH]
002At(80E0000C): LDR R0, SP, CH
002Bt(40080008): ADD R0, R0, 8H
002Cu(81E00014): LDR R1, SP, 14H
002Du(A1000000): STR R1, R0, 0H
002Ev(E7000003): B 3 [0032H]
002Fw(80E00014): LDR R0, SP, 14H
0030w .FIXUP D
0030w(8D00002A): LDR SB, MT, MOD0 [Kernel]
0031w(A0D00020): STR R0, SB, 20H [data]
ELSE (*reduce size*)
donex := TRUE;y p := q1;z q1 := q1 + len;a
0032x(E7000020): B 32 [0053H]
0033y(40000001): MOV R0, R0, 1H
0034y(B0E0001C): STR R0, SP, 1CH
0035z(80E00010): LDR R0, SP, 10H
0036z(81E00004): LDR R1, SP, 4H
0037z(A0100000): STR R0, R1, 0H
0038a(80E00010): LDR R0, SP, 10H
0039a(81E00008): LDR R1, SP, 8H
003Aa(00080001): ADD R0, R0, R1
003Ba(A0E00010): STR R0, SP, 10H
SYSTEM.PUT(q1, size-len)b;c SYSTEM.PUT(q1+4,d -1);e SYSTEM.PUT(q1+8,f q2);g
003Cb(80E00018): LDR R0, SP, 18H
003Db(81E00008): LDR R1, SP, 8H
003Eb(00090001): SUB R0, R0, R1
003Fc(81E00010): LDR R1, SP, 10H
0040c(A0100000): STR R0, R1, 0H
0041d(80E00010): LDR R0, SP, 10H
0042d(40080004): ADD R0, R0, 4H
0043e(5100FFFF): MOV R1, R0, FFFFFFFFH
0044e(A1000000): STR R1, R0, 0H
0045f(80E00010): LDR R0, SP, 10H
0046f(40080008): ADD R0, R0, 8H
0047g(81E00014): LDR R1, SP, 14H
0048g(A1000000): STR R1, R0, 0H
IF q0 # 0 THENh SYSTEM.PUT(q0+8,i q1) ELSEj list0k := q1 ENDl
0049h(80E0000C): LDR R0, SP, CH
004Ah(E1000005): BEQ 5 [0050H]
004Bi(80E0000C): LDR R0, SP, CH
004Ci(40080008): ADD R0, R0, 8H
004Dj(81E00010): LDR R1, SP, 10H
004Ej(A1000000): STR R1, R0, 0H
004Fk(E7000003): B 3 [0053H]
0050l(80E00010): LDR R0, SP, 10H
0051l .FIXUP D
0051l(8D000021): LDR SB, MT, MOD0 [Kernel]
0052l(A0D00020): STR R0, SB, 20H [data]
END
ENDm ;
0053m(E7FFFFB7): B -73 [000BH]
IF ~done THENn p := 0 ENDo
0054n(90E0001C): LDR R0, SP, 1CH
0055n(E9000003): BNE 3 [0059H]
0056o(40000000): MOV R0, R0, 0H
0057o(81E00004): LDR R1, SP, 4H
0058o(A0100000): STR R0, R1, 0H
ENDp GetBlock;
0059p(8FE00000): LDR LNK, SP, 0H
005Ap(4EE80020): ADD SP, SP, 20H
005Bp(C700000F): B LNK
PROCEDURE GetBlock128(VAR p: LONGINT);
VAR q: LONGINT;
BEGINq
005Cq(4EE9000C): SUB SP, SP, CH
005Dq(AFE00000): STR LNK, SP, 0H
005Eq(A0E00004): STR R0, SP, 4H
IF list1 # 0 THENr p := list1;s SYSTEM.GET(list1+8,t list1)
005Fr .FIXUP D
005Fr(8D00000E): LDR SB, MT, MOD0 [Kernel]
0060r(80D00024): LDR R0, SB, 24H [data]
0061r(E1000009): BEQ 9 [006BH]
0062s .FIXUP D
0062s(8D000003): LDR SB, MT, MOD0 [Kernel]
0063s(80D00024): LDR R0, SB, 24H [data]
0064s(81E00004): LDR R1, SP, 4H
0065s(A0100000): STR R0, R1, 0H
0066t(80D00024): LDR R0, SB, 24H
0067t(40080008): ADD R0, R0, 8H
ELSEu GetBlockv(q,w 256)x;y SYSTEM.PUT(q+128,z 128);a SYSTEM.PUT(q+132,b -1);c SYSTEM.PUT(q+136,d list1);e
0068u(80000000): LDR R0, R0, 0H
0069u(A0D00024): STR R0, SB, 24H
006Av(E7000016): B 22 [0081H]
006Bw(40E80008): ADD R0, SP, 8H
006Cx(41000100): MOV R1, R0, 100H
006Dy(F7FFFF92): BL -110 [0000H]
006Ez(80E00008): LDR R0, SP, 8H
006Fz(40080080): ADD R0, R0, 80H
0070a(41000080): MOV R1, R0, 80H
0071a(A1000000): STR R1, R0, 0H
0072b(80E00008): LDR R0, SP, 8H
0073b(40080084): ADD R0, R0, 84H
0074c(5100FFFF): MOV R1, R0, FFFFFFFFH
0075c(A1000000): STR R1, R0, 0H
0076d(80E00008): LDR R0, SP, 8H
0077d(40080088): ADD R0, R0, 88H
0078e .FIXUP D
0078e(8D000016): LDR SB, MT, MOD0 [Kernel]
0079e(81D00024): LDR R1, SB, 24H [data]
007Ae(A1000000): STR R1, R0, 0H
list1 := q + 128;f p := q
007Bf(80E00008): LDR R0, SP, 8H
007Cf(40080080): ADD R0, R0, 80H
007Df(A0D00024): STR R0, SB, 24H
ENDg
007Eg(80E00008): LDR R0, SP, 8H
007Fg(81E00004): LDR R1, SP, 4H
0080g(A0100000): STR R0, R1, 0H
ENDh GetBlock128;
0081h(8FE00000): LDR LNK, SP, 0H
0082h(4EE8000C): ADD SP, SP, CH
0083h(C700000F): B LNK
PROCEDURE GetBlock64(VAR p: LONGINT);
VAR q: LONGINT;
BEGINi
0084i(4EE9000C): SUB SP, SP, CH
0085i(AFE00000): STR LNK, SP, 0H
0086i(A0E00004): STR R0, SP, 4H
IF list2 # 0 THENj p := list2;k SYSTEM.GET(list2+8,l list2)
0087j .FIXUP D
0087j(8D00000F): LDR SB, MT, MOD0 [Kernel]
0088j(80D00028): LDR R0, SB, 28H [data]
0089j(E1000009): BEQ 9 [0093H]
008Ak .FIXUP D
008Ak(8D000003): LDR SB, MT, MOD0 [Kernel]
008Bk(80D00028): LDR R0, SB, 28H [data]
008Ck(81E00004): LDR R1, SP, 4H
008Dk(A0100000): STR R0, R1, 0H
008El(80D00028): LDR R0, SB, 28H
008Fl(40080008): ADD R0, R0, 8H
ELSEm GetBlock128n(q)o;p SYSTEM.PUT(q+64,q 64);r SYSTEM.PUT(q+68,s -1);t SYSTEM.PUT(q+72,u list2);v
0090m(80000000): LDR R0, R0, 0H
0091m(A0D00028): STR R0, SB, 28H
0092n(E7000015): B 21 [00A8H]
0093o(40E80008): ADD R0, SP, 8H
0094p(F7FFFFC7): BL -57 [005CH]
0095q(80E00008): LDR R0, SP, 8H
0096q(40080040): ADD R0, R0, 40H
0097r(41000040): MOV R1, R0, 40H
0098r(A1000000): STR R1, R0, 0H
0099s(80E00008): LDR R0, SP, 8H
009As(40080044): ADD R0, R0, 44H
009Bt(5100FFFF): MOV R1, R0, FFFFFFFFH
009Ct(A1000000): STR R1, R0, 0H
009Du(80E00008): LDR R0, SP, 8H
009Eu(40080048): ADD R0, R0, 48H
009Fv .FIXUP D
009Fv(8D000015): LDR SB, MT, MOD0 [Kernel]
00A0v(81D00028): LDR R1, SB, 28H [data]
00A1v(A1000000): STR R1, R0, 0H
list2 := q + 64;w p := q
00A2w(80E00008): LDR R0, SP, 8H
00A3w(40080040): ADD R0, R0, 40H
00A4w(A0D00028): STR R0, SB, 28H
ENDx
00A5x(80E00008): LDR R0, SP, 8H
00A6x(81E00004): LDR R1, SP, 4H
00A7x(A0100000): STR R0, R1, 0H
ENDy GetBlock64;
00A8y(8FE00000): LDR LNK, SP, 0H
00A9y(4EE8000C): ADD SP, SP, CH
00AAy(C700000F): B LNK
PROCEDURE GetBlock32(VAR p: LONGINT);
VAR q: LONGINT;
BEGINz
00ABz(4EE9000C): SUB SP, SP, CH
00ACz(AFE00000): STR LNK, SP, 0H
00ADz(A0E00004): STR R0, SP, 4H
IF list3 # 0 THENa p := list3;b SYSTEM.GET(list3+8,c list3)
00AEa .FIXUP D
00AEa(8D00000F): LDR SB, MT, MOD0 [Kernel]
00AFa(80D0002C): LDR R0, SB, 2CH [data]
00B0a(E1000009): BEQ 9 [00BAH]
00B1b .FIXUP D
00B1b(8D000003): LDR SB, MT, MOD0 [Kernel]
00B2b(80D0002C): LDR R0, SB, 2CH [data]
00B3b(81E00004): LDR R1, SP, 4H
00B4b(A0100000): STR R0, R1, 0H
00B5c(80D0002C): LDR R0, SB, 2CH
00B6c(40080008): ADD R0, R0, 8H
ELSEd GetBlock64e(q)f;g SYSTEM.PUT(q+32,h 32);i SYSTEM.PUT(q+36,j -1);k SYSTEM.PUT(q+40,l list3);m
00B7d(80000000): LDR R0, R0, 0H
00B8d(A0D0002C): STR R0, SB, 2CH
00B9e(E7000015): B 21 [00CFH]
00BAf(40E80008): ADD R0, SP, 8H
00BBg(F7FFFFC8): BL -56 [0084H]
00BCh(80E00008): LDR R0, SP, 8H
00BDh(40080020): ADD R0, R0, 20H
00BEi(41000020): MOV R1, R0, 20H
00BFi(A1000000): STR R1, R0, 0H
00C0j(80E00008): LDR R0, SP, 8H
00C1j(40080024): ADD R0, R0, 24H
00C2k(5100FFFF): MOV R1, R0, FFFFFFFFH
00C3k(A1000000): STR R1, R0, 0H
00C4l(80E00008): LDR R0, SP, 8H
00C5l(40080028): ADD R0, R0, 28H
00C6m .FIXUP D
00C6m(8D000015): LDR SB, MT, MOD0 [Kernel]
00C7m(81D0002C): LDR R1, SB, 2CH [data]
00C8m(A1000000): STR R1, R0, 0H
list3 := q + 32;n p := q
00C9n(80E00008): LDR R0, SP, 8H
00CAn(40080020): ADD R0, R0, 20H
00CBn(A0D0002C): STR R0, SB, 2CH
ENDo
00CCo(80E00008): LDR R0, SP, 8H
00CDo(81E00004): LDR R1, SP, 4H
00CEo(A0100000): STR R0, R1, 0H
ENDp GetBlock32;
00CFp(8FE00000): LDR LNK, SP, 0H
00D0p(4EE8000C): ADD SP, SP, CH
00D1p(C700000F): B LNK
PROCEDURE New*(VAR ptr: LONGINT; tag: LONGINT);
(*called by NEW via MT[0]; ptr and tag are pointers*)
VAR p, size, lim: LONGINT;
BEGINq SYSTEM.GET(tag, size);r
00D2q .PROC 8
00D2q(4EE90018): SUB SP, SP, 18H
00D3q(AFE00000): STR LNK, SP, 0H
00D4q(A0E00004): STR R0, SP, 4H
00D5q(A1E00008): STR R1, SP, 8H
00D6r(80E00008): LDR R0, SP, 8H
00D7r(80000000): LDR R0, R0, 0H
00D8r(A0E00010): STR R0, SP, 10H
IF size = 32 THENs GetBlock32(p)t
00D9s(80E00010): LDR R0, SP, 10H
00DAs(40090020): SUB R0, R0, 20H
00DBs(E9000003): BNE 3 [00DFH]
00DCt(40E8000C): ADD R0, SP, CH
ELSIFu sizev = 64 THENw GetBlock64(p)x
00DDu(F7FFFFCD): BL -51 [00ABH]
00DEv(E7000012): B 18 [00F1H]
00DFw(80E00010): LDR R0, SP, 10H
00E0w(40090040): SUB R0, R0, 40H
00E1w(E9000003): BNE 3 [00E5H]
00E2x(40E8000C): ADD R0, SP, CH
ELSIFy sizez = 128 THENa GetBlock128(p)b
00E3y(F7FFFFA0): BL -96 [0084H]
00E4z(E700000C): B 12 [00F1H]
00E5a(80E00010): LDR R0, SP, 10H
00E6a(40090080): SUB R0, R0, 80H
00E7a(E9000003): BNE 3 [00EBH]
00E8b(40E8000C): ADD R0, SP, CH
ELSEc GetBlockd(p,e (size+255)f DIV 256 *g 256)h
00E9c(F7FFFF72): BL -142 [005CH]
00EAd(E7000006): B 6 [00F1H]
00EBe(40E8000C): ADD R0, SP, CH
00ECf(81E00010): LDR R1, SP, 10H
00EDf(411800FF): ADD R1, R1, FFH
00EEg(41120008): ASR R1, R1, 8H
00EFh(41110008): LSL R1, R1, 8H
ENDi ;
00F0i(F7FFFF0F): BL -241 [0000H]
IF p = 0 THENj ptr := 0
00F1j(80E0000C): LDR R0, SP, CH
00F2j(E9000004): BNE 4 [00F7H]
ELSEk ptrl := p+8;m SYSTEM.PUT(p, tag);n lim := p + size;o INC(p, 4);p INC(allocated, size);q
00F3k(40000000): MOV R0, R0, 0H
00F4k(81E00004): LDR R1, SP, 4H
00F5k(A0100000): STR R0, R1, 0H
00F6l(E700001F): B 31 [0116H]
00F7m(80E0000C): LDR R0, SP, CH
00F8m(40080008): ADD R0, R0, 8H
00F9m(81E00004): LDR R1, SP, 4H
00FAm(A0100000): STR R0, R1, 0H
00FBn(80E0000C): LDR R0, SP, CH
00FCn(81E00008): LDR R1, SP, 8H
00FDn(A1000000): STR R1, R0, 0H
00FEo(80E0000C): LDR R0, SP, CH
00FFo(81E00010): LDR R1, SP, 10H
0100o(00080001): ADD R0, R0, R1
0101o(A0E00014): STR R0, SP, 14H
0102p(80E0000C): LDR R0, SP, CH
0103p(40080004): ADD R0, R0, 4H
0104p(A0E0000C): STR R0, SP, CH
0105q .FIXUP D
0105q(8D00003F): LDR SB, MT, MOD0 [Kernel]
0106q(40D80000): ADD R0, SB, 0H [data]
0107q(81000000): LDR R1, R0, 0H
0108q(82E00010): LDR R2, SP, 10H
0109q(01180002): ADD R1, R1, R2
010Aq(A1000000): STR R1, R0, 0H
WHILE p < lim DOr SYSTEM.PUT(p, 0);s INC(p, 4) ENDt
010Br(80E0000C): LDR R0, SP, CH
010Cr(81E00014): LDR R1, SP, 14H
010Dr(00090001): SUB R0, R0, R1
010Er(ED000007): BGE 7 [0116H]
010Fs(80E0000C): LDR R0, SP, CH
0110s(41000000): MOV R1, R0, 0H
0111s(A1000000): STR R1, R0, 0H
0112t(80E0000C): LDR R0, SP, CH
0113t(40080004): ADD R0, R0, 4H
0114t(A0E0000C): STR R0, SP, CH
0115t(E7FFFFF5): B -11 [010BH]
END
ENDu New;
0116u(8FE00000): LDR LNK, SP, 0H
0117u(4EE80018): ADD SP, SP, 18H
0118u(C700000F): B LNK
(* ---------- Garbage collector ----------*)
PROCEDURE Mark*(pref: LONGINT);
VAR pvadr, offadr, offset, tag, p, q, r: LONGINT;
BEGINv SYSTEM.GET(pref, pvadr);w (*pointers < heapOrg considered NIL*)
0119v .PROC 9
0119v(4EE90024): SUB SP, SP, 24H
011Av(AFE00000): STR LNK, SP, 0H
011Bv(A0E00004): STR R0, SP, 4H
011Cw(80E00004): LDR R0, SP, 4H
011Dw(80000000): LDR R0, R0, 0H
011Ew(A0E00008): STR R0, SP, 8H
WHILE pvadr # 0 DOx
011Fx(80E00008): LDR R0, SP, 8H
0120x(E100006C): BEQ 108 [018DH]
SYSTEM.GET(pvadr, p);y SYSTEM.GET(p-4,z offadr);a
0121y(80E00008): LDR R0, SP, 8H
0122y(80000000): LDR R0, R0, 0H
0123y(A0E00018): STR R0, SP, 18H
0124z(80E00018): LDR R0, SP, 18H
0125z(40090004): SUB R0, R0, 4H
0126a(80000000): LDR R0, R0, 0H
0127a(A0E0000C): STR R0, SP, CH
IF (p >= heapOrg)b & (coffadr = 0)d THENe q := p;f (*mark elements in data structure with root p*)
0128b(80E00018): LDR R0, SP, 18H
0129b .FIXUP D
0129b(8D000024): LDR SB, MT, MOD0 [Kernel]
012Ab(81D00008): LDR R1, SB, 8H [data]
012Bb(00090001): SUB R0, R0, R1
012Cc(E5000059): BLT 89 [0186H]
012Dd(80E0000C): LDR R0, SP, CH
012Ee(E9000057): BNE 87 [0186H]
012Ff(80E00018): LDR R0, SP, 18H
0130f(A0E0001C): STR R0, SP, 1CH
REPEAT SYSTEM.GET(p-4,g offadr);h
0131g(80E00018): LDR R0, SP, 18H
0132g(40090004): SUB R0, R0, 4H
0133h(80000000): LDR R0, R0, 0H
0134h(A0E0000C): STR R0, SP, CH
IF offadr = 0 THENi SYSTEM.GET(p-8,j tag);k offadr := tag + 16 ELSEl INCm(offadr, 4) ENDn ;
0135i(80E0000C): LDR R0, SP, CH
0136i(E9000008): BNE 8 [013FH]
0137j(80E00018): LDR R0, SP, 18H
0138j(40090008): SUB R0, R0, 8H
0139k(80000000): LDR R0, R0, 0H
013Ak(A0E00014): STR R0, SP, 14H
013Bl(80E00014): LDR R0, SP, 14H
013Cl(40080010): ADD R0, R0, 10H
013Dl(A0E0000C): STR R0, SP, CH
013Em(E7000003): B 3 [0142H]
013Fn(80E0000C): LDR R0, SP, CH
0140n(40080004): ADD R0, R0, 4H
0141n(A0E0000C): STR R0, SP, CH
SYSTEM.PUT(p-4,o offadr);p SYSTEM.GET(offadr, offset);q
0142o(80E00018): LDR R0, SP, 18H
0143o(40090004): SUB R0, R0, 4H
0144p(81E0000C): LDR R1, SP, CH
0145p(A1000000): STR R1, R0, 0H
0146q(80E0000C): LDR R0, SP, CH
0147q(80000000): LDR R0, R0, 0H
0148q(A0E00010): STR R0, SP, 10H
IF offset # -1 THENr (*down*)
0149r(80E00010): LDR R0, SP, 10H
014Ar(5009FFFF): SUB R0, R0, FFFFFFFFH
014Br(E100001A): BEQ 26 [0166H]
SYSTEM.GET(p+offset,s r);t SYSTEM.GET(r-4,u offadr);v
014Cs(80E00018): LDR R0, SP, 18H
014Ds(81E00010): LDR R1, SP, 10H
014Es(00080001): ADD R0, R0, R1
014Ft(80000000): LDR R0, R0, 0H
0150t(A0E00020): STR R0, SP, 20H
0151u(80E00020): LDR R0, SP, 20H
0152u(40090004): SUB R0, R0, 4H
0153v(80000000): LDR R0, R0, 0H
0154v(A0E0000C): STR R0, SP, CH
IF (r >= heapOrg)w & (xoffadr = 0)y THENz SYSTEM.PUT(p+offset,a q);b q := p;c p := r ENDd
0155w(80E00020): LDR R0, SP, 20H
0156w .FIXUP D
0156w(8D00002D): LDR SB, MT, MOD0 [Kernel]
0157w(81D00008): LDR R1, SB, 8H [data]
0158w(00090001): SUB R0, R0, R1
0159x(E500000B): BLT 11 [0165H]
015Ay(80E0000C): LDR R0, SP, CH
015Bz(E9000009): BNE 9 [0165H]
015Ca(80E00018): LDR R0, SP, 18H
015Da(81E00010): LDR R1, SP, 10H
015Ea(00080001): ADD R0, R0, R1
015Fb(81E0001C): LDR R1, SP, 1CH
0160b(A1000000): STR R1, R0, 0H
0161c(80E00018): LDR R0, SP, 18H
0162c(A0E0001C): STR R0, SP, 1CH
0163d(80E00020): LDR R0, SP, 20H
0164d(A0E00018): STR R0, SP, 18H
ELSE (*up*) SYSTEMe.GET(q-4,f offadr);g SYSTEM.GET(offadr, offset);h
0165e(E7000019): B 25 [017FH]
0166f(80E0001C): LDR R0, SP, 1CH
0167f(40090004): SUB R0, R0, 4H
0168g(80000000): LDR R0, R0, 0H
0169g(A0E0000C): STR R0, SP, CH
016Ah(80E0000C): LDR R0, SP, CH
016Bh(80000000): LDR R0, R0, 0H
016Ch(A0E00010): STR R0, SP, 10H
IF p # q THENi SYSTEM.GET(q+offset,j r);k SYSTEM.PUT(q+offset,l p);m p := q;n q := r ENDo
016Di(80E00018): LDR R0, SP, 18H
016Ei(81E0001C): LDR R1, SP, 1CH
016Fi(00090001): SUB R0, R0, R1
0170i(E100000E): BEQ 14 [017FH]
0171j(80E0001C): LDR R0, SP, 1CH
0172j(81E00010): LDR R1, SP, 10H
0173j(00080001): ADD R0, R0, R1
0174k(80000000): LDR R0, R0, 0H
0175k(A0E00020): STR R0, SP, 20H
0176l(80E0001C): LDR R0, SP, 1CH
0177l(81E00010): LDR R1, SP, 10H
0178l(00080001): ADD R0, R0, R1
0179m(81E00018): LDR R1, SP, 18H
017Am(A1000000): STR R1, R0, 0H
017Bn(80E0001C): LDR R0, SP, 1CH
017Cn(A0E00018): STR R0, SP, 18H
017Do(80E00020): LDR R0, SP, 20H
017Eo(A0E0001C): STR R0, SP, 1CH
END
UNTIL (p = q)p & (qoffset = -1)r
017Fp(80E00018): LDR R0, SP, 18H
0180p(81E0001C): LDR R1, SP, 1CH
0181p(00090001): SUB R0, R0, R1
0182q(E9FFFFAE): BNE -82 [0131H]
0183r(80E00010): LDR R0, SP, 10H
0184r(5009FFFF): SUB R0, R0, FFFFFFFFH
ENDs ;
0185s(E9FFFFAB): BNE -85 [0131H]
INC(pref, 4);t SYSTEM.GET(pref, pvadr)
0186t(80E00004): LDR R0, SP, 4H
0187t(40080004): ADD R0, R0, 4H
0188t(A0E00004): STR R0, SP, 4H
ENDu
0189u(80E00004): LDR R0, SP, 4H
018Au(80000000): LDR R0, R0, 0H
018Bu(A0E00008): STR R0, SP, 8H
018Cu(E7FFFF92): B -110 [011FH]
ENDv Mark;
018Dv(8FE00000): LDR LNK, SP, 0H
018Ev(4EE80024): ADD SP, SP, 24H
018Fv(C700000F): B LNK
PROCEDURE Scan*;
VAR p, q, mark, tag, size: LONGINT;
BEGINw p := heapOrg;x
0190w .PROC 10
0190w .COMMAND Scan
0190w(4EE90018): SUB SP, SP, 18H
0191w(AFE00000): STR LNK, SP, 0H
0192x .FIXUP D
0192x(8D00003C): LDR SB, MT, MOD0 [Kernel]
0193x(80D00008): LDR R0, SB, 8H [data]
0194x(A0E00004): STR R0, SP, 4H
REPEAT SYSTEM.GET(p+4,y mark);z q := p;a
0195y(80E00004): LDR R0, SP, 4H
0196y(40080004): ADD R0, R0, 4H
0197z(80000000): LDR R0, R0, 0H
0198z(A0E0000C): STR R0, SP, CH
0199a(80E00004): LDR R0, SP, 4H
019Aa(A0E00008): STR R0, SP, 8H
WHILE mark = 0 DOb
019Bb(80E0000C): LDR R0, SP, CH
019Cb(E900000F): BNE 15 [01ACH]
SYSTEM.GET(p, tag);c SYSTEM.GET(tag, size);d INC(p, size);e SYSTEM.GET(p+4,f mark)
019Dc(80E00004): LDR R0, SP, 4H
019Ec(80000000): LDR R0, R0, 0H
019Fc(A0E00010): STR R0, SP, 10H
01A0d(80E00010): LDR R0, SP, 10H
01A1d(80000000): LDR R0, R0, 0H
01A2d(A0E00014): STR R0, SP, 14H
01A3e(80E00004): LDR R0, SP, 4H
01A4e(81E00014): LDR R1, SP, 14H
01A5e(00080001): ADD R0, R0, R1
01A6e(A0E00004): STR R0, SP, 4H
01A7f(80E00004): LDR R0, SP, 4H
01A8f(40080004): ADD R0, R0, 4H
ENDg ;
01A9g(80000000): LDR R0, R0, 0H
01AAg(A0E0000C): STR R0, SP, CH
01ABg(E7FFFFEF): B -17 [019BH]
size := p - q;h DEC(allocated, size);i (*size of free block*)
01ACh(80E00004): LDR R0, SP, 4H
01ADh(81E00008): LDR R1, SP, 8H
01AEh(00090001): SUB R0, R0, R1
01AFh(A0E00014): STR R0, SP, 14H
01B0i .FIXUP D
01B0i(8D00001E): LDR SB, MT, MOD0 [Kernel]
01B1i(40D80000): ADD R0, SB, 0H [data]
01B2i(81000000): LDR R1, R0, 0H
01B3i(82E00014): LDR R2, SP, 14H
01B4i(01190002): SUB R1, R1, R2
01B5i(A1000000): STR R1, R0, 0H
IF size > 0 THENj
01B6j(80E00014): LDR R0, SP, 14H
01B7j(40090000): SUB R0, R0, 0H
01B8j(E600005D): BLE 93 [0216H]
IF size MOD 64 #k 0 THENl
01B9k(80E00014): LDR R0, SP, 14H
01BAk(4004003F): AND R0, R0, 3FH
01BBl(40090000): SUB R0, R0, 0H
01BCl(E1000014): BEQ 20 [01D1H]
SYSTEM.PUT(q, 32);m SYSTEM.PUT(q+4,n -1);o SYSTEM.PUT(q+8,p list3);q list3 := q;r INC(q, 32);s DEC(size, 32)
01BDm(80E00008): LDR R0, SP, 8H
01BEm(41000020): MOV R1, R0, 20H
01BFm(A1000000): STR R1, R0, 0H
01C0n(80E00008): LDR R0, SP, 8H
01C1n(40080004): ADD R0, R0, 4H
01C2o(5100FFFF): MOV R1, R0, FFFFFFFFH
01C3o(A1000000): STR R1, R0, 0H
01C4p(80E00008): LDR R0, SP, 8H
01C5p(40080008): ADD R0, R0, 8H
01C6q .FIXUP D
01C6q(8D000016): LDR SB, MT, MOD0 [Kernel]
01C7q(81D0002C): LDR R1, SB, 2CH [data]
01C8q(A1000000): STR R1, R0, 0H
01C9r(80E00008): LDR R0, SP, 8H
01CAr(A0D0002C): STR R0, SB, 2CH
01CBs(80E00008): LDR R0, SP, 8H
01CCs(40080020): ADD R0, R0, 20H
01CDs(A0E00008): STR R0, SP, 8H
ENDt ;
01CEt(80E00014): LDR R0, SP, 14H
01CFt(40090020): SUB R0, R0, 20H
01D0t(A0E00014): STR R0, SP, 14H
IF size MOD 128 #u 0 THENv
01D1u(80E00014): LDR R0, SP, 14H
01D2u(4004007F): AND R0, R0, 7FH
01D3v(40090000): SUB R0, R0, 0H
01D4v(E1000014): BEQ 20 [01E9H]
SYSTEM.PUT(q, 64);w SYSTEM.PUT(q+4,x -1);y SYSTEM.PUT(q+8,z list2);a list2 := q;b INC(q, 64);c DEC(size, 64)
01D5w(80E00008): LDR R0, SP, 8H
01D6w(41000040): MOV R1, R0, 40H
01D7w(A1000000): STR R1, R0, 0H
01D8x(80E00008): LDR R0, SP, 8H
01D9x(40080004): ADD R0, R0, 4H
01DAy(5100FFFF): MOV R1, R0, FFFFFFFFH
01DBy(A1000000): STR R1, R0, 0H
01DCz(80E00008): LDR R0, SP, 8H
01DDz(40080008): ADD R0, R0, 8H
01DEa .FIXUP D
01DEa(8D000018): LDR SB, MT, MOD0 [Kernel]
01DFa(81D00028): LDR R1, SB, 28H [data]
01E0a(A1000000): STR R1, R0, 0H
01E1b(80E00008): LDR R0, SP, 8H
01E2b(A0D00028): STR R0, SB, 28H
01E3c(80E00008): LDR R0, SP, 8H
01E4c(40080040): ADD R0, R0, 40H
01E5c(A0E00008): STR R0, SP, 8H
ENDd ;
01E6d(80E00014): LDR R0, SP, 14H
01E7d(40090040): SUB R0, R0, 40H
01E8d(A0E00014): STR R0, SP, 14H
IF size MOD 256 #e 0 THENf
01E9e(80E00014): LDR R0, SP, 14H
01EAe(400400FF): AND R0, R0, FFH
01EBf(40090000): SUB R0, R0, 0H
01ECf(E1000014): BEQ 20 [0201H]
SYSTEM.PUT(q, 128);g SYSTEM.PUT(q+4,h -1);i SYSTEM.PUT(q+8,j list1);k list1 := q;l INC(q, 128);m DEC(size, 128)
01EDg(80E00008): LDR R0, SP, 8H
01EEg(41000080): MOV R1, R0, 80H
01EFg(A1000000): STR R1, R0, 0H
01F0h(80E00008): LDR R0, SP, 8H
01F1h(40080004): ADD R0, R0, 4H
01F2i(5100FFFF): MOV R1, R0, FFFFFFFFH
01F3i(A1000000): STR R1, R0, 0H
01F4j(80E00008): LDR R0, SP, 8H
01F5j(40080008): ADD R0, R0, 8H
01F6k .FIXUP D
01F6k(8D000018): LDR SB, MT, MOD0 [Kernel]
01F7k(81D00024): LDR R1, SB, 24H [data]
01F8k(A1000000): STR R1, R0, 0H
01F9l(80E00008): LDR R0, SP, 8H
01FAl(A0D00024): STR R0, SB, 24H
01FBm(80E00008): LDR R0, SP, 8H
01FCm(40080080): ADD R0, R0, 80H
01FDm(A0E00008): STR R0, SP, 8H
ENDn ;
01FEn(80E00014): LDR R0, SP, 14H
01FFn(40090080): SUB R0, R0, 80H
0200n(A0E00014): STR R0, SP, 14H
IF size > 0 THENo
0201o(80E00014): LDR R0, SP, 14H
0202o(40090000): SUB R0, R0, 0H
0203o(E6000012): BLE 18 [0216H]
SYSTEM.PUT(q, size);p SYSTEM.PUT(q+4,q -1);r SYSTEM.PUT(q+8,s list0);t list0 := q;u INC(q, size)
0204p(80E00008): LDR R0, SP, 8H
0205p(81E00014): LDR R1, SP, 14H
0206p(A1000000): STR R1, R0, 0H
0207q(80E00008): LDR R0, SP, 8H
0208q(40080004): ADD R0, R0, 4H
0209r(5100FFFF): MOV R1, R0, FFFFFFFFH
020Ar(A1000000): STR R1, R0, 0H
020Bs(80E00008): LDR R0, SP, 8H
020Cs(40080008): ADD R0, R0, 8H
020Dt .FIXUP D
020Dt(8D000017): LDR SB, MT, MOD0 [Kernel]
020Et(81D00020): LDR R1, SB, 20H [data]
020Ft(A1000000): STR R1, R0, 0H
0210u(80E00008): LDR R0, SP, 8H
0211u(A0D00020): STR R0, SB, 20H
ENDv
0212v(80E00008): LDR R0, SP, 8H
0213v(81E00014): LDR R1, SP, 14H
0214v(00080001): ADD R0, R0, R1
0215v(A0E00008): STR R0, SP, 8H
END ;
IF mark > 0 THENw SYSTEM.GET(p, tag);x SYSTEM.GET(tag, size);y SYSTEM.PUT(p+4,z 0);a INC(p, size)
0216w(80E0000C): LDR R0, SP, CH
0217w(40090000): SUB R0, R0, 0H
0218w(E600000F): BLE 15 [0228H]
0219x(80E00004): LDR R0, SP, 4H
021Ax(80000000): LDR R0, R0, 0H
021Bx(A0E00010): STR R0, SP, 10H
021Cy(80E00010): LDR R0, SP, 10H
021Dy(80000000): LDR R0, R0, 0H
021Ey(A0E00014): STR R0, SP, 14H
021Fz(80E00004): LDR R0, SP, 4H
0220z(40080004): ADD R0, R0, 4H
0221a(41000000): MOV R1, R0, 0H
0222a(A1000000): STR R1, R0, 0H
ELSEb (*free*) SYSTEMc.GET(p, size);d INC(p, size)
0223b(80E00004): LDR R0, SP, 4H
0224b(81E00014): LDR R1, SP, 14H
0225b(00080001): ADD R0, R0, R1
0226b(A0E00004): STR R0, SP, 4H
0227c(E7000007): B 7 [022FH]
0228d(80E00004): LDR R0, SP, 4H
0229d(80000000): LDR R0, R0, 0H
022Ad(A0E00014): STR R0, SP, 14H
ENDe
022Be(80E00004): LDR R0, SP, 4H
022Ce(81E00014): LDR R1, SP, 14H
022De(00080001): ADD R0, R0, R1
022Ee(A0E00004): STR R0, SP, 4H
UNTIL p >= heapLim
ENDf Scan;
022Ff(80E00004): LDR R0, SP, 4H
0230f .FIXUP D
0230f(8D000023): LDR SB, MT, MOD0 [Kernel]
0231f(81D0000C): LDR R1, SB, CH [data]
0232f(00090001): SUB R0, R0, R1
0233f(E5FFFF61): BLT -159 [0195H]
0234f(8FE00000): LDR LNK, SP, 0H
0235f(4EE80018): ADD SP, SP, 18H
0236f(C700000F): B LNK
(* ---------- Disk storage management ----------*)
PROCEDURE SPIIdle(n: INTEGER); (*send n FFs slowly with no card selected*)
BEGINg SYSTEM.PUT(spiCtrl, 0);h
0237g(4EE90008): SUB SP, SP, 8H
0238g(AFE00000): STR LNK, SP, 0H
0239g(A0E00004): STR R0, SP, 4H
023Ah(5000FFD4): MOV R0, R0, FFFFFFD4H
023Bh(41000000): MOV R1, R0, 0H
023Ch(A1000000): STR R1, R0, 0H
WHILE n > 0 DOi DEC(n);j SYSTEM.PUT(spiData, -1);k
023Di(80E00004): LDR R0, SP, 4H
023Ei(40090000): SUB R0, R0, 0H
023Fi(E600000F): BLE 15 [024FH]
0240j(80E00004): LDR R0, SP, 4H
0241j(40090001): SUB R0, R0, 1H
0242j(A0E00004): STR R0, SP, 4H
0243k(5000FFD0): MOV R0, R0, FFFFFFD0H
0244k(5100FFFF): MOV R1, R0, FFFFFFFFH
0245k(A1000000): STR R1, R0, 0H
REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0);l
0246l(5000FFD4): MOV R0, R0, FFFFFFD4H
0247l(80000000): LDR R0, R0, 0H
0248l(40030001): ROR R0, R0, 1H
0249l(E8FFFFFC): BPL -4 [0246H]
SYSTEM.GET(spiData, data)
ENDm
024Am(5000FFD0): MOV R0, R0, FFFFFFD0H
024Bm(80000000): LDR R0, R0, 0H
024Cm .FIXUP D
024Cm(8D00001C): LDR SB, MT, MOD0 [Kernel]
024Dm(A0D00030): STR R0, SB, 30H [data]
024Em(E7FFFFEE): B -18 [023DH]
ENDn SPIIdle;
024Fn(8FE00000): LDR LNK, SP, 0H
0250n(4EE80008): ADD SP, SP, 8H
0251n(C700000F): B LNK
PROCEDURE SPI(n: INTEGER); (*send&rcv byte slowly with card selected*)
BEGINo SYSTEM.PUT(spiCtrl, CARD0);p SYSTEM.PUT(spiData, n);q
0252o(4EE90008): SUB SP, SP, 8H
0253o(AFE00000): STR LNK, SP, 0H
0254o(A0E00004): STR R0, SP, 4H
0255p(5000FFD4): MOV R0, R0, FFFFFFD4H
0256p(41000001): MOV R1, R0, 1H
0257p(A1000000): STR R1, R0, 0H
0258q(5000FFD0): MOV R0, R0, FFFFFFD0H
0259q(81E00004): LDR R1, SP, 4H
025Aq(A1000000): STR R1, R0, 0H
REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0);r
025Br(5000FFD4): MOV R0, R0, FFFFFFD4H
025Cr(80000000): LDR R0, R0, 0H
025Dr(40030001): ROR R0, R0, 1H
025Er(E8FFFFFC): BPL -4 [025BH]
SYSTEM.GET(spiData, data)
ENDs SPI;
025Fs(5000FFD0): MOV R0, R0, FFFFFFD0H
0260s(80000000): LDR R0, R0, 0H
0261s .FIXUP D
0261s(8D000015): LDR SB, MT, MOD0 [Kernel]
0262s(A0D00030): STR R0, SB, 30H [data]
0263s(8FE00000): LDR LNK, SP, 0H
0264s(4EE80008): ADD SP, SP, 8H
0265s(C700000F): B LNK
PROCEDURE SPICmd(n, arg: INTEGER);
VAR i, crc: INTEGER;
BEGINt (*send cmd*)
0266t(4EE90014): SUB SP, SP, 14H
0267t(AFE00000): STR LNK, SP, 0H
0268t(A0E00004): STR R0, SP, 4H
0269t(A1E00008): STR R1, SP, 8H
REPEAT SPIIdle(1)u UNTILv data = 255;w (*flush while unselected*)
026Au(40000001): MOV R0, R0, 1H
026Bv(F7FFFFCB): BL -53 [0237H]
026Cw .FIXUP D
026Cw(8D00000B): LDR SB, MT, MOD0 [Kernel]
026Dw(80D00030): LDR R0, SB, 30H [data]
026Ew(400900FF): SUB R0, R0, FFH
026Fw(E9FFFFFA): BNE -6 [026AH]
REPEAT SPI(255)x UNTILy data = 255;z (*flush while selected*)
0270x(400000FF): MOV R0, R0, FFH
0271y(F7FFFFE0): BL -32 [0252H]
0272z .FIXUP D
0272z(8D000006): LDR SB, MT, MOD0 [Kernel]
0273z(80D00030): LDR R0, SB, 30H [data]
0274z(400900FF): SUB R0, R0, FFH
0275z(E9FFFFFA): BNE -6 [0270H]
IF n = 8 THENa crc := 135 ELSIFb nc = 0 THENd crc := 149 ELSEe crcf := 255 ENDg;
0276a(80E00004): LDR R0, SP, 4H
0277a(40090008): SUB R0, R0, 8H
0278a(E9000003): BNE 3 [027CH]
0279b(40000087): MOV R0, R0, 87H
027Ab(A0E00010): STR R0, SP, 10H
027Bc(E7000007): B 7 [0283H]
027Cd(80E00004): LDR R0, SP, 4H
027Dd(E9000003): BNE 3 [0281H]
027Ee(40000095): MOV R0, R0, 95H
027Fe(A0E00010): STR R0, SP, 10H
0280f(E7000002): B 2 [0283H]
0281g(400000FF): MOV R0, R0, FFH
0282g(A0E00010): STR R0, SP, 10H
SPI(n MOD 64 +h 64)i;j (*send command*)
0283h(80E00004): LDR R0, SP, 4H
0284h(4004003F): AND R0, R0, 3FH
0285i(40080040): ADD R0, R0, 40H
0286j(F7FFFFCB): BL -53 [0252H]
FOR i := 24 TOk 0 BY -8 DO SPIl(ROR(arg, i))m ENDn;o (*send arg*)
0287k(40000018): MOV R0, R0, 18H
0288l(41090000): SUB R1, R0, 0H
0289l(E5000008): BLT 8 [0292H]
028Al(A0E0000C): STR R0, SP, CH
028Bm(80E00008): LDR R0, SP, 8H
028Cm(81E0000C): LDR R1, SP, CH
028Dm(00030001): ROR R0, R0, R1
028En(F7FFFFC3): BL -61 [0252H]
028Fo(80E0000C): LDR R0, SP, CH
0290o(5008FFF8): ADD R0, R0, FFFFFFF8H
0291o(E7FFFFF6): B -10 [0288H]
SPI(crc)p;q i := 32;r
0292p(80E00010): LDR R0, SP, 10H
0293q(F7FFFFBE): BL -66 [0252H]
0294r(40000020): MOV R0, R0, 20H
0295r(A0E0000C): STR R0, SP, CH
REPEAT SPI(255)s;t DEC(i) UNTILu (data < 80H)v OR (wi = 0)x
0296s(400000FF): MOV R0, R0, FFH
0297t(F7FFFFBA): BL -70 [0252H]
0298u(80E0000C): LDR R0, SP, CH
0299u(40090001): SUB R0, R0, 1H
029Au(A0E0000C): STR R0, SP, CH
029Bv .FIXUP D
029Bv(8D000029): LDR SB, MT, MOD0 [Kernel]
029Cv(80D00030): LDR R0, SB, 30H [data]
029Dv(40090080): SUB R0, R0, 80H
029Ew(E5000002): BLT 2 [02A1H]
029Fx(80E0000C): LDR R0, SP, CH
ENDy SPICmd;
02A0y(E9FFFFF5): BNE -11 [0296H]
02A1y(8FE00000): LDR LNK, SP, 0H
02A2y(4EE80014): ADD SP, SP, 14H
02A3y(C700000F): B LNK
PROCEDURE SDShift(VAR n: INTEGER);
VAR data: INTEGER;
BEGINz SPICmd(58,a 0)b;c (*CMD58 get card capacity bit*)
02A4z(4EE9000C): SUB SP, SP, CH
02A5z(AFE00000): STR LNK, SP, 0H
02A6z(A0E00004): STR R0, SP, 4H
02A7a(4000003A): MOV R0, R0, 3AH
02A8b(41000000): MOV R1, R0, 0H
02A9c(F7FFFFBC): BL -68 [0266H]
SYSTEM.GET(spiData, data);d SPI(-1)e;f
02AAd(5000FFD0): MOV R0, R0, FFFFFFD0H
02ABd(80000000): LDR R0, R0, 0H
02ACd(A0E00008): STR R0, SP, 8H
02ADe(5000FFFF): MOV R0, R0, FFFFFFFFH
02AEf(F7FFFFA3): BL -93 [0252H]
IF (data # 0)g OR ~hSYSTEM.BIT(spiData, 6) THENi n := n * 512 ENDj ; (*non-SDHC card*)
02AFg(80E00008): LDR R0, SP, 8H
02B0h(E9000004): BNE 4 [02B5H]
02B1i(5000FFD0): MOV R0, R0, FFFFFFD0H
02B2i(80000000): LDR R0, R0, 0H
02B3i(40030007): ROR R0, R0, 7H
02B4i(E0000005): BMI 5 [02BAH]
02B5j(80E00004): LDR R0, SP, 4H
02B6j(80000000): LDR R0, R0, 0H
02B7j(40010009): LSL R0, R0, 9H
02B8j(81E00004): LDR R1, SP, 4H
02B9j(A0100000): STR R0, R1, 0H
SPI(-1)k;l SPI(-1)m;n SPIIdle(1)o (*flush response*)
02BAk(5000FFFF): MOV R0, R0, FFFFFFFFH
02BBl(F7FFFF96): BL -106 [0252H]
02BCm(5000FFFF): MOV R0, R0, FFFFFFFFH
02BDn(F7FFFF94): BL -108 [0252H]
02BEo(40000001): MOV R0, R0, 1H
ENDp SDShift;
02BFp(F7FFFF77): BL -137 [0237H]
02C0p(8FE00000): LDR LNK, SP, 0H
02C1p(4EE8000C): ADD SP, SP, CH
02C2p(C700000F): B LNK
PROCEDURE ReadSD(src, dst: INTEGER);
VAR i: INTEGER;
BEGINq SDShift(src)r;s SPICmd(17,t src)u;v ASSERT(data = 0)w;x (*CMD17 read one block*)
02C3q(4EE90010): SUB SP, SP, 10H
02C4q(AFE00000): STR LNK, SP, 0H
02C5q(A0E00004): STR R0, SP, 4H
02C6q(A1E00008): STR R1, SP, 8H
02C7r(40E80004): ADD R0, SP, 4H
02C8s(F7FFFFDB): BL -37 [02A4H]
02C9t(40000011): MOV R0, R0, 11H
02CAu(81E00004): LDR R1, SP, 4H
02CBv(F7FFFF9A): BL -102 [0266H]
02CCw .FIXUP D
02CCw(8D000031): LDR SB, MT, MOD0 [Kernel]
02CDw(80D00030): LDR R0, SB, 30H [data]
02CEx(D9196B7C): BLNE MT [trap=7, pos=6507]
i := 0;y (*wait for start data marker*)
02CFy(40000000): MOV R0, R0, 0H
02D0y(A0E0000C): STR R0, SP, CH
REPEAT SPI(-1)z;a INC(i) UNTILb data = 254;c
02D1z(5000FFFF): MOV R0, R0, FFFFFFFFH
02D2a(F7FFFF7F): BL -129 [0252H]
02D3b(80E0000C): LDR R0, SP, CH
02D4b(40080001): ADD R0, R0, 1H
02D5b(A0E0000C): STR R0, SP, CH
02D6c .FIXUP D
02D6c(8D00000A): LDR SB, MT, MOD0 [Kernel]
02D7c(80D00030): LDR R0, SB, 30H [data]
02D8c(400900FE): SUB R0, R0, FEH
02D9c(E9FFFFF7): BNE -9 [02D1H]
SYSTEM.PUT(spiCtrl, SPIFAST + CARD0);d
02DAd(5000FFD4): MOV R0, R0, FFFFFFD4H
02DBd(41000005): MOV R1, R0, 5H
02DCd(A1000000): STR R1, R0, 0H
FOR i := 0 TOe 508 BY 4 DO
02DDe(40000000): MOV R0, R0, 0H
SYSTEMf.PUT(spiData, -1);g
02DEf(410901FC): SUB R1, R0, 1FCH
02DFf(EE000015): BGT 21 [02F5H]
02E0f(A0E0000C): STR R0, SP, CH
02E1g(5000FFD0): MOV R0, R0, FFFFFFD0H
02E2g(5100FFFF): MOV R1, R0, FFFFFFFFH
02E3g(A1000000): STR R1, R0, 0H
REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0);h
02E4h(5000FFD4): MOV R0, R0, FFFFFFD4H
02E5h(80000000): LDR R0, R0, 0H
02E6h(40030001): ROR R0, R0, 1H
02E7h(E8FFFFFC): BPL -4 [02E4H]
SYSTEM.GET(spiData, data);i SYSTEM.PUT(dst, data);j INC(dst, 4)
02E8i(5000FFD0): MOV R0, R0, FFFFFFD0H
02E9i(80000000): LDR R0, R0, 0H
02EAi .FIXUP D
02EAi(8D000014): LDR SB, MT, MOD0 [Kernel]
02EBi(A0D00030): STR R0, SB, 30H [data]
02ECj(80E00008): LDR R0, SP, 8H
02EDj(81D00030): LDR R1, SB, 30H
02EEj(A1000000): STR R1, R0, 0H
ENDk;l
02EFk(80E00008): LDR R0, SP, 8H
02F0k(40080004): ADD R0, R0, 4H
02F1k(A0E00008): STR R0, SP, 8H
02F2l(80E0000C): LDR R0, SP, CH
02F3l(40080004): ADD R0, R0, 4H
02F4l(E7FFFFE9): B -23 [02DEH]
SPI(255)m;n SPI(255)o;p SPIIdle(1)q (*may be a checksum; deselect card*)
02F5m(400000FF): MOV R0, R0, FFH
02F6n(F7FFFF5B): BL -165 [0252H]
02F7o(400000FF): MOV R0, R0, FFH
02F8p(F7FFFF59): BL -167 [0252H]
02F9q(40000001): MOV R0, R0, 1H
ENDr ReadSD;
02FAr(F7FFFF3C): BL -196 [0237H]
02FBr(8FE00000): LDR LNK, SP, 0H
02FCr(4EE80010): ADD SP, SP, 10H
02FDr(C700000F): B LNK
PROCEDURE WriteSD(dst, src: INTEGER);
VAR i, n: INTEGER; x: BYTE;
BEGINs SDShift(dst)t;u SPICmd(24,v dst)w;x ASSERT(data = 0)y;z (*CMD24 write one block*)
02FEs(4EE90018): SUB SP, SP, 18H
02FFs(AFE00000): STR LNK, SP, 0H
0300s(A0E00004): STR R0, SP, 4H
0301s(A1E00008): STR R1, SP, 8H
0302t(40E80004): ADD R0, SP, 4H
0303u(F7FFFFA0): BL -96 [02A4H]
0304v(40000018): MOV R0, R0, 18H
0305w(81E00004): LDR R1, SP, 4H
0306x(F7FFFF5F): BL -161 [0266H]
0307y .FIXUP D
0307y(8D00001D): LDR SB, MT, MOD0 [Kernel]
0308y(80D00030): LDR R0, SB, 30H [data]
0309z(D91B937C): BLNE MT [trap=7, pos=7059]
SPI(254)a;b (*write start data marker*)
030Aa(400000FE): MOV R0, R0, FEH
030Bb(F7FFFF46): BL -186 [0252H]
SYSTEM.PUT(spiCtrl, SPIFAST + CARD0);c
030Cc(5000FFD4): MOV R0, R0, FFFFFFD4H
030Dc(41000005): MOV R1, R0, 5H
030Ec(A1000000): STR R1, R0, 0H
FOR i := 0 TOd 508 BY 4 DO
030Fd(40000000): MOV R0, R0, 0H
SYSTEMe.GET(src, n);f INC(src, 4);g SYSTEM.PUT(spiData, n);h
0310e(410901FC): SUB R1, R0, 1FCH
0311e(EE000011): BGT 17 [0323H]
0312e(A0E0000C): STR R0, SP, CH
0313f(80E00008): LDR R0, SP, 8H
0314f(80000000): LDR R0, R0, 0H
0315f(A0E00010): STR R0, SP, 10H
0316g(80E00008): LDR R0, SP, 8H
0317g(40080004): ADD R0, R0, 4H
0318g(A0E00008): STR R0, SP, 8H
0319h(5000FFD0): MOV R0, R0, FFFFFFD0H
031Ah(81E00010): LDR R1, SP, 10H
031Bh(A1000000): STR R1, R0, 0H
REPEAT UNTIL SYSTEM.BIT(spiCtrl, 0)
ENDi;j
031Ci(5000FFD4): MOV R0, R0, FFFFFFD4H
031Di(80000000): LDR R0, R0, 0H
031Ei(40030001): ROR R0, R0, 1H
031Fi(E8FFFFFC): BPL -4 [031CH]
0320j(80E0000C): LDR R0, SP, CH
0321j(40080004): ADD R0, R0, 4H
0322j(E7FFFFED): B -19 [0310H]
SPI(255)k;l SPI(255)m;n (*dummy checksum*) i := 0;o
0323k(400000FF): MOV R0, R0, FFH
0324l(F7FFFF2D): BL -211 [0252H]
0325m(400000FF): MOV R0, R0, FFH
0326n(F7FFFF2B): BL -213 [0252H]
0327o(40000000): MOV R0, R0, 0H
0328o(A0E0000C): STR R0, SP, CH
REPEAT SPI(-1)p;q INC(i);r UNTIL (data MOD 32 =s 5)t OR (ui = 10000)v;w
0329p(5000FFFF): MOV R0, R0, FFFFFFFFH
032Aq(F7FFFF27): BL -217 [0252H]
032Br(80E0000C): LDR R0, SP, CH
032Cr(40080001): ADD R0, R0, 1H
032Dr(A0E0000C): STR R0, SP, CH
032Es .FIXUP D
032Es(8D000027): LDR SB, MT, MOD0 [Kernel]
032Fs(80D00030): LDR R0, SB, 30H [data]
0330s(4004001F): AND R0, R0, 1FH
0331t(40090005): SUB R0, R0, 5H
0332u(E1000003): BEQ 3 [0336H]
0333v(80E0000C): LDR R0, SP, CH
0334v(40092710): SUB R0, R0, 2710H
0335w(E9FFFFF3): BNE -13 [0329H]
ASSERT(data MOD 32 =x 5)y;z SPIIdle(1)a (*deselect card*)
0336x .FIXUP D
0336x(8D000008): LDR SB, MT, MOD0 [Kernel]
0337x(80D00030): LDR R0, SB, 30H [data]
0338x(4004001F): AND R0, R0, 1FH
0339y(40090005): SUB R0, R0, 5H
033Az(D91D257C): BLNE MT [trap=7, pos=7461]
033Ba(40000001): MOV R0, R0, 1H
ENDb WriteSD;
033Cb(F7FFFEFA): BL -262 [0237H]
033Db(8FE00000): LDR LNK, SP, 0H
033Eb(4EE80018): ADD SP, SP, 18H
033Fb(C700000F): B LNK
PROCEDURE InitSecMap*;
VAR i: INTEGER;
BEGINc NofSectors := 0;d sectorMap[0] := {0 .. 31};e sectorMap[1] := {0 .. 31};f
0340c .PROC 11
0340c .COMMAND InitSecMap
0340c(4EE90008): SUB SP, SP, 8H
0341c(AFE00000): STR LNK, SP, 0H
0342d(40000000): MOV R0, R0, 0H
0343d .FIXUP D
0343d(8D00000D): LDR SB, MT, MOD0 [Kernel]
0344d(A0D00004): STR R0, SB, 4H [data]
0345e(5000FFFF): MOV R0, R0, FFFFFFFFH
0346e(A0D00034): STR R0, SB, 34H
0347f(5000FFFF): MOV R0, R0, FFFFFFFFH
0348f(A0D00038): STR R0, SB, 38H
FOR i := 2 TOg mapsize DIV 32 - 1 DO sectorMaph[i]i := {} ENDj
0349g(40000002): MOV R0, R0, 2H
034Ah(410907FF): SUB R1, R0, 7FFH
034Bh(EE00000C): BGT 12 [0358H]
034Ch(A0E00004): STR R0, SP, 4H
034Di(80E00004): LDR R0, SP, 4H
034Ei(41090800): SUB R1, R0, 800H
034Fi(DA1E031C): BLCC MT [trap=1, pos=7683]
0350i(40010002): LSL R0, R0, 2H
0351i .FIXUP D
0351i(8D00000E): LDR SB, MT, MOD0 [Kernel]
0352i(00D80000): ADD R0, SB, R0 [global array]
0353j(41000000): MOV R1, R0, 0H
0354j(A1000034): STR R1, R0, 34H
ENDk InitSecMap;
0355k(80E00004): LDR R0, SP, 4H
0356k(40080001): ADD R0, R0, 1H
0357k(E7FFFFF2): B -14 [034AH]
0358k(8FE00000): LDR LNK, SP, 0H
0359k(4EE80008): ADD SP, SP, 8H
035Ak(C700000F): B LNK
PROCEDURE MarkSector*(sec: INTEGER);
BEGINl sec := sec DIV 29;m ASSERT(SYSTEM.H(0) =n 0)o;p
035Bl .PROC 12
035Bl(4EE90008): SUB SP, SP, 8H
035Cl(AFE00000): STR LNK, SP, 0H
035Dl(A0E00004): STR R0, SP, 4H
035Em(80E00004): LDR R0, SP, 4H
035Fm(400B001D): DIV R0, R0, 1DH
0360m(A0E00004): STR R0, SP, 4H
0361n(20000000): MOV' R0, R0, R0
0362o(40090000): SUB R0, R0, 0H
0363p(D91E7B7C): BLNE MT [trap=7, pos=7803]
INCL(sectorMap[sec DIV 32]q, sec MOD 32)r;s INC(NofSectors)
0364q(80E00004): LDR R0, SP, 4H
0365q(40020005): ASR R0, R0, 5H
0366q(41090800): SUB R1, R0, 800H
0367q(DA1E9A1C): BLCC MT [trap=1, pos=7834]
0368q(40010002): LSL R0, R0, 2H
0369q .FIXUP D
0369q(8D000018): LDR SB, MT, MOD0 [Kernel]
036Aq(00D80000): ADD R0, SB, R0 [global array]
036Br(81E00004): LDR R1, SP, 4H
036Cr(4114001F): AND R1, R1, 1FH
036Ds(40080034): ADD R0, R0, 34H
036Es(82000000): LDR R2, R0, 0H
036Fs(43000001): MOV R3, R0, 1H
0370s(01310001): LSL R1, R3, R1
0371s(02260001): IOR R2, R2, R1
0372s(A2000000): STR R2, R0, 0H
ENDt MarkSector;
0373t(40D80004): ADD R0, SB, 4H
0374t(81000000): LDR R1, R0, 0H
0375t(41180001): ADD R1, R1, 1H
0376t(A1000000): STR R1, R0, 0H
0377t(8FE00000): LDR LNK, SP, 0H
0378t(4EE80008): ADD SP, SP, 8H
0379t(C700000F): B LNK
PROCEDURE FreeSector*(sec: INTEGER);
BEGINu sec := sec DIV 29;v ASSERT(SYSTEM.H(0) =w 0)x;y
037Au .PROC 13
037Au(4EE90008): SUB SP, SP, 8H
037Bu(AFE00000): STR LNK, SP, 0H
037Cu(A0E00004): STR R0, SP, 4H
037Dv(80E00004): LDR R0, SP, 4H
037Ev(400B001D): DIV R0, R0, 1DH
037Fv(A0E00004): STR R0, SP, 4H
0380w(20000000): MOV' R0, R0, R0
0381x(40090000): SUB R0, R0, 0H
0382y(D91F267C): BLNE MT [trap=7, pos=7974]
EXCL(sectorMap[sec DIV 32]z, sec MOD 32)a;b DEC(NofSectors)
0383z(80E00004): LDR R0, SP, 4H
0384z(40020005): ASR R0, R0, 5H
0385z(41090800): SUB R1, R0, 800H
0386z(DA1F451C): BLCC MT [trap=1, pos=8005]
0387z(40010002): LSL R0, R0, 2H
0388z .FIXUP D
0388z(8D00001F): LDR SB, MT, MOD0 [Kernel]
0389z(00D80000): ADD R0, SB, R0 [global array]
038Aa(81E00004): LDR R1, SP, 4H
038Ba(4114001F): AND R1, R1, 1FH
038Cb(40080034): ADD R0, R0, 34H
038Db(82000000): LDR R2, R0, 0H
038Eb(43000001): MOV R3, R0, 1H
038Fb(01310001): LSL R1, R3, R1
0390b(02250001): ANN R2, R2, R1
0391b(A2000000): STR R2, R0, 0H
ENDc FreeSector;
0392c(40D80004): ADD R0, SB, 4H
0393c(81000000): LDR R1, R0, 0H
0394c(41190001): SUB R1, R1, 1H
0395c(A1000000): STR R1, R0, 0H
0396c(8FE00000): LDR LNK, SP, 0H
0397c(4EE80008): ADD SP, SP, 8H
0398c(C700000F): B LNK
PROCEDURE AllocSector*(hint: INTEGER; VAR sec: INTEGER);
VAR s: INTEGER;
BEGINd (*find free sector, starting after hint*)
0399d .PROC 14
0399d(4EE90010): SUB SP, SP, 10H
039Ad(AFE00000): STR LNK, SP, 0H
039Bd(A0E00004): STR R0, SP, 4H
039Cd(A1E00008): STR R1, SP, 8H
hint := hint DIV 29;e ASSERT(SYSTEM.H(0) =f 0)g;h s := hint;i
039De(80E00004): LDR R0, SP, 4H
039Ee(400B001D): DIV R0, R0, 1DH
039Fe(A0E00004): STR R0, SP, 4H
03A0f(20000000): MOV' R0, R0, R0
03A1g(40090000): SUB R0, R0, 0H
03A2h(D920297C): BLNE MT [trap=7, pos=8233]
03A3i(80E00004): LDR R0, SP, 4H
03A4i(A0E0000C): STR R0, SP, CH
REPEAT INC(s);j
03A5j(80E0000C): LDR R0, SP, CH
03A6j(40080001): ADD R0, R0, 1H
03A7j(A0E0000C): STR R0, SP, CH
IF s = mapsize THENk s := 1 ENDl ;
03A8k(80E0000C): LDR R0, SP, CH
03A9k(61000001): MOV' R1, R0, 1H
03AAk(00090001): SUB R0, R0, R1
03ABk(E9000002): BNE 2 [03AEH]
03ACl(40000001): MOV R0, R0, 1H
03ADl(A0E0000C): STR R0, SP, CH
UNTIL ~(s MOD 32 INm sectorMap[s DIV 32]n)o;p
03AEm(80E0000C): LDR R0, SP, CH
03AFm(4004001F): AND R0, R0, 1FH
03B0n(81E0000C): LDR R1, SP, CH
03B1n(41120005): ASR R1, R1, 5H
03B2n(42190800): SUB R2, R1, 800H
03B3n(DA209A1C): BLCC MT [trap=1, pos=8346]
03B4n(41110002): LSL R1, R1, 2H
03B5n .FIXUP D
03B5n(8D00002D): LDR SB, MT, MOD0 [Kernel]
03B6n(01D80001): ADD R1, SB, R1 [global array]
03B7o(81100034): LDR R1, R1, 34H
03B8o(40080001): ADD R0, R0, 1H
03B9o(01130000): ROR R1, R1, R0
03BAp(E0FFFFEA): BMI -22 [03A5H]
INCL(sectorMap[s DIV 32]q, s MOD 32)r;s INC(NofSectors);t sec := s * 29
03BBq(80E0000C): LDR R0, SP, CH
03BCq(40020005): ASR R0, R0, 5H
03BDq(41090800): SUB R1, R0, 800H
03BEq(DA20B91C): BLCC MT [trap=1, pos=8377]
03BFq(40010002): LSL R0, R0, 2H
03C0q .FIXUP D
03C0q(8D00000B): LDR SB, MT, MOD0 [Kernel]
03C1q(00D80000): ADD R0, SB, R0 [global array]
03C2r(81E0000C): LDR R1, SP, CH
03C3r(4114001F): AND R1, R1, 1FH
03C4s(40080034): ADD R0, R0, 34H
03C5s(82000000): LDR R2, R0, 0H
03C6s(43000001): MOV R3, R0, 1H
03C7s(01310001): LSL R1, R3, R1
03C8s(02260001): IOR R2, R2, R1
03C9s(A2000000): STR R2, R0, 0H
03CAt(40D80004): ADD R0, SB, 4H
03CBt(81000000): LDR R1, R0, 0H
03CCt(41180001): ADD R1, R1, 1H
03CDt(A1000000): STR R1, R0, 0H
ENDu AllocSector;
03CEu(80E0000C): LDR R0, SP, CH
03CFu(400A001D): MUL R0, R0, 1DH
03D0u(81E00008): LDR R1, SP, 8H
03D1u(A0100000): STR R0, R1, 0H
03D2u(8FE00000): LDR LNK, SP, 0H
03D3u(4EE80010): ADD SP, SP, 10H
03D4u(C700000F): B LNK
PROCEDURE GetSector*(src: INTEGER; VAR dst: Sector);
BEGINv src := src DIV 29;w ASSERT(SYSTEM.H(0) =x 0)y;z
03D5v .PROC 15
03D5v(4EE9000C): SUB SP, SP, CH
03D6v(AFE00000): STR LNK, SP, 0H
03D7v(A0E00004): STR R0, SP, 4H
03D8v(A1E00008): STR R1, SP, 8H
03D9w(80E00004): LDR R0, SP, 4H
03DAw(400B001D): DIV R0, R0, 1DH
03DBw(A0E00004): STR R0, SP, 4H
03DCx(20000000): MOV' R0, R0, R0
03DDy(40090000): SUB R0, R0, 0H
03DEz(D921637C): BLNE MT [trap=7, pos=8547]
src := src * 2 +a FSoffset;b
03DFa(80E00004): LDR R0, SP, 4H
03E0a(40010001): LSL R0, R0, 1H
03E1b(61000008): MOV' R1, R0, 8H
03E2b(00080001): ADD R0, R0, R1
03E3b(A0E00004): STR R0, SP, 4H
ReadSD(src,c SYSTEM.ADR(dst))d;e ReadSD(src+1,f SYSTEM.ADR(dst)+g512)h
03E4c(80E00004): LDR R0, SP, 4H
03E5d(81E00008): LDR R1, SP, 8H
03E6e(F7FFFEDC): BL -292 [02C3H]
03E7f(80E00004): LDR R0, SP, 4H
03E8f(40080001): ADD R0, R0, 1H
03E9g(81E00008): LDR R1, SP, 8H
03EAh(41180200): ADD R1, R1, 200H
ENDi GetSector;
03EBi(F7FFFED7): BL -297 [02C3H]
03ECi(8FE00000): LDR LNK, SP, 0H
03EDi(4EE8000C): ADD SP, SP, CH
03EEi(C700000F): B LNK
PROCEDURE PutSector*(dst: INTEGER; VAR src: Sector);
BEGINj dst := dst DIV 29;k ASSERT(SYSTEM.H(0) =l 0)m;n
03EFj .PROC 16
03EFj(4EE9000C): SUB SP, SP, CH
03F0j(AFE00000): STR LNK, SP, 0H
03F1j(A0E00004): STR R0, SP, 4H
03F2j(A1E00008): STR R1, SP, 8H
03F3k(80E00004): LDR R0, SP, 4H
03F4k(400B001D): DIV R0, R0, 1DH
03F5k(A0E00004): STR R0, SP, 4H
03F6l(20000000): MOV' R0, R0, R0
03F7m(40090000): SUB R0, R0, 0H
03F8n(D922487C): BLNE MT [trap=7, pos=8776]
dst := dst * 2 +o FSoffset;p
03F9o(80E00004): LDR R0, SP, 4H
03FAo(40010001): LSL R0, R0, 1H
03FBp(61000008): MOV' R1, R0, 8H
03FCp(00080001): ADD R0, R0, R1
03FDp(A0E00004): STR R0, SP, 4H
WriteSD(dst,q SYSTEM.ADR(src))r;s WriteSD(dst+1,t SYSTEM.ADR(src)+u512)v
03FEq(80E00004): LDR R0, SP, 4H
03FFr(81E00008): LDR R1, SP, 8H
0400s(F7FFFEFD): BL -259 [02FEH]
0401t(80E00004): LDR R0, SP, 4H
0402t(40080001): ADD R0, R0, 1H
0403u(81E00008): LDR R1, SP, 8H
0404v(41180200): ADD R1, R1, 200H
ENDw PutSector;
0405w(F7FFFEF8): BL -264 [02FEH]
0406w(8FE00000): LDR LNK, SP, 0H
0407w(4EE8000C): ADD SP, SP, CH
0408w(C700000F): B LNK
(*-------- Miscellaneous procedures----------*)
PROCEDURE Time*(): INTEGER;
VAR t: INTEGER;
BEGINx SYSTEM.GET(timer, t);y RETURN t
0409x .PROC 17
0409x(4EE90008): SUB SP, SP, 8H
040Ax(AFE00000): STR LNK, SP, 0H
040By(5000FFC0): MOV R0, R0, FFFFFFC0H
040Cy(80000000): LDR R0, R0, 0H
040Dy(A0E00004): STR R0, SP, 4H
ENDz Time;
040Ez(80E00004): LDR R0, SP, 4H
040Fz(8FE00000): LDR LNK, SP, 0H
0410z(4EE80008): ADD SP, SP, 8H
0411z(C700000F): B LNK
PROCEDURE Clock*(): INTEGER;
BEGINa RETURN clock
0412a .PROC 18
0412a(4EE90004): SUB SP, SP, 4H
0413a(AFE00000): STR LNK, SP, 0H
ENDb Clock;
0414b .FIXUP D
0414b(8D000054): LDR SB, MT, MOD0 [Kernel]
0415b(80D0001C): LDR R0, SB, 1CH [data]
0416b(8FE00000): LDR LNK, SP, 0H
0417b(4EE80004): ADD SP, SP, 4H
0418b(C700000F): B LNK
PROCEDURE SetClock*(dt: INTEGER);
BEGINc clock := dt
0419c .PROC 19
0419c(4EE90008): SUB SP, SP, 8H
041Ac(AFE00000): STR LNK, SP, 0H
041Bc(A0E00004): STR R0, SP, 4H
ENDd SetClock;
041Cd(80E00004): LDR R0, SP, 4H
041Dd .FIXUP D
041Dd(8D000009): LDR SB, MT, MOD0 [Kernel]
041Ed(A0D0001C): STR R0, SB, 1CH [data]
041Fd(8FE00000): LDR LNK, SP, 0H
0420d(4EE80008): ADD SP, SP, 8H
0421d(C700000F): B LNK
PROCEDURE Install*(Padr, at: INTEGER);
BEGINe SYSTEM.PUT(at, 0E7000000H + (Padr - at)f DIV 4 -g1)h
0422e .PROC 20
0422e(4EE9000C): SUB SP, SP, CH
0423e(AFE00000): STR LNK, SP, 0H
0424e(A0E00004): STR R0, SP, 4H
0425e(A1E00008): STR R1, SP, 8H
0426f(80E00004): LDR R0, SP, 4H
0427f(81E00008): LDR R1, SP, 8H
0428f(00090001): SUB R0, R0, R1
0429g(40020002): ASR R0, R0, 2H
042Ag(6100E700): MOV' R1, R0, FFFFE700H
042Bg(00180000): ADD R0, R1, R0
042Ch(40090001): SUB R0, R0, 1H
ENDi Install;
042Di(81E00008): LDR R1, SP, 8H
042Ei(A0100000): STR R0, R1, 0H
042Fi(8FE00000): LDR LNK, SP, 0H
0430i(4EE8000C): ADD SP, SP, CH
0431i(C700000F): B LNK
PROCEDURE Trap(VAR a: INTEGER; b: INTEGER);
VAR u, v, w: INTEGER;
BEGINj u := SYSTEM.REG(15);k SYSTEM.GET(u - 4,l v);m w := v DIV 10H MODn 10H;o (*trap number*)
0432j(4EE90018): SUB SP, SP, 18H
0433j(AFE00000): STR LNK, SP, 0H
0434j(A0E00004): STR R0, SP, 4H
0435j(A1E00008): STR R1, SP, 8H
0436k(0000000F): MOV R0, R0, LNK
0437k(A0E0000C): STR R0, SP, CH
0438l(80E0000C): LDR R0, SP, CH
0439l(40090004): SUB R0, R0, 4H
043Am(80000000): LDR R0, R0, 0H
043Bm(A0E00010): STR R0, SP, 10H
043Cn(80E00010): LDR R0, SP, 10H
043Dn(40020004): ASR R0, R0, 4H
043Eo(4004000F): AND R0, R0, FH
043Fo(A0E00014): STR R0, SP, 14H
IF w = 0 THENp New(a,q b)r
0440p(80E00014): LDR R0, SP, 14H
0441p(E9000004): BNE 4 [0446H]
0442q(80E00004): LDR R0, SP, 4H
0443r(81E00008): LDR R1, SP, 8H
ELSEs (*stop*) LEDt(w + 192)u;v REPEAT UNTIL FALSE
0444s(F7FFFC8D): BL -883 [00D2H]
0445t(E7000005): B 5 [044BH]
0446u(80E00014): LDR R0, SP, 14H
0447u(400800C0): ADD R0, R0, C0H
0448v(5100FFC4): MOV R1, R0, FFFFFFC4H
0449v(A0100000): STR R0, R1, 0H
ENDw
044Aw(E7FFFFFF): B -1 [044AH]
ENDx Trap;
044Bx(8FE00000): LDR LNK, SP, 0H
044Cx(4EE80018): ADD SP, SP, 18H
044Dx(C700000F): B LNK
PROCEDURE Init*;
BEGINy Install(SYSTEM.ADR(Trap),z 20H)a;b (*install temporary trap*)
044Ey .PROC 21
044Ey .COMMAND Init
044Ey(4EE90004): SUB SP, SP, 4H
044Fy(AFE00000): STR LNK, SP, 0H
0450z(F7000000): BL 0 [0451H]
0451z(40F9007C): SUB R0, LNK, 7CH
0452a(41000020): MOV R1, R0, 20H
0453b(F7FFFFCE): BL -50 [0422H]
SYSTEM.GET(12, MemLim);c SYSTEM.GET(24, heapOrg);d
0454c(4000000C): MOV R0, R0, CH
0455c(80000000): LDR R0, R0, 0H
0456c .FIXUP D
0456c(8D000039): LDR SB, MT, MOD0 [Kernel]
0457c(A0D00018): STR R0, SB, 18H [data]
0458d(40000018): MOV R0, R0, 18H
0459d(80000000): LDR R0, R0, 0H
045Ad(A0D00008): STR R0, SB, 8H
stackOrg := heapOrg;e stackSize := 8000H;f heapLim := MemLim;g
045Be(80D00008): LDR R0, SB, 8H
045Ce(A0D00010): STR R0, SB, 10H
045Df(40008000): MOV R0, R0, FFFF8000H
045Ef(A0D00014): STR R0, SB, 14H
045Fg(80D00018): LDR R0, SB, 18H
0460g(A0D0000C): STR R0, SB, CH
list1 := 0;h list2 := 0;i list3 := 0;j list0 := heapOrg;k
0461h(40000000): MOV R0, R0, 0H
0462h(A0D00024): STR R0, SB, 24H
0463i(40000000): MOV R0, R0, 0H
0464i(A0D00028): STR R0, SB, 28H
0465j(40000000): MOV R0, R0, 0H
0466j(A0D0002C): STR R0, SB, 2CH
0467k(80D00008): LDR R0, SB, 8H
0468k(A0D00020): STR R0, SB, 20H
SYSTEM.PUT(list0, heapLim - heapOrg)l;m SYSTEM.PUT(list0+4,n -1);o SYSTEM.PUT(list0+8,p 0);q
0469l(80D0000C): LDR R0, SB, CH
046Al(81D00008): LDR R1, SB, 8H
046Bl(00090001): SUB R0, R0, R1
046Cm(81D00020): LDR R1, SB, 20H
046Dm(A0100000): STR R0, R1, 0H
046En(80D00020): LDR R0, SB, 20H
046Fn(40080004): ADD R0, R0, 4H
0470o(5100FFFF): MOV R1, R0, FFFFFFFFH
0471o(A1000000): STR R1, R0, 0H
0472p(80D00020): LDR R0, SB, 20H
0473p(40080008): ADD R0, R0, 8H
0474q(41000000): MOV R1, R0, 0H
0475q(A1000000): STR R1, R0, 0H
allocated := 0;r clock := 0;s InitSecMap
0476r(40000000): MOV R0, R0, 0H
0477r(A0D00000): STR R0, SB, 0H
0478s(40000000): MOV R0, R0, 0H
0479s(A0D0001C): STR R0, SB, 1CH
ENDt Init;
047At(F7FFFEC5): BL -315 [0340H]
047Bt(8FE00000): LDR LNK, SP, 0H
047Ct(4EE80004): ADD SP, SP, 4H
047Dt(C700000F): B LNK
ENDu Kernel.v
047Eu .PROC 0
047Eu .ENTRYPOINT
047Eu(4EE90004): SUB SP, SP, 4H
047Fu(AFE00000): STR LNK, SP, 0H
0480v(8FE00000): LDR LNK, SP, 0H
0481v(4EE80004): ADD SP, SP, 4H
0482v(C700000F): B LNK