	OUT L
W07	EQU $13
W0700	EQU $1300
W17	EQU $1F
	ORG $06F4,$A8F4
	DFW $FFFF,$02E0,$02E1,START,$0C00,$1913
	JMP SETV
	JMP TOS
BSOFF	SEI
	LDA #0
	STA $D40E
	LDA $D301
	RTS
BSON	STA $D301
	LDA #$40
	STA $D40E
	CLI
	RTS
CHIPINIT	LDA #3
	STA $D20F
	LDA #0
	STA $D208
	RTS
SROUT	LDA SAVEKEY
	BEQ SROUT1
	JSR GETKEY
SROUT1	JSR CHIPINIT
	TSX
	STX SP
	JSR SMOTON
	LDX #NAMEBUF:L
	STX $36
	LDX #NAMEBUF:H
	STX $37
	LDX #$14
	STX $38
	LDX #$3
	STX $3E
	JSR SVORTON
	LDA $39
	CLC
	ADC #1
	DEX
	JSR SBYTE
	LDX #$12
SROUT2	LDA $0032,Y
	JSR SBYTE
	LDX #$10
	INY
	CPY #4
	NOP
	BNE SROUT2
	LDY #0
	LDX #$E
SROUT3	LDA ($36),Y
	CPY $38
	BCC SROUT4
	LDA #$20
	DEX
SROUT4	JSR SBYTE
	LDX #$F
	INY
	CPY #$BB
	BNE SROUT3
	JSR BSRAM
	LDA #4
	STA $3E
	JSR SVORTON
	TYA
	JSR SBYTE
	STY $31
	LDX #$14
SROUT5	DEX
	DEX
	DEX
	DEX
	DEX
SROUT6	LDA ($32),Y
	JSR SBYTE
	LDX #$E
	INC $32
	BNE SROUT7
	INC $33
	LDX #$A
	LDA $33
	CMP #$D0
	BNE SROUT7
	LDX #9
	LDA #$D8
	STA $33
SROUT7	LDA $32
	CMP $34
	LDA $33
	SBC $35
	BCC SROUT6
	LDA $35
	CMP #$00
	BNE SROUT9
	LDA $33
	ORA $32
	BNE SROUT5
	JMP SROUT8
SROUT8	DEX
	DEX
	DEX
	DEX
SROUT9	DEX
	DEX
	DEX
	LDA $31
SROUTA	JSR SBYTE
	LDX #$11
	DEY
	BNE SROUTA
	LDA #0
SROUTC	STA $30
	LDA #$3C
	STA $D302
	JSR CHIPINIT
	LDY #$22
	BNE SROUTB
SMOTON	LDY #$34
	STY $D302
	JSR DEXY
	STY $39
SROUTB	STY $D400
	RTS
SVORTON	LDY #0
	STY $30
SVORTON1	LDA #2
	JSR SBYTE
	LDX #$11
	DEY
	CPY #9
	BNE SVORTON1
	LDX #$F
	DEC $3E
	BNE SVORTON1
SVORTON2	TYA
	JSR SBYTE
	LDX #$11
	DEY
	BNE SVORTON2
	DEX
	DEX
	RTS
SBYTE	STA $3F
	EOR $31
	STA $31
	LDA #8
	STA $40
SBYTE1	ASL $3F
	LDA $30
	EOR #7
	JSR SBIT
	LDX #$1B
	NOP
	EOR #$80
	JSR SBIT
	LDX #$18
	DEC $40
	BNE SBYTE1
	RTS
SBIT     DEX
	BNE SBIT
	LDX $D20E
	BPL SBIT1
	LDX $00
	LDX #$00
	STX $D20E
	DEX
	STX $D20E
	BCC SBIT2
	LDX #$13
SBIT3	DEX
	BNE SBIT3
SBIT2	STA $D20F
	RTS
SBIT1	LDX SP
	TXS
	LDA #$80
	JMP SROUTC
LROUT	JSR CHIPINIT
	TSX
	STX SP
	JSR LMOTON
	LDA $33
	BNE LROUT4
LROUT1	JSR LVORTON
	LDA $40
	BEQ LROUT1
LROUT2	STA $0031,Y
	JSR LBYTE
	INY
	CPY #5
	BNE LROUT2
	LDY #0
