****** Laatste wijziging 10/09/87 ****** A.DISCCAT SYSFX 6,13 ;suppress line feed SYSVDU 2,1,27,1,82,1,0,3 ;american character set SYSVDU 2,1,27,1,51,1,30,3 ;line spacing 30/216 inch SYSVDU 2,1,27,1,33,1,17,3 ;elite, double strike SYSVDU 2,1,27,1,67,1,0,3 ;set form length by 11 inches TTL "DISC CATALOGUE" ****** OS addresses OSFILE EQU &FFDD OSRDCH EQU &FFE0 OSASCI EQU &FFE3 OSNEWL EQU &FFE7 OSWRCH EQU &FFEE OSWORD EQU &FFF1 OSBYTE EQU &FFF4 OSCLI EQU &FFF7 ****** Other addresses CATFLG EQU &07BD ;catalogue flag CTRBL EQU CATFLG+1;control block (&12) DRNR EQU &10CB ;drive number DRNR1 EQU CTRBL+18 DSIZE EQU DRNR1+1 ;disc size (4) HOAD EQU DSIZE+4 ;high order address (4) HOAD1 EQU HOAD+1 INDEX EQU HOAD+4 ;index (disc/file) LDAD EQU INDEX+1 ;last disc address (2) LFAD EQU LDAD+2 ;last file address (2) MAXAD EQU LFAD+2 ;end address of cat.file (2) MAXPAG EQU MAXAD+2 ;HIMEM MINPAG EQU MAXPAG+1;PAGE NAME EQU MINPAG+1;filename or string (&10) NBL1 EQU NAME+16 ;bottom nybble NBL11 EQU NBL1+1 NBL2 EQU NBL11+1 ;top nybble NBL22 EQU NBL2+1 NMLTH EQU NBL22+1 ;namelength NRB EQU NMLTH+1 ;number of bytes NRFILS EQU NRB+1 ;number of files POS EQU NRFILS+1;text cursor SECT EQU POS+1 ;sector nr SPT EQU SECT+1 ;sectors/track STKPTR EQU SPT+1 ;stack pointer TRCK EQU STKPTR+1;track nr VPOS EQU TRCK+1 ;text cursor XNR EQU VPOS+1 ;execution nr ****** Define data MARK EQU 01 ;mark number VRSION EQU 01 ;binary version number ****** Define characters "." EQU &2E ":" EQU &3A "?" EQU &3F "@" EQU &40 "L" EQU &4C "N" EQU &4E "S" EQU &53 "Y" EQU &59 ****** ROM header ORG &8000 EXEC &D9CD ROM JMP LANGUA ;language ROM entry point JMP SERVIC ;service ROM entry point DFB %11000010 ;ROM type byte DFB >COPYRI ;offset to copyright message DFB VRSION ;binary version number TITLE ASC "DISCCAT Catalogue for discs 10/09/87" DFB 0 DFB &0A,&0D ASC " version " DFB MARK+&30 ASC "." DFB VRSION+&30 COPYRI DFB 0 ASC "(C) J.C.Abels, 1181 EJ AMSTELVEEN" ASC " THE NETHERLANDS" ;copyright string DFB &00 ****** FLBS (Flush buffers) FLBS LDX #&00 LDA #&0F ;flush all JSR OSBYTE ;buffers RTS ****** BRKR (BRK routine) BRKR CLI LDA #&7E ;acknowledge detection JSR OSBYTE ;of ESCAPE condition LDX #&00 LDY #&FF LDA #&E5 ;normal action of JSR OSBYTE ;ESCAPE key JSR FLBS ;flush buffers LDY #&01 BRKR1 LDA (&FD),Y ;error text JSR OSWRCH INY CMP #&00 BNE BRKR1 JSR KEY JMP PROGRM ****** SERVIC (service_entry) SERVIC PHP ;save registers PHA TYA PHA TXA PHA TSX LDA &103,X ;A register CMP #&03 ;BREAK+BOOT? BEQ BOOT CMP #&09 ;*HELP? BEQ HELP CMP #&04 ;*UNKNOWN? BEQ UNKN RTN PLA ;end of service TAX ;restore registers PLA TAY PLA PLP RTS ****** BOOT BOOT JSR PRTTL JSR OSNEWL JSR OSNEWL JMP RTN ****** HELP HELP LDA &102,X ;Y register TAY LDA (&F2),Y CMP #&0D BNE HELP1 JSR OSNEWL ;simple *HELP JSR PRTTL JSR OSNEWL JMP RTN HELP1 LDX #&00 ;extended *HELP DEY JSR IDCMD BCC PRCS JMP RTN ****** PRCS (Print commands) PRCS JSR OSNEWL JSR PRTTL INY JSR PRTTL1 JSR OSNEWL LDX #&FF DTLLP INX LDA CS,X ;detailloop JSR OSASCI BNE DTLLP JMP RTN ****** UNKN (Unknown command) UNKN LDX #&00 DEY JSR IDCMD BCC FOUND ;*DISCCAT found JMP RTN ;unknown command FOUND LDX &F4 LDA #&8E ;enter this ROM in bank X JMP OSBYTE ;go to language entry ****** IDCMD (Identify command) IDCMD INY LDA (&F2),Y CMP #&20 BEQ IDCMD ;ignore leading spaces IDCMD1 LDA (&F2),Y AND #&5F ;change to capitals CMP TITLE,X BNE IDCMD2 INX INY JMP IDCMD1 IDCMD2 LDA (&F2),Y CMP #"." ;abbreviated? BEQ IDCMD4 CPX #&07 ;last character? BNE IDCMD3 CMP #&0D ;abbreviated? BEQ IDCMD4 IDCMD3 SEC ;no identification RTS IDCMD4 CLC ;*DISCCAT found RTS ****** LANGUA (Language entry point) LANGUA LDA &F4 STA &FE30 ;ROM number to read LDA #&07 JSR OSWRCH LDA DRNR STA DRNR1 SEI LDA #>BRKR STA &0202 LDA #TXFT2 JSR PRBS RTS ****** FANXD (Find address next disc) FANXD LDA LDAD ;last disc address STA &F8 LDA LDAD+1 STA &F9 FANXD1 JSR F8ADD CMP MAXPAG BEQ FANXD2 LDY #&0F LDA (&F8),Y BEQ FANXD1 CMP #&80 BCS FANXD1 LDA &F8 ;next disc address STA LDAD LDA &F9 STA LDAD+1 CLC ;ready, clear carry RTS FANXD2 SEC ;no more discs, set carry RTS ****** DLI (Delete index of disc and its files) DLI LDY #&0F LDA #&10 STA &F8 LDA MINPAG STA &F9 DLI1 LDA (&F8),Y AND #&7F CMP INDEX BNE DLI2 LDA #&00 ;change index STA (&F8),Y ;into &00 DLI2 JSR F8ADD CMP MAXPAG BNE DLI1 RTS ****** NML (Name length) NML PHA LDA NAME CMP #":" BNE NML2 LDA NAME+4 CMP #"." BNE NML1 LDA #&0C BNE NML4 NML1 LDA #&0A BNE NML4 NML2 LDA NAME+1 CMP #"." BNE NML3 LDA #&09 BNE NML4 NML3 LDA #&07 NML4 STA NMLTH PLA RTS ****** RDFN (Read filename) RDFN JSR FLBS ;flush buffers RDFN1 LDY #&00 RDFN2 JSR RDC JSR OSWRCH STA NAME,Y JSR NML CMP #&7F ;Delete? BNE RDFN3 DEY DEY BMI RDFN1 RDFN3 CMP #&0D BEQ RDFN7 CMP #"." BEQ RDFN4 CMP #":" BEQ RDFN5 BNE RDFN6 RDFN4 INC NMLTH RDFN5 INC NMLTH RDFN6 INY CPY NMLTH BNE RDFN2 LDA #&0D STA NAME,Y RDFN7 JSR OSNEWL RTS ****** WRFN (Write filename) WRFN LDA MINPAG STA &F9 LDA #&00 STA &F8 LDY #&02 WRFN1 STA (&F8),Y INY CPY #&0B BNE WRFN1 LDX #&00 LDY #&02 LDA NAME CMP #":" BNE WRFN2 LDX #&03 WRFN2 LDA NAME,X CMP #&0D BEQ WRFN3 STA (&F8),Y INX INY CPX #&0C BNE WRFN2 WRFN3 RTS ****** RDSTR (Read string) RDSTR JSR FLBS ;flush buffers RDSTR1 LDY #&00 RDSTR2 JSR RDC JSR OSWRCH CMP #&7B BCS RDSTR3 CMP #&61 BCC RDSTR3 AND #&DF RDSTR3 STA NAME,Y CMP #&7F ;delete? BNE RDSTR4 DEY DEY BMI RDSTR1 RDSTR4 CMP #&0D BEQ RDSTR5 INY CPY #&07 BNE RDSTR2 RDSTR5 DEY STY NMLTH JSR OSNEWL RTS ****** FMA (Find maximumm address of catalogue) FMA LDY #&0F LDA #&00 STA &F8 LDA MAXPAG STA &F9 FMA1 LDA &F8 SEC SBC #&10 STA &F8 LDA &F9 SBC #0 STA &F9 CMP MINPAG BNE FMA2 LDA &F8 BEQ FMA3 FMA2 LDA (&F8),Y BEQ FMA1 FMA3 LDA &F8 STA MAXAD LDA &F9 STA MAXAD+1 RTS ****** FRBS (Free bytes) FRBS JSR FMA ;find max.address catalogue SEC LDA #&00 SBC MAXAD PHA LDA MAXPAG SBC MAXAD+1 TAX SEC PLA SBC #&10 PHA TXA SBC #&00 JSR WRB PLA JSR WRB LDY #TXFT1 JSR PRBS RTS ****** SVCAT (Save catalogue) SVCAT JSR OSW7E JSR FNTX ;type filename JSR RDFN ;read filename JSR WRFN ;write filename JSR FMA ;find max.address LDA #&00 STA &38 LDA MINPAG STA &39 LDX #&12 SVCAT1 LDA FICOBL-1,X ;move file control block to CTRBL STA CTRBL-1,X DEX BNE SVCAT1 LDA MINPAG STA CTRBL+11 LDY #&0E CLC LDA MAXAD ADC #&10 STA CTRBL+14 LDA MAXAD+1 ADC #&00 STA CTRBL+15 LDX #>CTRBL ;CTRBL = address file control block LDY #CTRBL ;CTRBL = address file control block LDY #TXSSR ;Solidisk LDY #TXNR JSR PRTX LDA DRNR ORA #&30 JSR OSWRCH JSR OSNEWL JSR OSNEWL LDY #TXMN JSR PRTX JSR FRBS JSR FTTX JSR RDC PHA JSR MODE PLA CH0 CMP #&30 ;choice 0 BNE CH1 CH0EX JSR CH0TX ;change drive number JSR DRCH JMP PROGRM CH1 CMP #&31 ;choice 1 BNE CH2 CH1EX JSR CH1TX ;create catalogue CH1EX1 JSR FLBS JSR RDC AND #&DF CMP #"Y" BEQ CH1EX2 CMP #"N" BNE CH1EX1 JSR OSWRCH JSR OSNEWL JMP CH1EX3 CH1EX2 JSR OSWRCH JSR OSNEWL JSR SVCAT ;save catalogue CH1EX3 JSR START ;reset data JSR MCTX JSR CH3EX1 ;read discs, files JMP PROGRM CH2 CMP #&32 ;choice 2 BNE CH3 ****** CHN A.DISCCA1