> Client65/src < Source for Atom/System kernel for 65Tube Tube Emulator : (G >&8000:ș "OS_GetEnv"A$:A$,5)<>"B6502":"B6502"+A$,A$," ")) 2 :" at line ";: <: Fsave$="Kernel65" Pload%=&F800: mcode% &900 Z: d/nmiv =&200:brkv =&202:irq1v=&204:cliv =&206 n/wrchv=&208:rdchv=&20A:loadv=&20C:savev=&20E x/rdarv=&210:starv=&212:bgetv=&214:bputv=&216 $findv=&218:shutv=&21A:EVNTV=&220 0 &0E21 - keypress, b7=1 - nothing pressed : P=01 P%=load%:O%=mcode% [OPT P*3+4+16 ,\ &EC/D=>address to enter on MOS startup \ &EE/F=>current program 8\ &F0/1=>membot, if &F0<>0, membot=0000, memtop=0000 \ &F2/3=>command string \ &F4/5=>memtop 3\ &F6/7= readhex accumulator, ";params" pointer \ &F8/9=>control block *\ &FA/B=>String to print with PrString \ &FC = IRQ A store \ &FD/E=>last error "\ &FF = escape flag ,!\ &0236= command input buffer 6!\ &02EE= OSFILE control block @4\ &03xx= bit16-bit23 of Turbo65 (zp),Y addresses J6\ &03F3= b16-b23 of (&F2),Y command string pointer T.\ &03F5= b16-b23 of (&F4),Y memtop pointer ^5\ &03F9= b16-b23 of (&F8),Y control block pointer h.\ &03FB= b16-b23 of (&FA),Y string pointer r-\ &03FE= b16-b23 of (&FD),Y error pointer | \ Emulator opcodes  \ &03 - \ &13 - OSBYTE \ &23 - OSWORD \ &33 - OSWRCH \ &43 - OSRDCH \ &53 - OSFILE \ &63 - OSARGS \ &73 - OSBGET \ &83 - OSBPUT \ &93 - OSGBPB \ &A3 - OSFIND \ &B3 - Called by *Ș +\ &C3 - Called by *BASIC and OSBYTE 142  \ &D3  \ &E3 & \ &F3 0 :\ OSBYTE &A3,&F3 D9\ Y=4 - RESET, *OS, NMIHandler. Request code to enter N<\ Y=6 - RESET occured, request command string to execute X b l \ *OS - Enter command prompt v \ ==========================  .CmdOS ?JSR ErrorInit:JSR OSNEWL :\ Point brkv to ErrorHandler TYA:BNE JumpToCode :\ If Y<>0, enter code at XY D\LDA (&EC),Y :\ Look for a entry point at &EC/D !\CMP #&20:\BNE CmdOSLoop:\TYA LDX &EC:LDY &ED:STA &ED BNE JumpToCode  .CmdOSLoop 3JSR PrText :\ Display prompt EQUS "SYSTEM>* ":NOP  LDA #&00  LDX #LF84A 255 LDY #LF84A 256  5JSR XOSWORD:BCS OSEscape :\ Input a command *5LDX #&36:LDY #&02:JSR XOS_CLI :\ Execute command 4;JMP CmdOSLoop :\ Jump back for another > H \ *BASIC R \ ====== \ .CmdBASIC f1EQUB &C3 :\ Pass to host p z\ NMI Handler \ =========== .NMIHandler 7LDY #&04:JSR OSByteA3 :\ Ask host something ATYA:BEQ CmdOS :\ If Y=0, enter command prompt .JumpToCode ;JMP EnterCodeXY :\ Y<>0, enter code at XY   .OSEscape 0LDA #&7E:JSR XOSBYTE :\ Ack. escape !BRK:EQUB 17:EQUS "Escape":BRK   .LF84A 'EQUW &0236 :\ Input buffer at &0236 %EQUB &B7 :\ Max. &B7 characters #EQUB &20 :\ Minimum character #EQUB &FF :\ Maximum character $ . .RESET 80LDX #&FF:TXS :\ Clear stack BHJSR LF87F :\ Reset vectors and set memory limits L7LDY #&06:JSR OSByteA3 :\ Ask host something VCTYA:BNE OscliXY :\ If Y<>0, execute command at XY `=\ If Y=0, display startup banner and enter command prompt j%\ If Y<>0, XY=>command to execute t ~9JSR PrText :\ Print startup banner )EQUB 10:EQUS "Acorn Atom/System Tube" EQUB 10:EQUB 13 NOP ;JMP CmdOS :\ Jump to command prompt $\ Will then display help banner, 1\ then calls OsByteA3,4 for any entry address   .OscliXY 9JSR ErrorInit :\ Set up error handler >JSR XOS_CLI:JMP CmdQUIT :\ Execute command then quit  )\ Reset vectors and set memory limits )\ ===================================  .LF87F CLD:LDX #&35  .LF882 (>LDA LFB87,X:STA &0200,X :\ Copy from default vectors 2DEX:BPL LF882 <6STZ &FF:STZ &F0 :\ Clear escape flag FHLDX #&10:STX &F1 :\ Set F0/1=>bottom of memory at &1000 P-LDX #&00:LDY #&F8 :\ XY=&F800 ZESTX &F4:STY &F5 :\ Set F4/5=>top of memory at &F800 dRTS n x\ Interupt handler \ ================ .InterruptHandler =STA &FC:PLA:PHA :\ Save A, get flags from stack : #&10:BNE BRKHandler :\ If BRK, jump to BRK handler ;LDA &FC:PHA:JMP (irq1v) :\ Continue via irq1v handler  .IRQ1Handler FPLA:\JMP (IRQ2V) :\ No handlers, pass staight on to IRQ2V   .NullIRQ 5RTI :\ Return from interupt  .BRKHandler LLDA &FC:PLP:PHP:JMP (brkv) :\ Restore A and flags, jump to BRK handler  \ Default error handler "\ ===================== ,;\ On Atom, adjustment of &FD/E is done in error handler 6\ SP=>flags, ret.lo, ret.hi @\ J.ErrorHandler T*TXA:PHA :\ Save X ^:TSX:LDA &0103,X :\ Get address from stack hCLD:SEC:SBC #&01:STA &FD r;LDA &0104,X:SBC #&00:STA &FE :\ &FD/E=>after BRK opcode |JLDA #&00:STA &03FE :\ Error block at (&FD),Y is in block &00 :PLA:TAX:LDA &FC :\ Restore X, get saved A  ,\ Now continue into normal error handler /LDX #&FF:TXS :\ Clear stack CLI:JSR OSNEWL  LDY #&01  .LF8D7 6LDA (&FD),Y:BEQ LF8E1 :\ Print error string JSR OSWRCH:INY:BNE LF8D7  .LF8E1 :JSR OSNEWL:JMP CmdOSLoop :\ Jump to command prompt   \ *Ș  \ =====  .CmdQUIT 0EQUB &B3 :\ Pass to host & 0 .OSByteA3 :2LDA #&A3:LDX #&F3 :\ OSBYTE &A3,&F3 D/EQUB &13 :\ Host OSBYTE NRTS X b\ Scan hex l\ ======== v .ScanHex 9LDX #&00:STX &F6:STX &F7 :\ Clear hex accumulator ESTX &03F3 :\ String at (&F2),Y is in block &00  .LF8F7 9LDA (&F2),Y :\ Get current character .SEC:SBC #&30:BCC LF921 :\ <'0', exit @CMP #&0A:BCC LF90E :\ '0'..'9', add into accumator > #&DF:SBC #&07 :\ Ignore case, convert letters .CMP #&0A:BCC LF921 :\ <'A', exit .CMP #&10:BCS LF921 :\ >'F', exit  .LF90E 'ASL A:ASL A:ASL A:ASL A :\ *16  LDX #&03  .LF914 >ASL A:ROL &F6:ROL &F7 :\ Move bits into accumulator  =BCS LF959 :\ Overflowed, jump to error 6DEX:BPL LF914 :\ Loop for four bits  :INY:BNE LF8F7 :\ Move to next character * .LF921 4GJMP SkipSpaces :\ Skip past any final spaces and exit > H$\ Scan hex, error if null string R .LF924 \2JSR ScanHex:PHP :\ Save flag fLCPX #&00:BEQ LF959 :\ X=0, nothing read in, 'Bad number' error p6PLP:RTS :\ Get flag back z \ * - Set address \ ========================  .CmdPAGE BJSR SkipSpaces:BEQ LF94A :\ No parameters, jump to use &1000 :JSR LF924:BNE LF959 :\ Error if more parameters PLDY &F7:LDX &F6:BNE LF94E :\ addr<>&xx00, error as must by 256-byte aligned >CPY #&10:BCC LF94E :\ addr<&1000, error as too low ?CPY #&80:BCS LF94E :\ addr>&8000, error as too high  .LF946 3STY &F1:CLC:RTS :\ Store high byte  .LF94A 2LDY #&10:BRA LF946 :\ Default to &1000   .LF94E BRK 7EQUB 252:EQUS "Bad PAGE":BRK :\ Unusable value $ .LF959 .BRK 8.EQUB 252:EQUS "Bad number":BRK :\ Bad hex B .LF966 L:SEC:RTS :\ SEC=pass command to host V `\ *GO - Call machine code j\ ======================= t .CmdGO ~FJSR SkipSpaces:BEQ LF984 :\ If no params, re-enter existing code 4JSR ScanHex :\ Scan hex parameter @CPX #&00:BEQ LF966 :\ No hex parameter, pass to host . :\ eg *GO HELLO %CMP #&3B:BEQ LF97C :\ ';' 8CMP #&0D:BNE LF959 :\ More parameters, error .LF97C 9LDX &F6:LDY &F7 :\ Store parameter pointer 2 :\ Enter code at XY  .EnterCodeXY =STX &F4:STY &F5 :\ Set memtop to entry address .LF984 6LDA &EF:PHA:LDA &EE:PHA :\ Save current program JSR EnterCode MPLA:STA &EE:STA &F4 :\ Restore current program and also set memtop PLA:STA &EF:STA &F5 (2CLC:RTS :\ CLC=command done 2 <2\ Check if code to be entered has a ROM header F.EnterCode PDLDA &F4:STA &EE :\ Current program starts at memtop ZLDA &F5:STA &EF dJLDX #&00:STX &03F5:STX &03FE :\ Set memtop and errptr are in block &00 n8LDY #&07:LDA (&F4),Y :\ Get copyright offset xCLD:CLC:ADC &F4:STA &FD copyright message \ Check for &00,"(C)" ?LDY #&00:LDA (&FD),Y:BNE LF9FC :\ Check for initial &00 7INY:LDA (&FD),Y:CMP #&28:BNE LF9FC :\ Check for '(' 7INY:LDA (&FD),Y:CMP #&43:BNE LF9FC :\ Check for 'C' 7INY:LDA (&FD),Y:CMP #&29:BNE LF9FC :\ Check for ')' \ &00,"(C)" exists 0LDY #&06:LDA (&F4),Y :\ Get ROM type 6 #&4D:CMP #&40:BCC LFA2A :\ b6=0, Not a language A #&0D:BEQ LF9E6 :\ code=%x1xx00x0, enter 6502 code BCMP #&01:BNE LFA0E :\ code<>%x1xx00x1, not 6502 code .LF9E6 &\ romtype=%0000 - A=0 - 6502 BASIC %\ romtype=%0001 - A=1 - Turbo6502 )\ romtype=%0010 - A=0 - 6502 nonBASIC $\ romtype=%0011 - A=1 - reserved "?PHA:LDY #&09 :\ Save entry value &00 or &01 , .LF9E9 63LDA (&F4),Y:BEQ LF9F3 :\ Print ROM title @JSR OSWRCH:INY:BNE LF9E9 J .LF9F3 T1JSR OSNEWL:JSR OSNEWL :\ Print two NLs ^8PLA:BRA LF9FE :\ Get entry value back hD.LF9FC :\ No (C) string, enter as raw code r.LDA #&00 :\ Set flag=0 | .LF9FE 5STA &F0 :\ Store flag at &F0 +\ If flag=0, membot=&F0/1, memtop=&F4/5 .\ If flag<>0, membot=010000, memtop=040000 LDY #&00:TYA .LFA03 DSTA &0300,Y:DEY:BNE LFA03 :\ All (zp),Y accesses to block &00 7LDA #&01:JMP (&00F4) :\ Enter code with A=1  .LFA0E JSR ErrorInit BRK )BRK:EQUS "I cannot run this code":BRK .LFA2A JSR ErrorInit BRK )BRK:EQUS "This is not a language":BRK & 0.ErrorInit :4LDA #ErrorHandler 255:STA brkv+0 :\ Claim brkv D&LDA #ErrorHandler 256:STA brkv+1 NRTS X b\ *Ǔ - Display help l\ ==================== v .CmdHELP 2JSR SkipSpaces:BNE LFA5C :\ Exit if parameters 6JSR OSNEWL:JSR HelpBanner:\ Display startup banner .LFA5C ;SEC:RTS :\ Return, SEC to pass to host  .HelpBanner JSR PrText ;EQUS "6502 Emulator Atom/System MOS 0.10 (21 Feb 2012)" EQUB 10:EQUB 13 NOP RTS  \ OSBYTE Handler \ ============== #.osBYTE :\ OSBYTE PHA 0CMP #&82:BEQ BYTE82 :\ Read memory high word *0CMP #&83:BEQ BYTE83 :\ Read bottom of memory 4-CMP #&84:BEQ BYTE84 :\ Read top of memory >=CMP #&85:BEQ BYTE85 :\ Read top of memory for screen mode H)CMP #&8E:BEQ BYTE8E :\ Enter language R9CMP #&A3:BNE BYTEnn :\ Jump if not Application OSBYTE \(CPX #&FE:BCC BYTEnn :\ Jump if X<&FE f9\ OSBYTE &A3,&FE and OSBYTE &A3,FF - return unchanged pPLA zRTS  ..BYTEnn :\ Pass OSBYTE to host #EQUB &13 :\ MOS_BYTE !PLA:RTS :\ Return  0.BYTE82 :\ Read memory high word *LDX #&00:LDY #&00 :\ High word=&0000 PLA:RTS  0.BYTE83 :\ Read bottom of memory %PLA :\ Get A back :LDX &F0:BEQ LFABC :\ If &F0=0, &F0/F1=>memory bottom $LDA #&01 :\ Set A=&01 7LDX #&00:LDY #&00 :\ Return memory bottom=&010000 RTS  .LFABC $8LDX #&00:LDY &F1 :\ Get memory bottom from &F0/F1 .RTS 8 B-.BYTE84 :\ Read top of memory L%PLA :\ Get A back V6LDX &F0:BEQ LFACD :\ If &F0=0, &F4/5=>memory top `$LDA #&04 :\ Set A=&04 j4LDX #&00:LDY #&00 :\ Return memory top=&040000 tRTS ~ .LFACD 5LDX &F4:LDY &F5 :\ Get memory top from &F4/F5 RTS  8.BYTE85 :\ Read top of memory for screem 5LDX #&00:LDY #&80 :\ Return top of memory=&8000 /PLA:RTS :\ Restore A and return  ).BYTE8E :\ Enter language .JMP CmdBASIC :\ Jump to enter BASIC  \ File and I/O Interface \ ======================   C\ These low-level calls are the same on the Atom/System and BBC C\ -------------------------------------------------------------  .osFIND (.EQUB &A3:RTS :\ Pass OSFIND to host 2 .osGBPB <.EQUB &93:RTS :\ Pass OSGBPB to host F.osBPUT:.atomBPUT P.EQUB &83:RTS :\ Pass OSBPUT to host Z.osBGET:.atomBGET d.EQUB &73:RTS :\ Pass OSBGET to host n .osARGS x.EQUB &63:RTS :\ Padd OSARGS to host  .osFILE .EQUB &53:RTS :\ Pass OSFILE to host  .osRDCH .EQUB &43:RTS :\ Padd OSRDCH to host .osWRCH:.atomWRCH .EQUB &33:RTS :\ Pass OSWRCH to host  $\ A bit of hand-holding for RDCH $\ ------------------------------  .atomRDCH BIT &FF:BPL doRDCH +LDA #&7E:JSR XOSBYTE :\ Ack. any Escape  .doRDCH 0LDA #&FF:STA &0E21 :\ Set 'no key pressed' /EQUB &43 :\ Pass OSRDCH to host PHP "CMP #8:BEQ SwapRDCH ,CMP #127:BNE RDCHdone 6 .SwapRDCH @* #&77 :\ Swap &08 and &7F J .RDCHdone T PLP:RTS ^ h\ Atom file interface r\ ------------------- | \ OSLOAD - Load a file \ -------------------- \ On entry, X=>zero page $\ X+0/1=>file name &\ X+2/3=Load address A\ X+4 =if bit 7=0 use the file's start address %\ CC=Return immediately 7\ CS=Wait until IRQ/DMA actions completed \ On exit, all preserved \  .atomLOAD LDA #&FF:BNE doFILE  \ OSSAVE - Save a file \ -------------------- \ On entry, X=>zero page &#\ X+0/1=file name 0&\ X+2/3=load address :+\ X+4/5=execution address D7\ X+6/7=start address of data to save N9\ X+8/9=(end address)+1 of data to save X%\ CC=Return immediately b7\ CS=Wait until IRQ/DMA actions completed l\ On exit, all preserved v .atomSAVE  LDA #&00  .doFILE PHA TYA:PHA:TXA:PHA %LDA 0,X:STA &2EE :\ =>filename LDA 1,X:STA &2EF  LDY #0  .doFILElp LDA 2,X:STA &2F0,Y:INX:INY LDA 2,X:STA &2F0,Y:INX:INY /LDA #0 :\ Expand control block STA &2F0,Y:INY STA &2F0,Y:INY CPY #16:BNE doFILElp  ,TSX:LDA &103,X :\ Get OSFILE action CMP #&FF:BNE callFILE  LDA &2F4: #&FF *STA &2F4:LDA #&FF 4 .callFILE >1LDX #&EE:LDY #&02 :\ Point to control block H.EQUB &53 :\ Pass OSFILE to host R6TSX:STA &103,X :\ Store return value on stack \,PLA:TAX:PLA:TAY :\ Restore registers f6PLA:RTS :\ Get return value and return p z$\ OSRDAR - Read file's arguments $\ ------------------------------ &\ On entry, X=>zero page location \ Y=handle \ A=0 - read \ A=1 - read &\ A=2 - read allocation ,\ On exit, X+0-X+3 = returned argument  \ A,X,Y preserved  .atomRDAR :PHA:CLC:BCC doARGS :\ Jump to do even-numbered OSARGS  #\ OSSTAR - Set file's arguments #\ ----------------------------- &\ On entry, X=>zero page location \ Y=handle 1\ A=0 - write (usually, A=unset) $#\ X+0-X+3 = argument . \ On exit, A,X,Y preserved 8 .atomSTAR B1PHA:LDA #0:SEC :\ Do odd-numbered OSARGS L .doARGS V3ROL A :\ Convert to OSARGS action `.EQUB &63 :\ Pass OSARGS to host j/PLA:RTS :\ Restore A and return t ~\ OSFIND - Open file \ ------------------ \ On entry, X=>zero page #\ X+0/1=file name &\ CS=Open file for input '\ CC=Open file for output 3\ On exit, A=file handle, 0 if file not found \ X,Y=preserved  .atomFIND /PHA :\ Space for returned A #TYA:PHA:TXA:PHA :\ Save X,Y 'LDA 1,X:TAY :\ XY=>filename LDA 0,X:TAX / :\ Create OSFIND action  'LDA #0 :\ A=00, CS CC 'PHP:ROR A:PLP:ROR A :\ C0 00 % #&80 :\ 40 80 (.EQUB &A3 :\ Pass OSFIND to host 2)TSX:STA &103,X :\ Store on stack <&PLA:TAX:PLA:TAY :\ Restore X,Y F0PLA:RTS :\ Get handle and return P Z\ OSSHUT - Close a file d\ --------------------- n\ On entry, Y=file handle x\ On exit, all preserved  .atomSHUT -PHA:LDA #0 :\ OSFIND &00 - Close .EQUB &A3 :\ Pass OSFIND to host  PLA:RTS   \ OSWORD Handler \ ==============  .osWORD 7CMP #&05:BNE LFB0C :\ Jump if not Read I/O memory :  \ OSWORD 5 - Read I/O memory \ Reads from Tube memory 0STX &F8:STY &F9 :\ &F8/9=>control block ALDY #&00:STY &03F9 :\ Control block at (&F8),Y in block &00 LDA (&F8),Y:STA &FA "INY ,1LDA (&F8),Y:STA &FB :\ &FA/B=address to read 6-LDX #&00:LDA (&FA,X) :\ Read from address @embedded string BLDY #&00:STY &03FB :\ String at (&FA),Y is in block &00 INY  .LFB4A .LDA (&FA),Y :\ Get character ,CMP #&EA:BEQ LFB56 :\ Exit if NOP =JSR OSWRCH:INY:BNE LFB4A :\ Print char and loop for next  .LFB56 TYA:CLC:ADC &FA 6TAX:LDA #&00:ADC &FB :\ Update return address 4PHA:TXA:PHA :\ Points after string .NullReturn  RTS   \ Print string at XY *\ ------------------ 4 .PrString >2STX &FA:STY &FB :\ Store XY in &FA/B HBLDY #&00:STY &03FB :\ String at (&FA),Y is in block &00 R .LFB6C \0LDA (&FA),Y :\ Get a character f5CMP #&20:BCC LFB78 :\ Exit at control char p0JSR OSWRCH:INY:BNE LFB6C :\ Print character z .LFB78 RTS  .Unsupported BRK BRK:EQUS "Unsupported":BRK  \ Default vectors  .LFB87 (EQUW NMIHandler :\ &200 - nmiv (EQUW ErrorHandler :\ &202 - brkv )EQUW NullIRQ :\ &204 - irq1v (EQUW atomCLI :\ &206 - cliv )EQUW atomWRCH :\ &208 - wrchv )EQUW atomRDCH :\ &20A - rdchv )EQUW atomLOAD :\ &20C - loadv )EQUW atomSAVE :\ &20E - savev $)EQUW atomRDAR :\ &210 - rdarv .)EQUW atomSTAR :\ &212 - starv 8)EQUW atomBGET :\ &214 - bgetv B)EQUW atomBPUT :\ &216 - bputv L)EQUW atomFIND :\ &218 - findv V)EQUW atomSHUT :\ &21A - shutv `(EQUW NullReturn :\ &21C - v21C j(EQUW NullReturn :\ &21E - v21E t(EQUW NullReturn :\ &220 - v220 ~(EQUW NullReturn :\ &222 - v222 (EQUW NullReturn :\ &224 - v224 (EQUW NullReturn :\ &226 - v226 (EQUW NullReturn :\ &228 - v228 (EQUW NullReturn :\ &22A - v22A (EQUW NullReturn :\ &22C - v22C (EQUW NullReturn :\ &22E - v22E (EQUW NullReturn :\ &230 - v230 (EQUW NullReturn :\ &232 - v232 (EQUW NullReturn :\ &234 - v234   \ - Execute command string $\ ============================== \ Command string is at &100  \  .atomCLI CLDX #&00:LDY #&01 :\ Point XY=>&100, Atom command buffer ( .osCLI 25STX &F2:STY &F3 :\ &F2/3=>command string  d=INY:BNE LFBC6 :\ Loop for up to 256 characters n .LFBD2 x3RTS :\ No found, exit  .LFBD3 LDX #LFC6A 255 8LDY #LFC6A 256 :\ Point XY to command buffer =STX &F2:STY &F3 :\ Point &F2/3 to command buffer LDX #&00:LDY #&FF  .LFBDF 9JSR SkipSpaces1 :\ Move past and skip spaces ,CMP #"*":BEQ LFBDF :\ Skip past '*'s 1CMP #&0D:BEQ LFBD2 :\ Null string, exit /CMP #"|":BEQ LFBD2 :\ *|, comment, exit ICLC:TYA:ADC &F2:STA &F2 :\ Adjust &F2/3 to point to start of command BCC LFBF8:INC &F3  .LFBF8 3LDY #&00:LDA (&F2),Y :\ Get first character 8CMP #".":BEQ LFC45 :\ '*.', jump to pass to host  .LFC00 "4TYA:PHA :\ Save command pointer ,4JSR SkipSpaces :\ Skip any more spaces 6 .LFC05 @?LDA LFF02,X:BMI LFC20 :\ Jump if at end of command table J8 (&F2),Y :\ Compare with command table T; #&DF:BNE LFC14 :\ Ignore case, jump if no match ^0 from / :\ Osbyte 163,&F3  .LFC4A RTS   .LFC4B 8LDA LFC5E+1,X:PHA :\ Stack address high byte 7LDA LFC5E+0,X:PHA :\ Stack address low byte 0RTS :\ Jump to routine  .SkipSpaces1 INY  .SkipSpaces (LDA (&F2),Y:CMP #&20:BEQ SkipSpaces1  CMP #&0D:RTS * 4 .Pr2Hex >TYA:JSR PrHex:TXA H .PrHex RPHA:LSR A:LSR A:LSR A:LSR A \JSR PrNyb:PLA f .PrNyb p #15:CMP #10:BCC P%+4 zADC #6:ADC #48:JMP OSWRCH  \ Command addresses \ -----------------  .LFC5E EQUW CmdBASIC-1 :\ *BASIC EQUW CmdQUIT-1 :\ *Ș EQUW CmdHELP-1 :\ *Ǔ EQUW CmdGO-1 :\ *GO EQUW CmdOS-1 :\ *OS EQUW CmdPAGE-1 :\ *  \ command buffer \ --------------------  .LFC6A EQUS 128,0) EQUS 128,0) $ . .LFD6A 8EQUS &FE00-P%,0) BEQUS &FE80-P%,0) LEQUS &FF00-P%,0) V `\ Command table j\ ============= t .LFF00 ~EQUW LFF17  .LFF02 EQUS "GO" :EQUB &C3 EQUS "HELP" :EQUB &82 EQUS "OS" :EQUB &84 EQUS "PAGE" :EQUB &C5 EQUS "QUIT" :EQUB &81  .LFF17 EQUS "BASIC":EQUB &80  EQUB &00   %\ Copy of BBC MOS API entry block %\ ===============================  EQUS &FF4E-P%,0) #.XOSFIND :\ &FF4E :JMP osFIND #.XOSGBPB :\ &FF51 :JMP osGBPB (#.XOSBPUT :\ &FF54 :JMP osBPUT 2#.XOSBGET :\ &FF57 :JMP osBGET <#.XOSARGS :\ &FF5A :JMP osARGS F#.XOSFILE :\ &FF5D :JMP osFILE P Z#.XOSRDCH :\ &FF60 :JMP osRDCH d-.XOSASCI :\ &FF63 :CMP #&0D:BNE XOSWRCH n-.XOSNEWL :\ &FF67 :LDA #&0A:JSR XOSWRCH x!.XOSPRCR :\ &FF6C :LDA #&0D #.XOSWRCH :\ &FF6E :JMP osWRCH #.XOSWORD :\ &FF71 :JMP osWORD #.XOSBYTE :\ &FF74 :JMP osBYTE ".XOS_CLI :\ &FF77 :JMP osCLI  (.XNMIV :\ &FF7A :EQUW NMIHandler #.XRESETV :\ &FF7C :EQUW RESET ..XIRQV :\ &FF7E :EQUW InterruptHandler   \ Main MOS API entry block \ ======================== EQUS &FF9E-P%,0) '.LFF9E :\ &FF9E :JMP NullReturn '.LFFA1 :\ &FFA1 :JMP NullReturn '.LFFA4 :\ &FFA4 :JMP NullReturn "'.LFFA7 :\ &FFA7 :JMP NullReturn ,9.LFFAA :\ &FFAA :JMP PrHex :\ Print A in hex 6:.LFFAD :\ &FFAD :JMP Pr2Hex :\ Print YX in hex @3.LFFB0 :\ &FFB0 :JMP NullIRQ :\ IRQ stub J<.LFFB3 :\ &FFB3 :JMP PrText :\ Print inline text T,.VECDEF :\ &FFB6 :EQUB &36:EQUW LFB87 ^(.LFFB9 :\ &FFB9 :JMP Unsupported h(.LFFBC :\ &FFBC :JMP Unsupported r>.LFFBF :\ &FFBF :JMP LF87F :\ Reset vectors, etc. |(.LFFC2 :\ &FFC2 :JMP Unsupported (.LFFC5 :\ &FFC5 :JMP Unsupported (.LFFC8 :\ &FFC8 :JMP Unsupported  \ Atom/System Entry Block \ ----------------------- $.OSSHUT :\ &FFCB :JMP (shutv) $.OSFIND :\ &FFCE :JMP (findv) $.OSBPUT :\ &FFD1 :JMP (bputv) $.OSBGET :\ &FFD4 :JMP (bgetv) $.OSSTAR :\ &FFD7 :JMP (starv) $.OSRDAR :\ &FFDA :JMP (rdarv) $.OSSAVE :\ &FFDD :JMP (savev) $.OSLOAD :\ &FFE0 :JMP (loadv)  $.OSRDCH :\ &FFE3 :JMP (rdchv) #.OSECHO :\ &FFE6 :JSR OSRDCH &,.OSASCI :\ &FFE9 :CMP #&0D:BNE OSWRCH 0,.OSNEWL :\ &FFED :LDA #&0A:JSR OSWRCH :!.OSPRCR :\ &FFF2 :LDA #&0D D$.OSWRCH :\ &FFF4 :JMP (wrchv) N#.OS_CLI :\ &FFF7 :JMP (cliv) X b\ Hardware vectors l\ ---------------- v'.NMIV :\ &FFFA :EQUW NMIHandler ".RESETV :\ &FFFC :EQUW RESET -.IRQV :\ &FFFE :EQUW InterruptHandler ]: @"Save "+save$+" "+~mcode%+" "+~O%+" "+~load%+" "+~load%  : *Quit