LROUT3	STA NAMEBUF,Y
	JSR LBYTE
	INY
	CPY #$14
	BNE LROUT3
	BEQ LROUTB
LROUT4	STA $37
	JSR BSRAM
	LDA $32
	STA $36
LROUT5	JSR LVORTON
	TAX
	BNE LROUT5
	STY $31
	LDX #$36
	STX $D01A
LROUT8	JSR LBYTE
	LDY #0
	STA ($36),Y
	EOR $31
	STA $31
	INC $36
	BNE LROUT6
	INC $37
	LDA $37
	CMP #$D0
	BNE LROUT6
	LDA #$D8
	STA $37
LROUT6	LDA $35
	BNE LROUT7
	LDA $37
	BNE LROUT8
	BEQ LROUT9
LROUT7	LDA $36
	CMP $34
	LDA $37
	SBC $35
	BCC LROUT8
LROUT9	JSR LBYTE
	CMP $31
	BNE LROUTA
LROUTB	INX
LROUTA	STX $30
	JSR CHIPINIT
	JMP LMOTOFF
LVORTON	LDA #$70
	STA $D208
	LDA #$D2
	STA $D200
	LDA #1
	STA $D202
LVORTON1	LDX #0
	STX $D01A
	JSR LBIT
	ROL $40
	LDA $40
	CMP #2
	BNE LVORTON1
	STA $D01A
	LDY #9
LVORTON2	JSR LBYTE
	CMP #2
	BEQ LVORTON2
LVORTON3	CPY $40
	BNE LVORTON1
	JSR LBYTE
	DEY
	BNE LVORTON3
	RTS
LBYTE	LDA #8
	STA $3F
LBYTE1	JSR LBIT
	ROL $40
	DEC $3F
	BNE LBYTE1
	LDA $40
	RTS
LBIT3	LDX SP
	TXS
	LDX #$80
	BNE LROUTA
LBIT	LDA #1
LBIT1	BIT $D20E
	BNE LBIT1
LBIT4	LDA #$80
LBIT2	BIT $D302
	BEQ LBIT2
	LDA $D20E
	BPL LBIT3
	PHA
	LDX #0
	STX $D20E
	DEX
	STX $D20E
	STX $D209
	LDA $D300
	PLA
	EOR #3
	LSR
	LSR
	RTS
LMOTOFF	LDA #$3C
LMOTOFF2	STA $D302
	TAY
	JSR DEXY
	STX $D01A
	LDA #$22
	BNE LMOTON1
LMOTON	LDA #$36
	JSR LMOTOFF2
	JSR LBIT4
	TYA
LMOTON1	BIT $D40B
	BNE LMOTON1
	STA $D400
	RTS
TURBOV	DFW OPEN-1,CLOSE-1,GETBYTE-1,PUTBYTE-1,GETSTAT-1,RTS1-1
	DFB $4C
	DFW GETSTAT
	DFB $00
OPEN	JSR BSOFF
	PHA
	LDX #4
	LDA #0
OPEN1	STA $D016,X
	LDA #$26
	DEX
	BPL OPEN1
	LDX #$13
	LDA #0
OPEN2	STA NEEDN-7,X
	STA NAMEBUF,X
	DEX
	BPL OPEN2
	LDX #$21
	STX NAMEBUF+$13
	STX NAMEBUF+$F
	LDX #$30
	STX NAMEBUF+$E
	LDX #$32
	STX NAMEBUF+$10
	LDX #$34
	STX NAMEBUF+$11
	JSR OPEN3
	PLA
	JSR BSON
	STY FNE
	RTS
OPEN3	LDA $2A
	STA FN
	CMP #8
	BEQ JSOPEN
	CMP #4
	BEQ JLOPEN
	RTS
JSOPEN	JMP SOPEN
JLOPEN	JSR SNAME
	LDA FNR
	AND #$FE
	CMP #$30
	BEQ TLOPEN
	JMP RLOPEN
TLOPEN6	CPY #$FF
	BNE TLOPEN3
TLOPEN	LDA #0
	STA $33
	LDA #$E0
	STA $D409
TLOP	LDA $D40B
	BNE TLOP
	LDA #DLIST1:L
	STA $D402
	LDA #DLIST1:H
	STA $D403
	JSR LROUT
	LDY $30
	BPL TLOPEN1
