The loader also doesn't use any hardcoded secotr header ID
PROCESSOR 6502 ORG $9000 ;ZEROPAGE ADRESSEN VARBASE EQU $E0 ENDFLAG EQU VARBASE+$0 ZP2 EQU VARBASE+$1 ZP3 EQU VARBASE+$2 ZP4 EQU VARBASE+$3 ZP5 EQU VARBASE+$4 ZP6 EQU VARBASE+$5 ZP7 EQU VARBASE+$6 ZP8 EQU VARBASE+$7 ZP9 EQU VARBASE+$8 ZPA EQU VARBASE+$9 ZPB EQU VARBASE+$A BYTE EQU VARBASE+$B ;------------------------------------- ;MEMORYS STARTUP EQU $0002 ;------------------------------------- ;EQUS ;-------------------------------------- ;ZEROPAGE FUER SENDCODE FLOPPYBAL1 EQU $FC FLOPPYBAH1 EQU $FD FLOPPYBAL2 EQU $FE FLOPPYBAH2 EQU $FF ;-------------------------------------- ;FLOPPY EQUS COMMAND EQU $04 TRACK EQU $0E SECTOR EQU $0F ;-------------------------------------- ;NORMALE EQUS CODE EQU $AA DESTINATION EQU $130 ;-------------------------------------- START SUBROUTINE SEI CLD LDX #$FF TXS LDA #$37 STA $01 INX STX $D011 STX $D418 STX $D020 STX $D021 STX $D015 STX $D030 LDY #$1F .A LDA $FD30,Y STA $0314,Y DEY BPL .A LDA #$7E STA $0314 JSR SEND SEI LDX #$2F TXS LDA #$35 STA $01 LDA #$97 STA $DD00 LDX #$00 .1 LDA DATA1,X STA DESTINATION,X LDA DATA1+$100,X STA DESTINATION+$100,X LDA DATA1+$200,X STA DESTINATION+$200,X INX BNE .1 LDA #$00 LDX #"S" LDY #"0" JSR FLOAD JMP STARTUP ;------------------------------------------------------------------------------ SEND SUBROUTINE LDA #<FLOPPYCODE STA FLOPPYBAL1 LDA #>FLOPPYCODE STA FLOPPYBAH1 LDA #<FLOPPYSTART STA FLOPPYBAL2 LDA #>FLOPPYSTART STA FLOPPYBAH2 .NEXT JSR INITSEND LDA #"M" JSR $FFA8 LDA #"-" JSR $FFA8 LDA #"W" JSR $FFA8 LDA FLOPPYBAL2 JSR $FFA8 LDA FLOPPYBAH2 JSR $FFA8 LDA #$20 JSR $FFA8 LDX #$00 LDY #$00 .NEXTBYTE LDA (FLOPPYBAL1),Y JSR $FFA8 INC FLOPPYBAL1 BNE .OVER1 INC FLOPPYBAH1 .OVER1 INX CPX #$20 BNE .NEXTBYTE JSR $FFAE LDA FLOPPYBAL2 CLC ADC #$20 STA FLOPPYBAL2 LDA FLOPPYBAH2 ADC #$00 STA FLOPPYBAH2 CMP #$07 BNE .NEXT STARTCODE SUBROUTINE JSR INITSEND LDX #$00 .1 LDA .TEXT1,X JSR $FFA8 INX CPX #$05 BNE .1 .EXIT JSR $FFAE LDA #$C7 STA $DD00 LDY #$00 .2 DEX BNE .2 DEY BNE .2 RTS INITSEND LDA #$08 JSR $FFB1 LDA #$6F JMP $FF93 .TEXT1 DC.B "M-E",#<FLOPPYSTART,#>FLOPPYSTART DATA1 RORG DESTINATION ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ;1 BUCHSTABE NAME =XREG ;1 BUCHSTABE NAME =YREG ;AKKU ;0= LOAD NORMAL ;1= LOAD DECRUNCH FLOAD SUBROUTINE PHA TYA PHA LDA $DD00 AND #$0F STA ADD001+1 EOR #$10 STA SEND2BIT+1 EOR #$30 STA ADD003+1 EOR #$B0 STA GET+1 EOR #$50 STA FIVE+1 STA ADD006+1 ADD003 LDA #$27 STA $DD00 JSR SYNCRO TXA JSR SENDBYTE2 PLA JSR SENDBYTE2 LOADFLAG JSR SYNCRO PLA BNE DECRUNCHALOAD ;---------------------------- NORMAL SUBROUTINE JSR GETBYTE2 STA WRITE+1 JSR WAIT12 JSR GETBYTE2 STA WRITE+2 JSR WAIT12 LDX #$00 .NEXTBYTE JSR LOADBYTE BCS ENDLOAD DEC $01 WRITE STA $FFFF,X INC $01 INX BNE .NEXTBYTE INC WRITE+2 BNE .NEXTBYTE LOADBYTE SUBROUTINE JSR GETBYTE2 CMP #CODE BEQ .CHANGE CLC ENDLOAD RTS .CHANGE JSR GETBYTE2 CMP #$00 BEQ .SETCODE CMP #$80 BEQ .LOADEND JSR SYNCRO JMP LOADBYTE .SETCODE LDA #CODE CLC RTS .LOADEND INC ENDFLAG SEC RTS ;-------------------------------------- DECRUNCHALOAD SUBROUTINE LDA #$00 STA ENDFLAG CTRLGET LDX #$04 ;5 CONTROLBYTES LESEN CTRL1 JSR LOADBYTE STA ZP7,X DEX BPL CTRL1 LDY ENDFLAG BNE ENDLOAD DEC $01 JSR DECRUNCH INC $01 BNE CTRLGET ; PACKER ; SINGLES DECRUNCH TYA STY ZP2 STY ZP4 SINGL1 JSR DECOD1 ROL BNE SINGL2 BCC SEQUE1 SINGL2 ROL ZP4 JSR DECOD1 BCS SINGL1 STA ZP3 JSR SUBS1 ; SEQUENCE LAENGE SEQUE1 TYA STY ZP5 STY ZP6 SEQUE2 JSR DECOD1 ROL BEQ SEQUE4 BMI SEQUE3 JSR DECOD1 BCS SEQUE2 SEQUE3 INC ZP2 SEQUE4 ADC #$02 STA ZP3 AND #$FC BEQ GOON INC ZP2 GOON LDX #$03 ;PARA-NR. PARA1 JSR DECOD1 ROL ZP2 DEX BNE PARA1 ;PARA-GET PARA2 LDX ZP2 LDA PACKDAT,X TAX BEQ PARA4 PARA3 JSR DECOD1 ROL ZP5 ROL ZP6 DEX BNE PARA3 PARA4 LDA ZP2 AND #$07 BEQ PARA6 INC ZP5 BNE PARA5 INC ZP6 PARA5 DEC ZP2 BPL PARA2 PARA6 LDA ZP8 ADC ZP5 STA ZP5 LDA ZP9 ADC ZP6 STA ZP6 LDA ZP5 BNE PARA7 DEC ZP6 PARA7 DEC ZP5 INC ZP2 JSR SUBS2 BEQ DECRUNCH DECOD1 ASL ZP7 BNE DECOD4 CPY ZPA BNE DECOD2 CPY ZPB BNE DECOD3 PLA PLA RTS DECOD3 DEC ZPB DECOD2 DEC ZPA PHA INC $01 JSR LOADBYTE DEC $01 LDY #$00 SEC ROL STA ZP7 PLA DECOD4 RTS SUBS1 LDA ZPA SEC SBC ZP3 STA ZP5 STA ZPA LDA ZPB SBC #$00 STA ZP6 SBC ZP4 STA ZPB SUBS2 LDY ZP3 BEQ SUBS5 LDA ZP8 SEC SBC ZP3 STA ZP8 BCS SUBS4 SUBS3 DEC ZP9 SUBS4 LDX ZP2 BEQ LOOP2 LOOP1 LDA (ZP5),Y DEY STA (ZP8),Y BNE LOOP1 BEQ SUBS5 LOOP2 STY .YVAL+1 INC $01 JSR LOADBYTE DEC $01 .YVAL LDY #$00 DEY STA (ZP8),Y BNE LOOP2 SUBS5 CPY ZP4 BEQ SUBS6 DEC ZP6 DEC ZP4 BPL SUBS3 SUBS6 RTS ;-------------------------------------- GETBYTE2 SUBROUTINE GET LDY #$00 LDA $DD00 STY $DD00 ASL ROR BYTE NOP NOP FIVE LDY #$00 LDA $DD00 STY $DD00 ASL ROR BYTE NOP LDY GET+1 LDA $DD00 STY $DD00 ASL ROR BYTE NOP LDY FIVE+1 LDA $DD00 STY $DD00 ASL ROR BYTE NOP LDY GET+1 LDA $DD00 STY $DD00 ASL ROR BYTE NOP LDY FIVE+1 LDA $DD00 STY $DD00 ASL ROR BYTE NOP LDY GET+1 LDA $DD00 STY $DD00 ASL ROR BYTE NOP LDY FIVE+1 LDA $DD00 STY $DD00 ASL ROR BYTE LDA BYTE RTS SENDBYTE2 SUBROUTINE STA BYTE LDY #$04 SEND2BIT LDA #$17 LSR BYTE BCC .1 ORA #$20 .1 STA $DD00 NOP NOP NOP NOP ADD001 LDA #$07 LSR BYTE BCC .2 ORA #$20 .2 STA $DD00 DEY BNE SEND2BIT RTS SYNCRO SUBROUTINE LDY #$06 .1 DEY BNE .1 .2 LDA $DD00 AND #$40 BEQ .2 ADD006 LDA #$00 STA $DD00 LDY #$05 .3 DEY BNE .3 WAIT12 RTS PACKDAT DC.B $03,$01,$01,$01,$01,$00,$01,$01 DC.B $04,$01,$01,$01,$01,$01,$02,$02 DC.B $04,$01,$01,$01,$01,$02,$02,$02 REND ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ FLOPPYCODE RORG $0500 FLOPPYSTART SUBROUTINE SEI CLD LDY #$08 .4 LDA #$10 STA $1800 .1 DEX BNE .1 LDA #$00 STA $1800 .2 DEX BNE .2 DEY BNE .4 .3 LDA $1800 AND #$05 BNE .3 LDA $1800 AND #$05 BNE .3 START2 SUBROUTINE LDA #$08 STA $1800 LDA $1C00 ;LED AUS AND #$F7 STA $1C00 LDA #$36 STA $1C07 CLI LDA #$01 .1 BIT $1800 BEQ .1 SEI LDA #$00 STA $1800 JSR GETBYTE ;NAME 1 STA NAME1+1 JSR GETBYTE ;NAME 2 STA NAME2+1 LDA #$08 STA $1800 LDA $1C00 ;LED AN ORA #$08 STA $1C00 SEARCHFILENAME SUBROUTINE CLI JSR $D042 ;BAM LADEN UND DISK F▄R DISK-WECHSEL SEI LDY #$01 .NEXTSECTOR LDX #$12 STX TRACK STY SECTOR JSR LOADSECTOR LDY #$00 .NEXT LDA $0702,Y AND #$83 CMP #$82 BNE .NEXTFILE LDA $0705,Y NAME1 CMP #$00 BNE .NEXTFILE LDA $0706,Y NAME2 CMP #$00 BEQ .FILEFOUND .NEXTFILE TYA CLC ADC #$20 TAY BNE .NEXT LDY $0701 BPL .NEXTSECTOR .FILEFOUND LDA $0703,Y STA TRACK LDA $0704,Y STA SECTOR LOADFILE SUBROUTINE JSR LOADSECTOR LDA #$00 STA $1800 LDA $0700 BNE .FULLSECTOR LDY $0701 INY STY .1+1 LDY #$02 .2 LDX $0700,Y JSR SBYTE INY .1 CPY #$00 BNE .2 EXITOR LDX #CODE JSR SENDBYTE LDX #$80 JSR SENDBYTE JMP START2 .FULLSECTOR LDY #$02 .3 LDX $0700,Y JSR SBYTE INY BNE .3 LDA $0700 STA TRACK LDA $0701 STA SECTOR LDX #CODE JSR SENDBYTE LDX #$7F JSR SENDBYTE ; LDA $1C00 ; EOR #$08 ; STA $1C00 LDA #$08 STA $1800 BNE LOADFILE LOADSECTOR SUBROUTINE LDX #$06 CLI .NEXTTRY LDA #$80 STA COMMAND .1 LDA COMMAND BMI .1 CMP #$01 BEQ .NOERROR DEX BNE .NEXTTRY LDA #$C0 STA COMMAND .2 LDA COMMAND BMI .2 JMP LOADSECTOR .NOERROR SEI ; LDA $1C00 ; EOR #$08 ; STA $1C00 RTS SBYTE SUBROUTINE CPX #CODE BNE SENDBYTE JSR SENDBYTE LDX #$00 SENDBYTE SUBROUTINE STX $14 LDA #$04 LSR $14 LDX #$02 BCC .1 LDX #$00 .1 BIT $1800 BNE .1 STX $1800 LSR $14 LDX #$02 BCC .2 LDX #$00 .2 BIT $1800 BEQ .2 STX $1800 LSR $14 LDX #$02 BCC .3 LDX #$00 .3 BIT $1800 BNE .3 STX $1800 LSR $14 LDX #$02 BCC .4 LDX #$00 .4 BIT $1800 BEQ .4 STX $1800 LSR $14 LDX #$02 BCC .5 LDX #$00 .5 BIT $1800 BNE .5 STX $1800 LSR $14 LDX #$02 BCC .6 LDX #$00 .6 BIT $1800 BEQ .6 STX $1800 LSR $14 LDX #$02 BCC .7 LDX #$00 .7 BIT $1800 BNE .7 STX $1800 LSR $14 LDX #$02 BCC .8 LDX #$00 .8 BIT $1800 BEQ .8 STX $1800 RTS GETBYTE SUBROUTINE LDY #$04 .1 LDA #$04 .2 BIT $1800 BEQ .2 LDA $1800 LSR ROR $14 LDA #$04 .3 BIT $1800 BNE .3 LDA $1800 LSR ROR $14 DEY BNE .1 LDA $14 RTS REND