> Atom65/src < Source for Atom/System kernel for 65Tube Tube Emulator : (G >&8000:ș "OS_GetEnv"A$:A$,5)<>"B6502":"B6502"+A$,A$," ")) 2 :" at line ";: <: Ffname$="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 IOADDR=&FEE0 IOTUBE=&FEF8 C &0E21 - keypress, b7=1 - nothing pressed, 27=Escape pressed 1 &B001 - key matrix, b5=0 - Escape pressed : ERRBUF=&236:INPBUF=&236 :  Memory addresses: - &EC/D =>address to enter on MOS startup & &EE/F = PROG - Current program & &F0/1 = NUM - hex accumulator $ &F2/3 = MEMTOP - top of memory ? &F4/5 = address of byte transfer address, NMIAddr or ADDR , &F6/7 = ADDR - Data transfer address 2 &F8/9 = String pointer, OSWORD control block "J &FA/B = CTRL - OSFILE, OSGBPB control block, PrText string pointer , &FC = IRQ A store 6 &FD/E => last error @ &FF = Escape flag J: T" &0236 = command input buffer ^" &2EE = OSFILE control block h: r 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 !\ &02EE= OSFILE control block 4\ &03xx= bit16-bit23 of Turbo65 (zp),Y addresses 6\ &03F3= b16-b23 of (&F2),Y command string pointer &.\ &03F5= b16-b23 of (&F4),Y memtop pointer 05\ &03F9= b16-b23 of (&F8),Y control block pointer :.\ &03FB= b16-b23 of (&FA),Y string pointer D-\ &03FE= b16-b23 of (&FD),Y error pointer N X\ Emulator opcodes b \ &03 - l\ &13 - OSBYTE v\ &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   \ OSBYTE &A3,&F3 9\ Y=4 - RESET, *OS, NMIHandler. Request code to enter  <\ Y=6 - RESET occured, request command string to execute * 4 > \ *OS - Enter command prompt H \ ========================== R .CmdOS \0, enter code at XY A\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 JSR PrText 0EQUS "SYSTEM>* ":NOP :\ Display prompt LDX #LF84A 255 LDY #LF84A 256 5LDA #&00:JSR XOSWORD :\ Read line to INPBUF BCS CmdOSEscape LDX #INPBUF 255 /LDY #INPBUF 256 :\ Execute command 0, enter code at XY   .LF84A 'EQUW &0236 :\ Input buffer at &0236 %EQUB &B7 :\ Max. &B7 characters #EQUB &20 :\ Minimum character #EQUB &FF :\ Maximum character   .RESET  0LDX #&FF:TXS :\ Clear stack HJSR LF87F :\ Reset vectors and set memory limits 7LDY #&06:JSR OSByteA3 :\ Ask host something (CTYA:BNE OscliXY :\ If Y<>0, execute command at XY 2=\ If Y=0, display startup banner and enter command prompt <%\ If Y<>0, XY=>command to execute F P9JSR PrText :\ Print startup banner Z+EQUB 10:EQUS "Acorn Atom/System 65Tube" dEQUB 10:EQUB 13 nNOP x;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 DEX:BPL LF882 6STZ &FF:STZ &F0 :\ Clear escape flag HLDX #&10:STX &F1 :\ Set F0/1=>bottom of memory at &1000 "-LDX #&00:LDY #&F8 :\ XY=&F800 ,ESTX &F4:STY &F5 :\ Set F4/5=>top of memory at &F800 6RTS @ J\ Interupt handler T\ ================ ^.InterruptHandler h=STA &FC:PLA:PHA :\ Save A, get flags from stack r: #&10:BNE BRKHandler :\ If BRK, jump to BRK handler |: 1LDA &FC:PHA:JMP (irq1v) :\ Pass on to IRQ1V  .BRKHandler ILDA &FC:PLP:PHP:JMP (brkv):\ Restore A and flags, jump to BRK handler   .NullIRQ  PLA:RTI   \ Default error handler \ ===================== B\ On Atom/System, adjustment of &FD/E is done in error handler \ SP=>flags, ret.lo, ret.hi \ .ErrorHandler *TXA:PHA :\ Save X &:TSX:LDA &0103,X :\ Get address from stack 0CLD:SEC:SBC #&01:STA &FD :;LDA &0104,X:SBC #&00:STA &FE :\ &FD/E=>after BRK opcode DJLDA #&00:STA &03FE :\ Error block at (&FD),Y is in block &00 N:PLA:TAX:LDA &FC:CLI :\ Restore X, get saved A X b,\ Now continue into normal error handler l/LDX #&FF:TXS :\ Clear stack vJSR 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   .OSByteA3 2LDA #&A3:LDX #&F3 :\ OSBYTE &A3,&F3 /EQUB &13 :\ Host OSBYTE  RTS   \ Scan hex *\ ======== 4 .ScanHex >9LDX #&00:STX &F6:STX &F7 :\ Clear hex accumulator HESTX &03F3 :\ String at (&F2),Y is in block &00 R .LF8F7 \9LDA (&F2),Y :\ Get current character f.SEC:SBC #&30:BCC LF921 :\ <'0', exit p@CMP #&0A:BCC LF90E :\ '0'..'9', add into accumator z> #&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 GJMP SkipSpaces :\ Skip past any final spaces and exit  $\ Scan hex, error if null string  .LF924 2JSR ScanHex:PHP :\ Save flag $LCPX #&00:BEQ LF959 :\ X=0, nothing read in, 'Bad number' error .6PLP:RTS :\ Get flag back 8 B\ * - Set address L\ ======================== V .CmdPAGE `BJSR SkipSpaces:BEQ LF94A :\ No parameters, jump to use &1000 j:JSR LF924:BNE LF959 :\ Error if more parameters tPLDY &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 .EQUB 252:EQUS "Bad number":BRK :\ Bad hex .LF966 :SEC:RTS :\ SEC=pass command to host  \ *GO - Call machine code (\ ======================= 2 .CmdGO copyright message J\ Check for &00,"(C)" T?LDY #&00:LDA (&FD),Y:BNE LF9FC :\ Check for initial &00 ^7INY:LDA (&FD),Y:CMP #&28:BNE LF9FC :\ Check for '(' h7INY:LDA (&FD),Y:CMP #&43:BNE LF9FC :\ Check for 'C' r7INY: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 3LDA (&F4),Y:BEQ LF9F3 :\ Print ROM title JSR OSWRCH:INY:BNE LF9E9  .LF9F3 1JSR OSNEWL:JSR OSNEWL :\ Print two NLs 8PLA:BRA LF9FE :\ Get entry value back &D.LF9FC :\ No (C) string, enter as raw code 0.LDA #&00 :\ Set flag=0 : .LF9FE D5STA &F0 :\ Store flag at &F0 N+\ If flag=0, membot=&F0/1, memtop=&F4/5 X.\ If flag<>0, membot=010000, memtop=040000 bLDY #&00:TYA l .LFA03 vDSTA &0300,Y:DEY:BNE LFA03 :\ All (zp),Y accesses to block &00 7LDA #&01:JMP (&00F4) :\ Enter code with A=1  .LFA0E JSR ErrorInit 0BRK:EQUB 0:EQUS "I cannot run this code":BRK .LFA2A JSR ErrorInit 0BRK:EQUB 0:EQUS "This is not a language":BRK  .ErrorInit 4LDA #ErrorHandler 255:STA brkv+0 :\ Claim brkv &LDA #ErrorHandler 256:STA brkv+1 RTS  \ *Ǔ - Display help \ ==================== .CmdHELP *2JSR SkipSpaces:BNE LFA5C :\ Exit if parameters 46JSR OSNEWL:JSR HelpBanner:\ Display startup banner > .LFA5C H;SEC:RTS :\ Return, SEC to pass to host R \.HelpBanner fJSR PrText p4EQUS "65Tube Atom/System MOS 0.10 (21 Feb 2012)" zEQUB 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 -CMP #&84:BEQ BYTE84 :\ Read top of memory =CMP #&85:BEQ BYTE85 :\ Read top of memory for screen mode )CMP #&8E:BEQ BYTE8E :\ Enter language 9CMP #&A3:BNE BYTEnn :\ Jump if not Application OSBYTE (CPX #&FE:BCC BYTEnn :\ Jump if X<&FE 9\ OSBYTE &A3,&FE and OSBYTE &A3,FF - return unchanged PLA $RTS . 8..BYTEnn :\ Pass OSBYTE to host B#EQUB &13 :\ MOS_BYTE L!PLA:RTS :\ Return V `0.BYTE82 :\ Read memory high word j*LDX #&00:LDY #&00 :\ High word=&0000 t 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  -.BYTE84 :\ Read top of memory %PLA :\ Get A back 6LDX &F0:BEQ LFACD :\ If &F0=0, &F4/5=>memory top  $LDA #&04 :\ Set A=&04 4LDX #&00:LDY #&00 :\ Return memory top=&040000 RTS ( .LFACD 25LDX &F4:LDY &F5 :\ Get memory top from &F4/F5 <RTS F P8.BYTE85 :\ Read top of memory for screem Z5LDX #&00:LDY #&80 :\ Return top of memory=&8000 d/PLA:RTS :\ Restore A and return n x).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  .osGBPB .EQUB &93:RTS :\ Pass OSGBPB to host .osBPUT:.atomBPUT .EQUB &83:RTS :\ Pass OSBPUT to host .osBGET:.atomBGET .EQUB &73:RTS :\ Pass OSBGET to host  .osARGS ".EQUB &63:RTS :\ Padd OSARGS to host , .osFILE 6.EQUB &53:RTS :\ Pass OSFILE to host @ .osRDCH J.EQUB &43:RTS :\ Padd OSRDCH to host T.osWRCH:.atomWRCH ^.EQUB &33:RTS :\ Pass OSWRCH to host h r$\ 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  .SwapRDCH * #&77 :\ Swap &08 and &7F  .RDCHdone  PLP:RTS  \ Atom file interface \ ------------------- & 0\ OSLOAD - Load a file :\ -------------------- D\ On entry, X=>zero page N$\ X+0/1=>file name X&\ X+2/3=Load address bA\ X+4 =if bit 7=0 use the file's start address l%\ CC=Return immediately v7\ 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 &\ X+2/3=load address +\ X+4/5=execution address 7\ X+6/7=start address of data to save 9\ X+8/9=(end address)+1 of data to save %\ CC=Return immediately  7\ CS=Wait until IRQ/DMA actions completed \ On exit, all preserved  .atomSAVE * LDA #&00 4 .doFILE >PHA HTYA:PHA:TXA:PHA R%LDA 0,X:STA &2EE :\ =>filename \LDA 1,X:STA &2EF f LDY #0 p .doFILElp zLDA 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  .callFILE 1LDX #&EE:LDY #&02 :\ Point to control block .EQUB &53 :\ Pass OSFILE to host 6TSX:STA &103,X :\ Store return value on stack ,PLA:TAX:PLA:TAY :\ Restore registers 6PLA:RTS :\ Get return value and return  $$\ OSRDAR - Read file's arguments .$\ ------------------------------ 8&\ On entry, X=>zero page location B\ Y=handle L\ A=0 - read V\ A=1 - read `&\ A=2 - read allocation j,\ On exit, X+0-X+3 = returned argument t \ 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  .atomSTAR 1PHA:LDA #0:SEC :\ Do odd-numbered OSARGS  .doARGS 3ROL A :\ Convert to OSARGS action  .EQUB &63 :\ Pass OSARGS to host /PLA:RTS :\ Restore A and return  (\ OSFIND - Open file 2\ ------------------ <\ On entry, X=>zero page F#\ X+0/1=file name P&\ CS=Open file for input Z'\ CC=Open file for output d3\ On exit, A=file handle, 0 if file not found n\ X,Y=preserved x .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 )TSX:STA &103,X :\ Store on stack &PLA:TAX:PLA:TAY :\ Restore X,Y 0PLA:RTS :\ Get handle and return  \ OSSHUT - Close a file \ --------------------- \ On entry, Y=file handle "\ On exit, all preserved , .atomSHUT 6-PHA:LDA #0 :\ OSFIND &00 - Close @.EQUB &A3 :\ Pass OSFIND to host J PLA:RTS T ^ h\ OSWORD Handler r\ ============== | .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 -LDX #&00:LDA (&FA,X) :\ Read from address 7PLA:STA &FA:PLA:STA &FB :\ &FA/B=>embedded string HBLDY #&00:STY &03FB :\ String at (&FA),Y is in block &00 RINY \ .LFB4A f.LDA (&FA),Y :\ Get character p,CMP #&EA:BEQ LFB56 :\ Exit if NOP z=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 \ ------------------  .PrString 2STX &FA:STY &FB :\ Store XY in &FA/B BLDY #&00:STY &03FB :\ String at (&FA),Y is in block &00  .LFB6C 0LDA (&FA),Y :\ Get a character 5CMP #&20:BCC LFB78 :\ Exit at control char 0JSR OSWRCH:INY:BNE LFB6C :\ Print character $ .LFB78 .RTS 8 B.Unsupported LBRK VBRK:EQUS "Unsupported":BRK ` j\ Default vectors t .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 )EQUW atomBGET :\ &214 - bgetv )EQUW atomBPUT :\ &216 - bputv )EQUW atomFIND :\ &218 - findv )EQUW atomSHUT :\ &21A - shutv  (EQUW NullReturn :\ &21C - v21C (EQUW NullReturn :\ &21E - v21E (EQUW NullReturn :\ &220 - v220 ((EQUW NullReturn :\ &222 - v222 2(EQUW NullReturn :\ &224 - v224 <(EQUW NullReturn :\ &226 - v226 F(EQUW NullReturn :\ &228 - v228 P(EQUW NullReturn :\ &22A - v22A Z(EQUW NullReturn :\ &22C - v22C d(EQUW NullReturn :\ &22E - v22E n(EQUW NullReturn :\ &230 - v230 x(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 5STX &F2:STY &F3 :\ &F2/3=>command string ALDY #&00:STY &03F3 :\ String at (&F2),Y is in block &00  .LFBC6 CLDA (&F2),Y:STA LFC6A,Y :\ Copy command line to command buffer /CMP #&0D:BEQ LFBD3 :\ Loop until =INY:BNE LFBC6 :\ Loop for up to 256 characters  .LFBD2 "3RTS :\ No found, exit , .LFBD3 6LDX #LFC6A 255 @8LDY #LFC6A 256 :\ Point XY to command buffer J=STX &F2:STY &F3 :\ Point &F2/3 to command buffer TLDX #&00:LDY #&FF ^ .LFBDF h9JSR SkipSpaces1 :\ Move past and skip spaces r,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  .LFC05 ?LDA LFF02,X:BMI LFC20 :\ Jump if at end of command table 8 (&F2),Y :\ Compare with command table ; #&DF:BNE LFC14 :\ Ignore case, jump if no match I :\ it generates an NMI and returns <>0 from H/ :\ Osbyte 163,&F3 R .LFC4A \RTS f p .LFC4B z8LDA 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   .Pr2Hex TYA:JSR PrHex:TXA  .PrHex PHA:LSR A:LSR A:LSR A:LSR A JSR PrNyb:PLA  .PrNyb  #15:CMP #10:BCC P%+4 $ADC #6:ADC #48:JMP OSWRCH . 8\ Command addresses B\ ----------------- L .LFC5E VEQUW CmdBASIC-1 :\ *BASIC `EQUW CmdQUIT-1 :\ *Ș jEQUW CmdHELP-1 :\ *Ǔ tEQUW CmdGO-1 :\ *GO ~EQUW CmdOS-1 :\ *OS EQUW CmdPAGE-1 :\ *  \ command buffer \ --------------------  .LFC6A EQUS 128,0) EQUS 128,0)   .LFD6A EQUS &FE00-P%,0) EQUS &FE80-P%,0) EQUS &FF00-P%,0)   \ Command table \ =============  .LFF00 (EQUW LFF17 2 .LFF02 <EQUS "GO" :EQUB &C3 FEQUS "HELP" :EQUB &82 PEQUS "OS" :EQUB &84 ZEQUS "PAGE" :EQUB &C5 dEQUS "QUIT" :EQUB &81 n .LFF17 xEQUS "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 #.XOSBGET :\ &FF57 :JMP osBGET #.XOSARGS :\ &FF5A :JMP osARGS #.XOSFILE :\ &FF5D :JMP osFILE  #.XOSRDCH :\ &FF60 :JMP osRDCH -.XOSASCI :\ &FF63 :CMP #&0D:BNE XOSWRCH -.XOSNEWL :\ &FF67 :LDA #&0A:JSR XOSWRCH "!.XOSPRCR :\ &FF6C :LDA #&0D ,#.XOSWRCH :\ &FF6E :JMP osWRCH 6#.XOSWORD :\ &FF71 :JMP osWORD @#.XOSBYTE :\ &FF74 :JMP osBYTE J".XOS_CLI :\ &FF77 :JMP osCLI T ^(.XNMIV :\ &FF7A :EQUW NMIHandler h#.XRESETV :\ &FF7C :EQUW RESET r..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 :.LFFAD :\ &FFAD :JMP Pr2Hex :\ Print YX in hex 3.LFFB0 :\ &FFB0 :JMP NullReturn :\ IRQ stub <.LFFB3 :\ &FFB3 :JMP PrText :\ Print inline text ,.VECDEF :\ &FFB6 :EQUB &36:EQUW LFB87 (.LFFB9 :\ &FFB9 :JMP Unsupported (.LFFBC :\ &FFBC :JMP Unsupported >.LFFBF :\ &FFBF :JMP LF87F :\ Reset vectors, etc. &(.LFFC2 :\ &FFC2 :JMP Unsupported 0(.LFFC5 :\ &FFC5 :JMP Unsupported :(.LFFC8 :\ &FFC8 :JMP Unsupported D N\ Atom/System Entry Block X\ ----------------------- b$.OSSHUT :\ &FFCB :JMP (shutv) l$.OSFIND :\ &FFCE :JMP (findv) v$.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 ,.OSNEWL :\ &FFED :LDA #&0A:JSR OSWRCH !.OSPRCR :\ &FFF2 :LDA #&0D $.OSWRCH :\ &FFF4 :JMP (wrchv) #.OS_CLI :\ &FFF7 :JMP (cliv) ! ! \ Hardware vectors !\ ---------------- ! '.NMIV :\ &FFFA :EQUW NMIHandler !*".RESETV :\ &FFFC :EQUW RESET !4-.IRQV :\ &FFFE :EQUW InterruptHandler !>]: !HA"Save "+fname$+" "+~mcode%+" "+~O%+" "+~load%+" "+~load% !R : !\ *Quit