TLOPEN3	STY RAMDKZ
	STY NAMEBUF+$13
	RTS
TLOPEN1	LDA #$FF
	STA $D301
	JSR GETKEY
	CMP ' 
	BNE TLOPEN
	LDA NAMEBUF+$13
	AND #$3F
	CMP #$21
	BNE TLOPEN
	LDX #$31
	LDA $33
	CMP #$C0
	BEQ TLOPEN2
	DEX
	CMP #W07
	BNE TLOPEN
TLOPEN2	STX FNR
	JSR LROUT
	LDY $30
	BMI TLOPEN6
TLOPEN7	LDX #2
	LDY FNR
TLOPEN5	LDA W0700,X
	CPY #$30
	BEQ TLOPEN4
	LDA $C000,X
TLOPEN4	STA KENNBYTE,X
	DEX
	BPL TLOPEN5
	LDY #1
	LDA #3
	STA $32
	RTS
SOPEN	LDA #NAMEE:L
	STA DLIST8+$9
	LDA #DLIST8:L
	STA $D402
	LDA #DLIST8:H
	STA $D403
	JSR SNAME
	LDA FNR
	LDY #$FC
	AND #$FE
	CMP #$30
	BEQ TSOPEN
	LDY #$FA
TSOPEN	STY KENNBYTE
	LDA FNR
	LDY #W07
	AND #$FD
	CMP #$30
	BEQ TSOPEN1
	LDY #$C0
TSOPEN1	STY $33
	STY AREGE+1
	STY $35
	LDA #0
	STA $32
	LDA #3
	STA $34
	STA AREGE
GETSTAT	LDY #1
RTS1	RTS
GETBYTE	LDY FNE
	CPY #$1
	BEQ GETBYTE1
	RTS
GETBYTE5	LDY #1
GETBYTE6	PLA
	JSR BSON
	TXA
	RTS
GETBYTE1	JSR BSOFF
	PHA
GETBYTEE	LDY #0
	JSR BSRAM
	LDA ($32),Y
	INC $32
	BNE GETBYTE2
	INC $33
	LDY $33
	CPY #$D0
	BNE GETBYTE2
	LDY #$D8
	STY $33
GETBYTE2	TAX
	LDA AREGE
	CMP $32
	LDA AREGE+1
	SBC $33
	BCS GETBYTE5
	LDA AREGE+1
	BNE GETBYTE4
	LDA $33
	BNE GETBYTE5
GETBYTE4	LDY #$88
	LDX KENNBYTE
	LDA AREGE+1
	AND #$C0
	CMP #$C0
	BNE GETBYTEF
	LDX $C000
	CPX #$FA
	BEQ GETBYTE6
	LDY #162
GETBYTEF	CPX #$FC
	BNE GETBYTE6
	LDX #$B
GETBYTE9	LDA NAMEBUF,X
	STA NEEDN,X
	DEX
	BPL GETBYTE9
	INC $D301
	INC NAMEBUF+$13
GETBYTEA	LDA NAMEBUF+$13
GETBYTE8	PHA
	LDA #0
	STA $33
	LDA #$E0
	STA $D409
GETBY	LDA $D40B
	BNE GETBY
	LDA #DLIST3:L
	STA $D402
	LDA #DLIST3:H
	STA $D403
	JSR LROUT
	LDY $30
	BPL GETBYTEB
	PLA
GETBYTEX	JMP GETBYTE6
GETBYTEB	LDA #$34
	STA $D302
	LDA #$FF
	STA $D301
	LDA #6
	JSR TOSB3
	LDA #$3C
	STA $D302
	PLA
	CMP NAMEBUF+$13
	BNE GETBYTE8
	LDX #$B
GETBYTEC	LDA NAMEBUF,X
	CMP NEEDN,X
	BNE GETBYTEA
	DEX
	BPL GETBYTEC
	JSR LROUT
	LDY $30
	BPL GETBYTED
	CPY #$FF
	BNE GETBYTEX
	BEQ GETBYTEA
GETBYTED	JSR TLOPEN7
	JMP GETBYTEE
SNAME	LDY #1
	LDA ($24),Y
	TAX
	DEX
	CMP #$32
	BEQ SNAME1
	CMP #$33
	BEQ SNAME6
	CMP #$34
	BEQ SNAME6
	LDX #$30
