Home » Archimedes archive » Archimedes World » archimedes_world_volume_16_issue_1_scp.adf » !ARMwrest_ARM » Examples

Examples

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: Examples
Read OK:
File size: 0488 bytes
Load address: 0000
Exec address: 0000
File contents
   10LIBRARY "MemLib"
   20
   30REM Read how much of each type of memory is connected to the computer
   40
   50PRINT "There are ";FNreadRAMSize;" bytes of RAM connected to this computer."
   60PRINT "There are ";FNreadVRAMSize;" bytes of VRAM connected to this computer."
   70PRINT "There are ";FNreadROMSize;" bytes of ROM connected to this computer."
   80
   90REM Read the allocation table and print out info for each page
  100
  110tab% = 0
  120entries% = 0
  130PROCreadAllocationTable(tab%,entries%)
  140
  150PRINT "There are a total of ";entries%;" pages."
  160
  170FOR i% = 0 TO entries%-1
  180  PROCdecodePageInfo(i%,FNgetPageInfo(tab%,i%))
  190NEXT
  200
  210END
  220
  230DEF PROCdecodePageInfo(pageNum%,info%)
  240
  250  LOCAL type$,available$
  260  
  270  CASE info% AND 7 OF
  280  
  290    WHEN 0 : type$ = "not present"
  300    
  310    WHEN 1 : type$ = "RAM"
  320    
  330    WHEN 2 : type$ = "VRAM"
  340    
  350    WHEN 3 : type$ = "ROM"
  360    
  370    WHEN 4 : type$ = "I/O space"
  380    
  390    OTHERWISE : type$ = "undefined"
  400
  410  ENDCASE
  420  
  430  IF (info% AND 8) = 8 THEN
  440    available$ = "not available for allocation"
  450  ELSE
  460    available$ = "available for allocation"
  470  ENDIF
  480  
  490  PRINT "Page ";pageNum%;" is ";type$;" and is ";available$;"."
  500  
  510ENDPROC

ț "MemLib"

