Initial Apple II source files

This commit is contained in:
Bill Budge 2013-02-24 13:49:08 -08:00
parent c10dcd6d21
commit 615edfe43b
9 changed files with 11399 additions and 0 deletions

951
source_disc1/CDRAW.S Normal file
View File

@ -0,0 +1,951 @@
LST OFF
***************************
* *
* RECTANGLE AND BITMAP *
* DRAWING ROUTINES *
* *
***************************
*
* PURE TEMP'S AND PARAM SPACE
*
PARAM EQU $00
TEMP EQU PARAM+7
XTEMP EQU TEMP+1
YTEMP EQU XTEMP+1
*
* LOCALS FOR BITMAP ROUTINES
*
BASE1 EQU $10
BASE2 EQU BASE1+2
TEMPBITS EQU BASE2+2
VERT EQU TEMPBITS+2
HDIV7 EQU VERT+1
HMOD7 EQU HDIV7+1
WIDTH EQU HMOD7+1
HEIGHT EQU WIDTH+1
*
* LOCALS FOR RECTANGLE ROUTINES
*
TEMPRECT EQU BASE2
TOP EQU TEMPRECT+2
LFTDIV7 EQU TOP+1
LFTMOD7 EQU LFTDIV7+1
LEFTEDGE EQU LFTMOD7+1
LEFTMASK EQU LEFTEDGE+1
BOTTOM EQU LEFTMASK+1
RTDIV7 EQU BOTTOM+1
RTMOD7 EQU RTDIV7+1
RIGHTEDGE EQU RTMOD7+1
RIGHTMASK EQU RIGHTEDGE+1
*
* LOCALS FOR MOVE ROUTINES
*
SBEGIN EQU $10
SEND EQU SBEGIN+2
DBEGIN EQU SEND+2
DEND EQU DBEGIN
EXTRA EQU DEND+2
*
* LOCALS FOR TEXT
*
TBASE EQU HEIGHT+1
*
* USER INTERFACE LOC'S
*
CURSOR EQU $80
CURSORY EQU CURSOR+2
CURSORXDIV7 EQU CURSORY+1
CURSORXMOD7 EQU CURSORXDIV7+1
CURSORHEIGHT EQU CURSORXMOD7+1
CURSORWIDTH EQU CURSORHEIGHT+1
CRSRXACC EQU CURSORWIDTH+1
CRSRYACC EQU CRSRXACC+1
NEWCURSORXDIV7 EQU CRSRYACC+1
NEWCURSORXMOD7 EQU NEWCURSORXDIV7+1
NEWCURSORY EQU NEWCURSORXMOD7+1
CRSRRTSTOP EQU NEWCURSORY+1
NEWITEM EQU CRSRRTSTOP+1
LASTITEM EQU NEWITEM+2
*
* BITMAP TABLES
*
SHFRSLT EQU $800
SHFOUT EQU SHFRSLT+$600
DIV7 EQU SHFOUT+$600
MOD7 EQU DIV7+$100
LO EQU MOD7+$100
HI EQU LO+$C0
*
ORG HI+$C0
*
* DRAW BITMAPS AND ICONS
*
GETBITS STA TEMPBITS
STX TEMPBITS+1
LDY #0
LDA (TEMPBITS),Y
STA BASE2
STA BITMAP
INY
LDA (TEMPBITS),Y
STA BASE2+1
STA BITMAP+1
INY
LDA (TEMPBITS),Y
STA VERT
INY
LDA (TEMPBITS),Y
STA HDIV7
INY
LDA (TEMPBITS),Y
STA HMOD7
INY
LDA (TEMPBITS),Y
STA HEIGHT
INY
LDA (TEMPBITS),Y
SEC
SBC #1
STA WIDTH
RTS
*
* PEN MODE ROUTINES
*
STORE LDA (BASE2),Y
STA (BASE1),Y
DEY
BPL STORE
BMI DRAWBTS3
*
GRAB LDA (BASE1),Y
STA (BASE2),Y
DEY
BPL GRAB
BMI DRAWBTS3
*
XOR LDA (BASE2),Y
EOR (BASE1),Y
STA (BASE1),Y
DEY
BPL XOR
BMI DRAWBTS3
*
CLR EQU XOR
OR EQU XOR
*
* SET GRAPHICS MODE
*
SETMODE LDA PTBL1,Y ;Y=PEN MODE
STA PMPATCH1 ;MAKE ALL PATCHES
LDA PTBL2,Y
STA PMPATCH2
LDA PTBL3,Y
STA PMPATCH3
STA PMPATCH4
RTS
*
PTBL1 DA <STORE
DA <GRAB
DA <XOR
DA <CLR
DA <OR
*
PTBL2 DA <STORE2
DA <GRAB2
DA <XOR2
DA <CLR2
DA <OR2
*
PTBL3 DA <STORE3
DA <GRAB3
DA <XOR3
DA <CLR3
DA <OR3
*
DRAWBITS JSR GETBITS
DRAWBTS2 LDY VERT ;GET BASE ADDRESS
CPY #192
BCS BITSOUT
LDA LO,Y
CLC
ADC HDIV7
STA BASE1
LDA HI,Y
STA BASE1+1
*
LDY WIDTH ;BLAST OUT A SCAN LINE
PMPATCH1 EQU *+1
JMP STORE ;OFF TO APPROPRIATE MODE
*
DRAWBTS3 DEC HEIGHT
BEQ BITSOUT ;ANY MORE?
*
LDA BASE2 ;NEXT ROW IN BITMAP
SEC
ADC WIDTH ;WIDTH - 1
STA BASE2
LDA BASE2+1
ADC #0
STA BASE2+1
INC VERT
BNE DRAWBTS2
BITSOUT RTS
*
* BITMAP DRAWING OFFSET BY
* A NUMBER MOD 7
*
SRADDR DA >SHFRSLT
DA >SHFRSLT+$100
DA >SHFRSLT+$200
DA >SHFRSLT+$300
DA >SHFRSLT+$400
DA >SHFRSLT+$500
*
SOADDR DA >SHFOUT
DA >SHFOUT+$100
DA >SHFOUT+$200
DA >SHFOUT+$300
DA >SHFOUT+$400
DA >SHFOUT+$500
*
XOFFDRAW JSR GETBITS
LDY HMOD7 ;BYTE ALIGNED?
BEQ DRAWBTS2 ;YES, SPECIAL CASE
LDA SRADDR-1,Y ;POKE IN SHIFT RESULT,
STA SHIFTRESULT ;SHIFT OUT TABLE ADDRESSES
LDA SOADDR-1,Y
STA SHIFTOUT
*
XOFFDRW2 LDY VERT ;GET BASE
CPY #192
BCS BITSOUT
LDA LO,Y
SEC
ADC HDIV7 ;ADD BYTE OFFSET + 1
STA BASE1
LDA HI,Y
STA BASE1+1
*
LDY WIDTH ;DO A SCAN LINE
LDA #0 ;BOUNDARY SHIFT RESULT
BITMAP EQU *+1
XOFFDRW3 LDX $FFFF,Y ;POKE BITMAP ADDRESS
SHIFTOUT EQU *+2
ORA SHFOUT,X ;HI BYTE MODIFIED
EOR (BASE1),Y
STA (BASE1),Y
SHIFTRESULT EQU *+2
LDA SHFRSLT,X ;HI BYTE MODIFIED
DEY
BPL XOFFDRW3
*
DEC BASE1+1 ;Y=$FF
EOR (BASE1),Y
STA (BASE1),Y
*
DEC HEIGHT
BEQ BITSOUT
*
LDA BITMAP
SEC
ADC WIDTH
STA BITMAP
LDA BITMAP+1
ADC #0
STA BITMAP+1
INC VERT
BNE XOFFDRW2
*
**********************
* *
* RECTANGLE ROUTINES *
* *
**********************
*
GETRECT STA TEMPRECT
STX TEMPRECT+1
LDY #0
LDA (TEMPRECT),Y
STA TOP
INY
LDA (TEMPRECT),Y
STA LFTDIV7
INY
LDA (TEMPRECT),Y
STA LFTMOD7
TAX
LDA MASKS,X
EOR #$7F
STA LEFTMASK
*
INY
LDA (TEMPRECT),Y
CLC
ADC TOP
STA BOTTOM
INY
INY
LDA (TEMPRECT),Y
CLC
ADC LFTMOD7
CMP #7
BCC *+4
SBC #7
STA RTMOD7
TAX
DEY
LDA (TEMPRECT),Y
ADC LFTDIV7
STA RTDIV7
LDA MASKS+1,X
STA RIGHTMASK
RTS
*
* MASK AND EDGE TABLES
*
MASKS HEX 00,01,03,07,0F,1F,3F,7F
EDGES HEX 01,02,04,08,10,20,40
*
* HORIZONTAL LINE DRAWING
*
HLINE LDA LO,X ;X=SCAN LINE
STA BASE1
LDA HI,X
STA BASE1+1
*
LDA LEFTMASK
LDY LFTDIV7
CPY RTDIV7 ;RECT IN A BYTE?
BEQ HLIN2
*
PMPATCH2 EQU *+1
JMP STORE2
*
HLIN2 EOR RIGHTMASK
EOR #$7F
BCS HLIN4
*
HLIN3 LDA RIGHTMASK
PMPATCH3 EQU *+1
HLIN4 JMP STORE3
*
* VERTICAL LINE DRAWING
*
VLINE LDA EDGES,X ;Y=DIV7, X=MOD7
STA LEFTEDGE
LDX TOP
VLIN2 LDA LO,X
STA BASE1
LDA HI,X
STA BASE1+1
*
LDA LEFTEDGE
PMPATCH4 EQU *+1
JSR STORE3
*
VLIN3 INX
CPX BOTTOM
BCC VLIN2
BEQ VLIN2
RTS
*
* PEN MODE HANDLERS FOR RECT'S
*
STORE2 EQU *
GRAB2 EQU *
*
XOR2A LDA #$7F
XOR2 EOR (BASE1),Y
STA (BASE1),Y
INY
CPY RTDIV7
BCC XOR2A
BCS HLIN3
*
CLR2A LDA #$7F
CLR2 EOR #$7F
AND (BASE1),Y
STA (BASE1),Y
INY
CPY RTDIV7
BCC CLR2A
BCS HLIN3
*
OR2A LDA #$7F
OR2 ORA (BASE1),Y
STA (BASE1),Y
INY
CPY RTDIV7
BCC OR2A
BCS HLIN3
*
STORE3 EQU *
GRAB3 EQU *
*
XOR3 EOR (BASE1),Y
STA (BASE1),Y
RTS
*
CLR3 EOR #$7F
AND (BASE1),Y
STA (BASE1),Y
RTS
*
OR3 ORA (BASE1),Y
STA (BASE1),Y
RTS
*
* FRAME A RECTANGLE
*
FRAMERECT JSR GETRECT
LDX TOP
JSR HLINE
LDX BOTTOM
CPX TOP
BEQ RECTOUT
JSR HLINE
*
INC TOP
DEC BOTTOM
CPX TOP
BCC RECTOUT
*
LDY LFTDIV7
LDX LFTMOD7
JSR VLINE
LDY RTDIV7
LDX RTMOD7
JMP VLINE
RECTOUT RTS
*
* DRAW A RECTANGULAR AREA
*
DRAWRECT JSR GETRECT
LDX TOP
DRAWRCT2 JSR HLINE
INX
CPX BOTTOM
BCC DRAWRCT2
BEQ DRAWRCT2
RTS
*
* RECTANGLE HIT TEST
*
INRECT JSR GETRECT
INRECT2 LDX PARAM+3
LDA PARAM+4
LDY PARAM+5
CPX LFTDIV7
BCC INRECT4
BNE INRECT3
CMP LFTMOD7
BCC INRECT4
INRECT3 CPX RTDIV7
BCC INRECT5
BNE INRECT4
CMP RTMOD7
BCC INRECT5
BEQ INRECT5
INRECT4 CLC ;NOT IN RECTANGLE
RTS
INRECT5 CPY TOP
BCC INRECT4
CPY BOTTOM
BCC *+4
BNE INRECT4
SEC ;CURSOR IN RECTANGLE
RTS
*
**********************
* *
* USER INTERFACE AND *
* MISC STUFF *
* *
**********************
*
GETBUTNS LDA $C061
ORA $C062
RTS
*
INITCRSR JSR GETBITS
LDA BASE2
STA CURSOR
LDA BASE2+1
STA CURSOR+1
LDA HEIGHT
STA CURSORHEIGHT
LDX WIDTH
INX
STX CURSORWIDTH
LDA #40
SEC
SBC CURSORWIDTH
STA CRSRRTSTOP
*
* SPECIAL CASE CURSOR DRAWING
*
XDRAWCRSR LDA #<CURSOR
LDX #>CURSOR
JMP XOFFDRAW
*
UPDATECRSR JSR DOCRSRX
STX NEWCURSORXDIV7
STA NEWCURSORXMOD7
JSR DOCRSRY
STA NEWCURSORY
JSR XDRAWCRSR ;ERASE OLD ONE
LDA NEWCURSORXDIV7
STA CURSORXDIV7
LDA NEWCURSORXMOD7
STA CURSORXMOD7
LDA NEWCURSORY
STA CURSORY
JMP XDRAWCRSR ;DRAW NEW ONE
*
* READ THE PADDLES AND UPDATE
* THE CURSOR LOCATION
*
DOCRSRX LDA #50
JSR $FCA8
LDX #0
JSR $FB1E
TYA
CMOD1 EQU *+1
EOR #$00
LSR
LSR
LSR
LSR
TAY
LDA LOGLO,Y
CLC
ADC CRSRXACC
STA CRSRXACC
LDX CURSORXDIV7
LDA LOGHI,Y
ADC CURSORXMOD7
BPL DCRSRX3
*
CLC
DCRSRX2 DEX
ADC #7
BMI DCRSRX2
BPL DCRSRX4
*
DCRSRX3 CMP #7
BCC DCRSRX4
SBC #7
INX
BNE DCRSRX3
*
DCRSRX4 CPX CRSRRTSTOP
BCC DCRSRX6
BEQ DCRSRX5
BPL DCRSRX5
LDA #0
TAX
RTS
DCRSRX5 LDA #0
LDX CRSRRTSTOP
DCRSRX6 RTS
*
GETCURSORX LDA CURSORXDIV7
CMP #37
BCS GETC2
STA YTEMP
ASL
ASL
ASL
SEC
SBC YTEMP
CLC
ADC CURSORXMOD7
BCC GETC3
GETC2 LDA #$FF
GETC3 RTS
*
DOCRSRY LDA #50
JSR $FCA8
LDX #1
JSR $FB1E
TYA
CMOD2 EQU *+1
EOR #$00
LSR
LSR
LSR
LSR
TAY
LDA LOGLO,Y
CLC
ADC CRSRYACC
STA CRSRYACC
LDA LOGHI,Y
ADC CURSORY
CMP #192
BCC DCRSRY3
CMP #224
BCC DCRSRY2
LDA #0
RTS
DCRSRY2 LDA #191
DCRSRY3 RTS
*
LOGLO HEX 00,00,80,00,80,E0,00,00
HEX 00,00,20,80,00,80,00,00
LOGHI HEX FB,FE,FE,FF,FF,FF,00,00
HEX 00,00,00,00,01,01,02,05
*
JSCTRL LDX $C000
BPL JSC3
STX $C010
CPX #$D8
BNE JSC2
LDA CMOD1
EOR #$FF
STA CMOD1
JSC2 CPX #$D9
BNE JSC3
LDA CMOD2
EOR #$FF
STA CMOD2
JSC3 RTS
*
* CURSOR IN RECTANGLE TEST
*
CRSRINRECT LDY CURSORXDIV7 ;KEEP A,X
STY PARAM+3
LDY CURSORXMOD7
STY PARAM+4
LDY CURSORY
STY PARAM+5
STA NEWITEM
STX NEWITEM+1
JMP INRECT
*
* MENU SELECTION UTILITY
*
DOMENU STA PARAM
STX PARAM+1
*
DOMNU2 LDY #0
DOMNU3 LDA (PARAM),Y
BNE DOMNU5
*
LDX LASTITEM+1 ;END OF LIST
BEQ DOMNU4
LDA LASTITEM
JSR DRAWRECT ;PENMODE=XOR
LDA #0
STA LASTITEM+1
DOMNU4 JSR UPDATECRSR
JSR GETBUTNS
BMI DOMNU2
LDX LASTITEM+1
BNE *+3
RTS
LDA LASTITEM
JMP DRAWRECT
*
DOMNU5 STY YTEMP ;GET RECTANGLE
PHA
INY
LDA (PARAM),Y
TAX
PLA
*
JSR CRSRINRECT ;CURSOR IN IT?
BCC DOMNU7
JSR SELECT
LDY YTEMP
BCC DOMNU3
*
INY
INY
LDA (PARAM),Y ;JUMP TO SELECTION
STA DOMNU6+1
INY
LDA (PARAM),Y
STA DOMNU6+2
DOMNU6 JMP $FFFF
*
DOMNU7 LDA YTEMP ;NEXT MENU ITEM
ADC #4
TAY
BNE DOMNU3
*
SELECT LDA LASTITEM+1 ;NO SELECTION?
BEQ SELECT3
CMP NEWITEM+1 ;SAME AS NEW ONE?
BNE SELECT2
LDA LASTITEM
CMP NEWITEM
BEQ SELECT4
*
SELECT2 JSR DRAWRECT+3 ;NO, TURN NEW ONE ON
LDA LASTITEM
LDX LASTITEM+1
LDY NEWITEM
STY LASTITEM
LDY NEWITEM+1
STY LASTITEM+1
JSR DRAWRECT ;TURN OLD ONE OFF
JMP SELECT4
*
SELECT3 JSR DRAWRECT+3 ;TURN ON NEW ONE
LDA NEWITEM
STA LASTITEM
LDA NEWITEM+1
STA LASTITEM+1
*
SELECT4 JSR UPDATECRSR
*
JSR GETBUTNS
CLC
BMI SELECT5
LDA LASTITEM
LDX LASTITEM+1
JSR DRAWRECT
SEC
SELECT5 RTS
*
* INIT STUFF
*
INIT LDA #$20
STA BASE1+1
LDY #0
STY BASE1
CLR1A TYA
CLR1B STA (BASE1),Y
DEY
BNE CLR1B
INC BASE1+1
LDA BASE1+1
CMP #$40
BCC CLR1A
RTS
*
GETPTRS PHA
LDA $0,X
STA SBEGIN
LDA $1,X
STA SBEGIN+1
LDA $0,Y
STA DBEGIN
LDA $1,Y
STA DBEGIN+1
PLA
TAX
LDA $0,X
STA SEND
LDA $1,X
STA SEND+1
RTS
*
MOVEUP JSR GETPTRS
*
MOVUP2 DEC SEND+1
DEC DEND+1
LDA SBEGIN+1
CMP SEND+1
BCC MOVUP6
BNE MOVUP3
LDA SBEGIN
CMP SEND
BCC MOVUP6
BEQ MOVUP6
*
MOVUP3 LDA SBEGIN ;C=1
SBC SEND
BEQ MOVUP5
STA EXTRA
LDY #$FF
MOVUP4 LDA (SEND),Y
STA (DEND),Y
DEY
CPY EXTRA
BCS MOVUP4
MOVUP5 RTS
*
MOVUP6 LDY #$FF
MOVUP7 LDA (SEND),Y
STA (DEND),Y
DEY
BNE MOVUP7
LDA (SEND),Y
STA (DEND),Y
JMP MOVUP2
*
MOVEDOWN JSR GETPTRS
*
MOVDN2 LDX SBEGIN+1
INX
CPX SEND+1
BCC MOVDN6
BNE MOVDN3
LDA SBEGIN
CMP SEND
BCC MOVDN6
BEQ MOVDN6
*
MOVDN3 LDA SEND
SBC SBEGIN
BEQ MOVDN5
STA EXTRA
LDY #0
MOVDN4 LDA (SBEGIN),Y
STA (DBEGIN),Y
CPY EXTRA
BEQ MOVDN5
INY
BNE MOVDN4
MOVDN5 RTS
*
MOVDN6 LDY #0
MOVDN7 LDA (SBEGIN),Y
STA (DBEGIN),Y
INY
BNE MOVDN7
*
INC SBEGIN+1
INC DBEGIN+1
BNE MOVDN2
*
ADDIYX CLC
ADC 0,Y
STA 0,X
LDA 1,Y
ADC #0
STA 1,X
RTS
*
ADDYX LDA 0,X
CLC
ADC 0,Y
STA 0,X
LDA 1,X
ADC 1,Y
STA 1,X
RTS
*
SUBIYX STA TEMP
SEC
LDA 0,Y
SBC TEMP
STA 0,X
LDA 1,Y
SBC #0
STA 1,X
RTS
*
SUBYX LDA 0,X
SEC
SBC 0,Y
STA 0,X
LDA 1,X
SBC 1,Y
STA 1,X
RTS
*
CMPYX LDA 1,Y
CMP 1,X
BCC CMPYX2
BNE CMPYX2
LDA 0,Y
CMP 0,X
CMPYX2 RTS
*
* MINI-FONT STUFF
*
CHARTO STA CHARBITS+4
STX CHARBITS+3
STY CHARBITS+2
RTS
*
PRCHAR STA TEMP
CMP #36
BEQ SPACE
ASL
ASL
ASL
SEC
SBC TEMP ;(A)*7
CLC
ADC #<FONT
STA CHARBITS
LDA #0
ADC #>FONT
STA CHARBITS+1
LDA #<CHARBITS
LDX #>CHARBITS
JSR XOFFDRAW
SPACE LDY TEMP
LDA CWIDTH,Y
SEC
ADC CHARBITS+4
PRCHR2 CMP #7
BCC PRCHR3
INC CHARBITS+3
SBC #7
BCS PRCHR2
PRCHR3 STA CHARBITS+4
RTS
*
PRINT STA TBASE
STX TBASE+1
LDY #0
PRNT2 LDA (TBASE),Y
BMI PRNT3
STY YTEMP
JSR PRCHAR
LDY YTEMP
INY
BNE PRNT2
PRNT3 AND #$7F
JMP PRCHAR
*
CHARBITS HEX 00,00
HEX 00,00,00,07,01
*
FONT HEX 0E1B1B1B1B1B0E
HEX 0607060606060F
HEX 0E1B180C06031F
HEX 0E1B180C181B0E
HEX 1B1B1B1F181818
HEX 1F030F18181B0E
HEX 0E1B030F1B1B0E
HEX 1F180C06060606
HEX 0E1B1B0E1B1B0E
HEX 0E1B1B1E181B0E
HEX 0E1B1B1F1B1B1B
HEX 0F1B1B0F1B1B0F
HEX 0E1B0303031B0E
HEX 0F1B1B1B1B1B0F
HEX 1F03030F03031F
HEX 1F03030F030303
HEX 0E1B031F1B1B0E
HEX 1B1B1B1F1B1B1B
HEX 0F06060606060F
HEX 3C1818181B1B0E
HEX 331B0F070F1B33
HEX 0303030303031F
HEX 777F6B63636363
HEX 33373B33333333
HEX 1F1B1B1B1B1B1F
HEX 0F1B1B0F030303
HEX 0E1B1B1B1B0E18
HEX 0F1B1B0F1B1B1B
HEX 0E1B030E181B0E
HEX 3F0C0C0C0C0C0C
HEX 1B1B1B1B1B1B0E
HEX 1B1B1B1B1B0E04
HEX 636363636B7F63
HEX 331E0C0C0C1E33
HEX 3333331E0C0C0C
HEX 1F180C0603031F
*
CWIDTH HEX 05040505050505050505
HEX 05050505050505050406060507
HEX 06050505050506050507060605
HEX 04
*