SNAME1	STX FNR
SNAME2	INY
	CMP #$9B
	BEQ SNAME7
	CMP #$3A
	BEQ SNAME3
	LDA ($24),Y
	CPY #3
	BNE SNAME2
	BEQ SNAME7
SNAME3	LDX #$14
	LDA $2A
	CMP #8
	BNE SNAME4
	LDX #0
SNAME4	LDA ($24),Y
	CMP #$9B
	BEQ SNAME8
	CLC
	ADC #$20
	STA NAMEBUF,X
	INY
	INX
	CPX #$C
	BEQ SNAME5
	CPX #$20
	BNE SNAME4
SNAME5	RTS
SNAME6	STX FNR
	RTS
SNAME7	LDA $2A
	CMP #8
	BNE SNAME5
SNAME9	LDX #0
SNAME8	TXA
	BNE SNAME5
	TAY
SNAME10	LDA #$4E
	STA NAMEBUF,Y
	TYA
	PHA
	JSR GETKEY
	CMP #$20
	BNE SNAME11
	LDA #0
	BEQ SNAME12
SNAME11	CLC
	ADC #$20
SNAME12	TAX
	PLA
	TAY
	CPX #$3B
	BEQ SNAME9
	TXA
	STA NAMEBUF,Y
	INY
	CPY #$C
	BNE SNAME10
	RTS
GETKEY	LDY #$60
	JSR DEXY
GETKEY2	LDA $D20F
	AND #4
	BNE GETKEY2
	LDA $D209
	AND #$7F
GETKEY3	TAY
	LDA ($79),Y
	CMP #$61
	BCC GETKEY4
	CMP #$7B
	BCS GETKEY4
	TYA
	ORA #$40
	JMP GETKEY3
GETKEY4	CPY $2F2
	STY $2F2
	BEQ GETKEY5
	LDY #$60
	JSR DEXY
GETKEY5	LDY #$FF
	STY $02FC
	LDY #1
	RTS
RLOPEN	LDA RAMDKZ
	BEQ RLOPEN2
	LDY #$88
	RTS
RLOPEN2	LDA AREGE+1
	AND #$80
	LDX #$32
	LDY #W07
	CMP #$80
	BNE RLOPEN1
	INX
	LDY #$C0
RLOPEN1	STX FNR
	STY $33
	LDY #3
	STY $32
	LDY #1
	RTS
PUTBYTE	LDY FNE
	CPY #1
	BEQ PUTBYTE1
	RTS
PUTBYTE1	TAX
	JSR BSOFF
	PHA
	LDY #0
	JSR BSRAM
	TXA
	STA ($34),Y
	INC $34
	LDA $34
	STA AREGE
	BNE PUTBYTE2
	INC $35
	LDA $35
	STA AREGE+1
	BEQ PUTBYTE3
	CMP #W17
	BEQ PUTBYTE3
	CMP #$D0
	BNE PUTBYTEG
	LDA #$D8
	STA $35
PUTBYTEG	STA AREGE+1
PUTBYTE2	LDY #1
PUTBYTE4	PLA
	JSR BSON
	STY FNE
	RTS
PUTBYTE3	LDA FNR
	LDY #162
	AND #$FE
	CMP #$32
	BEQ PUTBYTE4
	LDY #2
PUTBYTE7	LDA KENNBYTE,Y
	STA ($32),Y
	DEY
	BPL PUTBYTE7
	LDA $33
	PHA
	JSR SROUT
	INC NAMEBUF+$13
	PLA
	STA $33
	STA $35
	STA AREGE+1
	LDA #0
	STA $32
	LDA #3
	STA $34
	STA AREGE
	LDY $30
	BPL PUTBYTE2
	BMI PUTBYTE4
CLOSE	LDA FNR
	ORA FN
	AND #$FE
	LDY FNE
	DEY
	BNE CLOSE6
	CMP #$36
	BEQ CLOSE4
	CMP #$38
	PHP
	LDA NAMEBUF+$13
	AND #$3F
	SEC
	SBC #$21
	PLP
CLOSE6	STA RAMDKZ
	BEQ CLOSE1
CLOSE4	LDY #1
	RTS
CLOSE1	LDA #$FA
	STA KENNBYTE
	JSR BSOFF
	PHA
	JSR BSRAM
	LDY #2
