mirror of
https://github.com/option8/OUP-M.git
synced 2024-09-12 09:55:06 +00:00
2478 lines
61 KiB
ArmAsm
2478 lines
61 KiB
ArmAsm
|
12640 ;OUP/M BDOS WRITTEN BY SHAO, JIAN - XIONG
|
||
|
12650 ;ERROR NO. LISTING
|
||
|
12660 ;$02 DISK NO. TOO LARGE
|
||
|
12670 ;$03 FUNCTION NO. TOO LARGE
|
||
|
12680 ;$04 DISK WRITING PROTECTION
|
||
|
12690 ;$05 DUPLICTED FILE WHEN MAKE FILE
|
||
|
12700 ;$06 CHECK AREA NOT MATCH
|
||
|
12710 ;$07 FILE WRITING PROTECTION
|
||
|
12720 ;$08 FILE NOT OPEN
|
||
|
12730 *=$D93A
|
||
|
12740 START=$00 ;WARM BOOT ADDR.
|
||
|
12750 IOBYTE=$03 ;I/O BYTE
|
||
|
12760 CREG=$08 ;WORK STORAGE
|
||
|
12770 DEREG=$09
|
||
|
12780 HLREG=$08
|
||
|
12790 HLREG1=$0D
|
||
|
12800 USERSP=$10
|
||
|
12810 RTNFLG=$18 ;RETURN FLAG
|
||
|
12820 TEMP=$1F
|
||
|
12830 CDTDRN=$25 ;'DR' RESERVATION
|
||
|
12840 SCNPTS=$38 ;SCREEN LINE START POINTER
|
||
|
12850 CHRNUB=$3E ;CHAR. NOS IN INPUT BUFFER
|
||
|
12860 CSBUFS=$3F ;OFFSET OF LAST CHAR TO
|
||
|
12870 ;STARING ADDRESS OF THE BUFFER
|
||
|
12880 COUNT=$3D
|
||
|
12890 BRHTAB=$DBC3 ;BDOS
|
||
|
12900 ADCOFS=$DC80
|
||
|
12910 STRTFG=$DFDA
|
||
|
12920 RETURN=$E3D8
|
||
|
12930 R$TURN=$E3EE
|
||
|
12940 WBOOT=$E477 ;BIOS
|
||
|
12950 CSLTET=$E560
|
||
|
12960 CLINN=$E57A
|
||
|
12970 CLOUTT=$E591
|
||
|
12980 LITOUT=$E5A9
|
||
|
12990 ERROR=$E928
|
||
|
13000 BANBAC .BYTE$00 ;NO. COUNTER OF BACK SPACE
|
||
|
13010 PRTFLG .BYTE$00 ;PRINTER ON/OFF FLAG
|
||
|
13020 SCNPNT .BYTE$00 ;SCREEN LINE COUNTER
|
||
|
13030 PRECHR .BYTE$00 ;PREVIOUS CHARACTER
|
||
|
13040 WMBCOT .BYTE$2D ;
|
||
|
13050 ;
|
||
|
13060 BDOS=*
|
||
|
13070 ;
|
||
|
13080 STX CREG ;STORE PARAMETERS
|
||
|
13090 STA DEREG
|
||
|
13100 STY DEREG+1
|
||
|
13110 LDA #$00 ;INIT. SOME LOCATIONS FOR
|
||
|
13120 STA CRTDRN ;RETURN ROUTINE
|
||
|
13130 STA RTNFLG
|
||
|
13140 STA RTNFLG+1
|
||
|
13150 STA RTNFLG+2
|
||
|
13160 LDA #RETURN-1/256
|
||
|
13170 PHA ;SET RETURN ROUTINE ADDR.
|
||
|
13180 LDA #RETURN-1
|
||
|
13190 PHA
|
||
|
13200 LDA CREG ;CHECK FUNCTION NO. LEGALITY
|
||
|
13210 CMP #$29
|
||
|
13220 BCC B$0S
|
||
|
13230 LDA #$03 ;IF ILLEGAL, ERR!
|
||
|
13240 JMP ERROR
|
||
|
13250 B$OS=*
|
||
|
13260 ASL A
|
||
|
13270 LDX #BRHTAB ;ADDRESS FROM BRHTAB
|
||
|
13280 STX HLREG
|
||
|
13290 LDX #BRHTAB/256
|
||
|
13300 STX HLREG+1
|
||
|
13310 LDY #$00
|
||
|
13320 STY TEMP
|
||
|
13330 JSR ADCOFS
|
||
|
13340 LDA (HLREG),Y
|
||
|
13350 STA HLREG1
|
||
|
13360 INY
|
||
|
13370 LDA (HLREG),Y
|
||
|
13380 STA HLREG1+1
|
||
|
13390 LDA DEREG
|
||
|
13400 JHP (HLREG1) ;JMPE TO DESIRED ROUTINE
|
||
|
13410 REV1*=*+40
|
||
|
13420 ;
|
||
|
13430 ;******************************************************
|
||
|
13440 ;*
|
||
|
13450 ;* FUNCTION 0 : SYSTEM RESET
|
||
|
13460 ;*
|
||
|
13470 ;********************************************************
|
||
|
13480 ;*
|
||
|
13490 ;* ENTRY PARAMETERS :
|
||
|
13500 ;* REGISTER X : $00
|
||
|
13510 ;*
|
||
|
13520 ;*******************************************************
|
||
|
13530 ;
|
||
|
13540 SYMRST=*
|
||
|
13550 ;
|
||
|
13560 JMP WBOOT;
|
||
|
13570 ;
|
||
|
13580 INCHR=* ;GET A CHARACTER FROM CONSOLE
|
||
|
13590 ;
|
||
|
13600 LDA PRECHR
|
||
|
13610 BEQ I$CHR
|
||
|
13620 LDX #$00
|
||
|
13630 STX PRECHR
|
||
|
13640 RTS
|
||
|
13650 I$CHR=*
|
||
|
13660 LDX #$00
|
||
|
13670 STX PRECHR
|
||
|
13680 JMP CLINK
|
||
|
13690 RESV2*=*+4
|
||
|
13700 ;
|
||
|
13710 ;*****************************************************
|
||
|
13720 ;*
|
||
|
13730 ;* FUNCTION 1 : CONSOLE INPUT
|
||
|
13740 ;*
|
||
|
13750 ;*****************************************************
|
||
|
13760 ;*
|
||
|
13770 ;* ENTRY PARAMETERS :
|
||
|
13780 ;* REGISTER X : $01
|
||
|
13790 ;*
|
||
|
13800 ;* RETURNED VALUE :
|
||
|
13810 ;* REGISTER A : ASCII CHARACTER
|
||
|
13820 ;*
|
||
|
13830 ;***************************************************
|
||
|
13840 ;
|
||
|
13850 CSLIN=*
|
||
|
13860 ;
|
||
|
13870 JSR INCHR ;GET A CHAR FROM CONSOLE
|
||
|
13880 JSR C$LIN ;HANDLING CONTROL CHARACTER
|
||
|
13890 BCC CS$IN ;IF CONTROL CHAR EXCEPT
|
||
|
13900 ;'CR','LF','BA','TAB',THEN RETURN
|
||
|
13910 PHA
|
||
|
13920 JSR CSLOUT
|
||
|
13930 PLA
|
||
|
13940 CS$IN=*
|
||
|
13950 JMP STRTFG
|
||
|
13960 C$LIN=*
|
||
|
13970 CMP #$011 ;'CR'?
|
||
|
13980 BNE CSLIN1
|
||
|
13990 RTS
|
||
|
14000 CSLIN1=*
|
||
|
14010 CMP #$0A ;'LF'?
|
||
|
14020 BNE CSLIN2
|
||
|
14030 RTS
|
||
|
14040 CSLIN2=*
|
||
|
14050 CMP #$09 ;'TAB'?
|
||
|
14060 BNE CSLIN3
|
||
|
14070 RTS
|
||
|
14080 CSLIN3=*
|
||
|
14090 CMP #$08 ;'BA'?
|
||
|
14100 BNE CSLIN4
|
||
|
14110 RTS
|
||
|
14120 CSLIN4=*
|
||
|
14130 CMP #$20
|
||
|
14140 RTS
|
||
|
14150 ;
|
||
|
14160 INTPHD=* ;INTERUPTING CHAR HANDLING
|
||
|
14170 ;
|
||
|
14180 LDA PRECHR ;CHECK IF THERE IS A PREVIOUS CHAR
|
||
|
14190 BNE INTPH$
|
||
|
14200 JSR CSLTET ;TEST IF CONSOLE IS READY
|
||
|
14210 AND #$01
|
||
|
14220 BEQ I$TPHD
|
||
|
14230 JSR CLINN ;IF READY,READ A CHAR.
|
||
|
14240 CMP #$13 ;CONTROL-S?
|
||
|
14250 SHE IN%PHD
|
||
|
14260 INT$HD=*
|
||
|
14270 JSR CLINN ;IF IT IS CONTROL-S,WAIT UNTIL NEXT
|
||
|
14280 ;CHAR COMING IN.
|
||
|
14290 CMP #$03 ;CONTROL-C?
|
||
|
14300 SHE INTP$D
|
||
|
14310 JMP $0000 ;IF IS,TO WARM BOOT
|
||
|
14320 INTP$B=.
|
||
|
14330 LDA $00 ;IF ANOTHER CHARACTER,RETURN
|
||
|
14340 RTS
|
||
|
14350 INSPHD=*
|
||
|
14360 STA PRECHR ;WHEN FIRST RENDING IS NOT CTRL-S
|
||
|
14370 ;STORE IT TO PREV. CHAR. LOCATION
|
||
|
14380 INTPH$=*
|
||
|
14390 LDA IBFF
|
||
|
14400 ISTPHD=*
|
||
|
14410 RTS
|
||
|
14420 ;
|
||
|
14430 OUTCHR=* ;OUTPUT A CHARACTER
|
||
|
14440 ;
|
||
|
14450 PHA
|
||
|
14460 LDA BANBAC ;TO SEE IF THIS IS FROMN 'BA'
|
||
|
14470 SHE OSTCHR ;IF IS,NOT OUTPUT TO CSL
|
||
|
14480 JSR INTPHD ;HANDLING INTERUPTING CHAR.
|
||
|
14490 PLA
|
||
|
14500 PHA
|
||
|
14510 JSR CLOUTT ;OUTPUT TIS CHAR TO CONSOLE
|
||
|
14520 PLA
|
||
|
14530 PHA
|
||
|
14540 LDX PRTFLG ;TO SEE IF PRINTER
|
||
|
14550 BEQ OSTCHR
|
||
|
14560 JSR LITOUT ;IF ON,ALSO SENT TO PRINTER.
|
||
|
14570 OSTCHR=*
|
||
|
14580 PLA
|
||
|
14590 CMP #$7F ;IF IS 'DEL' ,RETURN,THAT IS, NOT
|
||
|
14600 ;INCREASING SCNPNT
|
||
|
14610 BNE OUSCHR
|
||
|
14620 RTS
|
||
|
14630 OUSCHR=*
|
||
|
14640 INC SCNPNT ;IF IT LESS THAN $7F, GREATER THEN
|
||
|
14650 ;EQUALTO $20, SCNPNT INCREASED
|
||
|
14660 ;BY 1
|
||
|
14670 CMP #$20
|
||
|
14680 BCC OUT$HR
|
||
|
14690 RTS
|
||
|
14700 OUT$HR=*
|
||
|
14710 DEC SCNPNT ;IF IT IS CTRL CHAR.,THAT IS, LESS
|
||
|
14720 ;THAN $20
|
||
|
14730 LDX SCNPNT ;THEN, NOTCHANGE SCNPNT
|
||
|
14740 BNE OUTC$R
|
||
|
14750 RTS
|
||
|
14760 OUTC$R=*
|
||
|
14770 CMP #$08 ;IF IS 'BA',SCNPNT DECREASED BY 1
|
||
|
14780 ONE OUTCH$
|
||
|
14790 DEC SCNPNT
|
||
|
14800 RTS
|
||
|
14810 OUTCH$=*
|
||
|
14820 CMP #$0A ;IF IS 'LF',SCNPNT SHOULD BE SET
|
||
|
14830 ;TO ZERO
|
||
|
14840 ONE OUTC$$
|
||
|
14850 LDA #$00
|
||
|
14860 STA SCNPNT
|
||
|
14870 OUTC$$=1
|
||
|
14880 RTS
|
||
|
14890 CSLOU$=*
|
||
|
14900 JSR C$LIN ;DISTINGUISH CTRL & NO-CTRL CHAR
|
||
|
14910 BCS CSLOUT ;EXCEPT 'CR','LF','BA','TAB'
|
||
|
14920 PHA
|
||
|
14930 LDA #$5E ;IF CTRL CHAR, OUTPUT '~', FOLLOWED
|
||
|
14940 ;BY A CHAR CORRES, THIS DESIRED
|
||
|
14950 ;CONTROL CHARACTER
|
||
|
14960 JSR OUTCHR
|
||
|
14970 PLA
|
||
|
14980 ORA #$40
|
||
|
14990 ;
|
||
|
15000 ;*******************************************************
|
||
|
15010 ;*
|
||
|
15020 ;* FUNCTION 2 : CONSOLE OUTPUT *
|
||
|
15030 ;*
|
||
|
15040 ;********************************************************
|
||
|
15050 ;*
|
||
|
15060 ;* ENTRY PARAMETERS :
|
||
|
15070 ;* REGISTER X : $02
|
||
|
15080 ;* REGISTER A : ASCII CHARACTER
|
||
|
15090 ;*
|
||
|
15100 ;*******************************************************
|
||
|
15110 ;
|
||
|
15120 CSLOUT=*
|
||
|
15130 ;
|
||
|
15140 CMP #$09 ;CHECK FOR 'TAB'
|
||
|
15150 BEQ C$LOUT
|
||
|
15160 JMP OUTCHR
|
||
|
15170 CLOUT=*
|
||
|
15180 LDA #$20 ;IF IS 'TAB',OUTPUT SOME SPACE TO
|
||
|
15190 JSR OUTCHR ;FIT THE NEEDS OF THE 'TAB'
|
||
|
15200 LDA SCNPNT
|
||
|
15210 AND #$07
|
||
|
15220 ONE C$LOUT
|
||
|
15230 RTS
|
||
|
15240 RESV*=*+1
|
||
|
15250 ;
|
||
|
15260 ;
|
||
|
15270 ;
|
||
|
15280 ;
|
||
|
15290 ;
|
||
|
15300 ;
|
||
|
15310 ;
|
||
|
15320 ;*****************************************************
|
||
|
15330 ;*
|
||
|
15340 ;* FUNCTION 3 : LIST OUTPUT
|
||
|
15350 ;*
|
||
|
15360 ;******************************************************
|
||
|
15370 ;*
|
||
|
15380 ;* ENTRY PARAMETERS :
|
||
|
15390 ;* REGISTER X : $03
|
||
|
15400 ;******************************************************
|
||
|
15410 ;
|
||
|
15420 LITOTT=*
|
||
|
15430 ;
|
||
|
15440 JMP LITOUT
|
||
|
15450 ;
|
||
|
15460 ;*******************************************************
|
||
|
15470 ;*
|
||
|
15480 ;* FUNCTION 4 : DIRECT CONSOLE I/0
|
||
|
15490 ;*
|
||
|
15500 ;********************************************************
|
||
|
15510 ;*
|
||
|
15520 ;* ENTRY PARAMETERS :
|
||
|
15530 ;* REGISTER X : $04
|
||
|
15540 ;* REGISTER A : $FF (INPUT) OR CHAR(OUTPUT)
|
||
|
15550 ;*
|
||
|
15560 ;* RETURNED VALUE :
|
||
|
15570 ;* REGISTER A : CHARACTER OR STATUS
|
||
|
15580 ;*
|
||
|
15590 ;*******************************************************
|
||
|
15600 ;
|
||
|
15610 DRCSIO=*
|
||
|
15620 ;
|
||
|
15630 TAX
|
||
|
15640 INX ;CHECK FOR INPUT OR OUTPUT
|
||
|
15650 BEQ D$CSIO
|
||
|
15660 JMP CLOUTT ;OUTPUT THIS CHARACTER
|
||
|
15670 D$CSIO=*
|
||
|
15680 JSR CSLTET ;TEST IF CONSOLE IS READY INPUT
|
||
|
15690 AND #$01
|
||
|
15700 BEQ DR$SIO ;IF NOT READY,RETURN
|
||
|
15710 JSR CLINN ;INPUT A CHARACTER
|
||
|
15720 DR$SIO=*
|
||
|
15730 JMP STRTFG
|
||
|
15740 REESV*=*+3
|
||
|
15750 ;
|
||
|
15760 ;
|
||
|
15770 ;
|
||
|
15780 ;
|
||
|
15790 ;
|
||
|
15800 ;
|
||
|
15810 ;
|
||
|
15820 ;
|
||
|
15830 ;
|
||
|
15840 ;
|
||
|
15850 ;
|
||
|
15860 ;********************************************************
|
||
|
15870 ;*
|
||
|
15880 ;* FUNCTION 5 : BUFFER OUTPUT
|
||
|
15890 ;*
|
||
|
15900 ;********************************************************
|
||
|
15910 ;*
|
||
|
15920 ;* ENTRY PARAMETERS :
|
||
|
15930 ;* REGISTER X : $05
|
||
|
15940 ;* REGISTER Y,A : STARTING ADDRESS OF THE BUFFER
|
||
|
15950 ;*
|
||
|
15960 ;******************************************************
|
||
|
15970 ;
|
||
|
15980 OUTBUF=*
|
||
|
15990 ;
|
||
|
16000 LDY #$00
|
||
|
16010 OU$BUF=*
|
||
|
16020 LDA (DEREG),Y
|
||
|
16030 CMP #$24 ;'$'?
|
||
|
16040 BNE O$TBUF ;IF IS,END
|
||
|
16050 RTS
|
||
|
16060 O$TBUF=*
|
||
|
16070 JSR CSLOUT ;IF NOT,OUTPUT THIS CHARACTER UNTIL
|
||
|
16080 ;$ IS MET.
|
||
|
16090 INY
|
||
|
16100 BNE OU$BUF
|
||
|
16110 INC DEREG+1
|
||
|
16120 BNE OU$BU
|
||
|
16130 ;
|
||
|
16140 BKSPAC=* ;BACK SPACE ONE CHARACTER
|
||
|
16150 ;
|
||
|
16160 JSR B$SPAC
|
||
|
16170 LDA 11,20
|
||
|
16180 JSR CLOUTT
|
||
|
16190 B$SPAC=*
|
||
|
16200 LDA #$08
|
||
|
16210 JMP CLOUTT
|
||
|
16220 ;
|
||
|
16230 NWLNHD=* ;POSITION CURSOR TO THE LOCA. OF NEW
|
||
|
16240 ;LINE CORRESPONDING TO THE ORIGINAL
|
||
|
16250 ;POSITION IN CURRENT LINE
|
||
|
16260 LDA #$23 ;OUTPUT # TO ENDED CURRENT LINE
|
||
|
16270 JSR OUTCHR
|
||
|
16280 JSR CRLFHD ;CURSOR TO A NEW LINE
|
||
|
16290 NW$NHD=*
|
||
|
16300 LDA SCNPNT ;POSITION CURSOR TO THE LOCA.
|
||
|
16310 ;CORRESPONDING THE ORIGINAL ONE
|
||
|
16320 CMP SCNPTS
|
||
|
16330 BCC N$LNHD
|
||
|
16340 RTS
|
||
|
16350 N$LNHD=*
|
||
|
16360 LDA #$20
|
||
|
16370 JSR OUTCHR
|
||
|
16380 JMP NW$NHD
|
||
|
16390 ;
|
||
|
16400 CRLFH11=*: ;CR AND LF HANDLING
|
||
|
16410 ;
|
||
|
16420 LDA #$011
|
||
|
16430 JSR OUTCHR
|
||
|
16440 LDA #$0A
|
||
|
16450 JMP OUTCHR
|
||
|
16460 ;
|
||
|
16470 ;*******************************************************
|
||
|
16480 ;*
|
||
|
16490 ;* FUNCTION 6 : READ CONSOLE BUFFER
|
||
|
16500 ;*
|
||
|
16510 ;*******************************************************
|
||
|
16520 ;*
|
||
|
16530 ;* ENTRY PARAMETERS ;
|
||
|
16540 ;* REGISTER X ; $06
|
||
|
16550 ;* REGISTER Y,A: STARTING ADDRESS OF THIS BUFFER *
|
||
|
16560 ;*
|
||
|
16570 ;* RETURNED VALUE :
|
||
|
16580 ;* CONSOLE CHARACTERS IN THE BUFFER
|
||
|
16590 ;*
|
||
|
16600 ;*******************************************************
|
||
|
16610 ;
|
||
|
16620 RDCSBF=*
|
||
|
16630 ;
|
||
|
16640 CLD
|
||
|
16650 LDA SCNPNT ;STORE THE INIT VALUE OF SCREEN
|
||
|
16660 ;LINE POINTER TO SCREEN STAR POINTER
|
||
|
16670 STA SCNPTS
|
||
|
16680 LDA #$00
|
||
|
16690 LDY #$01
|
||
|
16700 STA CHRNUB ;KEEP COUNTER OF CURRENT CHAR.S
|
||
|
16710 STY CSBUFS ;AND OFFSET OF THE LAST CHAR TO START
|
||
|
16720 ;ADDRESS OFTHEBUFFER.
|
||
|
16730 RD$SBF=*
|
||
|
16740 JSR INCHR ;GET A CHARACTER
|
||
|
16750 AND #$7F
|
||
|
16760 CMP #30D ;'CR'?
|
||
|
16770 BEQ RD$$$F
|
||
|
16780 CMP #$0A ;'LF'?
|
||
|
16790 BNE RDC$$$
|
||
|
16800 RD$$$F=*
|
||
|
16810 JMP RDC$$F
|
||
|
16820 RDC$$$=*
|
||
|
16830 CMP 1308 ;'BA`?
|
||
|
16840 BNE RDC$BF
|
||
|
16850 LDA CHRNUB ;'BA' HANDLING
|
||
|
16860 BEQ RD$SBF
|
||
|
16870 DEC CHRNUB ;COUNTER DECREASE BY 1
|
||
|
16880 LDA SCNPNT ;STORE SCREEN LINE POINTER
|
||
|
16890 STA BANBAC ;TO BACK SPACE NUMBER ACCOUNTER
|
||
|
16900 JMP RD$$BF
|
||
|
16910 RDC$BF=*
|
||
|
16920 NOP
|
||
|
16930 CMP #$7F ;'DEL'?
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
16940 BNE RDCS$F
|
||
|
16950 LDX CHRNUB
|
||
|
16960 BEQ RD$SBF
|
||
|
16970 DEC CHRNUB ;NUMBER ACCOUNTER AND BUFFER
|
||
|
16980 DEC CSBUFS ;OFFSET DECREASE BY 1 TO ELIMMINATE
|
||
|
16990 ;THE LAST WORD
|
||
|
17000 JMP RD$SB$
|
||
|
17010 RDCS$F=*
|
||
|
17020 CMP #$05 ;CONTROL-E?
|
||
|
17030 BNE RDCSB$
|
||
|
17040 JSR CRLFHD ;GIVING A 'CR','LF'COMMAND
|
||
|
17050 LDA #$00 ;SET SCREEN START POINTER TO ZERO
|
||
|
17060 STA SCNPTS
|
||
|
17070 JMP RD$SBF ;GET NEXT CHARACTER
|
||
|
17080 RDCSB$=*
|
||
|
17090 CMP #$10 ;CONTROL-P?
|
||
|
17100 BNE R$$SBF
|
||
|
17110 LDA #$B0 ;REVERSE THE PRINTER FLAG
|
||
|
17120 FOR PRTFLG
|
||
|
17130 STA PRTFLG
|
||
|
17140 JMP RD$SBF ;GET NEXT CHARACTER
|
||
|
17150 R$$SBF-*
|
||
|
17160 CMP #$18 ;'CONTROL-X '?
|
||
|
17170 BNE R$C$BF
|
||
|
17180 RDCSB1=*
|
||
|
17190 LDA SCMPTS ;KEEP BACKING SPACE UNTIL THE START
|
||
|
17200 ;POSITION OF CURRENT LINE ARRIVED
|
||
|
17210 CMP SCNPNT
|
||
|
17220 BCS RDCSBF
|
||
|
17230 DEC SCNPNT
|
||
|
17240 JSR BKSPAC
|
||
|
17250 JMP RDCSB1
|
||
|
17260 R$C$BF=*
|
||
|
17270 CMP #$15 ;'CONTROL U'?
|
||
|
17280 BNE R$CS$F
|
||
|
17290 JSR NWLNHD ;CREATE A NEW LINE
|
||
|
17300 JMP RDCSBF
|
||
|
17310 R$CS$F=*
|
||
|
17320 CMP #$12 ;'CONTROL-R'?
|
||
|
17330 BNE R$CSB$
|
||
|
17340 RD$$BF=*
|
||
|
17350 JSR NWLNHD ;NEW LINE HANDLING
|
||
|
17360 LDY #$01 ;START TO WRITE A NEW LINE FROM THE
|
||
|
17370 ;FIRST CHARCACTER OF CURRENT LINE IN
|
||
|
17380 ;CONSOLE BUFFER
|
||
|
17390 STY CSBUFS
|
||
|
17400 LDA CHRNUB
|
||
|
17410 STA TEMP
|
||
|
17420 RIICSB2=*
|
||
|
17430 BEQ RD$S$F
|
||
|
17440 INC CSBUFS ;INCRE. OFFSET TO WRITE NEXT CHAR
|
||
|
17450 LDY CSBUFS
|
||
|
17460 LDA (DEREG),Y
|
||
|
17470 JSR CSLOU$ ;WRITE NEXT CHARACTER
|
||
|
17480 DEC TEMP
|
||
|
17490 JMP RDCSB2
|
||
|
17500 RD$S$F=1
|
||
|
17510 LDA BANBAC ;IF AL CHAR HAVE RETYPED,CHECK FOR
|
||
|
17520 BNE RDCSBS
|
||
|
17530 JMP RD$SBF ;IF BANBAC=0
|
||
|
17540 RDCSB5=*
|
||
|
17550 SEC
|
||
|
17560 SBC SCNPNT ;TO FIND THE DIFFERENCE NO. BETWEEN
|
||
|
17570 ;CURRENT ACCOUNTER AND PREVIOUS
|
||
|
17580 ;ACCOUNTER
|
||
|
17590 STA BANBAC
|
||
|
17600 RDCSB3=*
|
||
|
17610 JSR BKSPAC ;BACK SPACE UNTIL CURRENT ACCOUNTER
|
||
|
17620 DEC BANBAC ;MATCHING PREVIOUS ONE
|
||
|
17630 BNE RDCSB3
|
||
|
17640 JMP RD$SBF
|
||
|
17650 R$C3B$=*
|
||
|
17660 INC CSBUFS ;SET UFFSET TO CURRENT CHAR.
|
||
|
17670 LDY CSBUFS
|
||
|
17680 STA (DEREG),Y ;STORE THE CHAR INTO CORRESPONDING
|
||
|
17690 ;LOCATIONN
|
||
|
17700 INC CHRNUB ;INCREASING CHR NUMBER 1
|
||
|
17710 RD$SB$=*
|
||
|
17720 PHA
|
||
|
17730 JSR CSLOU$ ;TYPE IT
|
||
|
17740 PLA
|
||
|
17750 CMP #$03 ;CHECK FOR CONTROL-C
|
||
|
17760 BNE RDCSB4
|
||
|
17770 LDA CHRNUB
|
||
|
17780 CMP #$01
|
||
|
17790 BNE RDCSB4
|
||
|
17800 JMP $0000 ;IF IS CTRL-C AND IN STARTING
|
||
|
17810 ;POSITION,GO TO WARM BOOT
|
||
|
17820 REICSB4=*
|
||
|
17830 NOP
|
||
|
17840 NOP
|
||
|
17850 LDY #$00 ;TO COMPARE CHAR NO. WITH MAX NO.
|
||
|
17860 LDA (DEREG),Y
|
||
|
17370 CMP CHRNUB
|
||
|
17880 BEQ RDC$$F
|
||
|
17890 JMP RD$SBF ;IF LESS THAN,GET NEXT CHAR.
|
||
|
17900 RDC$$F=*
|
||
|
17910 LDY #$01 ;STORE CHR NO. TO CONSOLE BUFFER
|
||
|
17920 ;WHEN RETURN
|
||
|
17930 LDA CHRNUB
|
||
|
17940 STA (DEREG),Y
|
||
|
17950 JMP CRLFHD
|
||
|
17960 ;
|
||
|
17970 ;
|
||
|
17980 ;
|
||
|
17990 ;
|
||
|
18000 ;
|
||
|
18010 ;
|
||
|
18020 ;*******************************************************
|
||
|
18030 ;*
|
||
|
18040 ;* FUNCTION 7 : GET INPUT/OUTPUT BYTE
|
||
|
18050 ;*
|
||
|
18060 ;*******************************************************
|
||
|
18070 ;*
|
||
|
18030 ;* ENTRY PARAMETERS :
|
||
|
18090 ;* REGISTER X : $07
|
||
|
18100 ;*
|
||
|
18110 ;* RETURNED VALUE :
|
||
|
18120 ;* REGISTER A : INPUT/OUTPUT BYTE VALUE
|
||
|
18130 ;*
|
||
|
18140 ;*******************************************************
|
||
|
18150 ;
|
||
|
18160 GTIOBY=*
|
||
|
18170 ;
|
||
|
18180 LDA IOBYTE
|
||
|
18190 JMP STRTFG
|
||
|
18200 ;
|
||
|
18210 ;*******************************************************
|
||
|
18220 ;*
|
||
|
18230 ;* FUNCTION 8 : SET INPUT/OUTPUT BYTE
|
||
|
18240 ;*
|
||
|
18250 ;******************************************************* *
|
||
|
18260 ;*
|
||
|
18270 ;* ENTRY PARAMETERS :
|
||
|
18280 ;* REGISTER X : $08
|
||
|
18290 ;* REGISTER A : INPUT/OUTPUT BYTE VALUE
|
||
|
18300 ;*
|
||
|
18310 ;*******************************************************
|
||
|
18320 ;
|
||
|
18330 STIOBY=*
|
||
|
18340 ;
|
||
|
18350 STA IOBYTE
|
||
|
18360 RTS
|
||
|
18370 ;
|
||
|
18380 ;******************************************************* *
|
||
|
18390 ;*
|
||
|
18400 ;* FUNCTION 9 : GET CONSOLE STATUS *
|
||
|
18410 ;*
|
||
|
18420 ;******************************************************* *
|
||
|
18430 ;*
|
||
|
18440 ;* ENTRY PARAMETERS :
|
||
|
18450 ;* REGISTER X : $09
|
||
|
18460 ;*
|
||
|
18470 ;* RETURNED VALUE :
|
||
|
18480 ;* REGISTER A : CONSOLE STATUS
|
||
|
18490 ;*
|
||
|
18500 ;*******************************************************
|
||
|
18510 ;
|
||
|
18520 GTCLST=*
|
||
|
18530 ;
|
||
|
18540 JSR INTPHEI
|
||
|
18550 JNP STRTFG
|
||
|
|
||
|
18560 *=$DBCO
|
||
|
18570 START=$00
|
||
|
18580 CREG=$08
|
||
|
19590 DEREG=$09
|
||
|
18600 HLREG=$08
|
||
|
18610 HLREG1=$0D
|
||
|
18620 FLAG=$0F ;BIT3:'1' FOR BUILD UP CHECK AREA
|
||
|
18630 ;BIT4:'1' FOR R/W SECTOR
|
||
|
18640 ;BIT5:'1' FOR ADD MAP BIT
|
||
|
18650 ;BIT6:'1' FOR WRITE
|
||
|
18660 ;BIT7:'1' FOR DIR ENTRY FINISH
|
||
|
18670 DIRBFA=$12 ;DIR BUFFER
|
||
|
18680 MAPBFA=$14 ;MAP AREA
|
||
|
18690 CHKBFA=$16 ;CHECK AREA
|
||
|
18700 RTNFLG=$18 ;THREE RETURN FLAGS
|
||
|
18710 DRERNB=$1C ;DIR ENTRY#
|
||
|
18720 DREROF=$1D ;DIR ENTRY OFFSET
|
||
|
18730 TEMP=$1F
|
||
|
18740 BLKNUB=$21 ;BLOCK NUMBER
|
||
|
18750 TRKNUB=$22 ;TRACK NUMBER
|
||
|
18760 TEMP1=$23
|
||
|
18770 PRVDSK=$24 ;PREVIOUS DISK#
|
||
|
18780 CRTDRN=$25 ;RESERVED FOR DR OF FCB
|
||
|
18790 CMERCT=$27 ;NUMBER OF MATCHING FCB WITH DIR
|
||
|
18800 DERDSK=$29 ;DESIRED DISK#
|
||
|
18810 RTNFG1=$2A ;AXULIRARY RETURN FLAG
|
||
|
18820 FLAG2=$2C
|
||
|
18830 CRRCNB=$2D ;CR
|
||
|
18840 TLRCNB=$2E ;RC
|
||
|
18850 EXNTNB=S2F ;EX
|
||
|
18860 SECNUB=$30 ;SECTOR# WITHIN A TRACK
|
||
|
18870 TEMP2=$37
|
||
|
18880 BKRBLK=$31 ;BACK BLOCK#
|
||
|
18890 ADVBLK=$33 ;ADVANCED BLOCK#
|
||
|
18900 BKOSFG=$35 ;BLOCK OFFSET FLAG
|
||
|
18910 BLKOFS=$36 ;BLOCK OFFSET
|
||
|
18920 IOBFFG=$39 ;'FLUSH' FLAG
|
||
|
18930 CRTDSK=$3A ;CURRENT DISK NO.
|
||
|
18940 CBADRV=$55 ;RESERVED FOR SERCH NEXT
|
||
|
18950 FLAG1=$58
|
||
|
18960 SYMRST=$D9A6 ;BDO1
|
||
|
18970 CSLIN=$D9C0
|
||
|
18980 CSLOUT=$DA5C
|
||
|
18990 LITOTT=$DA71
|
||
|
19000 DRCSIO=$DA74
|
||
|
19010 OUTBUF=$DA8B
|
||
|
19020 RDCSBF=$DACD
|
||
|
19030 GTIOBY=$D8B2
|
||
|
19040 STIOBY=$D8B7
|
||
|
19050 GTCLST=$DBBA
|
||
|
19060 PAMTAB=$E41F ;BIOS
|
||
|
19070 LITOUT=$E5A9
|
||
|
19080 HOMEHD=$E5F5
|
||
|
19090 DKSEL1=$E643
|
||
|
19100 SETTR1=$E665
|
||
|
19110 SETSC1=$E668
|
||
|
19120 SETBL1=$E66B
|
||
|
19130 STDMA1=$E66E
|
||
|
19140 WRTIRK=$E822
|
||
|
14150 RWDBS1=$E887
|
||
|
19160 ERROR=$E928
|
||
|
19170 SIOBDK=$E90A
|
||
|
19180 DFBUFA=$E965
|
||
|
19190 DIRBUF=$EB65
|
||
|
19200 MAPAR0=$ED65
|
||
|
19210 MAPAR1=$EDA5
|
||
|
19220 CHKAR0=SEDE5
|
||
|
19230 CHKAR1=$EDF3
|
||
|
19240 FLCTBK=$EE01
|
||
|
19250 IOBUF=$B000
|
||
|
19260 USERCD .BYTE $01 ;USER CODE
|
||
|
19270 WPTVCT .BYTE $00 ;R/O VECTOR
|
||
|
19280 LOGVTR .BYTE $00 ;LOGIN VECTOR
|
||
|
19290 ;BRANCH TABLE
|
||
|
19300 BRHTAB .WORD SYMRST,CSLIN,CSLOUT,LITOTT,DRCSIO
|
||
|
19310 .WORD OUTBUF,RDCSBF,GTIOBY,STIOBY,GTCLST
|
||
|
19320 .WORD RSDKSM,GTLGVT,GTCRDK,GTMPLT,SETWPT
|
||
|
19330 .WORD GTROVT,GTDKPA,SGTUCD,SETDMA,SELDSK
|
||
|
19340 .WORD MAKFIL,DELFIL,OPNFIL,CLSFIL,RDRCSO
|
||
|
19350 .WORD WTRCSO,RDRCRM,WIRCRM,SHFIST,SHNEXT
|
||
|
19360 .WORD RENAME,CHATRB,CPFISZ,STRDRC,SIODSK
|
||
|
19370 ;
|
||
|
19380 ;*******************************************************
|
||
|
19390 ;*
|
||
|
19400 ;* FUNCTION 10 : RESET DISK SYSTEM
|
||
|
19410 ;*
|
||
|
19420 ;*******************************************************
|
||
|
19430 ;*
|
||
|
19440 ;* ENTRY PARAMETERS :
|
||
|
19450 ;* REGISTERX : $0A
|
||
|
19460 ;*
|
||
|
19470 ;*******************************************************
|
||
|
19480 ;
|
||
|
19490 RSDKSM=*
|
||
|
19500 ;
|
||
|
19510 LDA #$00 ;INITIALIZE WRITING PROTECT VECTOR
|
||
|
19520 STA LOGVTR ;& DISK LOG VECTOR
|
||
|
19530 STA WPTVCT
|
||
|
19540 STA DERDSK ;SELECT DISK A
|
||
|
19550 JSR S$LDSK
|
||
|
19560 LDA #DFBUFA ;SELECT DEFAULT BUF FOR DMA
|
||
|
19570 LDX #DFBUFA/256
|
||
|
19580 JMF STDMA1
|
||
|
19590 ;
|
||
|
19600 ;
|
||
|
19610 ;
|
||
|
19620 ;*******************************************************
|
||
|
19630 ;*
|
||
|
19640 ;* FUNCTION 11 : GET LOGIN VECTOR
|
||
|
19650 ;*
|
||
|
19660 ;*******************************************************
|
||
|
19670 ;*
|
||
|
19680 ;* ENTRY PARAMETERS :
|
||
|
19690 ;* REGISTER X : $0B
|
||
|
19700 ;*
|
||
|
19710 ;* RETURNED VALUE :
|
||
|
19720 ;* REGISTER A : LOGIN VECTOR
|
||
|
19730 ;*
|
||
|
19740 ;******************************************************
|
||
|
19750 ;
|
||
|
19760 GTLGVT=*
|
||
|
19770 ;
|
||
|
19780 LDA LOGVTR
|
||
|
19790 JMP STRTFG
|
||
|
19800 ;
|
||
|
19810 ;*******************************************************
|
||
|
19820 ;*
|
||
|
19830 ;* FUNCTION 12 : GET CURRENT DISK NUMBER *
|
||
|
19840 ;*
|
||
|
19850 ;*******************************************************
|
||
|
19860 ;*
|
||
|
19870 ;* ENTRY PARAMETERS :
|
||
|
19830 ;* REGISTER X : $0C
|
||
|
19890 ;*
|
||
|
19900 ;* RETURNED VALUE :
|
||
|
19910 ;* REGISTER A : CURRENT DISK NUMBER
|
||
|
19920 ;*
|
||
|
19930 ;*******************************************************
|
||
|
19940 ;
|
||
|
19450 GTCRDK=*
|
||
|
19960 LDA CRTDSK
|
||
|
19970 JMP STRTFG
|
||
|
19980 ;
|
||
|
19990 ;********************************************************
|
||
|
20000 ;*
|
||
|
20010 ;* FUNCTION 13 : GET MAP ADDRESS OF CURRENT DISK *
|
||
|
20020 ;*
|
||
|
20030 ;********************************************************
|
||
|
20040 ;*
|
||
|
20050 ;* ENTRY PARAMETERS :
|
||
|
20060 ;* REGISTER X : $0D
|
||
|
20070 ;*
|
||
|
20080 ;* RETURNED VALUE :
|
||
|
20090 ;* REGISTER Y,A : MAP ADDRESS OF CURRENT DISK *
|
||
|
20100 ;*
|
||
|
20110 ;********************************************************
|
||
|
20120 ;
|
||
|
20130 GTMPLT=*
|
||
|
20140 ;
|
||
|
20150 LDA MAPBFA
|
||
|
20160 STA RTNFLG+1
|
||
|
20170 LDA NAPBFA+1
|
||
|
20180 STA RTNFLG+2
|
||
|
20190 RTS
|
||
|
20200 ;
|
||
|
20210 ;********************************************************
|
||
|
20220 ;*
|
||
|
20230 ;* FUNCTION 14 : SET WRITING PROTECT VECTOR
|
||
|
20240 ;*
|
||
|
20250 ;********************************************************
|
||
|
20260 ;*
|
||
|
20270 ;* ENTRY PARAMETERS :
|
||
|
20280 ;* REGISTER X : $0E
|
||
|
20290 ;*
|
||
|
20300 ;****************************************************
|
||
|
20310 ;
|
||
|
20320 SETWPT=*
|
||
|
20330 ;
|
||
|
20340 LDA CRTDSK ;GET BIT PATTERN FOR CURRENT
|
||
|
20350 JSR BNYBIT ;DISK
|
||
|
20360 ORA WPTVCT
|
||
|
20370 STA WPTVCT ;SET R/O FOR CURRENT DISK
|
||
|
20380 RTS
|
||
|
20390 ;
|
||
|
20400 ;********************************************************
|
||
|
20410 ;*
|
||
|
20420 ;* FUNCTION 15 : GET READ ONLY VECTOR
|
||
|
20430 ;*
|
||
|
20440 ;******************************************************
|
||
|
20450 ;*
|
||
|
20460 ;* ENTRY PARAMETERS :
|
||
|
20470 ;* REGISTER X : $0F
|
||
|
20480 ;*
|
||
|
20490 ;* RETURNED VALUE :
|
||
|
20500 ;* REGISTER A : READY ONLY VECTOR
|
||
|
20510 ;*
|
||
|
20520 ;********************************************************
|
||
|
20530 ;
|
||
|
20540 GTROVT=*
|
||
|
20550 ;
|
||
|
20560 LDA WPTVCT
|
||
|
20570 JMP STRTFG
|
||
|
20580 ;
|
||
|
20590 ;
|
||
|
20600 ;
|
||
|
20610 ;
|
||
|
20620 ;
|
||
|
20630 ;
|
||
|
20640 ;
|
||
|
20650 ;
|
||
|
20660 ;
|
||
|
20670 ;
|
||
|
20680 ;
|
||
|
20690 ;
|
||
|
20700 ;*****************************************************
|
||
|
20710 ;*
|
||
|
20720 ;* FUNCTION 1 6 : GET PARAMETER TABLE ADDRESS OF
|
||
|
20730 ;* CURRENT DISK
|
||
|
20740 ;*
|
||
|
20750 ;*****************************************************
|
||
|
20760 ;*
|
||
|
20770 ;* ENTRY PARAMETERS :
|
||
|
20780 ;* REGISTER X : $10
|
||
|
20790 ;*
|
||
|
20800 ;* RETURNED VALUE :
|
||
|
20810 ;* REGISTER Y,A : PARAMETER TABLE ADDRESS
|
||
|
20820 ;*
|
||
|
20830 ;********************************************************
|
||
|
20840 ;
|
||
|
20850 GTDKPA=*
|
||
|
20860 ;
|
||
|
20870 LDA CRTOSK
|
||
|
20880 LDX #$03
|
||
|
20890 JSR ASLDSR
|
||
|
20900 LDX #PAMTAB ;GET CORRES. ADDR.
|
||
|
20910 STX HLREG
|
||
|
20920 LDX #PAMTAB/256
|
||
|
20930 STX HLREG+1
|
||
|
20940 LDX #$00
|
||
|
20950 STX TEMP
|
||
|
20960 JSR ADCOFS
|
||
|
20970 LOA HLREG ;RETURN THE ADDR.
|
||
|
20980 STA RTNFLG+1
|
||
|
20990 LOA HLREG+1
|
||
|
21000 STA RTNFLG+2
|
||
|
21010 RTS
|
||
|
21020 ;
|
||
|
21030 ;*********************************************************
|
||
|
21040 ;*
|
||
|
21050 ;* FUNCTION 17 : SET/GET USERCODE
|
||
|
21060 ;*
|
||
|
21070 ;*********************************************************
|
||
|
21080 ;*
|
||
|
21090 ;* ENTRY PARAMETERS :
|
||
|
21100 ;* REGISTER X : $11
|
||
|
21110 ;* REGISTER A : $FF (GET) OR USERCODE (SET)
|
||
|
21120 ;*
|
||
|
21130 ;* RETURNED VALUE :
|
||
|
21140 ;* REGISTER A :CURRENT CODE OR (NO VALUE)
|
||
|
21150 ;*
|
||
|
21160 ;*********************************************************
|
||
|
21170 ;
|
||
|
21180 SGTUCD=*
|
||
|
21190 CMP #$FF ;CHECK WETHER SET OR GET
|
||
|
21200 ONE S$TUCD
|
||
|
21210 LDA USERCD ;GET IT
|
||
|
21220 JMP STRTFG
|
||
|
21230 S$TUCD=*
|
||
|
21240 AND #$1F
|
||
|
21250 STA USERCD ;GET IT
|
||
|
21260 RTS
|
||
|
21270 ;
|
||
|
21280 ;*********************************************************
|
||
|
21290 ;*
|
||
|
21300 ;* FUNCTION 18 : SET DMA ADDRESS
|
||
|
21310 ;*
|
||
|
21320 ;*****************************************************
|
||
|
21330 ;*
|
||
|
21340 ;* ENTRY PARAMETERS :
|
||
|
21350 ;* REGISTER X : $12
|
||
|
21360 ;* REGISTER Y,A : DMA ADDRESS
|
||
|
21370 ;
|
||
|
21380 ;*********************************************************
|
||
|
21390 ;
|
||
|
21400 SETDMA=*
|
||
|
21410 ;
|
||
|
21420 LDA DEREG
|
||
|
21439 LUX DEREG+1
|
||
|
21440 JMP STDMA1
|
||
|
21450 ;
|
||
|
21460 ASLDSR=* ;VALUE*(2**(X))
|
||
|
21470 ; ;WHERE VALUE IS IN A & TEMP
|
||
|
21480 ;
|
||
|
21490 ASL A
|
||
|
21500 ROL TEMP
|
||
|
21510 DEX
|
||
|
21520 BNE ASLDSR
|
||
|
21530 RTS
|
||
|
21540 ;
|
||
|
21550 ADCOFS=* ;ADD OFFSET TO THE ADDR.
|
||
|
21560 ;
|
||
|
21570 CLC
|
||
|
21530 ADC HLREG
|
||
|
21590 STA HLREG
|
||
|
21600 LDA TEMP
|
||
|
21610 ADC HLREG+1
|
||
|
21620 STA HLREG+1
|
||
|
21630 RTS
|
||
|
21640 ;
|
||
|
21650 GETENT=* ;GET DESIRED DIR ENTRY ADDR.
|
||
|
21660 ;
|
||
|
21670 LDA DIRBFA
|
||
|
21680 STA HLREG
|
||
|
21690 LDA DIRBFA+1
|
||
|
21700 STA HLREG+1
|
||
|
21710 LDA DREROF+1
|
||
|
21720 STA TEMP
|
||
|
21730 LDA DREROF
|
||
|
21740 JMP ADCOFS
|
||
|
21750 ;
|
||
|
21760 BNYBIT=* ;ENTRY:A BINARY
|
||
|
21770 ;EXIT:A BIT PATTERN
|
||
|
21780 ;
|
||
|
21790 TAX
|
||
|
21800 LDA #$01
|
||
|
21810 B$YBIT=*
|
||
|
21820 DEX
|
||
|
21830 BMI BN$BIT
|
||
|
21840 ASL A
|
||
|
21850 JMP B$YBIT
|
||
|
21860 BN$BIT=*
|
||
|
21870 RTS
|
||
|
21880 ;
|
||
|
21890 ;FOR THE INPUT PHYSICAL BLOCK NO.IN A &TEMP
|
||
|
21900 ;CACULATE THE CORRS. BYTE OFFSET FROM BIT MAP
|
||
|
21910 ;AND STORE IT TO Y,THE BIT PATTERN WITHIN THE
|
||
|
21920 ;BYTE ANDSTORE IT TO A
|
||
|
21930 ;
|
||
|
21940 GTMAPB=*:
|
||
|
21950 ;
|
||
|
21960 PHA ;LOW BYTE R-SHIFT 3 TIMES
|
||
|
21970 LSR A
|
||
|
21980 LSR A
|
||
|
21990 LSR A
|
||
|
22000 LDX #$05
|
||
|
22010 G$MAPB=*
|
||
|
22020 ASL TEMP ;HIGH BYTE L-SHIFT 5 TIMES
|
||
|
22030 DEX
|
||
|
22040 BNE G$MAPB
|
||
|
22050 ORA TEMP ;THE RESULT: PHY. BLOCK NO./8
|
||
|
22060 TAY
|
||
|
22070 PLA
|
||
|
22080 AND #$07 ;GET THE CORRES. BIT PATTERN
|
||
|
22090 STA TEMP+1
|
||
|
22100 LDA #$07
|
||
|
22110 SEC
|
||
|
22120 SBC TEMP+1
|
||
|
22130 JMP BNYBIT
|
||
|
22140 ;
|
||
|
22150 GTBKNB=* ;GET PHYSICAL BLOCK NO.
|
||
|
22160 ;AND STORE IN A & TEMP
|
||
|
22170 ;
|
||
|
22180 LDA #$00
|
||
|
22190 STA TEMP
|
||
|
22200 LDA (HLREG1),Y ;GET LOGICAL BLOCK NO.
|
||
|
22210 LDX #$01 ;AND *2
|
||
|
22220 JSR ASLDSR
|
||
|
22230 TAX
|
||
|
22240 TYA
|
||
|
22250 LSR A ;ODD OR EVEN?
|
||
|
22260 BCS G$BKNB ;ODD, -1
|
||
|
22270 JSR G$BKNB ;EVEN, -2
|
||
|
22280 G$BKNB=*
|
||
|
22290 CPX #$00
|
||
|
22300 BNE GT$KNB
|
||
|
22310 DEC TEMP
|
||
|
22320 GT$KNB=*
|
||
|
22330 DEX
|
||
|
22340 TXA
|
||
|
22350 RTS
|
||
|
22360 ;
|
||
|
22370 MDFMPB=* ;BUILD OR MODIFY BIT MAP
|
||
|
22380 ;
|
||
|
72390 JSR GTBKNB ;GET PHSICAL BLOCK NO.
|
||
|
22400 JSR GTMAPB
|
||
|
22410 PHA
|
||
|
22420 LDA #$20 ;ADD OR DELETE?
|
||
|
22430 BIT FLAG
|
||
|
22440 BEQ M$FMPB
|
||
|
22450 PLA
|
||
|
22460 ORA (MAPBFA),Y ;SET CORRES. BIT
|
||
|
22470 STA (MAPBFA),Y
|
||
|
22480 RTS
|
||
|
22490 M$FMPB=*
|
||
|
22500 PLA
|
||
|
22510 EOR #$FF
|
||
|
22520 AND (MAPBFA),Y ;RESET CORRES. BIT
|
||
|
22530 STA (MAPBFA),Y
|
||
|
22540 RTS
|
||
|
22550 ;
|
||
|
22560 MDFMAP=* ;BUILD OR MODIFY BIT MAP FOR
|
||
|
22570 ;WHOLE ENTRY'
|
||
|
22580 ;
|
||
|
22590 LDA HLREG ;DIR ADDR. STORE TO HLREG1
|
||
|
22600 STA HLREG1
|
||
|
22610 LDA HLREG+1
|
||
|
22620 STA HLREG1+1
|
||
|
22630 LDY #$0F
|
||
|
22640 MD$MAP=*
|
||
|
22650 INY
|
||
|
22660 CPY #$20 ;16 BYTES DONE?
|
||
|
22670 BNE M$FMAP ;NO, KEEP DOING
|
||
|
22680 RTS
|
||
|
22690 M$FMAP=*
|
||
|
22700 LDA (HLREG1),Y ;GET LOGICAL BLOCK NO.
|
||
|
22710 BEQ MD$MAP ;IF 0, SKIP IT
|
||
|
22720 STY TEMP1
|
||
|
22730 JSR MDFMPB ;IF NO 0, MODIFY CORRE. BIT MAP
|
||
|
22740 LDY TEMP1
|
||
|
22750 JMP MD$MAP
|
||
|
22760 ;
|
||
|
22770 ADDDIR=* ;GET THE CHECKSUM OF THE DIR
|
||
|
22780 ;BLOCK AND STORE IT TO X & TEMP
|
||
|
22790 ;EXIT:X,TEMP SUM OF WHOLE DIR
|
||
|
22800 ;
|
||
|
22810 LDX #$02
|
||
|
22820 LDY #$00
|
||
|
22830 LDA #$00
|
||
|
22840 A$DDIR=*
|
||
|
22850 CLC ;ADD UP ALL BYTES IN THE BLOCK
|
||
|
|
||
|
22860 ADC (HLREG),Y
|
||
|
22870 BCC AD$DIR
|
||
|
22880 INC TEMP
|
||
|
22890 AD$DIR=*
|
||
|
22900 INY
|
||
|
22910 BNE A$DDIR
|
||
|
22920 INC HLREG+1
|
||
|