> Patch035  Patch ARMCoPro MOS v0.35 : ( mcode% 128*1024 2"LOAD U033035v0 "+~mcode% <4length%=&2A8: Offset to length to copy to flash F;base%=&72C : Offset to start of data to copy to flash Poldlen%=mcode%!length% Z: d P=0 1 nP%=length%:O%=P%+mcode% x[OPT P*3+4 EQUD newend ] P%=&0124:O%=P%+mcode%+base% [OPT P*3+4 >BL CheckExtension ; R0 contains startup ack. byte > ; Overwrites TEQ R0,#&80 opcode ] P%=&0168:O%=P%+mcode%+base% [OPT P*3+4 3EQUS "M " ; Simple visual clue ] P%=&14A4:O%=P%+mcode%+base% [OPT P*3+4 ALDMIA R13,{R2-R5} ; All OSFILEs return all registers :MOV R0,R12 ; All OSFILEs return result ] "!P%=oldlen%:O%=P%+mcode%+base% ,[OPT P*3+4 6.CheckExtension @LMOV R3,R0:MOV R4,R14 :\ Save Tube response byte and return address JC :\ Needs to return checking for #&80 T ^-\ Check for * pressed and skip everything h-\ --------------------------------------- r4MOV R0,#&7A:SWI "OS_Byte" :\ Check keys pressed |9CMP R1,#&5B:CMPNE R1,#&48 :\ Either '*' key pressed? 2BEQ ReturnCore :\ Abort if pressed : -MOV R2,#&C8000000 :\ Base of ROM :ADD R2,R2,#&20000 :\ Start of expansion space : 5LDRB R0,[R2,#7] ; Get Copyright offset 5ADD R1,R2,R0 ; R1=>copyright string ;LDRB R0,[R1],#1 ; Check for copyright string CMP R0,#0 LDRB R0,[R1],#1 CMPEQ R0,#"(" LDRB R0,[R1],#1 CMPEQ R0,#"C" LDRB R0,[R1],#1 CMPEQ R0,#")" CBNE ReturnCore ; No ROM header, return to core code &2LDRB R0,[R2,#6] ; Get ROM type byte 0 R0,R0,#&4F :3CMP R0,#&4D ; ARM language code? DBBNE ReturnCore ; Not ARM code, return to core code NILDR R0,[R2,#0] ; Get entry address - assumes word aligned XCBIC R0,R0,#&FF000000 ; Drop 6502 JMP opcode from top byte b3ADD R2,R2,R0 ; Add to entry point l?STMFD R13!,{R3,R4} ; Save Tube byte, return address vMOV R12,#&1900 9LDR R1,[R12,#780] ; R1=base of code to enter =MOV R0,R3 ; R0=&80 if code to be entered 4MOV R14,PC:MOV PC,R2 ; Call extension code >LDMFD R13!,{R0,R4} ; Get Tube byte back and return .ReturnCore -MOV R0,R3 ; R0=Tube byte 7\\ TEQ R0,#&80 ; Code to be entered? 'TEQ R0,R0 ; Set EQ 4MOV PC,R4 ; Return to core code  .newend ] 3"SAVE U033035 "+~mcode%+" "+~O%+" 8000 8000"