CLOSE3	LDA KENNBYTE,Y
	STA ($32),Y
	DEY
	BPL CLOSE3
	JSR SROUT
	PLA
	JSR BSON
	LDY $30
	BEQ CLOSE4
	RTS
SETV	LDA $D01F
	AND #1
	BNE SETV1
	JMP $E477
SETV1	LDX #$C
	LDA #$54
	STA TLDEV
	STA TSDEV
	STA $31D,X
	INX
	LDA #TURBOV:L
	STA $31D,X
	INX
	LDA #TURBOV:H
	STA $31D,X
	LDA #0
	STA $2E7
	LDA #$1F
	STA $2E8
	RTS
BSRAM	LDA #$FE
	STA $D301
	RTS
DLIST1	DFB $70,$70,$70,$70,$70,$46
	DFW NEEDN
	DFB $70,$70,$70,$46
	DFW FOUNDA
	DFB $70,$47
	DFW NAMEBUF
	DFB $70,$70,$70,$46
	DFW GETA
	DFB $41
	DFW DLIST1
NAMEBUF	ASC %                    %
NEEDN	ASC %             TO LOAD%
RAMDKZ	DFB $10
FNR	DFB $30
GETA	ASC %PRESS SPACE  TO LOAD%
KENNBYTE	DFB $FA
AREGE	DFB $03,$07
SP	DFB $80
FNE	DFB $1
NAMEE	ASC % PLEASE ENTER NAME.%
FOUNDA	ASC %      FOUND...%
STARTA	ASC %      START...    %
RAMDOV	ASC %  RAMDISK OVERLOAD %
LADA	ASC % CHAOS-LOADER 2  BY %
DLIST3	DFB $70,$70,$70,$70,$70,$46
	DFW NEEDN
	DFB $70,$70,$70,$46
	DFW FOUNDA
	DFB $70,$47
	DFW NAMEBUF
	DFB $41
	DFW DLIST3
SAVEKEY	DFB $0
FN	DFB $4
DLIST6	DFB $70,$70,$70,$46
	DFW TOSZ1
	DFB $30,$7
	DFB $70,$6,$6,$6,$6,$6,$6,$6,$41
	DFW DLIST6
TOSZ1	ASC % TOS 1.1 WRITTEN BY %
TOSZ2	ASC % THE CHAOTIC HACKER %
TOSZ3	ASC %A RUN CHAOS-LOADER 2%
TOSZA	ASC %B GO CARTRIDGE/BASIC%
TOSZ5	ASC %C COPY FILE         %
TOSZ6	ASC %D SAVE MEMORY       %
TOSZ7	ASC %E EXECUTE T:*.COM   %
TOSZ8	ASC %F KEY TO SAVE: N    %
TOSZ9	ASC %G GOTO HEX ADDRESS  %
JUMPTAB	DFW TOSA,TOSB,TOSC,TOSD,TOSE,TOSF,TOSG
DLIST7	DFB $70,$70,$70,$70,$70,$70,$70,$70,$46
	DFW SAVEN
	DFB $41
	DFW DLIST7
AFN	DFB $0
DLIST8	DFB $70,$70,$70,$70,$70,$70,$70,$70,$46
	DFW FOUNDA
	DFB $70,$70,$70,$70,$47
	DFW NAMEBUF
	DFB $41
	DFW DLIST8
TAB	ASC "PQRSTUVWXYabcdef"
TLDEV	DFB $54,$9B
TSDEV	ASC "T1:AAAAAAAAAAAA"
	DFB $9B
SAVEKEN	DFB $FF,$FF,$E0,$2,$E1,$2
	ASC "      "
SAVEE	ASC %FROM/TO/RUNAD:      %
GOAD	ASC %ADDRESS?           %
SAVEN	ASC % SAVE 1, 2, N OR Y? %
CART	ASC %SORRY, NO CARTRIDGE!%
DEXY	DEX
	BNE DEXY
	INY
	BNE DEXY
	RTS
TOSB	LDA $BFFC
	BNE TOSB1
	INC $BFFC
	CMP $BFFC
	BNE TOSB1
	JSR TOSB2
	JMP ($BFFA)
TOSB2	JMP ($BFFE)
TOSB1	LDA #CART:L
	JSR DLIST7S
