> CmdROM ) Build a sideways ROM with *commands # BASIC version of Micron+ code (: 2*&87:" Collect *Commands into a ROM"' <9 mcode% &3FFF, ctrl% 31, name% 79:X%=ctrl%:Y%=X%256 F*OSNEWL=&FFE5:OSASCI=&FFE3:OSBYTE=&FFF4 P)zp0=&A8:zp1=zp0+1:zp2=zp0+2:zp3=zp0+3 Z+zp4=zp0+4:zp5=zp0+5:zp6=zp0+6:zp7=zp0+7 d: n"ROM title: "title$ x1"ROM version number: &"A$:version%=("&"+A$) #"ROM version string: "version$ F"ROM copyright string: (C)"copyright$:copyright$="(C)"+copyright$ "ROM help string: "help$ : ROMHeader: 0"Enter filenames, terminated with RETURN": J"Space left: &";~mcode%+&4000-here%;" (";mcode%+&4000-here%;" bytes)" "File: "f$: f$<>"" ROMAdd -f$="" here%>mcode%+&3FFE:here%=here%+1 "Save filename: "f$ Hf$<>"":"Saving";:"Save "+f$+" "+~mcode%+" "+~here%+" 8000 8000"   : ROMHeader P=01:P%=&8000:O%=mcode% "[OPT P*2+4 ,BRK:BRK:BRK 6.L8003:JMP L801C @.L8006:EQUB &82 J .L8007 TEQUB Copyright-&8000 ^EQUB version%:EQUS title$ h#EQUS 0+version$,version$<>"") r.Copyright |!EQUB 0:EQUS copyright$:EQUB 0 :  .L8015 -CLC:BCC L801C :\ Marks entry for *RLIST +EQUW L8149 :\ Pointer to Ǔ string *EQUW L814F :\ Pointer to commands :  .L801C PHA:TYA:PHA TSX:LDA &0102,X CMP #&09:BNE L806C :  \ *Help JSR OSNEWL $LDA L8003+1:CLC:ADC #&03:STA zp2 @LDA L8003+2:ADC #&00:STA zp3:\ (zp2)=>pointer to Help string  LDY #&00:LDA (zp2),Y:STA zp0 &0INY:LDA (zp2),Y:STA zp1:\ (zp0)=>Help string 0 LDY #&00 : .L804D DLDA (zp0),Y:BEQ L8062 NCMP #&23:BNE L8057 X LDA #&0D b .L8057 lJSR OSASCI vINC zp0:BNE L804D INC zp1:BNE L804D  .L8062 JSR OSNEWL :  .L8065 LDX &F4:PLA:TAY:PLA RTS :  .L806C CMP #&04:BNE L8065 : \ *Command  STY zp5 $LDA L8003+1:CLC:ADC #&05:STA zp0  =LDA L8003+2:ADC #&00:STA zp1:\ (zp0)=>pointer to commands  LDY #&00:LDA (zp0),Y:STA zp2  -INY:LDA (zp0),Y:STA zp3:\ (zp2)=>commands * .L8090 4LDA zp2:STA zp0 >LDA zp3:STA zp1 HLDA zp5:STA zp4 R .L809C \LDY #&00:LDA (zp0),Y fBEQ L8065:BMI L80D4 p!LDY zp4:CMP (&F2),Y:BEQ L80B0 z #&20:CMP (&F2),Y:BNE L80BB  .L80B0  INC zp4 INC zp0:BNE L80B8:INC zp1  .L80B8 CLC:BCC L809C :  .L80BB  LDY #&00  .L80BD INC zp0:BNE L80C3:INC zp1  .L80C3 LDA (zp0),Y:BPL L80BD INY:LDA (zp0),Y:STA zp2 INY:LDA (zp0),Y:STA zp3 CLC:BCC L8090 : $ .L80D4 .PHA:LDX #&00 8 .L80D6 BINY:LDA (zp0),Y:STA zp2,X L@INX:CPX #&06:BNE L80D6:\ zp2/3=>next, zp4/5=load, zp6/7=exec VPLA:PHA:CMP #&FE:BNE L80E0 `$LDA #&83:JSR OSBYTE:\ Read OSHWM jSTX zp4:STY zp5 t .L80E0 ~ LDA zp0:CLC:ADC #&07:STA zp0 (LDA zp1:ADC #&00:STA zp1:\ zp0=>data  LDY #&00  .L80EF 'LDA (zp0),Y:STA (zp4),Y:\ Copy data INC zp0:BNE L80F9:INC zp1  .L80F9 INC zp4:BNE L80FF:INC zp5  .L80FF LDA zp2:CMP zp0:BNE L80EF LDA zp3:CMP zp1:BNE L80EF "PLA:CMP #&FE:BEQ L8114:\ BASIC JSR JumpMC  PLA:PLA:LDA #&00:RTS:\ Claim  .JumpMC  JMP (zp6)  ( .L8114 :\ BASIC 2LDA #&8A:LDX #&00 <+LDY #&4F:JSR OSBYTE:LDY #&4C:JSR OSBYTE F+LDY #&44:JSR OSBYTE:LDY #&0D:JSR OSBYTE P+LDY #&52:JSR OSBYTE:LDY #&55:JSR OSBYTE Z+LDY #&4E:JSR OSBYTE:LDY #&0D:JSR OSBYTE d>LDA #&BB:LDX #&00:LDY #&FF:JSR OSBYTE:\ Read BASIC ROM num n%LDA #&8E:JMP OSBYTE:\ Enter BASIC x:  .L8149 EQUS help$:EQUB 0  .L814F \ EQUS !\ EQUB &FF - M/C, &FE - BASIC !\ EQUW
\ EQUW \ EQUW \ Contents of file +\ EQUS or &00 end marker ]::here%=O%: :  ROMAdd f$,1)="*":f$: 4A%=file(f$,5):A%<>1:"File '"f$"' not found": 2X%!10>(mcode%+&4000-here%):"No more space": ""Command name: "name$ ,/"BASIC or M/C? ";:type%="MmBb",):type% 6#$here%=name$:here%=here%+name$ @(?here%=255-(type%-1)2:here%=here%+1 J%!here%=here%+X%!10+6-mcode%+&8000 There%!2=X%!2:here%!4=X%!6 ^here%=here%+6 h"LOAD "+f$+" "+~here% rhere%=here%+X%!10:?here%=0 | : Bݤfile(A$,A%):$name%=A$:?X%=name%:X%?1=name%256:=(&FFDD)&FF