2641
source_disc1/EDIT.S Normal file

File diff suppressed because it is too large Load Diff

1249
source_disc1/PPAK.S Normal file

File diff suppressed because it is too large Load Diff

1262
source_disc1/RUN2.S Normal file

File diff suppressed because it is too large Load Diff

140
source_disc2/BOOT2.S Normal file
View File

@ -0,0 +1,140 @@
*
* SECOND STAGE BOOT
*
ORG $B700
OBJ $8000
*
TEMP EQU 7
SWAPEDIT EQU $1E00
*
STX SLOT
STX SLOTFOUND
STX BOOTSLOT
LDA #1
STA DRIVE
STA DRIVEFOUND
TXA
LSR
LSR
LSR
LSR
TAX
LDA #0
STA $1FD8,X
STA $1FD0,X
LDA #13
STA SECTORCOUNT
LDA #1
LDX #12
LDY #$B5
JSR READSECTORS
*
LDA #1
STA SECTORCOUNT
LDA #3
LDX #8
LDY #$40
JSR READSECTORS
*
LDA #23
STA SECTORCOUNT
LDA #3
LDX #6
LDY #$1E
JSR READSECTORS
*
LDA #32
STA SECTORCOUNT
LDA #5
LDX #15
LDY #$3F
JSR READSECTORS
*
STA $C050
STA $C052
STA $C054
STA $C057
STA $C010
TIME LDA #20
STA TEMP
TIM2 LDA $C000
ORA $C061
ORA $C062
BMI TIM3
LDA #0
JSR $FCA8
DEC TEMP
BPL TIM2
TIM3 EQU *
*
LDX #$FF
TXS
JMP SWAPEDIT
*
READSECTORS STA TRACK
STX SECTOR
STY READBUFHI
LDA #1
STA CMDCODE
READS2 LDA #>RWTSPARMS
LDY #<RWTSPARMS
JSR RWTSCALL
BCS READS2
LDY SECTOR
DEY
BPL READS3
LDY #15
DEC TRACK
READS3 STY SECTOR
DEC READBUFHI
DEC SECTORCOUNT
BNE READS2
RTS
*
DS $3
*
RWTSCALL PHP
SEI
JSR $BD00
BCS BADCALL
PLP
CLC
RTS
BADCALL PLP
SEC
RTS
*
BOOT2PARMS EQU *
SECTORCOUNT HEX 00
BOOTSLOT HEX 00
*
DS $12
*
BZERO LDA #0
TAY
BZER2 STA ($42),Y
INY
BNE BZER2
RTS
*
DS $9
*
RWTSPARMS EQU *
TABLETYPE HEX 01
SLOT HEX 00
DRIVE HEX 00
VOLUME HEX 00
TRACK HEX 00
SECTOR HEX 00
DA DEVCHARTBL
READBUFLO HEX 00
READBUFHI HEX 00
HEX 00
HEX 00
CMDCODE HEX 00
ERRCODE HEX 00
VOLFOUND HEX 00
SLOTFOUND HEX 00
DRIVEFOUND HEX 00
*
DEVCHARTBL HEX 00,01,EF,D8