TOSB5	LDA #$04
TOSB3	TAY
TOSB4	JSR DEXY
	SEC
	SBC #$01
	BNE TOSB4
	RTS
SCR	LDA $E411
	PHA
	LDA $E410
	PHA
	RTS
TOS	LDX #$FF
	TXS
	CLD
	LDA #DLIST6:L
	STA $0230
	LDA #DLIST6:H
	STA $0231
TOS1	JSR GETKEY
	SEC
	SBC #$41
	CMP #7
	BCS TOS1
	ASL
	TAX
	LDA JUMPTAB,X
	STA TOS2+1
	INX
	LDA JUMPTAB,X
	STA TOS2+2
	JSR SCR
TOS2	JSR $0000
	JMP TOS
DLIST7S	STA DLIST7+9
	LDA #DLIST7:L
	STA $0230
	LDA #DLIST7:H
	STA $0231
	RTS
TOSASCR  STA DLIST8+9
	LDA #DLIST8:L
	STA $0230
	LDA #DLIST8:H
	STA $0231
TOSASCR2	LDY #$00
	JMP DEXY
TOSALA	JSR BSOFF
	PHA
	JSR LROUT
	PLA
	JMP BSON
TOSA	LDA #0
	STA AFN
	LDA #LADA:L
	JSR TOSASCR
TOSA1	LDA TOSZ2,Y
	STA NAMEBUF,Y
	INY
	CPY #$14
	BNE TOSA1
	JSR TOSASCR2
	STY $33
	JSR TOSALA
	LDA $30
	BPL TOSA2
TOSA3	RTS
TOSA2	LDA #FOUNDA:L
	JSR TOSASCR
	JSR GETKEY
	JSR TOSALA
	LDA $30
	BMI TOSA3
	LDA #STARTA:L
	JSR TOSASCR
TOSAB	JSR TOSAXA
	STX $02E0
	STA $02E1
	JSR TOSAKEN
	LDA $43
	STA TOSAST2+4
	LDA $44
	STA TOSAST2+5
	JMP TOSA4
TOSAXA	LDX #RTS1:L
	LDA #RTS1:H
	STX $02E2
	STA $02E3
	RTS
TOSA5	JSR TOSAXA
	JSR TOSAKEN
TOSA4	JSR TOSABYT
	BCS TOSAST
	LDY #0
	STA ($43),Y
	LDA AFN
	BNE TOSA6
	LDA $44
	AND #$F8
	CMP #$D0
	BEQ TOSA6
	LDA $33
	BEQ TOSA6
	LDY $43
	LDA $44
	CPY $32
	SBC $33
	STA $D40A
	BCC TOSA6
	LDA $35
	BEQ TOSA9
	LDA $44
	CPY $34
	SBC $35
	BCC TOSA9
TOSA6	INC $43
	BNE TOSA7
	INC $44
TOSA7	LDY $45
	LDA $46
	CPY $43
	SBC $44
	BCS TOSA4
	JSR TOSA8
	JMP TOSA5
TOSA8	JMP ($02E2)
TOSA9	LDA #RAMDOV:L
	JSR TOSASCR
TOSAA	JMP TOSAA
TOSAST1	LDA #$40
	STA $D40E
	JMP ($02E0)
TOSAST	LDA AFN
	BEQ TOSAST2
	LDA #$C
	JSR TOSABYT6
TOSAST2	JSR TOSAST1
	JSR $0000
	JMP $E474
TOSAKEN	JSR TOSABYTT
	BCS TOSAKEN1
	STX $43
	STA $44
	AND $43
	CMP #$FF
	BEQ TOSAKEN
	JSR TOSABYTT
	STX $45
	STA $46
TOSAKEN1	RTS
TOSABYTT	JSR TOSABYT
	BCS TOSAKEN1
	TAX
TOSABYT  STX TOSABYT5+1
	LDA AFN
	BNE TOSABYT4
	LDA $35
	BEQ TOSABYT1
	LDY $32
	LDA $33
	CPY $34
	SBC $35
	BCC TOSABYT1
TOSABYT2	SEC
	RTS
