10
20
30 :
40 DIM mcode% 255
50 FOR cpu%=0 TO 15
60 IF INSTR("0123789BD",STR$~cpu%):PROCheader
70 NEXT cpu%
80 END
90
100 DEFPROCheader
110 FOR opt%=4 TO 7 STEP 2
120 P%=&A000:O%=mcode%
130 [OPT opt%:.Start:]
140 :
150 IF cpu%<3 :[OPT opt%:EQUB &4C:EQUW Entry:] :
160 IF cpu%=3 :[OPT opt%:EQUB &7E:EQUW Entry:] :
170 IF cpu%=7 :[OPT opt%:EQUW (Entry-Start-2)/2+256:EQUB 0:]:
180 IF cpu%=8 :[OPT opt%:EQUB &C3:EQUW Entry:] :
190 IF cpu%=9 :[OPT opt%:EQUB &60:EQUW Entry:] :
200 IF cpu%=11:[OPT opt%:EQUB &E9:EQUW Entry:] :
210 IF cpu%=13:[OPT opt%:EQUW (Entry-Start-8)/4:EQUW &EA00:]:
220 :
230 IF cpu%<>13:[OPT opt%:EQUB &60:EQUW 0:]:
240 IF cpu%= 13:[OPT opt%:EQUB &60:EQUB 0:]:
250 :
260 [OPT opt%
270 EQUB &E0+cpu%
280 EQUB Copyright-Start
290 EQUB 0:EQUS "Sample CPU "+STR$~cpu%
300 EQUB 0:EQUS "0.01 (01 Jan 2007)"
310 .Copyright
320 EQUB 0:EQUS "(C)":EQUB 0
330 EQUD Start:]
340 IF cpu%=7 :[OPT opt%:EQUD Entry-Start:]:
350 IF cpu%=9 :[OPT opt%:EQUD Entry-Start:]:
360 IF cpu%=13:[OPT opt%:EQUD End-Entry:] :
370 [OPT opt%
380 EQUS STRING$((4-P%)AND3,CHR$0)
390 .Entry
400 EQUS "code is here"
410 .End
420 ]NEXT opt%
430 OSCLI "SAVE cpu"+STR$~cpu%+"/rom "+STR$~mcode%+" "+STR$~O%+" 0 0"
440 A%=OPENIN("cpu"+STR$~cpu%+"/inf"):IFA%:CLOSE#A%:OSCLI "DELETE cpu"+STR$~cpu%+"/inf"
450 ENDPROC