> NEWMOS02/S % Source for Extended BBC MOS ROM )oscli=&FFF7:OSWORD=&FFF1:OSBYTE=&FFF4 (*OSWRCH=&FFEE:OSNEWL=&FFE4:OSASCI=&FFE3 2nvwrch=&FFCB: mcode% &1000 < P=0 1 FO%=mcode%:P%=&8000 P[OPT P*3+4 Z JMP lang d JMP serv n EQUB &C2 xEQUB copy-&8000 EQUB &02:\ Version 8EQUS "Extra Utilities":BRK:EQUS "1.02 (20 Jan 1989)" .copy &BRK:EQUS "(C)1988 J.G.Harston":BRK %\ Language part .lang LDX #&FF:TXS:CLD:CLI #LDA #err_handler 255:STA &202 #LDA #err_handler 256:STA &203 .lang_loop LDA #"*":JSR OSWRCH LDA #0:LDX #buff 255 LDY #(buff) 256 JSR OSWORD:BCS escape LDX #0:LDY #7:JSR oscli JMP lang_loop " .escape ,LDA #124:JSR OSBYTE 6!BRK:EQUB 17:EQUS "Escape":BRK @ .buff J EQUW &700 TEQUB 255:EQUB 32:EQUB 255 ^.err_handler h&LDX &F4:LDA #252:LDY #0:JSR OSBYTE rJSR OSNEWL:JSR report |JMP lang_loop  .report  LDY #1  .errloop LDA (&FD),Y:BEQ err2 JSR OSWRCH:INY:JMP errloop  .err2 JMP OSNEWL $\ Service part +.serv7:PHA:LDA &EF:CMP #90:BNE serv7try BLDA &F0:BEQ serv7info:CMP #2:BNE disabled:\ Recognises *FX90,2 0LDA &DF0,X:A #128:STA &DF0,X:PLA:LDA #0:RTS ".serv7try:CMP #89:BNE disabled %LDA &F0:JSR pr_hex:PLA:LDA #0:RTS $.serv7info:LDA &F1:BEQ serv7help CMP #1:BNE disabled +JSR pr_text:EQUS "2: ":BRK:JSR pr_title &JMP disabled 0/.serv7help:LDA #90:LDX #0:LDY #1:JSR OSBYTE :PLA:LDA #0:RTS D .serv NCMP #7:BEQ serv7 X*PHA:LDA &DF0,X: #128:BEQ disabled:PLA bCMP #2:BEQ serv2 lCMP #4:BEQ serv4 vCMP #6:BEQ serv6:\Errors CMP #9:BEQ serv9 CMP #&FE:BEQ servFE RTS .disabled:PLA:RTS .serv4:JMP serv4run -.serv6:JSR new_oscli_ret_check:LDA #6:RTS .serv9:JMP serv9run  .servFE JSR new_os +LDA #1:STA &267:JSR OSNEWL:JSR pr_title LDA &28D:BEQ servFEexit LDA #7:JSR OSWRCH '.servFEexit:JSR OSNEWL:LDA #&FE:RTS  .serv2  DTYA:PHA:A #128:STA &DF0,X:JSR find_ws:LDY #8:LDA #0:STA (&A8),Y ILDA #3:STA &202:LDA #255:STA &203:LDA #&A8:LDX #0:LDY #&FF:JSR OSBYTE  zSTX &A8:STY &A9:LDY #3:LDA #err_handler &FF:STA (&A8),Y:INY:LDA #err_handler 256:STA (&A8),Y:INY:LDA &F4:STA (&A8),Y *TAX:PLA:TAY:INY:LDA #2:RTS 4F.pr_title:JSR pr_text:EQUS "Extended BBC MOS 1.00":EQUB 13:BRK:RTS > .serv9run H/STY &AF:LDA (&F2),Y:CMP #13:BEQ serv9simple R;CMP #".":BEQ serv9print: #&DF:CMP #"E":BNE serv9exit \KINY:LDA (&F2),Y:CMP #".":BEQ serv9print: #&DF:CMP #"X":BNE serv9exit fKINY:LDA (&F2),Y:CMP #".":BEQ serv9print: #&DF:CMP #"T":BNE serv9exit p.serv9print zJSR serv9text %LDA #osc_help_text1 255:STA &AC %LDA #osc_help_text1 256:STA &AD !LDA #osc_table1 255:STA &A9 !LDA #osc_table1 256:STA &AA JSR do_help /LDY &AF:LDA (&F2),Y:CMP #".":BEQ serv9exit LDA #0:RTS .serv9text JSR pr_text ;EQUB 13:EQUS "Sideways RAM Extension 1.00 ":EQUB 13:BRK RTS .serv9simple:JSR serv9text !.serv9exit:LDY &AF:LDA #9:RTS  .run_help -STY &AF:LDA (&F2),Y:CMP #13:BNE run_help2 VJSR OSNEWL:JSR pr_title:JSR pr_text:EQUS " FILE":EQUB 13:EQUS " MOS":EQUB 13:BRK $.run_help_end .LDA #9:LDY &AF:RTS 8.run_help2 B&LDA (&F2),Y:CMP #".":BEQ do_help1 L& #&DF:CMP #"F":BNE not_file_help VMINY:LDA (&F2),Y:CMP #".":BEQ do_help1: #&DF:CMP #"I":BNE not_file_help `MINY:LDA (&F2),Y:CMP #".":BEQ do_help1: #&DF:CMP #"L":BNE not_file_help jMINY:LDA (&F2),Y:CMP #".":BEQ do_help1: #&DF:CMP #"E":BNE not_file_help t .do_help1 ~EJSR pr_text:EQUB 13:EQUS "Extended file handler 1.00":EQUB 13:BRK #LDA #file_os_text 255:STA &AC #LDA #file_os_text 256:STA &AD LDA #file_os 255:STA &A9 LDA #file_os 256:STA &AA JSR do_help:LDY &AF -LDA (&F2),Y:CMP #".":BNE run_help_finish JMP do_help2 #.run_help_end2:JMP run_help_end .not_file_help 2LDA (&F2),Y: #&DF:CMP #"M":BNE run_help_end2 MINY:LDA (&F2),Y:CMP #".":BEQ do_help2: #&DF:CMP #"O":BNE run_help_end2 MINY:LDA (&F2),Y:CMP #".":BEQ do_help2: #&DF:CMP #"S":BNE run_help_end2  .do_help2  JSR OSNEWL:JSR pr_title "LDA #mos_os_text 255:STA &AC "LDA #mos_os_text 256:STA &AD (LDA #mos_os 255:STA &A9 2LDA #mos_os 256:STA &AA <JSR do_help:LDY &AF F+LDA (&F2),Y:CMP #".":BEQ run_help_end2 P.run_help_finish ZLDA #0:RTS d .do_help n-TYA:PHA:LDA #&BD:STA &A8:LDA #&60:STA &AB xLDX #0:LDY #0 .help_mess_loop !LDA #32:JSR OSWRCH:JSR OSWRCH .help_mess_loop2 JSR &A8:BEQ help_word *JSR OSWRCH:INX:CLC:BCC help_mess_loop2 .help_word LDA #32:JSR OSWRCH .help_mess_loop3 !LDA (&AC),Y:BEQ help_text_end *JSR OSWRCH:INY:CLC:BCC help_mess_loop3 .help_text_end JSR OSNEWL 7INY:INX:INX:INX:JSR &A8:CMP #&FF:BNE help_mess_loop PLA:TAY:RTS .search_table LDA #&BD:STA &A8 "LDA #&60:STA &AB , STY &AF 6 LDX #0 @.search_main_loop J LDY &AF T.search_loop ^!LDA (&F2),Y:CMP #".":BEQ dot h%JSR &A8:CMP (&F2),Y:BNE not_equal r .equal |!INX:INY:JSR &A8:BEQ zero_byte BNE search_loop .dot JSR fnd_zero1 INY .zero_byte INX:JSR &A8:STA &AC INX:JSR &A8:STA &AD .no_spaces &LDA (&F2),Y:CMP #32:BNE found_code INY:CLC:BCC no_spaces .found_code  CLC:RTS  .fnd_zero INX .fnd_zero1 JSR &A8:BNE fnd_zero &RTS 0.not_equal : #32:CMP (&F2),Y:BEQ equal DJSR fnd_zero N INX:INX:INX:JSR &A8:CMP #&FF XBNE search_main_loop bLDY &AF:SEC:RTS l .serv4run vLDA #(osc_table1) 256  STA &A9 LDA #(osc_table1) 256  STA &AA .serv4bit:JSR search_table BCC serv4go LDA #4:LDX &F4:RTS .serv4go:LDX &F4  JSR jump LDA #0:RTS .jump:JMP (&AC) "\ Tables .osc_table1 (EQUS "NEWOS":BRK:EQUW new_os_command &EQUS "NEWOFF":BRK:EQUW rom_disable  EQUB 255  .file_os  EQUS "CAT":BRK:EQUW cat *EQUS "BUILD":BRK:EQUW build 4EQUS "DUMP":BRK:EQUW dump >EQUS "EXEC":BRK:EQUW exec HEQUS "INFO":BRK:EQUW info REQUS "LIST":BRK:EQUW list \EQUS "LOAD":BRK:EQUW load fEQUS "OPT":BRK:EQUW opt pEQUS "RUN":BRK:EQUW run zEQUS "SAVE":BRK:EQUW save EQUS "SPOOL":BRK:EQUW spool EQUS "TYPE":BRK:EQUW type  EQUB 255  .mos_os EQUS "FX":BRK:EQUW fx EQUS "HELP":BRK:EQUW help EQUS "KEY":BRK:EQUW key #EQUS "MESSAGE":BRK:EQUW message EQUS "MEDIT":BRK:EQUW enter !EQUS "MDUMP":BRK:EQUW examine EQUS "OS":BRK:EQUW os EQUS "ROMS":BRK:EQUW roms EQUS "TAPE":BRK:EQUW tape  EQUB 255 .file_os_text &EQUS "(#) ()":BRK $EQUS "":BRK .(EQUS "(#) ()":BRK 8EQUS "()":BRK BEQUS "(#) ":BRK LEQUS "(#) ":BRK VEQUS " ()":BRK `EQUS " ()":BRK j EQUS " ()":BRK t?EQUS " |+ ( ())":BRK ~EQUS "()":BRK EQUS "(#) ":BRK .mos_os_text *EQUS " ( ())":BRK EQUS "(#) ":BRK EQUS " ":BRK EQUS "":BRK EQUS "":BRK 2EQUS "(#) (|+)":BRK EQUS "":BRK EQUS "(#)":BRK EQUS "()":BRK .osc_help_text1 EQUS "":BRK EQUS "":BRK  \ Routines .os (LDA #142:JMP OSBYTE 2.enter:.examine:.message <2JSR errors:EQUB 254:EQUS "Not yet written":BRK F".list:.type:.roms:.dump:.build P:.exec:.fx:.key:.load:.opt:.run:.save:.spool:.tape:.rom ZLDY &AF:PLA:PLA:LDA #4:RTS d5.new_os_command:LDA (&F2),Y:CMP #13:BEQ new_os_c2 nCMP #"#":BEQnew_os x.new_os_c2 JSR find_ws &LDY #8:LDA (&A8),Y:BEQ new_os_cont 9JSR errors:EQUB 254:EQUS "NewOs already selected":BRK .new_os JSR find_ws &LDY #8:LDA (&A8),Y:BEQ new_os_cont RTS .new_os_cont 6SEI:LDA #255:STA (&A8),Y:\ NewOS On flag at Y=8 #LDY #4:LDA &208:STA (&A8),Y:INY /LDA &209:STA (&A8),Y:INY:\ CLIV at Y=4/5 \Store old FILE_V as well 'LDA #12:STA &208:\LDA #18:\STA &20C LDA #21:STA &20E (LDA #&FF:STA &209:STA &20F:\STA &20D 'LDA #&A8:LDX #0:LDY #&FF:JSR OSBYTE "#STX &A8:STY &A9:LDY #12:LDX &F4 ,$LDA #new_oscli &FF:STA (&A8),Y 6(INY:LDA #new_oscli 256:STA (&A8),Y @INY:TXA:STA (&A8),Y J*LDY #21:LDA #new_vdu &FF:STA (&A8),Y T&INY:LDA #new_vdu 256:STA (&A8),Y ^INY:TXA:STA (&A8),Y h\ Set new osword vectors r3JSR collapse:LDA #0:STA &A8:TAY:INY:STA (&A8),Y |CLI:CLD:RTS .new_oscli (PHA:TXA:PHA:TYA:PHA:JSR new_oscli_go PLA:TAY:PLA:TAX:PLA:RTS .new_oscli_go STX &F2:STY &F3:LDY #&FF .new_oscli_loop 0INY:LDA (&F2),Y:CMP #"*":BEQ new_oscli_loop CMP #" ":BEQ new_oscli_loop CMP #13:BEQ new_oscli_ret CMP #"|":BNE new_oscli1 .new_oscli_ret:RTS P.new_oscli_ret_check:JSR find_ws:LDY #2:LDA (&A8),Y:TAX:LDA #255:STA (&A8),Y TCPX #255:BEQ new_oscli_ret:LDA #18:JSR OSWRCH:LDA #&89:JSR OSWRCH:TXA:JMP OSWRCH .new_oscli1 ,INY:CMP #":":BEQ do_old_cli:DEY:TYA:PHA 3JSR find_ws:LDY #2:LDA #255:STA (&A8),Y:PLA:TAY &LDA #file_os 255:STA &A9 0LDA #file_os 256:STA &AA :/JSR serv4bit:CMP #0:BEQ new_oscli_ret_check DLDA #mos_os 255:STA &A9 NLDA #mos_os 256:STA &AA X/JSR serv4bit:CMP #0:BEQ new_oscli_ret_check b.do_old_cli lSTY &AF:JSR find_ws:LDY #4 vLDA (&A8),Y:STA &AC INY:LDA (&A8),Y:STA &AD LDA &AF:CLC:ADC &F2:TAX &LDA #0:ADC &F3:TAY:JMP (&AC):\Jump \ Misc. routines .pr_hex PHA:LSR A:LSR A:LSR A:LSR A JSR first PLA .first  #&0F:CMP #10 BCC over ADC #6 .over ADC #48:JMP OSWRCH \  .pr_text STA &AE *+PLA:STA &AC:PLA:STA &AD:TXA:PHA:TYA:PHA 4LDY #0:.pr_main_loop >INC &AC:BNE continue HINC &AD:.continue RLDA (&AC),Y \BEQ end_of_string fJSR OSASCI:JMP pr_main_loop p.end_of_string zINC &AC:BNE pr_exit_end INC &AD:.pr_exit_end %PLA:TAY:PLA:TAX:LDA &AE:JMP (&AC) \ .errors PLA:STA &FD:PLA:STA &FE LDY #0 .error_main_loop INY:LDA (&FD),Y:STA &100,Y BNE error_main_loop STA &100:JMP &100 \ .check_strm TYA:PHA:JSR find_ws:PLA:TAY LDA (&F2),Y:CMP #"#" BNE check_strm_ret JSR nextch $PHA:JSR nextch:JSR separ .BCS Bad_Command 86TYA:PHA:LDY #1:LDA (&A8),Y:INY:STA (&A8),Y:PLA:TAY B>LDA #18:JSR OSWRCH:LDA #&89:JSR OSWRCH:PLA: #7:JSR OSWRCH L.check_strm_ret:RTS V .nextch `&INY:LDA (&F2),Y:CMP #32:BEQ nextch jRTS t .separ ~CMP #13:BEQ separ_ret1 CMP #";":BEQ separ_ret CMP #",":BEQ separ_ret  SEC:RTS .separ_ret JSR nextch .separ_ret1  CLC:RTS .Bad_Command JSR errors #EQUB 254:EQUS "Bad command":BRK .Bad_Number JSR errors "EQUB 252:EQUS "Bad number":BRK  .find_ws GPHA:LDX &F4:LDA &DF0,X: #127:STA &A9:LDA #0:STA &A8:PLA:LDY #0:RTS >\ 1=window, 2=winpend, 4/5=OldCLI, 8=NewOS On, 16+ windows (.cat 2JSR check_strm <TYA:CLC:ADC &F2:PHP:TAX FLDA #0:PLP:ADC &F3:TAY PLDA #5:JMP (&21E) Z .help dJSR check_strm nJSR run_help xCMP #9:BNE info_end LDA #143:LDX #9:JMP OSBYTE  .info JSR check_strm LDA #"I":STA &700 LDA #"N":STA &701 LDA #"F":STA &702 LDA #"O":STA &703 LDA #" ":STA &704  LDX #5  .infoloop "LDA (&F2),Y:STA &700,X:INY:INX CMP #13:BNE infoloop #LDX #0:LDY #7:LDA #3:JMP (&21E)  .info_end RTS .Bad_Number2:JMP Bad_Number ".rom_disable , LDA &DF0,X: #127:STA &DF0,X 6+JSR pr_text:EQUS "Press CTRL-BREAK":BRK @.rom_dis2:JMP rom_dis2 J: T:\ Window handler ^: h.find_wind_addr r #7:PHA |JSR find_ws PLA:ASL A:STA &A8 ,ASL A:ASL A:ADC &A8:ADC #&10:STA &A8:RTS  .new_vdu PHA:PHP:TXA:PHA:TYA:PHA LDA &A8:PHA:LDA &A9:PHA TSX:LDA &106,X JSR new_vdu_go PLA:STA &A9:PLA:STA &A8 PLA:TAY:PLA:TAX:PLP:PLA RTS .new_vdu_go JSR find_ws PHA:LDA &26A:\ Queue CMP #&FF:BEQ last_item PLA:BIT &26A:BMI old_jmp  STA (&A8),Y:\ last_ch at Y=0 &CMP #26:BEQ do_collapse 0 .old_jmp :?JMP nvwrch:\ Do this so RS232, SPOOL, etc can have a chance D.last_item N LDA (&A8),Y:\ last_ch at Y=0 XCMP #22:BEQ do_mode bCMP #23:\BEQ do_char lCMP #18:BEQ do_gcol_etc v .do_old PLA:JMP nvwrch .do_ignore PLA  .do_spool -LDX #&FE:STX &26A:JSR nvwrch:INC &26A:RTS .do_mode:PLA .do_collapse JSR nvwrch  .collapse  LDA #7 .coll_loop PHA:JSR save_window  PLA:SEC:SBC #1:BPL coll_loop RTS  .do_gcol_etc 5LDA &322:CMP #&89:BNE do_ignore:\ GCOL &89,window  .do_window *#INY:LDA (&A8),Y:\ window at Y=1 4JSR save_window >,PLA:JSR do_spool:LDY #0:STY &A8:INY: #7 HSTA (&A8),Y:\ window RJSR get_window \RTS f.save_window pJSR find_wind_addr:LDX #0 z.save_loop 7LDA &308,X:STA (&A8),Y:INY:INX:CPX #4:BCC save_loop "LDA #134:JSR OSBYTE:TYA:LDY #5 +STA (&A8),Y:DEY:TXA:STA (&A8),Y:INY:INY LDA &357:STA (&A8),Y:INY LDA &358:STA (&A8),Y:INY LDA &D2:STA (&A8),Y:INY LDA &D3:STA (&A8),Y:RTS .get_window PHA :LDA #3:LDX #&54:LDY #0:JSR OSBYTE:\ select screen only *PLA:TAY:TXA:PHA:TYA:JSR find_wind_addr LDA #28:JSR nvwrch .get_w_loop 4LDA (&A8),Y:JSR nvwrch:INY:CPY #4:BCC get_w_loop LDA #31:JSR nvwrch LDA (&A8),Y:JSR nvwrch:INY $LDA (&A8),Y:JSR nvwrch:INY .LDA (&A8),Y:STA &357:INY 8LDA (&A8),Y:STA &358:INY BLDA (&A8),Y:STA &D2:INY LLDA (&A8),Y:STA &D3 V6PLA:TAX:LDY #0:LDA #3:JMP OSBYTE:\ Restore outputs `: j \ Stick new editor here... t: ~]  P 8" *SAVE ROM "+~(mcode%)+" "+~(O%+1)+" 0 FFFBBC00"