TOSABYT1	LDA $33
	BEQ TOSABYT2
	JSR BSOFF
	STA $40
	JSR BSRAM
	LDY #0
	LDA ($32),Y
	PHA
	TYA
	STA ($32),Y
	LDA $40
	JSR BSON
	INC $32
	BNE TOSABYT3
	INC $33
	LDA $33
	CMP #$D0
	BNE TOSABYT3
	LDA #$D8
	STA $33
TOSABYT3	PLA
	CLC
	RTS
TOSABYT4	LDX #0
	STX $0358
TOSABYT7	LDA #7
TOSABYT8	STX $0359
TOSABYT6	STA $0352
TOSABYT9	LDX #$10
	JSR $E456
	BMI TOSABYT2
TOSABYT5	LDX #0
	CLC
	RTS
TOSC	LDA #$C
	JSR TOSABYT6
	LDA #4
	JSR TOSE2
	BCC TOSC1
TOSC2	JMP $E474
TOSC1	LDA #0
	STA $0354
	STA $0358
	LDA #$1F
	STA $0355
	LDX #$9D
	JSR TOSABYT7
	CPY #$88
	BNE TOSC2
	LDA $0358
	STA TOSC7+1
	LDA $0359
	STA TOSC8+1
TOSC6	LDA #$C
	JSR TOSABYT6
	LDA #SAVEN:L
	JSR DLIST7S
	LDX #$B
TOSC4	LDA NAMEBUF,X
	SEC
	SBC #$20
	STA TSDEV+3,X
	DEX
	BPL TOSC4
	LDX FNR
	INX
TOSC3	STX TSDEV+1
	JSR GETKEY
	TAX
	CMP #$31
	BEQ TOSC3
	CMP #$32
	BEQ TOSC3
	LDX #$9B
	CMP #$4E
	BNE TOSC5
	STX TSDEV+3
TOSC5	STX TSDEV+$F
	LDA #$08
	STA $035A
	LDA #TSDEV:L
	STA $0354
	LDA #TSDEV:H
	JSR TOSE3
	BCS TOSC6
	LDA #0
	STA $0354
	LDA #$1F
	STA $0355
TOSC7	LDA #$00
	STA $0358
	LDA #$0B
TOSC8	LDX #$00
	JSR TOSABYT8
	JMP TOSC6
TOSD	LDA #SAVEE:L
	JSR DLIST7S
	JSR TOSDNR
	STA $43
	STX $44
	STA SAVEKEN+8
	STX SAVEKEN+9
	JSR TOSDNR
	STA $45
	STX $46
	BNE TOSD4
	DEX
TOSD4	SEC
	SBC #1
	STA SAVEKEN+$A
	STX SAVEKEN+$B
	JSR TOSDNR
	STA SAVEKEN+6
	STX SAVEKEN+7
	LDA #8
	JSR TOSE2
	BCS TOSD3
	LDA #$B
	LDX #SAVEKEN:L
	STX $0354
	LDX #SAVEKEN:H
	STX $0355
	LDX #$C
	STX $0358
	LDX #0
	JSR TOSABYT8
	BCS TOSD3
TOSD2	LDY #0
	LDA ($43),Y
	JSR PUTBYTE
	CPY #$01
	BNE TOSD3
	INC $43
	BNE TOSD1
	INC $44
TOSD1	LDA $43
	CMP $45
	LDA $44
	SBC $46
	BCC TOSD2
TOSD3	LDA #$C
	JMP TOSABYT6
TOSDNR	LDX #4
	LDA #0
TOSDNR1	STA SAVEE+$F,X
	STA GOAD+7,X
	DEX
	BNE TOSDNR1
TOSDNR5	STX TOSDNR4+1
TOSDNR3	JSR GETKEY
	CLC
	ADC #$20
	LDX #$F
TOSDNR2	CMP TAB,X
	BEQ TOSDNR4
	DEX
	BPL TOSDNR2
	BMI TOSDNR3
TOSDNR4	LDX #$00
	STA SAVEE+$10,X
	STA GOAD+8,X
	INX
	CPX #4
	BNE TOSDNR5
	JSR TOSB5
	LDY #0
	JSR TOSDNR8
	TAX
TOSDNR8	LDA #0
	STA AFN
	JSR TOSDNR7
	ASL
	ASL
	ASL
	ASL
	STA AFN
TOSDNR7	LDA SAVEE+$10,Y
	SEC
	SBC #$50
	CMP #$A
	BMI TOSDNR6
	SEC
	SBC #7
