1000 ORG 20000
1010 INPUT EQU $FFCF
1020 TALK EQU $FFB4
1030 SEKTALK EQU $FF96
1040 IECIN EQU $FFA5
1050 UNTALK EQU $FFAB
1060 LISTEN EQU $FFB1
1070 SEKLIST EQU $FF93
1080 IECOUT EQU $FFA8
1090 UNLIST EQU $FFAE
1100 OUTCHR EQU $FFD2
1110 OPEN EQU $FFC0
1120 CLOSE EQU $FFC3
1130 SETPAR EQU $FFBA
1140 SETNAM EQU $FFBD
1150 CHKIN EQU $FFC6
1160 CKOUT EQU $FFC9
1170 CLRCH EQU $FFCC
1180 ;
1190 CR EQU 13
1200 QUOTFLAG EQU 212
1210 BIP EQU $200
1220 SAVX EQU BIP+1
1230 WRAP EQU BIP+2
1240 BAD EQU BIP+3
1250 VON EQU BIP+4
1260 BIS EQU BIP+5
1270 STTUS EQU $90
1280 SA EQU $B9
1290 FA EQU $BA
1300 FNADR EQU $BB
1310 FNLEN EQU $B7
1320 TMPC EQU $97
1330 TMP2 EQU $14
1340 PROMPT EQU 62 ; ""
1350 NCOMMS EQU 6
1360 COUNT EQU 8
1370 ;
1380 ;
1390 INIT LDA #14
1400 STA 53280
1410 STA 646
1420 AND #7
1430 STA 53281
1440 JSR WRITETEXT
1450 DFB 13,"",0
1460 LDX #0
1470 TXA
1480 INIT1 STA BUFFER,X
1490 DEX
1500 BNE INIT1
1510 ;
1520 ;
1530 ANFANG JSR WRITETEXT
1540 DFB 13,PROMPT,0
1550 LDA #0
1560 STA WRAP
1570 ST1 JSR RDOC
1580 CMP #PROMPT
1590 BEQ ST1
1600 CMP #32
1610 BEQ ST1
1620 S0 LDX #NCOMMS-1
1630 S1 CMP CMDS,X
1640 BNE S2
1650 STX SAVX
1660 TXA
1670 CLC
1680 ASL
1690 TAX
1700 LDA SPRUNGTAB,X
1710 STA TMP2
1720 LDA SPRUNGTAB+1,X
1730 STA TMP2+1
1740 JMP (TMP2)
1750 S2 DEX
1760 BPL S1
1770 ;
1780 ERRR LDA #63 ; ?
1790 JSR OUTCHR
1800 JMP ANFANG
1810 ;
1820 CMDS DFB ""
1830 ;
1840 SPRUNGTAB DFB <ALTMEM,>ALTMEM
1850 DFB <DSPLYM,>DSPLYM
1860 DFB <READ ,>READ
1870 DFB <WRITE ,>WRITE
1880 DFB <DISK ,>DISK
1890 DFB <CRLF ,>CRLF
1900 ;
1910 ;
1920 ;********************
1930 ;
1940 WRITETEXT LDY #0
1950 PLA
1960 STA TMP2
1970 PLA
1980 STA TMP2+1
1990 WRITETEXT1 INC TMP2
2000 BNE WRITETEXT2
2010 INC TMP2+1
2020 WRITETEXT2 LDA (TMP2),Y
2030 BEQ WRITENDE
2040 JSR OUTCHR
2050 JMP WRITETEXT1
2060 WRITENDE LDA TMP2+1
2070 PHA
2080 LDA TMP2
2090 PHA
2100 RTS
2110 ;
2120 ;
2130 ;
2140 ; *******************
2150 ; SPEICHER AENDERN
2160 ; *******************
2170 ;
2180 ALTMEM JSR RDOB ; ADRSE LESN
2190 BCC ALTMEMERR
2200 TAY
2210 LDA #COUNT
2220 STA TMPC
2230 JSR RDOC
2240 ALTMEM1 JSR RDOC
2250 ;
2260 JSR RDOB
2270 BCC ALTMEMERR
2280 STA BUFFER,Y
2290 ALTMEM2 INY
2300 DEC TMPC
2310 ;
2320 BNE ALTMEM1
2330 JSR ASCDMP
2340 JMP ANFANG
2350 ALTMEMERR JMP ERRR
2360 ;
2370 ; *******************
2380 ; SPEICHER ANZEIGEN
2390 ; *******************
2400 ;
2410 DSPLYM LDY #0
2420 STY VON
2430 DEY
2440 STY BIS
2450 JSR INPUT
2460 CMP #CR
2470 BEQ DSPLYM1
2480 JSR RDOB ; STARTADR
2490 BCC DSPLYM1
2500 STA VON
2510 JSR INPUT
2520 CMP #CR
2530 BEQ DSPLYM1
2540 JSR RDOB ; ENDADR
2550 BCC DSPLYM1
2560 STA BIS
2570 DSPLYM1 LDY VON
2580 DSPLYM2 JSR TESTEND
2590 JSR ALTRIT
2600 TYA
2610 JSR WROB ; ADRESSE
2620 JSR SPACE
2630 LDA #COUNT
2640 JSR DM ; ANZEIGEN
2650 JSR ASCDMP
2660 JMP DSPLYM2
2670 ;
2680 ; *******************
2690 ; BLOCK - READ
2700 ; *******************
2710 ;
2720 READ JSR GETPAR
2730 BCC READERR
2740 JSR OPNDIR
2750 LDA #49 ; ""
2760 JSR SENDCMD
2770 LDX #13
2780 JSR CHKIN
2790 LDX #0
2800 READ1 JSR INPUT
2810 STA BUFFER,X
2820 INX
2830 BNE READ1
2840 JSR CLRCH
2850 JSR CLSDIR
2860 JMP ANFANG
2870 READERR JMP ERRR
2880 ;
2890 ; *******************
2900 ; BLOCK - WRITE
2910 ; *******************
2920 ;
2930 WRITE JSR GETPAR
2940 BCC WRITEERR
2950 JSR OPNDIR
2960 JSR BUFPNT
2970 LDX #13
2980 JSR CKOUT
2990 LDX #0
3000 WRITE1 LDA BUFFER,X
3010 JSR OUTCHR
3020 INX
3030 BNE WRITE1
3040 JSR CLRCH
3050 LDA #50 ; ""
3060 JSR SENDCMD
3070 JSR CLSDIR
3080 JMP ANFANG
3090 WRITEERR JMP ERRR
3100 ;
3110 ;
3120 ;
3130 ;BYTE ALS HEXZAHL SCHREIBEN
3140 ;
3150 WROB PHA
3160 LSR
3170 LSR
3180 LSR
3190 LSR
3200 JSR ASCII
3210 TAX
3220 PLA
3230 AND#%00001111
3240 JSR ASCII
3250 JMP WRTWO
3260 ;
3270 ;ZEICHEN IN X UND A SCHREIBEN
3280 ;
3290 WRTWO PHA
3300 TXA
3310 JSR OUTCHR
3320 PLA
3330 JMP OUTCHR
3340 ;
3350 ;
3360 ASCII CLC
3370 ADC #246
3380 BCC ASC1
3390 ADC #6
3400 ASC1 ADC #58
3410 RTS
3420 ;
3430 ;HEXBYTE LESEN UND NACH A BRINGEN
3440 ;
3450 RDOB LDA #0
3460 STA BAD
3470 JSR GETCHR ; ZEICHEN
3480 BCC RDOB4
3490 CMP #32
3500 BNE RDOB2 ; HEXZIFFER
3510 RDOB4 CLC
3520 RTS
3530 RDOB2 JSR HEXIT ; NACH HEX WANDELN
3540 ASL
3550 ASL
3560 ASL
3570 ASL
3580 STA BAD
3590 JSR GETCHR
3600 BCC RDOB4
3610 RDOB3 JSR HEXIT
3620 ORA BAD
3630 SEC
3640 RTS
3650 ;
3660 HEXIT CMP #58
3670 PHP
3680 AND #%00001111
3690 PLP
3700 BCC HEX09 ; 0-9
3710 ADC #8;PLUS 9 (CEQU1)
3720 HEX09 RTS
3730 ;
3740 ;
3750 ;
3760 GETCHR JSR INPUT
3770 CMP #13
3780 BEQ GETCHR1
3790 SEC
3800 RTS
3810 GETCHR1 CLC
3820 RTS
3830 ;
3840 RDOC JSR GETCHR
3850 BCC RDOC1
3860 RTS
3870 RDOC1 PLA
3880 PLA ; WENN CR
3890 JMP ANFANG
3900 ;
3910 ; DOS SUPPORT
3920 ;
3930 DISK JSR INPUT
3940 CMP #CR
3950 BNE DSKCMD ; DISK COMMAND
3960 LDA #0
3970 STA STTUS ; STATUS LOESCHEN
3980 JSR CRLF
3990 LDA #8
4000 STA FA ; FLOPPYADRESSE
4010 JSR TALK
4020 LDA #15+$60 ; SAEQU15
4030 STA SA
4040 JSR SEKTALK
4050 ERRIN JSR IECIN
4060 BIT STTUS
4070 BVS ENDDSK
4080 JSR OUTCHR
4090 BNE ERRIN
4100 ENDDSK JSR UNTALK
4110 JMP ANFANG
4120 DSKCMD CMP #36 ; $ DIRECTORY NICHT MOEGLICH
4130 BEQ ERR1
4140 PHA
4150 LDA #8
4160 STA FA
4170 JSR LISTEN
4180 LDA #15+$60
4190 STA SA
4200 JSR SEKLIST
4210 PLA
4220 CMDOUT JSR IECOUT
4230 JSR INPUT
4240 CMP #CR
4250 BNE CMDOUT
4260 JSR UNLIST
4270 JMP ANFANG
4280 ERR1 JMP ERRR
4290 ;
4300 ;
4310 GETPAR JSR RDOC
4320 JSR RDOB ; TRACK
4330 BCC GETPAR1
4340 STA TRACK
4350 JSR RDOC
4360 JSR RDOB ; SEKTOR
4370 BCC GETPAR1
4380 STA SEKTOR
4390 RTS
4400 GETPAR1 CLC
4410 RTS
4420 ;
4430 ;
4440 SENDCMD STA CMDSTR+1
4450 LDA TRACK
4460 JSR NUMBASC
4470 STX TRACK
4480 STA TRACK+1
4490 LDA SEKTOR
4500 JSR NUMBASC
4510 STX SEKTOR
4520 STA SEKTOR+1
4530 LDX #15
4540 JSR CKOUT
4550 LDX #0
4560 CMDOUT1 LDA CMDSTR,X
4570 JSR OUTCHR
4580 INX
4590 CPX #BUFPNT-CMDSTR
4600 BNE CMDOUT1
4610 JMP CLRCH
4620 CMDSTR DFB ""
4630 TRACK DFB 0,0,""
4640 SEKTOR DFB 0,0
4650 ;
4660 BUFPNT LDX #15
4670 JSR CKOUT
4680 LDX #0
4690 PNTOUT LDA BUFTXT,X
4700 JSR OUTCHR
4710 INX
4720 CPX #OPNDIR-BUFTXT
4730 BNE PNTOUT
4740 JMP CLRCH
4750 ;
4760 BUFTXT DFB ""
4770 ;
4780 OPNDIR LDA #15
4790 TAY
4800 LDX #8
4810 JSR SETPAR
4820 LDA #0
4830 JSR SETNAM
4840 JSR OPEN
4850 LDA #13
4860 TAY
4870 LDX #8
4880 JSR SETPAR
4890 LDA #1
4900 LDX #<DADR
4910 LDY #>DADR
4920 JSR SETNAM
4930 JMP OPEN
4940 DADR DFB ""
4950 ;
4960 CLSDIR LDA #13
4970 JSR CLOSE
4980 LDA #15
4990 JMP CLOSE
5000 ;
5010 NUMBASC LDX #48 ; "" HEXZAHL NACH ASCII
5020 SEC
5030 NUMB1 SBC #10
5040 BCC NUMB2
5050 INX
5060 BCS NUMB1
5070 NUMB2 ADC #58 ;""+1
5080 RTS
5090 ;
5100 ASCDMP TYA
5110 SEC
5120 SBC #COUNT
5130 TAY
5140 JSR SPACE
5150 LDA #39 ; ""
5160 JSR OUTCHR
5170 LDX #COUNT
5180 ASCDMP1 LDA #1
5190 STA QUOTFLAG
5200 LDA BUFFER,Y
5210 PHA
5220 AND #127
5230 CMP #13
5240 BNE ASCDMP2
5250 LDA #0
5260 STA QUOTFLAG
5270 LDA #18 ; RVS ON
5280 JSR OUTCHR
5290 PLA
5300 ORA #64
5310 JSR OUTCHR
5320 LDA #146 ; RVS OFF
5330 PHA
5340 ASCDMP2 PLA
5350 JSR OUTCHR
5360 INY
5370 DEX
5380 BNE ASCDMP1
5390 RTS
5400 ;
5410 TESTEND LDA WRAP
5420 BNE ENDEND
5430 CPY BIS
5440 BCS ENDEND
5450 RTS
5460 ENDEND PLA
5470 PLA
5480 JMP ANFANG
5490 ;
5500 ALTRIT JSR CRLF
5510 LDA #58 ; ""
5520 LDX #PROMPT
5530 JMP WRTWO
5540 ;
5550 ;ANZEIGE DES DISKINHALTES
5560 ;
5570 DM STA TMPC
5580 DM1 JSR SPACE
5590 LDA BUFFER,Y
5600 JSR WROB
5610 INY
5620 BNE DM2
5630 INC WRAP
5640 DM2 DEC TMPC
5650 BNE DM1
5660 RTS
5670 ;
5680 ;
5690 SPAC2 JSR SPACE
5700 SPACE LDA #32 ; ""
5710 DFB $2C
5720 CRLF LDA #CR
5730 JMP OUTCHR
5740 BUFFER EQU *
READY.