REM > listphysmem : REM This program displays the addresses of the different areas and REM types of physical memory under RISC OS. It lists the physical REM address of each block it finds and the number of pages in that REM block. REM This program only works on RISC OS 3.5 and later. REM It will give rubbish results under RISC OS 4.03 unless memfix REM has been installed. : DIM drama%(1000),dramp%(1000),vrama%(1000),vramp%(1000),roma%(1000),romp%(1000),ioa%(1000),iop%(1000) D%=0 :REM Number of blocks of dynamic RAM V%=0 :REM Number of blocks of video RAM R%=0 :REM Number of blocks of ROM I%=0 :REM Number of blocks of I/O space cur%=-1 addr%=0 count%=0 pageno%=0 SYS"OS_Memory",6 TO ,size%,page% PRINT"Memory table size = ";size%;" Page size = ";page% DIM block% size%+100 SYS"OS_Memory",7,block% FOR P%=0 TO size%-1 B%=block%?P% PROCidentify(B%) PROCidentify(B%>>4) NEXT IF D%=0 THEN PRINT"No dynamic RAM found" ELSE PRINT D%;" blocks of DRAM found" IF V%=0 THEN PRINT"No VRAM found" ELSE PRINT V%;" block of VRAM found" PRINT I%;" blocks of ROM found" IF D%=0 THEN STOP PRINT'"Dynamic RAM:" C%=0 FOR N%=0 TO D%-1 PRINT FNhex(drama%(N%), 8);" ";dramp%(N%);" pages" C%+=dramp%(N%) NEXT PRINT;C%;" pages found"' IF V%=0 THEN PRINT"No video RAM found" ELSE PRINT"Video RAM:" C%=0 FOR N%=0 TO V%-1 PRINT FNhex(vrama%(N%), 8);" ";vramp%(N%);" pages" C%+=vramp%(N%) NEXT PRINT;C%;" pages found"''"ROM:" ENDIF C%=0 FOR N%=0 TO R%-1 PRINT FNhex(roma%(N%), 8);" ";romp%(N%);" pages" C%+=romp%(N%) NEXT PRINT;C%;" pages found"''"IO Space:" C%=0 FOR N%=0 TO I%-1 PRINT FNhex(ioa%(N%), 8);" ";iop%(N%);" pages" C%+=iop%(N%) NEXT PRINT;C%;" pages found" END : DEF PROCidentify(X%) X%=X% AND 7 IF X%>4 THEN PRINT"Odd memory type ";X%;" at ";pageno%: STOP IF X%<>cur% THEN CASE cur% OF WHEN 1: drama%(D%)=addr%*4096 dramp%(D%)=count% D%+=1 WHEN 2: vrama%(V%)=addr%*4096 vramp%(V%)=count% V%+=1 WHEN 3: roma%(R%)=addr%*4096 romp%(R%)=count% R%+=1 WHEN 4: ioa%(I%)=addr%*4096 iop%(I%)=count% I%+=1 ENDCASE cur%=X% addr%=pageno% count%=0 ENDIF count%+=1 pageno%+=1 ENDPROC : DEF FNhex(X%,W%)=RIGHT$(" "+STR$~X%,W%)