TOSDNR6	INY
	ORA AFN
	RTS
TOSE	LDA #4
	STA AFN
	JSR TOSE2
	BCS TOSD3
TOSE1	JMP TOSAB
TOSE2	STA $035A
	LDA #TLDEV:L
	STA $0354
	LDA #TLDEV:H
TOSE3	STA $0355
	LDA #3
	JMP TOSABYT6
TOSF	LDX #$2E
	LDY #0
	LDA TOSZ8+$F
	CMP #$2E
	BNE TOSF1
	LDX #$39
	LDY #1
TOSF1	STX TOSZ8+$F
	STY SAVEKEY
	RTS
TOSG	LDA #GOAD:L
	JSR DLIST7S
	JSR TOSDNR
	STX TOSG1+2
	STA TOSG1+1
	JSR SCR
TOSG1	JMP $0000
	ORG $1800,$B500
START	LDY #$C
	LDX #0
	TXA
START4	CLC
	ADC $C00,X
	INX
	BNE START4
	INC START4+3
	DEY
	BNE START4
START3	CMP #$00
	BEQ START5
	JMP $E474
START5	LDX #$C
	LDY #0
START7	LDA $C00,Y
	STA $700,Y
	INY
	BNE START7
	INC START7+2
	INC START7+5
	DEX
	BNE START7
START1	LDX #1
	STX $9
	STX $3F8
	DEX
	STX $244
	LDA #START1:L
	STA $A
	LDA #START1:H
	STA $B
	LDA #SETV:L
	STA $C
	LDA #SETV:H
	STA $D
	LDA #DLIST4:L
	STA $0230
	LDA #DLIST4:H
	STA $0231
START8	JSR GETKEY
	LDX #0
	CMP #$43
	BEQ START9
	LDX #$C
	CMP #$44
	BEQ START9
	CMP #$54
	BNE START8
START9	STX SETV1+1
	STA SETV1+3
	LDA #DLIST5A:L
	STA $0230
	LDA #DLIST5A:H
	STA $231
	JSR GETKEY
	LDY #$40
	CMP 'Y
	BNE STARTD
	LDY #$C0
STARTD	STY BSON+4
	LDA #DLIST5:L
	STA $0230
	LDA #DLIST5:H
	STA $231
STARTC	JSR GETKEY
	CMP 'T
	BEQ STARTB
	CMP 'B
	BNE STARTC
	LDX #0
	STX $3F8
	INX
	STX $CA
STARTB	LDA #TOS:L
	STA $A
	LDA #TOS:H
	STA $B
	JMP $E474
DLIST4	DFB $70,$70,$70,$70,$70,$70,$70,$70,$46
	DFW DEV
	DFB $41
	DFW DLIST4
DEV	ASC % DEVICE c, d OR t ? %
DLIST5	DFB $70,$70,$70,$70,$70,$70,$70,$70,$46
	DFW RUN
	DFB $41
	DFW DLIST5
RUN	ASC % RUN bASIC OR tOS ? %
DLIST5A	DFB $70,$70,$70,$70,$70,$70,$70,$70,$46
	DFW DLI
	DFB $41
	DFW DLIST5
DLI	ASC %   DLI ENABLED y?   %
	ORG $B700
* DAS ABSAVEN DES ASSEMBLIERTEN TOS
* SOLLTE MIT DIESER ROUTINE GESCHEHEN.
SAVE	LDA #$A9
	STA SAVE4+3
	LDY #$C
	LDX #0
	TXA
SAVE4	CLC
	ADC $A900,X
	INX
	BNE SAVE4
	INC SAVE4+3
	DEY
	BNE SAVE4
	STA START3+1-$1800+$B500
	LDX #$10
	LDA #3
	STA $342,X
	LDA #DEVIC:L
	STA $344,X
	LDA #DEVIC:H
	STA $345,X
	LDA #8
	STA $34A,X
	JSR $E456
	LDA #$B
	STA $342,X
	LDA #$F4
	STA $344,X
	LDA #$A8
	STA $345,X
	LDA #$20
	STA $348,X
	LDA #$D
	STA $349,X
	JSR $E456
	LDA #$C
	STA $342,X
	JMP $E456
DEVIC	DFB $54,$31,$3A,$9B�������������������