G� Read how much of each type of memory is connected to the computer
(
2K� "There are ";�readRAMSize;" bytes of RAM connected to this computer."
<M� "There are ";�readVRAMSize;" bytes of VRAM connected to this computer."
FK� "There are ";�readROMSize;" bytes of ROM connected to this computer."
P
Z@� Read the allocation table and print out info for each page
d
ntab% = 0
xentries% = 0
�'�readAllocationTable(tab%,entries%)
�
�0� "There are a total of ";entries%;" pages."
�
�� i% = 0 � entries%-1
�/  �decodePageInfo(i%,�getPageInfo(tab%,i%))
��
�
��
�
�%� �decodePageInfo(pageNum%,info%)
�
�  � type$,available$
  
  Ȏ info% � 7 �
  
"#    � 0 : type$ = "not present"
,    
6    � 1 : type$ = "RAM"
@    
J    � 2 : type$ = "VRAM"
T    
^    � 3 : type$ = "ROM"
h    
r!    � 4 : type$ = "I/O space"
|    
�     : type$ = "undefined"
�
�  �
�  
�  � (info% � 8) = 8 �
�3    available$ = "not available for allocation"
�  �
�/    available$ = "available for allocation"
�  �
�  
�?  � "Page ";pageNum%;" is ";type$;" and is ";available$;"."
�  
��
�
00000000  0d 00 0a 0f c8 9b 20 22  4d 65 6d 4c 69 62 22 0d  |...... "MemLib".|
00000010  00 14 04 0d 00 1e 47 f4  20 52 65 61 64 20 68 6f  |......G. Read ho|
00000020  77 20 6d 75 63 68 20 6f  66 20 65 61 63 68 20 74  |w much of each t|
00000030  79 70 65 20 6f 66 20 6d  65 6d 6f 72 79 20 69 73  |ype of memory is|
00000040  20 63 6f 6e 6e 65 63 74  65 64 20 74 6f 20 74 68  | connected to th|
00000050  65 20 63 6f 6d 70 75 74  65 72 0d 00 28 04 0d 00  |e computer..(...|
00000060  32 4b f1 20 22 54 68 65  72 65 20 61 72 65 20 22  |2K. "There are "|
00000070  3b a4 72 65 61 64 52 41  4d 53 69 7a 65 3b 22 20  |;.readRAMSize;" |
00000080  62 79 74 65 73 20 6f 66  20 52 41 4d 20 63 6f 6e  |bytes of RAM con|
00000090  6e 65 63 74 65 64 20 74  6f 20 74 68 69 73 20 63  |nected to this c|
000000a0  6f 6d 70 75 74 65 72 2e  22 0d 00 3c 4d f1 20 22  |omputer."..<M. "|
000000b0  54 68 65 72 65 20 61 72  65 20 22 3b a4 72 65 61  |There are ";.rea|
000000c0  64 56 52 41 4d 53 69 7a  65 3b 22 20 62 79 74 65  |dVRAMSize;" byte|
000000d0  73 20 6f 66 20 56 52 41  4d 20 63 6f 6e 6e 65 63  |s of VRAM connec|
000000e0  74 65 64 20 74 6f 20 74  68 69 73 20 63 6f 6d 70  |ted to this comp|
000000f0  75 74 65 72 2e 22 0d 00  46 4b f1 20 22 54 68 65  |uter."..FK. "The|
00000100  72 65 20 61 72 65 20 22  3b a4 72 65 61 64 52 4f  |re are ";.readRO|
00000110  4d 53 69 7a 65 3b 22 20  62 79 74 65 73 20 6f 66  |MSize;" bytes of|
00000120  20 52 4f 4d 20 63 6f 6e  6e 65 63 74 65 64 20 74  | ROM connected t|
00000130  6f 20 74 68 69 73 20 63  6f 6d 70 75 74 65 72 2e  |o this computer.|
00000140  22 0d 00 50 04 0d 00 5a  40 f4 20 52 65 61 64 20  |"..P...Z@. Read |
00000150  74 68 65 20 61 6c 6c 6f  63 61 74 69 6f 6e 20 74  |the allocation t|
00000160  61 62 6c 65 20 61 6e 64  20 70 72 69 6e 74 20 6f  |able and print o|
00000170  75 74 20 69 6e 66 6f 20  66 6f 72 20 65 61 63 68  |ut info for each|
00000180  20 70 61 67 65 0d 00 64  04 0d 00 6e 0c 74 61 62  | page..d...n.tab|
00000190  25 20 3d 20 30 0d 00 78  10 65 6e 74 72 69 65 73  |% = 0..x.entries|
000001a0  25 20 3d 20 30 0d 00 82  27 f2 72 65 61 64 41 6c  |% = 0...'.readAl|
000001b0  6c 6f 63 61 74 69 6f 6e  54 61 62 6c 65 28 74 61  |locationTable(ta|
000001c0  62 25 2c 65 6e 74 72 69  65 73 25 29 0d 00 8c 04  |b%,entries%)....|
000001d0  0d 00 96 30 f1 20 22 54  68 65 72 65 20 61 72 65  |...0. "There are|
000001e0  20 61 20 74 6f 74 61 6c  20 6f 66 20 22 3b 65 6e  | a total of ";en|
000001f0  74 72 69 65 73 25 3b 22  20 70 61 67 65 73 2e 22  |tries%;" pages."|
00000200  0d 00 a0 04 0d 00 aa 19  e3 20 69 25 20 3d 20 30  |......... i% = 0|
00000210  20 b8 20 65 6e 74 72 69  65 73 25 2d 31 0d 00 b4  | . entries%-1...|
00000220  2f 20 20 f2 64 65 63 6f  64 65 50 61 67 65 49 6e  |/  .decodePageIn|
00000230  66 6f 28 69 25 2c a4 67  65 74 50 61 67 65 49 6e  |fo(i%,.getPageIn|
00000240  66 6f 28 74 61 62 25 2c  69 25 29 29 0d 00 be 05  |fo(tab%,i%))....|
00000250  ed 0d 00 c8 04 0d 00 d2  05 e0 0d 00 dc 04 0d 00  |................|
00000260  e6 25 dd 20 f2 64 65 63  6f 64 65 50 61 67 65 49  |.%. .decodePageI|
00000270  6e 66 6f 28 70 61 67 65  4e 75 6d 25 2c 69 6e 66  |nfo(pageNum%,inf|
00000280  6f 25 29 0d 00 f0 04 0d  00 fa 18 20 20 ea 20 74  |o%)........  . t|
00000290  79 70 65 24 2c 61 76 61  69 6c 61 62 6c 65 24 0d  |ype$,available$.|
000002a0  01 04 06 20 20 0d 01 0e  14 20 20 c8 8e 20 69 6e  |...  ....  .. in|
000002b0  66 6f 25 20 80 20 37 20  ca 0d 01 18 06 20 20 0d  |fo% . 7 .....  .|
000002c0  01 22 23 20 20 20 20 c9  20 30 20 3a 20 74 79 70  |."#    . 0 : typ|
000002d0  65 24 20 3d 20 22 6e 6f  74 20 70 72 65 73 65 6e  |e$ = "not presen|
000002e0  74 22 0d 01 2c 08 20 20  20 20 0d 01 36 1b 20 20  |t"..,.    ..6.  |
000002f0  20 20 c9 20 31 20 3a 20  74 79 70 65 24 20 3d 20  |  . 1 : type$ = |
00000300  22 52 41 4d 22 0d 01 40  08 20 20 20 20 0d 01 4a  |"RAM"..@.    ..J|
00000310  1c 20 20 20 20 c9 20 32  20 3a 20 74 79 70 65 24  |.    . 2 : type$|
00000320  20 3d 20 22 56 52 41 4d  22 0d 01 54 08 20 20 20  | = "VRAM"..T.   |
00000330  20 0d 01 5e 1b 20 20 20  20 c9 20 33 20 3a 20 74  | ..^.    . 3 : t|
00000340  79 70 65 24 20 3d 20 22  52 4f 4d 22 0d 01 68 08  |ype$ = "ROM"..h.|
00000350  20 20 20 20 0d 01 72 21  20 20 20 20 c9 20 34 20  |    ..r!    . 4 |
00000360  3a 20 74 79 70 65 24 20  3d 20 22 49 2f 4f 20 73  |: type$ = "I/O s|
00000370  70 61 63 65 22 0d 01 7c  08 20 20 20 20 0d 01 86  |pace"..|.    ...|
00000380  1f 20 20 20 20 7f 20 3a  20 74 79 70 65 24 20 3d  |.    . : type$ =|
00000390  20 22 75 6e 64 65 66 69  6e 65 64 22 0d 01 90 04  | "undefined"....|
000003a0  0d 01 9a 07 20 20 cb 0d  01 a4 06 20 20 0d 01 ae  |....  .....  ...|
000003b0  19 20 20 e7 20 28 69 6e  66 6f 25 20 80 20 38 29  |.  . (info% . 8)|
000003c0  20 3d 20 38 20 8c 0d 01  b8 33 20 20 20 20 61 76  | = 8 ....3    av|
000003d0  61 69 6c 61 62 6c 65 24  20 3d 20 22 6e 6f 74 20  |ailable$ = "not |
000003e0  61 76 61 69 6c 61 62 6c  65 20 66 6f 72 20 61 6c  |available for al|
000003f0  6c 6f 63 61 74 69 6f 6e  22 0d 01 c2 07 20 20 cc  |location"....  .|
00000400  0d 01 cc 2f 20 20 20 20  61 76 61 69 6c 61 62 6c  |.../    availabl|
00000410  65 24 20 3d 20 22 61 76  61 69 6c 61 62 6c 65 20  |e$ = "available |
00000420  66 6f 72 20 61 6c 6c 6f  63 61 74 69 6f 6e 22 0d  |for allocation".|
00000430  01 d6 07 20 20 cd 0d 01  e0 06 20 20 0d 01 ea 3f  |...  .....  ...?|
00000440  20 20 f1 20 22 50 61 67  65 20 22 3b 70 61 67 65  |  . "Page ";page|
00000450  4e 75 6d 25 3b 22 20 69  73 20 22 3b 74 79 70 65  |Num%;" is ";type|
00000460  24 3b 22 20 61 6e 64 20  69 73 20 22 3b 61 76 61  |$;" and is ";ava|
00000470  69 6c 61 62 6c 65 24 3b  22 2e 22 0d 01 f4 06 20  |ilable$;".".... |
00000480  20 0d 01 fe 05 e1 0d ff                           | .......|
00000488