What are you doing with RISC OS?
Chris Hall (132) 3558 posts |
Update the switcher/task manager so that the info window will display the ROM build date instead of the fixed date it currently displays (Jan 2010) I can help here: why not just get the switcher to display kernel date and CRC. It is a simple matter (provided you can arbitrarily change the last four or so bytes of the ROM image [when it is produced] that is CRC’d) to make the CRC result for the whole ROM including those last few bytes into a defined human-readable result. For example Version: 5.17 (xx-Jan-10) CRC: B1.15.08.11 meaning beta version 1 on 15th August 2011. All that is needed is a bit of boolean algebra! (The CRC result here is &B1150811) |
Jeffrey Lee (213) 6048 posts |
Well if you think it’s easy to do it that way, feel free to try it. Let’s see who gets their chosen implementation working first ;-) |
Chris Hall (132) 3558 posts |
Provided there are six bytes at the end of the ROM image which can be changed to arbitrary values then the necessary six bytes can be calculated in a few minutes using the following programme: 10REM >CRC 20buffer_size%=5000000 30length%=0:max_length%=0:name$="":crc=0:DIM buffer% buffer_size%+10 40DIM code% 2000 50PROCmcode 60!bufferptr=buffer% 70PROCinitpoly 80OSCLI("Load riscos "+STR$~(buffer%)) 90length%=4194304 91REM Desired CRC 92!crcptr=&B1280711 100PRINT "The CRC can be changed to ";~!crcptr;"by altering the last" 110PRINT "six bytes to the ASCII characters given" 120?(buffer%+length%-6)=&20 130?(buffer%+length%-5)=&20 140?(buffer%+length%-4)=&20 150?(buffer%+length%-3)=&20 160?(buffer%+length%-2)=&20 170?(buffer%+length%-1)=&20 180buffer%?length%=0 210crc=FNcrc(length%-6) 220END 230: 240DEFPROCinitpoly 250LOCAL N% 260polynomial=&EDB88320 270FOR N%=0 TO 255 280 crctable!(4*N%)=0 290NEXT N% 300crcsum=polynomial 310bit%=&80 320REPEAT 330 FOR N%=0 TO &FF 340 IF (N% AND bit%) crctable!(4*N%)=crctable!(4*N%) EOR crcsum 350 NEXT N% 360 IF (crcsum AND 1) THEN 370 crcsum=(crcsum>>1)AND&7FFFFFFF 380 crcsum=crcsum EOR polynomial 390 ELSE 400 crcsum=(crcsum>>1)AND&7FFFFFFF 410 ENDIF 420 bit%=(bit%>>1) 430UNTIL bit%=0 440ENDPROC 450 460DEFFNcrc(length%) 470LOCAL crc 480!maxlength=length% 490SYS "Hourglass_On":crc=USR(calccrc):SYS "Hourglass_Off" 500=crc 510 520DEFPROCmcode 530LOCAL N%,P%,sp,link 540sp=13:link=14:spare=8:length=4:maxlen=5:table=9 550FOR N%=0 TO 2 STEP 2 560P%=code% 570[ OPT N% 580.calccrc 590 STMFD (sp)!,{link} 600 MOV length,#0 610 ADR R12,crcseed 620 LDR R12,[R12] ; R12 contains seed 630 ADR R11,crcptr 640 LDR R11,[R11] ; R11 contains desired CRC 650 ADR R6,bufferptr 660 LDR R6,[R6] ; R6 points to data 670 ADR maxlen,maxlength 680 LDR maxlen,[maxlen] ; R5 is max length 690 ADR table,crctable 700 .loop 710 LDRB R0,[R6] 720 ADD R6,R6,#1 730 ADD length,length,#1 740 CMP length,maxlen 750 BGT exit 760 AND R8,R12,#&FF 770 EOR R8,R0,R8 780 LDR R8,[table,R8, LSL #2] 790 EOR R12,R8,R12,LSR #8 800 B loop 810.exit 820 ; CRC now done for all but last 6 bytes 830 ; store R12 and R6 840 ADR R8,bufferptr 850 STR R6,[R8] 860 ADR R8,maxlength 870 STR R12,[R8] 880 .rep 890 ADR R8,bufferptr 900 LDR R6,[R8] ; restore prt -> end-6 910 ADR R8,maxlength 920 LDR R12,[R8] ; restore CRC at end-6 930 LDRB R0,[R6] 940 ADD R6,R6,#1 950 AND R8,R12,#&FF 960 EOR R8,R0,R8 970 LDR R8,[table,R8, LSL #2] 980 EOR R12,R8,R12,LSR #8 990 LDRB R0,[R6] 1000 ADD R6,R6,#1 1010 AND R8,R12,#&FF 1020 EOR R8,R0,R8 1030 LDR R8,[table,R8, LSL #2] 1040 EOR R12,R8,R12,LSR #8 1050 LDRB R0,[R6] 1060 ADD R6,R6,#1 1070 AND R8,R12,#&FF 1080 EOR R8,R0,R8 1090 LDR R8,[table,R8, LSL #2] 1100 EOR R12,R8,R12,LSR #8 1110 LDRB R0,[R6] 1120 ADD R6,R6,#1 1130 AND R8,R12,#&FF 1140 EOR R8,R0,R8 1150 LDR R8,[table,R8, LSL #2] 1160 EOR R12,R8,R12,LSR #8 1170 LDRB R0,[R6] 1180 ADD R6,R6,#1 1190 AND R8,R12,#&FF 1200 EOR R8,R0,R8 1210 LDR R8,[table,R8, LSL #2] 1220 EOR R12,R8,R12,LSR #8 1230 LDRB R0,[R6] 1240 ADD R6,R6,#1 1250 AND R8,R12,#&FF 1260 EOR R8,R0,R8 1270 LDR R8,[table,R8, LSL #2] 1280 EOR R12,R8,R12,LSR #8 1290 ; R12 is crc 1300 ADR R8,crcptr 1310 LDR R8,[R8] 1320 CMP R8,R12 1330 BNE step 1340 ADR R0,bufferptr 1350 LDR R0,[R0] ; restore prt -> end-6 1360 SWI "OS_Write0" 1370 MOV R0,#&3A 1380 SWI "OS_WriteC" 1390 ; now output R12 1400 MOV R0,R12,LSR #28 1410 AND R0,R0,#&0F 1420 ORR R0,R0,#&30 1430 CMP R0,#&39 1440 ADDGT R0,R0,#7 1450 SWI "OS_WriteC" 1460 MOV R0,R12,LSR #24 1470 AND R0,R0,#&0F 1480 ORR R0,R0,#&30 1490 CMP R0,#&39 1500 ADDGT R0,R0,#7 1510 SWI "OS_WriteC" 1520 MOV R0,R12,LSR #20 1530 AND R0,R0,#&0F 1540 ORR R0,R0,#&30 1550 CMP R0,#&39 1560 ADDGT R0,R0,#7 1570 SWI "OS_WriteC" 1580 MOV R0,R12,LSR #16 1590 AND R0,R0,#&0F 1600 ORR R0,R0,#&30 1610 CMP R0,#&39 1620 ADDGT R0,R0,#7 1630 SWI "OS_WriteC" 1640 MOV R0,R12,LSR #12 1650 AND R0,R0,#&0F 1660 ORR R0,R0,#&30 1670 CMP R0,#&39 1680 ADDGT R0,R0,#7 1690 SWI "OS_WriteC" 1700 MOV R0,R12,LSR #8 1710 AND R0,R0,#&0F 1720 ORR R0,R0,#&30 1730 CMP R0,#&39 1740 ADDGT R0,R0,#7 1750 SWI "OS_WriteC" 1760 MOV R0,R12,LSR #4 1770 AND R0,R0,#&0F 1780 ORR R0,R0,#&30 1790 CMP R0,#&39 1800 ADDGT R0,R0,#7 1810 SWI "OS_WriteC" 1820 MOV R0,R12 1830 AND R0,R0,#&0F 1840 ORR R0,R0,#&30 1850 CMP R0,#&39 1860 ADDGT R0,R0,#7 1870 SWI "OS_WriteC" 1880 MOV R0,#13 1890 SWI "OS_WriteC" 1900 MOV R0,#10 1910 SWI "OS_WriteC" 1920 MOV R0,R12 ;put CRC into R0 <- end-6 > Z99999 1930 LDMFD (sp)!,{PC} 1940 1950 .step 1960 ADR R0,bufferptr 1970 LDR R6,[R0] ; restore prt -> end-6 1980 LDRB R0,[R6] ;get end-6 1990 ADD R0,R0,#1 2000 STRB R0,[R6] 2010 CMP R0,#&7E 2020 BLT rep 2030 MOV R0,#&20 2040 STRB R0,[R6] 2050 ADD R6,R6,#1 2060 LDRB R0,[R6] ;get end-5 2070 ADD R0,R0,#1 2080 STRB R0,[R6] 2090 CMP R0,#&7E 2100 BLT rep 2110 MOV R0,#&20 2120 STRB R0,[R6] 2130 ADD R6,R6,#1 2140 LDRB R0,[R6] ;get end-4 2150 ADD R0,R0,#1 2160 STRB R0,[R6] 2170 CMP R0,#&7E 2180 BLT rep 2190 MOV R0,#&20 2200 STRB R0,[R6] 2210 ADD R6,R6,#1 2220 LDRB R0,[R6] ;get end-3 2230 ADD R0,R0,#1 2240 STRB R0,[R6] 2250 CMP R0,#&7E 2260 BLT rep 2270 MOV R0,#&20 2280 STRB R0,[R6] 2290 ADD R6,R6,#1 2300 LDRB R0,[R6] ;get end-2 2310 ADD R0,R0,#1 2320 STRB R0,[R6] 2330 ; for progress print 2340 B cont 2350 MOV R0,#&3A 2360 SWI "OS_WriteC" 2370 ADR R0,bufferptr 2380 LDR R0,[R0] ; restore prt -> end-6 2390 SWI "OS_Write0" 2400 MOV R0,#&3A 2410 SWI "OS_WriteC" 2420 ADR R0,bufferptr 2430 LDR R6,[R0] ; restore prt -> end-6 2440 ADD R6,R6,#4 2450 ; continue 2460 .cont 2470 LDRB R0,[R6] 2480 CMP R0,#&7E 2490 BLT rep 2500 MOV R0,#&20 2510 STRB R0,[R6] 2520 ADD R6,R6,#1 2530 LDRB R0,[R6] ;get end-1 2540 ADD R0,R0,#1 2550 STRB R0,[R6] 2560 CMP R0,#&7E 2570 BLT rep 2580 MOV R0,R12 ;put CRC into R0 <- end-6 > Z99999 2590 LDMFD (sp)!,{PC} 2600 ALIGN 2610.crcseed 2620 EQUD &FFFFFFFF 2630 ALIGN 2640.filename 2650 EQUS STRING$(255," ") 2660 ALIGN 2670.maxlength 2680 EQUD 0 2690 ALIGN 2700.crcptr 2710 EQUD 0 2720 ALIGN 2730.bufferptr 2740 EQUD 0 2750 ALIGN 2760.crctable 2770] 2780NEXT N% 2790ENDPROC 2800: >RUN The CRC can be changed to B1280711by altering the last six bytes to the ASCII characters given .g"U7 :B1280711 > The following code calculates the CRC of the ROM image in the necessary format for display in the switcher: >LIST 10REM >CRC 20buffer_size%=5000000 30length%=0:max_length%=0:name$="":crc=0:DIM buffer% buffer_size%+10 40DIM code% 2000 50PROCmcode 60!bufferptr=buffer% 70PROCinitpoly 80OSCLI("Load riscos "+STR$~(buffer%)) 90length%=4194304 210crc=FNcrc(length%) 220PRINT "CRC is ";STR$~((crc>>24)AND &FF);".";STR$~((crc>>16) AND &FF);".";STR$~((crc>>8) AND &FF);".";STR$~(crc AND &FF) 221END 230: 240DEFPROCinitpoly 250LOCAL N% 260polynomial=&EDB88320 270FOR N%=0 TO 255 280 crctable!(4*N%)=0 290NEXT N% 300crcsum=polynomial 310bit%=&80 320REPEAT 330 FOR N%=0 TO &FF 340 IF (N% AND bit%) crctable!(4*N%)=crctable!(4*N%) EOR crcsum 350 NEXT N% 360 IF (crcsum AND 1) THEN 370 crcsum=(crcsum>>1)AND&7FFFFFFF 380 crcsum=crcsum EOR polynomial 390 ELSE 400 crcsum=(crcsum>>1)AND&7FFFFFFF 410 ENDIF 420 bit%=(bit%>>1) 430UNTIL bit%=0 440ENDPROC 450 460DEFFNcrc(length%) 470LOCAL crc 480!maxlength=length% 490SYS "Hourglass_On":crc=USR(calccrc):SYS "Hourglass_Off" 500=crc 510 520DEFPROCmcode 530LOCAL N%,P%,sp,link 540sp=13:link=14:spare=8:length=4:maxlen=5:table=9 550FOR N%=0 TO 2 STEP 2 560P%=code% 570[ OPT N% 580.calccrc 590 STMFD (sp)!,{link} 600 MOV length,#0 610 ADR R12,crcseed 620 LDR R12,[R12] ; R12 contains seed 650 ADR R6,bufferptr 660 LDR R6,[R6] ; R6 points to data 670 ADR maxlen,maxlength 680 LDR maxlen,[maxlen] ; R5 is max length 690 ADR table,crctable 700 .loop 710 LDRB R0,[R6] 720 ADD R6,R6,#1 730 ADD length,length,#1 740 CMP length,maxlen 750 BGT exit 760 AND R8,R12,#&FF 770 EOR R8,R0,R8 780 LDR R8,[table,R8, LSL #2] 790 EOR R12,R8,R12,LSR #8 800 B loop 810.exit 1920 MOV R0,R12 ;put CRC into R0 <- end-6 > Z99999 1930 LDMFD (sp)!,{PC} 2600 ALIGN 2610.crcseed 2620 EQUD &FFFFFFFF 2630 ALIGN 2640.filename 2650 EQUS STRING$(255," ") 2660 ALIGN 2670.maxlength 2680 EQUD 0 2690 ALIGN 2700.crcptr 2710 EQUD 0 2720 ALIGN 2730.bufferptr 2740 EQUD 0 2750 ALIGN 2760.crctable 2770] 2780NEXT N% 2790ENDPROC 2800: >RUN CRC is BA.56.10.8A But the actual CRC would probably be stored in the last word at the end of the ROM (so that it doesn’t need to be calculated each time and so that the CRC of the ROM up to and excluding the last word can be checked with the value in the last word to ensure it is not corrupted. I notice that the last few bytes of the ROM image are non-zero but I don’t know how they are currently chosen. Once the switcher shows the CRC of the ROM image then for quick-hack test images there is no need to force the CRC into a useful value. Keep that for ROM images that are to be put up for download. |
Jeffrey Lee (213) 6048 posts |
I wasn’t expecting you to actually take me up on that offer!
Adding a few minutes to the build time isn’t very useful for people like me who sometimes do over 30 ROM builds a day :-(
Have a look at the makerom_finish function. At the end of the ROM image there’s the POST word (not sure what that’s for – probably hasn’t been used for 20 years), the “ROM signature” (was used to differentiate between NCOS & other ROMs, but is currently unused), a 16 bit checksum, and a 64 bit checksum. And it updates the CRCs while writing them out, and it seems to write out the 64 bit CRC in some funny manner. |
Chris Hall (132) 3558 posts |
Let’s keep it simple. The ROM signature, if genuinely unused, is the obvious place to put a ‘sub’ version number/date. Example ‘B1.27.07.11’ meaning beta 1 27 July 2011. The switcher can then just display the version number, kernel date and ROM signature. The constant signature just needs to be set to the correct value (automatically to the current date of build for example) and the switcher just to display it. However I don’t programme in c/c++, never tried it and I just use BASIC so you’ll definitely win the race! Even numbered releases can have a signature of ‘FFFFFFFF’ as at present as there’ll only be one version of them. Or just make the switcher use the ROM build date :) A 64-bit CRC is not easy to generate – processing time to guess the right tweaks for a particular 32 bit CRC result is feasible. Not 64. |
Sprow (202) 1158 posts |
I think it’s used when considering extension ROMs (see Podule manager).
Last desktop machine using that would be Risc PC and 7500 derivatives, some 7500 based set top boxes too. |
Chris Hall (132) 3558 posts |
During development of a release candidate for an even numbered build then the date of the Utility Module keeps getting adjusted (even if the module itself is unchanged) until a candidate is finally released when it becomes the release date. Why not just do the same for odd numbered builds? Then the switcher will display version 5.17 and the build date (rather than the date of the last even-numbered kernel). |
Dave Higton (281) 668 posts |
That’s the very simple solution that I’d appreciate. |
Ben Avison (25) 445 posts |
For the uninitiated, POST stands for Power On Self Test. This was the stuff which turned the screen red and cyan during bootup during various phases of early bootup, and flashes the floppy disc LED with a magic code in case of hardware failure, to aid in diagnostics. Sources in RiscOS/Sources/Kernel/Test. For understandable reasons, nobody has put the effort into rewriting this for anything beyond IOMD/VIDC machines. I think Acorn didn’t even have it working in RISC OS 3.70 due to StrongARM compatibility issues (but IIRC it was reinstated for 3.71). Not sure if it’s been used since. |
Trevor Johnson (329) 1645 posts |
POST at Wikipedia: RISC OS to do! |
WPB (1391) 352 posts |
@nemo, now you are back on the scene, is there any chance of you releasing VectorExtend? Your BASIC enhancements would be really great to see, too. Thanks! |
Rick Murray (539) 13850 posts |
Thought I’d re-invigorate this thread to prompt others to provide some updates… Not doing work to RISC OS itself, but some support stuff outside of the OS; for example Harinezumi to help to diagnose early boot problems; and a compatible build of DeskLib. |
nemo (145) 2552 posts |
There is a theory that the closer on a keyboard an aberrant letter is to the correct letter, the more socially acceptable the typo is. In which case, I’m fetching my fiddle… and some matches. |
Dave Higton (1515) 3534 posts |
I like to address business letters to Deaf Sod. |
Bruce Smith (1838) 31 posts |
We’ll I’m re-learning RISC OS if that is an answer appropriate to this thread? But here it is anyway. After too many years, the Raspberry Pi got be back in front of it and has stimulated the writing juices – for good or bad. So decided I would take some of the time on my hands and write a few books. These are mainly related to the RPi at the moment, but I hope will gravitate into more general RISC OS style books. |
Chris Evans (457) 1614 posts |
Bruce: I believe it bis one and the same. |
Chris Johnson (125) 825 posts |
It comes in the Tools directory of the Norcroft/ROOL C/C++ compiler package, or at least it did the last time I upgraded, which is probably a couple of years or more ago. I have never seen any announcement of newer version. |
Rick Murray (539) 13850 posts |
It still comes with the DDE. Not looked, but I have the PDF manual in the docs directory. Still, I’d take it on. Not sure if I’m smart enough to bring it up to date and such, but I’d be willing to give it a shot. ROOL has my email address and developer number, if the current owners of ABC are open to the idea, get in touch. Please excuse brevity and typos, writing this on an Xperia U screen while slugging down tea at break time. Now gotta get changed and go back, ho hum (or “oh ’iss” in French ;-) ). |
Bruce Smith (1838) 31 posts |
@Chris / @Chris / @Rick |
Bryan Hogan (339) 593 posts |
http://www.rougol.jellybaby.net/meetings/2012/PaulFellows/index.html Completely gratuitous ROUGOL link, because it was such a good talk! :-) |
Bruce Smith (1838) 31 posts |
@ABC Just heard back from Paul Fellows and we are just looking into a few copyright issues. More shortly. @Bryan – Great link, very interesting! |
Trevor Johnson (329) 1645 posts |
That implies the code is available :-) |
Bruce Smith (1838) 31 posts |
If Paul can get the copyright back – it will be. Currently with Castle as I understand it. |
Steve Pampling (1551) 8172 posts |
That would suggest that the source could be opened but Castle haven’t done that as there is a partial element with the author (Paul). Perhaps a conversation with Castle/ROOL would have it available in the open repository. |
Bruce Smith (1838) 31 posts |
I believe that’s what Paul is planning. |