1080
source_disc2/DISK.S Normal file

File diff suppressed because it is too large Load Diff

2752
source_disc2/RUN.S Normal file

File diff suppressed because it is too large Load Diff

175
source_disc2/SWAP.S Normal file
View File

@ -0,0 +1,175 @@
LST OFF
*
* PCS - SWAPPING HANDLER
*
ORG $1E00
OBJ $8000
*
TEMP EQU $07
XTEMP EQU TEMP+1
YTEMP EQU XTEMP+1
*
* EXTERNALS
*
DIV7 EQU $1400
MOD7 EQU DIV7+$100
LO EQU MOD7+$100
HI EQU LO+$C0
SETMODE EQU HI+$10F
DRAWBITS EQU SETMODE+$25
XOFFDRAW EQU DRAWBITS+$3D
GETRECT EQU XOFFDRAW+$59
MASKS EQU GETRECT+$41
HLINE EQU MASKS+$F
VLINE EQU HLINE+$20
FRAMERECT EQU VLINE+$58
DRAWRECT EQU FRAMERECT+$28
INRECT EQU DRAWRECT+$10
GETBUTNS EQU INRECT+$2D
INITCRSR EQU GETBUTNS+$7
XDRAWCRSR EQU INITCRSR+$1B
UPDATECRSR EQU XDRAWCRSR+$7
DOCRSRX EQU UPDATECRSR+$1E
GETCURSORX EQU DOCRSRX+$45
DOCRSRY EQU GETCURSORX+$16
JSCTRL EQU DOCRSRY+$4D
CRSRINRECT EQU JSCTRL+$21
DOMENU EQU CRSRINRECT+$13
SELECT EQU DOMENU+$54
INIT EQU SELECT+$40
MOVEUP EQU INIT+$35
MOVEDOWN EQU MOVEUP+$3B
ADDIYX EQU MOVEDOWN+$39
ADDYX EQU ADDIYX+$E
SUBIYX EQU ADDYX+$10
SUBYX EQU SUBIYX+$12
CMPYX EQU SUBYX+$10
CHARTO EQU CMPYX+$F
PRCHAR EQU CHARTO+$A
PRINT EQU PRCHAR+$38
CHAR EQU PRINT+$19
*
VALIDBUF EQU $A500
FIRSTBOOT EQU $B700
READSECTORS EQU $B784
SECTORCOUNT EQU $B7C2
BOOTSLOT EQU $B7C3
SLOT EQU $B7E9
DRIVE EQU $B7EA
VOLUME EQU $B7EB
READBUFLO EQU $B7F0
*
SWAPEDIT LDX #0
JSR SWAPSECTORS
JMP $9500
*
SWAPWIRE LDX #1
JSR SWAPPIECE
JMP $9513
*
SWAPDISK LDX #2
JSR SWAPPIECE
JMP $9510
*
SWAPUSER LDX #3
BNE SWAPSECTORS
*
RELOAD PHA
LDX #1
JSR SWAPSECTORS
PLA
TAX
TXS
LDA #0
STA $82
STA $83
STA $84
RTS
*
SWAPPIECE JSR SWAPSECTORS
JSR $9500
LDX #0
*
SWAPSECTORS STX XTEMP
LDA BOOTSLOT
STA SLOT
LDA #1
STA DRIVE
LDA #0
STA READBUFLO
STA VOLUME
JSR PCSINSERTED
*
LDX XTEMP
LDA COUNT,X
STA SECTORCOUNT
LDA SECTOR,X
STA TEMP
LDA TRACK,X
LDY ADDRHI,X
LDX TEMP
JMP READSECTORS
*
COUNT HEX 390A080A
TRACK HEX 0B0C0D0E
SECTOR HEX 08090709
ADDRHI HEX A89E9C8E
*
PCSINSERTED LDA #0
LDX #1
STX SECTORCOUNT
LDY #>VALIDBUF
JSR READSECTORS
*
LDY #$40
PCSIN2 LDA VALIDBUF,Y
CMP FIRSTBOOT,Y
BNE PCSIN3
DEY
BPL PCSIN2
RTS
*
PCSIN3 LDY #1
JSR SETMODE
LDA #<DIALOGBITS
LDX #>DIALOGBITS
JSR DRAWBITS
LDY #3
JSR SETMODE
LDA #<DIALOGBOX
LDX #>DIALOGBOX
JSR DRAWRECT
LDY #2
JSR SETMODE
JSR FRAMERECT+3
*
LDY #$59
LDX #1
LDA #0
JSR CHARTO
LDA #<INSERTMSG
LDX #>INSERTMSG
JSR PRINT
*
STA $C010
WAIT1 LDA $C000
BPL WAIT1
STA $C010
*
LDY #0
JSR SETMODE
LDA #<DIALOGBITS
LDX #>DIALOGBITS
JSR DRAWBITS
LDY #2
JSR SETMODE
*
JMP PCSINSERTED
*
INSERTMSG HEX 12171C0E1B1D24190C1C240D121C94
*
DIALOGBITS DA $A000
HEX 5700000B28
*
DIALOGBOX HEX 5700000A2705
*

1149
source_disc2/WIRE.S Normal file

File diff suppressed because it is too large Load Diff