Home » Archimedes archive » Archimedes World » archimedes_world_volume_16_issue_1_scp.adf » !ARMwrest_ARM » MemLib
MemLib
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Archimedes World » archimedes_world_volume_16_issue_1_scp.adf » !ARMwrest_ARM |
Filename: | MemLib |
Read OK: | ✔ |
File size: | 1847 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM MemLib - memory control library. 20 30ERROR 0,"The Memory Library cannot be run. Use the LIBRARY command to include it in you code." 40 50REM ---------------------------------------------------------------------------------------------------- 60REM PROCcreateDynamicArea() 70REM Creates a new dynamic area. 80REM On entry: The arguments are as for the SWI call. 90REM On exit: areaNumber% contains the new dynamic area number and areaBase% contains it's base address. 100REM ---------------------------------------------------------------------------------------------------- 110 120DEF PROCcreateDynamicArea(initialSize%,flags%,maxSize%,handler%,handlerWorkspace%,name$,RETURN areaNumber%, RETURN areaBase%) 130 SYS "OS_DynamicArea",0,-1,initialSize%,-1,flags%,maxSize%,handler%,handlerWorkspace%,name$ TO ,areaNumber%,areaBase% 140ENDPROC 150 160REM ---------------------------------------------------------------------------------------------------- 170REM PROCdeleteDynamicArea() 180REM Deletes an existing dynamic area. 190REM On entry: areaNumber% contains an area number previously returned from createDynamicArea 200REM ---------------------------------------------------------------------------------------------------- 210 220DEF PROCdeleteDynamicArea(areaNumber%) 230 SYS "OS_DynamicArea",1,areaNumber% 240ENDPROC 250 260REM ---------------------------------------------------------------------------------------------------- 270REM FNchangeDynamicArea() 280REM Changes the size of an existing dynamic area. 290REM On entry: areaNumber% should conatin an area number returned by PROCcreateDynamic area. 300REM change% should cantain the amount to change the size by. 310REM Returns: The amount that the size has actually changed by. 320REM ---------------------------------------------------------------------------------------------------- 330 340DEF FNchangeDynamicArea(areaNumber%,change%) 350 LOCAL t% 360 SYS "OS_ChangeDynamicArea",areaNumber%,change% TO ,t% 370= t% 380 390REM ---------------------------------------------------------------------------------------------------- 400REM FNreadRAMSize 410REM Returns: The amount of RAM connected to the computer (in bytes) 420REM ---------------------------------------------------------------------------------------------------- 430 440DEF FNreadRAMSize 450 LOCAL num%,psize% 460 SYS "OS_Memory",264 TO ,num%,psize% 470= num% * psize% 480 490REM ---------------------------------------------------------------------------------------------------- 500REM FNreadROMSize 510REM Returns: The amount of ROM connected to the computer (in bytes) 520REM ---------------------------------------------------------------------------------------------------- 530 540DEF FNreadROMSize 550 LOCAL num%,psize% 560 SYS "OS_Memory",776 TO ,num%,psize% 570= num% * psize% 580 590REM ---------------------------------------------------------------------------------------------------- 600REM FNreadVRAMSize 610REM Returns: The amount of VRAM connected to the computer (in bytes) 620REM ---------------------------------------------------------------------------------------------------- 630 640DEF FNreadVRAMSize 650 LOCAL num%,psize% 660 SYS "OS_Memory",520 TO ,num%,psize% 670= num% * psize% 680 690REM ---------------------------------------------------------------------------------------------------- 700REM PROCreadAllocationTable() 710REM On exit: table% points to the table an entries% hold the number of entries in the table. 720REM ---------------------------------------------------------------------------------------------------- 730 740DEF PROCreadAllocationTable(RETURN table%, RETURN entries%) 750 SYS "OS_Memory",6 TO ,entries% 760 DIM table% entries% 770 SYS "OS_Memory",7,table% 780 entries% = entries% * 2 790ENDPROC 800 810REM ---------------------------------------------------------------------------------------------------- 820REM FNgetPageInfo() 830REM On entry: table% points to the table returned by PROCreadAllocationTable(). 840REM Returns: the four bits of information for the given page number. 850REM ---------------------------------------------------------------------------------------------------- 860 870DEF FNgetPageInfo(table%,pageNumber%) 880 LOCAL t% 890 t% = table%?(pageNumber% >> 1) 900 IF NOT (pageNumber% AND 1) THEN t% = t% >> 4 910= t% AND &F 920 930REM ---------------------------------------------------------------------------------------------------- 940REM FNphysicalToLogicalAddress() 950REM Converts the given physical address into a logical address and returns it. 960REM ---------------------------------------------------------------------------------------------------- 970 980DEF FNphysicalToLogicalAddress(physical%) 990 LOCAL pb% 1000 DIM pb% 12 1010 pb!8 = physical% 1020 SYS "OS_Memory",1<<10 OR 1<<12,pb%,1 1030= pb%!4 1040 1050REM ---------------------------------------------------------------------------------------------------- 1060REM FNlogicalToPhysicalAddress() 1070REM Converts the given logical address into a physical address and returns it. 1080REM ---------------------------------------------------------------------------------------------------- 1090 1100DEF FNlogicalToPhyscalAddress(logical%) 1110 LOCAL pb% 1120 DIM pb% 12 1130 pb!0 = logical% 1140 SYS "OS_Memory",1<<9 OR 1<<13,pb%,1 1150= pb%!8 1160 1170REM ---------------------------------------------------------------------------------------------------- 1180REM FNphysicalAddressToPageNumber() 1190REM Converts the given physical address into a page number and returns it. 1200REM ---------------------------------------------------------------------------------------------------- 1210 1220DEF FNphysicalAddressToPageNumber(physical%) 1230 LOCAL pb% 1240 DIM pb% 12 1250 pb!8 = physical% 1260 SYS "OS_Memory",1<<10 OR 1<<11,pb%,1 1270= pb%!0 1280 1290REM ---------------------------------------------------------------------------------------------------- 1300REM PROCsetPageCacheable() 1310REM On entry: address% is the address to set cacheability for and cacheable% is 1 to set it to cachable 1320REM or 0 to set it to non-cacheable. 1330REM ---------------------------------------------------------------------------------------------------- 1340 1350DEF PROCsetPageCacheable(address%,cacheable%) 1360 LOCAL pb% 1370 DIM pb% 12 1380 pb!4 = address% 1390 IF cachable% THEN 1400 SYS "OS_Memory",1<<9 OR 3<<14,pb%,1 1410 ELSE 1420 SYS "OS_Memory",1<<9 OR 2<<14,pb%,1 1430 ENDIF 1440ENDPROC
&� MemLib - memory control library. ^� 0,"The Memory Library cannot be run. Use the LIBRARY command to include it in you code." ( 2j� ---------------------------------------------------------------------------------------------------- <� PROCcreateDynamicArea() F!� Creates a new dynamic area. P6� On entry: The arguments are as for the SWI call. Zi� On exit: areaNumber% contains the new dynamic area number and areaBase% contains it's base address. dj� ---------------------------------------------------------------------------------------------------- n xr� �createDynamicArea(initialSize%,flags%,maxSize%,handler%,handlerWorkspace%,name$,� areaNumber%, � areaBase%) �x ș "OS_DynamicArea",0,-1,initialSize%,-1,flags%,maxSize%,handler%,handlerWorkspace%,name$ � ,areaNumber%,areaBase% �� � �j� ---------------------------------------------------------------------------------------------------- �� PROCdeleteDynamicArea() �'� Deletes an existing dynamic area. �^� On entry: areaNumber% contains an area number previously returned from createDynamicArea �j� ---------------------------------------------------------------------------------------------------- � �%� �deleteDynamicArea(areaNumber%) �' ș "OS_DynamicArea",1,areaNumber% �� � j� ---------------------------------------------------------------------------------------------------- � FNchangeDynamicArea() 3� Changes the size of an existing dynamic area. "]� On entry: areaNumber% should conatin an area number returned by PROCcreateDynamic area. ,H� change% should cantain the amount to change the size by. 6@� Returns: The amount that the size has actually changed by. @j� ---------------------------------------------------------------------------------------------------- J T-� �changeDynamicArea(areaNumber%,change%) ^ � t% h9 ș "OS_ChangeDynamicArea",areaNumber%,change% � ,t% r= t% | �j� ---------------------------------------------------------------------------------------------------- �� FNreadRAMSize �E� Returns: The amount of RAM connected to the computer (in bytes) �j� ---------------------------------------------------------------------------------------------------- � �� �readRAMSize � � num%,psize% �' ș "OS_Memory",264 � ,num%,psize% �= num% * psize% � �j� ---------------------------------------------------------------------------------------------------- �� FNreadROMSize �E� Returns: The amount of ROM connected to the computer (in bytes) j� ---------------------------------------------------------------------------------------------------- � �readROMSize & � num%,psize% 0' ș "OS_Memory",776 � ,num%,psize% := num% * psize% D Nj� ---------------------------------------------------------------------------------------------------- X� FNreadVRAMSize bF� Returns: The amount of VRAM connected to the computer (in bytes) lj� ---------------------------------------------------------------------------------------------------- v �� �readVRAMSize � � num%,psize% �' ș "OS_Memory",520 � ,num%,psize% �= num% * psize% � �j� ---------------------------------------------------------------------------------------------------- �� PROCreadAllocationTable() �^� On exit: table% points to the table an entries% hold the number of entries in the table. �j� ---------------------------------------------------------------------------------------------------- � �0� �readAllocationTable(� table%, � entries%) �" ș "OS_Memory",6 � ,entries% � � table% entries% ș "OS_Memory",7,table% entries% = entries% * 2 � *j� ---------------------------------------------------------------------------------------------------- 4� FNgetPageInfo() >Q� On entry: table% points to the table returned by PROCreadAllocationTable(). HF� Returns: the four bits of information for the given page number. Rj� ---------------------------------------------------------------------------------------------------- \ f&� �getPageInfo(table%,pageNumber%) p � t% z$ t% = table%?(pageNumber% >> 1) �* � � (pageNumber% � 1) � t% = t% >> 4 � = t% � &F � �j� ---------------------------------------------------------------------------------------------------- �"� FNphysicalToLogicalAddress() �P� Converts the given physical address into a logical address and returns it. �j� ---------------------------------------------------------------------------------------------------- � �*� �physicalToLogicalAddress(physical%) � � pb% � � pb% 12 � pb!8 = physical% �( ș "OS_Memory",1<<10 � 1<<12,pb%,1 = pb%!4 j� ---------------------------------------------------------------------------------------------------- $"� FNlogicalToPhysicalAddress() .P� Converts the given logical address into a physical address and returns it. 8j� ---------------------------------------------------------------------------------------------------- B L(� �logicalToPhyscalAddress(logical%) V � pb% ` � pb% 12 j pb!0 = logical% t' ș "OS_Memory",1<<9 � 1<<13,pb%,1 ~= pb%!8 � �j� ---------------------------------------------------------------------------------------------------- �%� FNphysicalAddressToPageNumber() �L� Converts the given physical address into a page number and returns it. �j� ---------------------------------------------------------------------------------------------------- � �-� �physicalAddressToPageNumber(physical%) � � pb% � � pb% 12 � pb!8 = physical% �( ș "OS_Memory",1<<10 � 1<<11,pb%,1 �= pb%!0 j� ---------------------------------------------------------------------------------------------------- � PROCsetPageCacheable() i� On entry: address% is the address to set cacheability for and cacheable% is 1 to set it to cachable (0� or 0 to set it to non-cacheable. 2j� ---------------------------------------------------------------------------------------------------- < F,� �setPageCacheable(address%,cacheable%) P � pb% Z � pb% 12 d pb!4 = address% n � cachable% � x) ș "OS_Memory",1<<9 � 3<<14,pb%,1 � � �) ș "OS_Memory",1<<9 � 2<<14,pb%,1 � � �� �
00000000 0d 00 0a 26 f4 20 4d 65 6d 4c 69 62 20 2d 20 6d |...&. MemLib - m| 00000010 65 6d 6f 72 79 20 63 6f 6e 74 72 6f 6c 20 6c 69 |emory control li| 00000020 62 72 61 72 79 2e 0d 00 14 04 0d 00 1e 5e 85 20 |brary........^. | 00000030 30 2c 22 54 68 65 20 4d 65 6d 6f 72 79 20 4c 69 |0,"The Memory Li| 00000040 62 72 61 72 79 20 63 61 6e 6e 6f 74 20 62 65 20 |brary cannot be | 00000050 72 75 6e 2e 20 55 73 65 20 74 68 65 20 4c 49 42 |run. Use the LIB| 00000060 52 41 52 59 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 |RARY command to | 00000070 69 6e 63 6c 75 64 65 20 69 74 20 69 6e 20 79 6f |include it in yo| 00000080 75 20 63 6f 64 65 2e 22 0d 00 28 04 0d 00 32 6a |u code."..(...2j| 00000090 f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |. --------------| 000000a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000000f0 2d 2d 2d 2d 2d 2d 0d 00 3c 1d f4 20 50 52 4f 43 |------..<.. PROC| 00000100 63 72 65 61 74 65 44 79 6e 61 6d 69 63 41 72 65 |createDynamicAre| 00000110 61 28 29 0d 00 46 21 f4 20 43 72 65 61 74 65 73 |a()..F!. Creates| 00000120 20 61 20 6e 65 77 20 64 79 6e 61 6d 69 63 20 61 | a new dynamic a| 00000130 72 65 61 2e 0d 00 50 36 f4 20 4f 6e 20 65 6e 74 |rea...P6. On ent| 00000140 72 79 3a 20 54 68 65 20 61 72 67 75 6d 65 6e 74 |ry: The argument| 00000150 73 20 61 72 65 20 61 73 20 66 6f 72 20 74 68 65 |s are as for the| 00000160 20 53 57 49 20 63 61 6c 6c 2e 0d 00 5a 69 f4 20 | SWI call...Zi. | 00000170 4f 6e 20 65 78 69 74 3a 20 61 72 65 61 4e 75 6d |On exit: areaNum| 00000180 62 65 72 25 20 63 6f 6e 74 61 69 6e 73 20 74 68 |ber% contains th| 00000190 65 20 6e 65 77 20 64 79 6e 61 6d 69 63 20 61 72 |e new dynamic ar| 000001a0 65 61 20 6e 75 6d 62 65 72 20 61 6e 64 20 61 72 |ea number and ar| 000001b0 65 61 42 61 73 65 25 20 63 6f 6e 74 61 69 6e 73 |eaBase% contains| 000001c0 20 69 74 27 73 20 62 61 73 65 20 61 64 64 72 65 | it's base addre| 000001d0 73 73 2e 0d 00 64 6a f4 20 2d 2d 2d 2d 2d 2d 2d |ss...dj. -------| 000001e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000230 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 6e |-------------..n| 00000240 04 0d 00 78 72 dd 20 f2 63 72 65 61 74 65 44 79 |...xr. .createDy| 00000250 6e 61 6d 69 63 41 72 65 61 28 69 6e 69 74 69 61 |namicArea(initia| 00000260 6c 53 69 7a 65 25 2c 66 6c 61 67 73 25 2c 6d 61 |lSize%,flags%,ma| 00000270 78 53 69 7a 65 25 2c 68 61 6e 64 6c 65 72 25 2c |xSize%,handler%,| 00000280 68 61 6e 64 6c 65 72 57 6f 72 6b 73 70 61 63 65 |handlerWorkspace| 00000290 25 2c 6e 61 6d 65 24 2c f8 20 61 72 65 61 4e 75 |%,name$,. areaNu| 000002a0 6d 62 65 72 25 2c 20 f8 20 61 72 65 61 42 61 73 |mber%, . areaBas| 000002b0 65 25 29 0d 00 82 78 20 20 c8 99 20 22 4f 53 5f |e%)...x .. "OS_| 000002c0 44 79 6e 61 6d 69 63 41 72 65 61 22 2c 30 2c 2d |DynamicArea",0,-| 000002d0 31 2c 69 6e 69 74 69 61 6c 53 69 7a 65 25 2c 2d |1,initialSize%,-| 000002e0 31 2c 66 6c 61 67 73 25 2c 6d 61 78 53 69 7a 65 |1,flags%,maxSize| 000002f0 25 2c 68 61 6e 64 6c 65 72 25 2c 68 61 6e 64 6c |%,handler%,handl| 00000300 65 72 57 6f 72 6b 73 70 61 63 65 25 2c 6e 61 6d |erWorkspace%,nam| 00000310 65 24 20 b8 20 2c 61 72 65 61 4e 75 6d 62 65 72 |e$ . ,areaNumber| 00000320 25 2c 61 72 65 61 42 61 73 65 25 0d 00 8c 05 e1 |%,areaBase%.....| 00000330 0d 00 96 04 0d 00 a0 6a f4 20 2d 2d 2d 2d 2d 2d |.......j. ------| 00000340 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000390 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 |--------------..| 000003a0 aa 1d f4 20 50 52 4f 43 64 65 6c 65 74 65 44 79 |... PROCdeleteDy| 000003b0 6e 61 6d 69 63 41 72 65 61 28 29 0d 00 b4 27 f4 |namicArea()...'.| 000003c0 20 44 65 6c 65 74 65 73 20 61 6e 20 65 78 69 73 | Deletes an exis| 000003d0 74 69 6e 67 20 64 79 6e 61 6d 69 63 20 61 72 65 |ting dynamic are| 000003e0 61 2e 0d 00 be 5e f4 20 4f 6e 20 65 6e 74 72 79 |a....^. On entry| 000003f0 3a 20 61 72 65 61 4e 75 6d 62 65 72 25 20 63 6f |: areaNumber% co| 00000400 6e 74 61 69 6e 73 20 61 6e 20 61 72 65 61 20 6e |ntains an area n| 00000410 75 6d 62 65 72 20 70 72 65 76 69 6f 75 73 6c 79 |umber previously| 00000420 20 72 65 74 75 72 6e 65 64 20 66 72 6f 6d 20 63 | returned from c| 00000430 72 65 61 74 65 44 79 6e 61 6d 69 63 41 72 65 61 |reateDynamicArea| 00000440 0d 00 c8 6a f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |...j. ----------| 00000450 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000004a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 d2 04 0d 00 |----------......| 000004b0 dc 25 dd 20 f2 64 65 6c 65 74 65 44 79 6e 61 6d |.%. .deleteDynam| 000004c0 69 63 41 72 65 61 28 61 72 65 61 4e 75 6d 62 65 |icArea(areaNumbe| 000004d0 72 25 29 0d 00 e6 27 20 20 c8 99 20 22 4f 53 5f |r%)...' .. "OS_| 000004e0 44 79 6e 61 6d 69 63 41 72 65 61 22 2c 31 2c 61 |DynamicArea",1,a| 000004f0 72 65 61 4e 75 6d 62 65 72 25 0d 00 f0 05 e1 0d |reaNumber%......| 00000500 00 fa 04 0d 01 04 6a f4 20 2d 2d 2d 2d 2d 2d 2d |......j. -------| 00000510 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000560 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 01 0e |-------------...| 00000570 1b f4 20 46 4e 63 68 61 6e 67 65 44 79 6e 61 6d |.. FNchangeDynam| 00000580 69 63 41 72 65 61 28 29 0d 01 18 33 f4 20 43 68 |icArea()...3. Ch| 00000590 61 6e 67 65 73 20 74 68 65 20 73 69 7a 65 20 6f |anges the size o| 000005a0 66 20 61 6e 20 65 78 69 73 74 69 6e 67 20 64 79 |f an existing dy| 000005b0 6e 61 6d 69 63 20 61 72 65 61 2e 0d 01 22 5d f4 |namic area..."].| 000005c0 20 4f 6e 20 65 6e 74 72 79 3a 20 61 72 65 61 4e | On entry: areaN| 000005d0 75 6d 62 65 72 25 20 73 68 6f 75 6c 64 20 63 6f |umber% should co| 000005e0 6e 61 74 69 6e 20 61 6e 20 61 72 65 61 20 6e 75 |natin an area nu| 000005f0 6d 62 65 72 20 72 65 74 75 72 6e 65 64 20 62 79 |mber returned by| 00000600 20 50 52 4f 43 63 72 65 61 74 65 44 79 6e 61 6d | PROCcreateDynam| 00000610 69 63 20 61 72 65 61 2e 0d 01 2c 48 f4 20 20 20 |ic area...,H. | 00000620 20 20 20 20 20 20 20 20 63 68 61 6e 67 65 25 20 | change% | 00000630 73 68 6f 75 6c 64 20 63 61 6e 74 61 69 6e 20 74 |should cantain t| 00000640 68 65 20 61 6d 6f 75 6e 74 20 74 6f 20 63 68 61 |he amount to cha| 00000650 6e 67 65 20 74 68 65 20 73 69 7a 65 20 62 79 2e |nge the size by.| 00000660 0d 01 36 40 f4 20 52 65 74 75 72 6e 73 3a 20 54 |..6@. Returns: T| 00000670 68 65 20 61 6d 6f 75 6e 74 20 74 68 61 74 20 74 |he amount that t| 00000680 68 65 20 73 69 7a 65 20 68 61 73 20 61 63 74 75 |he size has actu| 00000690 61 6c 6c 79 20 63 68 61 6e 67 65 64 20 62 79 2e |ally changed by.| 000006a0 0d 01 40 6a f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |..@j. ----------| 000006b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000700 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 01 4a 04 0d 01 |----------..J...| 00000710 54 2d dd 20 a4 63 68 61 6e 67 65 44 79 6e 61 6d |T-. .changeDynam| 00000720 69 63 41 72 65 61 28 61 72 65 61 4e 75 6d 62 65 |icArea(areaNumbe| 00000730 72 25 2c 63 68 61 6e 67 65 25 29 0d 01 5e 0a 20 |r%,change%)..^. | 00000740 20 ea 20 74 25 0d 01 68 39 20 20 c8 99 20 22 4f | . t%..h9 .. "O| 00000750 53 5f 43 68 61 6e 67 65 44 79 6e 61 6d 69 63 41 |S_ChangeDynamicA| 00000760 72 65 61 22 2c 61 72 65 61 4e 75 6d 62 65 72 25 |rea",areaNumber%| 00000770 2c 63 68 61 6e 67 65 25 20 b8 20 2c 74 25 0d 01 |,change% . ,t%..| 00000780 72 08 3d 20 74 25 0d 01 7c 04 0d 01 86 6a f4 20 |r.= t%..|....j. | 00000790 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000007f0 2d 2d 2d 2d 0d 01 90 13 f4 20 46 4e 72 65 61 64 |----..... FNread| 00000800 52 41 4d 53 69 7a 65 0d 01 9a 45 f4 20 52 65 74 |RAMSize...E. Ret| 00000810 75 72 6e 73 3a 20 54 68 65 20 61 6d 6f 75 6e 74 |urns: The amount| 00000820 20 6f 66 20 52 41 4d 20 63 6f 6e 6e 65 63 74 65 | of RAM connecte| 00000830 64 20 74 6f 20 74 68 65 20 63 6f 6d 70 75 74 65 |d to the compute| 00000840 72 20 28 69 6e 20 62 79 74 65 73 29 0d 01 a4 6a |r (in bytes)...j| 00000850 f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |. --------------| 00000860 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000008b0 2d 2d 2d 2d 2d 2d 0d 01 ae 04 0d 01 b8 12 dd 20 |------......... | 000008c0 a4 72 65 61 64 52 41 4d 53 69 7a 65 0d 01 c2 13 |.readRAMSize....| 000008d0 20 20 ea 20 6e 75 6d 25 2c 70 73 69 7a 65 25 0d | . num%,psize%.| 000008e0 01 cc 27 20 20 c8 99 20 22 4f 53 5f 4d 65 6d 6f |..' .. "OS_Memo| 000008f0 72 79 22 2c 32 36 34 20 b8 20 2c 6e 75 6d 25 2c |ry",264 . ,num%,| 00000900 70 73 69 7a 65 25 0d 01 d6 13 3d 20 6e 75 6d 25 |psize%....= num%| 00000910 20 2a 20 70 73 69 7a 65 25 0d 01 e0 04 0d 01 ea | * psize%.......| 00000920 6a f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |j. -------------| 00000930 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000980 2d 2d 2d 2d 2d 2d 2d 0d 01 f4 13 f4 20 46 4e 72 |-------..... FNr| 00000990 65 61 64 52 4f 4d 53 69 7a 65 0d 01 fe 45 f4 20 |eadROMSize...E. | 000009a0 52 65 74 75 72 6e 73 3a 20 54 68 65 20 61 6d 6f |Returns: The amo| 000009b0 75 6e 74 20 6f 66 20 52 4f 4d 20 63 6f 6e 6e 65 |unt of ROM conne| 000009c0 63 74 65 64 20 74 6f 20 74 68 65 20 63 6f 6d 70 |cted to the comp| 000009d0 75 74 65 72 20 28 69 6e 20 62 79 74 65 73 29 0d |uter (in bytes).| 000009e0 02 08 6a f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |..j. -----------| 000009f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000a40 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 02 12 04 0d 02 1c |---------.......| 00000a50 12 dd 20 a4 72 65 61 64 52 4f 4d 53 69 7a 65 0d |.. .readROMSize.| 00000a60 02 26 13 20 20 ea 20 6e 75 6d 25 2c 70 73 69 7a |.&. . num%,psiz| 00000a70 65 25 0d 02 30 27 20 20 c8 99 20 22 4f 53 5f 4d |e%..0' .. "OS_M| 00000a80 65 6d 6f 72 79 22 2c 37 37 36 20 b8 20 2c 6e 75 |emory",776 . ,nu| 00000a90 6d 25 2c 70 73 69 7a 65 25 0d 02 3a 13 3d 20 6e |m%,psize%..:.= n| 00000aa0 75 6d 25 20 2a 20 70 73 69 7a 65 25 0d 02 44 04 |um% * psize%..D.| 00000ab0 0d 02 4e 6a f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |..Nj. ----------| 00000ac0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000b10 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 02 58 14 f4 20 |----------..X.. | 00000b20 46 4e 72 65 61 64 56 52 41 4d 53 69 7a 65 0d 02 |FNreadVRAMSize..| 00000b30 62 46 f4 20 52 65 74 75 72 6e 73 3a 20 54 68 65 |bF. Returns: The| 00000b40 20 61 6d 6f 75 6e 74 20 6f 66 20 56 52 41 4d 20 | amount of VRAM | 00000b50 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 74 68 65 |connected to the| 00000b60 20 63 6f 6d 70 75 74 65 72 20 28 69 6e 20 62 79 | computer (in by| 00000b70 74 65 73 29 0d 02 6c 6a f4 20 2d 2d 2d 2d 2d 2d |tes)..lj. ------| 00000b80 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000bd0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 02 |--------------..| 00000be0 76 04 0d 02 80 13 dd 20 a4 72 65 61 64 56 52 41 |v...... .readVRA| 00000bf0 4d 53 69 7a 65 0d 02 8a 13 20 20 ea 20 6e 75 6d |MSize.... . num| 00000c00 25 2c 70 73 69 7a 65 25 0d 02 94 27 20 20 c8 99 |%,psize%...' ..| 00000c10 20 22 4f 53 5f 4d 65 6d 6f 72 79 22 2c 35 32 30 | "OS_Memory",520| 00000c20 20 b8 20 2c 6e 75 6d 25 2c 70 73 69 7a 65 25 0d | . ,num%,psize%.| 00000c30 02 9e 13 3d 20 6e 75 6d 25 20 2a 20 70 73 69 7a |...= num% * psiz| 00000c40 65 25 0d 02 a8 04 0d 02 b2 6a f4 20 2d 2d 2d 2d |e%.......j. ----| 00000c50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000cb0 0d 02 bc 1f f4 20 50 52 4f 43 72 65 61 64 41 6c |..... PROCreadAl| 00000cc0 6c 6f 63 61 74 69 6f 6e 54 61 62 6c 65 28 29 0d |locationTable().| 00000cd0 02 c6 5e f4 20 4f 6e 20 65 78 69 74 3a 20 74 61 |..^. On exit: ta| 00000ce0 62 6c 65 25 20 70 6f 69 6e 74 73 20 74 6f 20 74 |ble% points to t| 00000cf0 68 65 20 74 61 62 6c 65 20 61 6e 20 65 6e 74 72 |he table an entr| 00000d00 69 65 73 25 20 68 6f 6c 64 20 74 68 65 20 6e 75 |ies% hold the nu| 00000d10 6d 62 65 72 20 6f 66 20 65 6e 74 72 69 65 73 20 |mber of entries | 00000d20 69 6e 20 74 68 65 20 74 61 62 6c 65 2e 0d 02 d0 |in the table....| 00000d30 6a f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |j. -------------| 00000d40 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000d90 2d 2d 2d 2d 2d 2d 2d 0d 02 da 04 0d 02 e4 30 dd |-------.......0.| 00000da0 20 f2 72 65 61 64 41 6c 6c 6f 63 61 74 69 6f 6e | .readAllocation| 00000db0 54 61 62 6c 65 28 f8 20 74 61 62 6c 65 25 2c 20 |Table(. table%, | 00000dc0 f8 20 65 6e 74 72 69 65 73 25 29 0d 02 ee 22 20 |. entries%)..." | 00000dd0 20 c8 99 20 22 4f 53 5f 4d 65 6d 6f 72 79 22 2c | .. "OS_Memory",| 00000de0 36 20 b8 20 2c 65 6e 74 72 69 65 73 25 0d 02 f8 |6 . ,entries%...| 00000df0 17 20 20 de 20 74 61 62 6c 65 25 20 65 6e 74 72 |. . table% entr| 00000e00 69 65 73 25 0d 03 02 1d 20 20 c8 99 20 22 4f 53 |ies%.... .. "OS| 00000e10 5f 4d 65 6d 6f 72 79 22 2c 37 2c 74 61 62 6c 65 |_Memory",7,table| 00000e20 25 0d 03 0c 1d 20 20 65 6e 74 72 69 65 73 25 20 |%.... entries% | 00000e30 3d 20 65 6e 74 72 69 65 73 25 20 2a 20 32 0d 03 |= entries% * 2..| 00000e40 16 05 e1 0d 03 20 04 0d 03 2a 6a f4 20 2d 2d 2d |..... ...*j. ---| 00000e50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000eb0 2d 0d 03 34 15 f4 20 46 4e 67 65 74 50 61 67 65 |-..4.. FNgetPage| 00000ec0 49 6e 66 6f 28 29 0d 03 3e 51 f4 20 4f 6e 20 65 |Info()..>Q. On e| 00000ed0 6e 74 72 79 3a 20 74 61 62 6c 65 25 20 70 6f 69 |ntry: table% poi| 00000ee0 6e 74 73 20 74 6f 20 74 68 65 20 74 61 62 6c 65 |nts to the table| 00000ef0 20 72 65 74 75 72 6e 65 64 20 62 79 20 50 52 4f | returned by PRO| 00000f00 43 72 65 61 64 41 6c 6c 6f 63 61 74 69 6f 6e 54 |CreadAllocationT| 00000f10 61 62 6c 65 28 29 2e 0d 03 48 46 f4 20 52 65 74 |able()...HF. Ret| 00000f20 75 72 6e 73 3a 20 74 68 65 20 66 6f 75 72 20 62 |urns: the four b| 00000f30 69 74 73 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 |its of informati| 00000f40 6f 6e 20 66 6f 72 20 74 68 65 20 67 69 76 65 6e |on for the given| 00000f50 20 70 61 67 65 20 6e 75 6d 62 65 72 2e 0d 03 52 | page number...R| 00000f60 6a f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |j. -------------| 00000f70 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000fc0 2d 2d 2d 2d 2d 2d 2d 0d 03 5c 04 0d 03 66 26 dd |-------..\...f&.| 00000fd0 20 a4 67 65 74 50 61 67 65 49 6e 66 6f 28 74 61 | .getPageInfo(ta| 00000fe0 62 6c 65 25 2c 70 61 67 65 4e 75 6d 62 65 72 25 |ble%,pageNumber%| 00000ff0 29 0d 03 70 0a 20 20 ea 20 74 25 0d 03 7a 24 20 |)..p. . t%..z$ | 00001000 20 74 25 20 3d 20 74 61 62 6c 65 25 3f 28 70 61 | t% = table%?(pa| 00001010 67 65 4e 75 6d 62 65 72 25 20 3e 3e 20 31 29 0d |geNumber% >> 1).| 00001020 03 84 2a 20 20 e7 20 ac 20 28 70 61 67 65 4e 75 |..* . . (pageNu| 00001030 6d 62 65 72 25 20 80 20 31 29 20 8c 20 74 25 20 |mber% . 1) . t% | 00001040 3d 20 74 25 20 3e 3e 20 34 0d 03 8e 0d 3d 20 74 |= t% >> 4....= t| 00001050 25 20 80 20 26 46 0d 03 98 04 0d 03 a2 6a f4 20 |% . &F.......j. | 00001060 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000010c0 2d 2d 2d 2d 0d 03 ac 22 f4 20 46 4e 70 68 79 73 |----...". FNphys| 000010d0 69 63 61 6c 54 6f 4c 6f 67 69 63 61 6c 41 64 64 |icalToLogicalAdd| 000010e0 72 65 73 73 28 29 0d 03 b6 50 f4 20 43 6f 6e 76 |ress()...P. Conv| 000010f0 65 72 74 73 20 74 68 65 20 67 69 76 65 6e 20 70 |erts the given p| 00001100 68 79 73 69 63 61 6c 20 61 64 64 72 65 73 73 20 |hysical address | 00001110 69 6e 74 6f 20 61 20 6c 6f 67 69 63 61 6c 20 61 |into a logical a| 00001120 64 64 72 65 73 73 20 61 6e 64 20 72 65 74 75 72 |ddress and retur| 00001130 6e 73 20 69 74 2e 0d 03 c0 6a f4 20 2d 2d 2d 2d |ns it....j. ----| 00001140 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000011a0 0d 03 ca 04 0d 03 d4 2a dd 20 a4 70 68 79 73 69 |.......*. .physi| 000011b0 63 61 6c 54 6f 4c 6f 67 69 63 61 6c 41 64 64 72 |calToLogicalAddr| 000011c0 65 73 73 28 70 68 79 73 69 63 61 6c 25 29 0d 03 |ess(physical%)..| 000011d0 de 0b 20 20 ea 20 70 62 25 0d 03 e8 0e 20 20 de |.. . pb%.... .| 000011e0 20 70 62 25 20 31 32 0d 03 f2 16 20 20 70 62 21 | pb% 12.... pb!| 000011f0 38 20 3d 20 70 68 79 73 69 63 61 6c 25 0d 03 fc |8 = physical%...| 00001200 28 20 20 c8 99 20 22 4f 53 5f 4d 65 6d 6f 72 79 |( .. "OS_Memory| 00001210 22 2c 31 3c 3c 31 30 20 84 20 31 3c 3c 31 32 2c |",1<<10 . 1<<12,| 00001220 70 62 25 2c 31 0d 04 06 0b 3d 20 70 62 25 21 34 |pb%,1....= pb%!4| 00001230 0d 04 10 04 0d 04 1a 6a f4 20 2d 2d 2d 2d 2d 2d |.......j. ------| 00001240 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00001290 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 04 |--------------..| 000012a0 24 22 f4 20 46 4e 6c 6f 67 69 63 61 6c 54 6f 50 |$". FNlogicalToP| 000012b0 68 79 73 69 63 61 6c 41 64 64 72 65 73 73 28 29 |hysicalAddress()| 000012c0 0d 04 2e 50 f4 20 43 6f 6e 76 65 72 74 73 20 74 |...P. Converts t| 000012d0 68 65 20 67 69 76 65 6e 20 6c 6f 67 69 63 61 6c |he given logical| 000012e0 20 61 64 64 72 65 73 73 20 69 6e 74 6f 20 61 20 | address into a | 000012f0 70 68 79 73 69 63 61 6c 20 61 64 64 72 65 73 73 |physical address| 00001300 20 61 6e 64 20 72 65 74 75 72 6e 73 20 69 74 2e | and returns it.| 00001310 0d 04 38 6a f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |..8j. ----------| 00001320 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00001370 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 04 42 04 0d 04 |----------..B...| 00001380 4c 28 dd 20 a4 6c 6f 67 69 63 61 6c 54 6f 50 68 |L(. .logicalToPh| 00001390 79 73 63 61 6c 41 64 64 72 65 73 73 28 6c 6f 67 |yscalAddress(log| 000013a0 69 63 61 6c 25 29 0d 04 56 0b 20 20 ea 20 70 62 |ical%)..V. . pb| 000013b0 25 0d 04 60 0e 20 20 de 20 70 62 25 20 31 32 0d |%..`. . pb% 12.| 000013c0 04 6a 15 20 20 70 62 21 30 20 3d 20 6c 6f 67 69 |.j. pb!0 = logi| 000013d0 63 61 6c 25 0d 04 74 27 20 20 c8 99 20 22 4f 53 |cal%..t' .. "OS| 000013e0 5f 4d 65 6d 6f 72 79 22 2c 31 3c 3c 39 20 84 20 |_Memory",1<<9 . | 000013f0 31 3c 3c 31 33 2c 70 62 25 2c 31 0d 04 7e 0b 3d |1<<13,pb%,1..~.=| 00001400 20 70 62 25 21 38 0d 04 88 04 0d 04 92 6a f4 20 | pb%!8.......j. | 00001410 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00001470 2d 2d 2d 2d 0d 04 9c 25 f4 20 46 4e 70 68 79 73 |----...%. FNphys| 00001480 69 63 61 6c 41 64 64 72 65 73 73 54 6f 50 61 67 |icalAddressToPag| 00001490 65 4e 75 6d 62 65 72 28 29 0d 04 a6 4c f4 20 43 |eNumber()...L. C| 000014a0 6f 6e 76 65 72 74 73 20 74 68 65 20 67 69 76 65 |onverts the give| 000014b0 6e 20 70 68 79 73 69 63 61 6c 20 61 64 64 72 65 |n physical addre| 000014c0 73 73 20 69 6e 74 6f 20 61 20 70 61 67 65 20 6e |ss into a page n| 000014d0 75 6d 62 65 72 20 61 6e 64 20 72 65 74 75 72 6e |umber and return| 000014e0 73 20 69 74 2e 0d 04 b0 6a f4 20 2d 2d 2d 2d 2d |s it....j. -----| 000014f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00001540 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d |---------------.| 00001550 04 ba 04 0d 04 c4 2d dd 20 a4 70 68 79 73 69 63 |......-. .physic| 00001560 61 6c 41 64 64 72 65 73 73 54 6f 50 61 67 65 4e |alAddressToPageN| 00001570 75 6d 62 65 72 28 70 68 79 73 69 63 61 6c 25 29 |umber(physical%)| 00001580 0d 04 ce 0b 20 20 ea 20 70 62 25 0d 04 d8 0e 20 |.... . pb%.... | 00001590 20 de 20 70 62 25 20 31 32 0d 04 e2 16 20 20 70 | . pb% 12.... p| 000015a0 62 21 38 20 3d 20 70 68 79 73 69 63 61 6c 25 0d |b!8 = physical%.| 000015b0 04 ec 28 20 20 c8 99 20 22 4f 53 5f 4d 65 6d 6f |..( .. "OS_Memo| 000015c0 72 79 22 2c 31 3c 3c 31 30 20 84 20 31 3c 3c 31 |ry",1<<10 . 1<<1| 000015d0 31 2c 70 62 25 2c 31 0d 04 f6 0b 3d 20 70 62 25 |1,pb%,1....= pb%| 000015e0 21 30 0d 05 00 04 0d 05 0a 6a f4 20 2d 2d 2d 2d |!0.......j. ----| 000015f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00001650 0d 05 14 1c f4 20 50 52 4f 43 73 65 74 50 61 67 |..... PROCsetPag| 00001660 65 43 61 63 68 65 61 62 6c 65 28 29 0d 05 1e 69 |eCacheable()...i| 00001670 f4 20 4f 6e 20 65 6e 74 72 79 3a 20 61 64 64 72 |. On entry: addr| 00001680 65 73 73 25 20 69 73 20 74 68 65 20 61 64 64 72 |ess% is the addr| 00001690 65 73 73 20 74 6f 20 73 65 74 20 63 61 63 68 65 |ess to set cache| 000016a0 61 62 69 6c 69 74 79 20 66 6f 72 20 61 6e 64 20 |ability for and | 000016b0 63 61 63 68 65 61 62 6c 65 25 20 69 73 20 31 20 |cacheable% is 1 | 000016c0 74 6f 20 73 65 74 20 69 74 20 74 6f 20 63 61 63 |to set it to cac| 000016d0 68 61 62 6c 65 0d 05 28 30 f4 20 20 20 20 20 20 |hable..(0. | 000016e0 20 20 20 20 20 6f 72 20 30 20 74 6f 20 73 65 74 | or 0 to set| 000016f0 20 69 74 20 74 6f 20 6e 6f 6e 2d 63 61 63 68 65 | it to non-cache| 00001700 61 62 6c 65 2e 0d 05 32 6a f4 20 2d 2d 2d 2d 2d |able...2j. -----| 00001710 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00001760 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d |---------------.| 00001770 05 3c 04 0d 05 46 2c dd 20 f2 73 65 74 50 61 67 |.<...F,. .setPag| 00001780 65 43 61 63 68 65 61 62 6c 65 28 61 64 64 72 65 |eCacheable(addre| 00001790 73 73 25 2c 63 61 63 68 65 61 62 6c 65 25 29 0d |ss%,cacheable%).| 000017a0 05 50 0b 20 20 ea 20 70 62 25 0d 05 5a 0e 20 20 |.P. . pb%..Z. | 000017b0 de 20 70 62 25 20 31 32 0d 05 64 15 20 20 70 62 |. pb% 12..d. pb| 000017c0 21 34 20 3d 20 61 64 64 72 65 73 73 25 0d 05 6e |!4 = address%..n| 000017d0 13 20 20 e7 20 63 61 63 68 61 62 6c 65 25 20 8c |. . cachable% .| 000017e0 0d 05 78 29 20 20 20 20 c8 99 20 22 4f 53 5f 4d |..x) .. "OS_M| 000017f0 65 6d 6f 72 79 22 2c 31 3c 3c 39 20 84 20 33 3c |emory",1<<9 . 3<| 00001800 3c 31 34 2c 70 62 25 2c 31 0d 05 82 07 20 20 cc |<14,pb%,1.... .| 00001810 0d 05 8c 29 20 20 20 20 c8 99 20 22 4f 53 5f 4d |...) .. "OS_M| 00001820 65 6d 6f 72 79 22 2c 31 3c 3c 39 20 84 20 32 3c |emory",1<<9 . 2<| 00001830 3c 31 34 2c 70 62 25 2c 31 0d 05 96 07 20 20 cd |<14,pb%,1.... .| 00001840 0d 05 a0 05 e1 0d ff |.......| 00001847