File:  [Infocom source] / coco / boot.src
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Fri Mar 20 10:19:53 2020 UTC (20 months, 2 weeks ago) by root
Branches: infocom, MAIN
CVS tags: tandy, makefile, lwasm, VERSION_D, HEAD
Patches for lwasm


	;------------------------------------------
	; NEW ZIP LOADER
	; RESIDES ON TRACK 34 OF CO-CO DISK
	; AND IS LOADED BY CO-CO WITH 'DOS' COMMAND
	;------------------------------------------


PIA0 	EQU	$FF00
KEYBUF	EQU	$0152
CASFLG	EQU	$011A
DEBVAL	EQU	$011B

DEVNUM	EQU	$6F
BS	EQU	$08
SPACE	EQU	$20

IRQVEC	EQU	$10C
RDYTMR	EQU	$985
DCDRV	EQU	$EB
DRGRAM	EQU	$986
DCTRK	EQU	$EC
DSKREG	EQU	$FF40
DCSTA	EQU	$F0
DCOPC	EQU	$EA
DR0TRK	EQU	$97E
FDCREG	EQU	$FF48
ZERO	EQU	$8A
DSEC	EQU	$ED
DNMIVC	EQU	$983
DCBPT	EQU	$EE
NMIFLG	EQU	$982
SKP2	EQU	$8C

DCB	EQU	$EA


RVEC3 	EQU	$0167
CR	EQU	$0D
VIDRAM	EQU	$0400
CURPOS	EQU	$88

	; EQUATES

BUG	EQU	0
ZSTART	EQU	$1100
ZEND	EQU	$3000+BUG




	ORG	$2600


	.STR	"OS"		; REQUIRED BY DOS

MOVE:	LDX	#00     	; SET UP TO MOVE BOOT CODE OUT OF WAY OF ZIP
MOVLP:	LDD	HERE,X
	STD	THERE,X
	LEAX	2,X
	CMPX	#$800
	BLO	MOVLP
	JMP	RUN

HERE:	EQU	*

	ORG	$5000

THERE:	EQU	*

RUN:	LDX	#DIRQSV		;SET VECTOR
 	STX	IRQVEC+1
	LDA	#$7E		;JMP OP
	STA	IRQVEC


	LDD	#$0001
	STD	TRACK
	LDD	#ZSTART
	STD	BUFFER
LOOP:	LDX	#DCB
	LDD	#$0200
	STD	,X
	LDD	TRACK
	STD	2,X
	INCB
	CMPB	#19
	BLO	DOBUFF
	LDB	#1
	INCA
DOBUFF:	STD	TRACK
	LDD	BUFFER
	STD	4,X
	INCA
	STD	BUFFER
	LBSR	MYCON
	TST	6,X
	BNE	ERROR
	CMPD	#ZEND
	BLO	LOOP
	JMP	ZSTART

	;ERROR HANDLER

ERRM:	.DB	$0D
	.STR	"DISK ERRROR!"
	.DB	$0D
ERRML:	EQU	*-ERRM

ERROR:	LDX	#ERRM
	LDB	#ERRML
ELOOP:	LDA	,X+
	LBSR	MYCHR
	DECB
	BNE	ELOOP
FREEZ:	BRA	FREEZ

TRACK:	.DB	$00,$00
BUFFER:	.DB	$00,$00

ZZZ:	EQU	*


;-----------------------------------------------------------------------------
; ROM- ROUTINES


	; IRQ HANDLER NEEDED FOR RDYTMR

DIRQSV:	LDA	PIA0+3
	BPL	DRTI
	LDA	PIA0+2
	LDA	RDYTMR
	BEQ	DRTI
	DECA
	STA	RDYTMR
	BNE	DRTI
	LDA	DRGRAM
	ANDA	#$B0
	STA	DRGRAM
	STA	DSKREG
DRTI:	RTI


;POLCAT




LA7D1:	LDX	ZERO
LA7D3:	LEAX	-1,X
	BNE	LA7D3
	RTS

;------------------------
; COPY OF CHROUT FROM ROM
;------------------------

;
MYCHR:	JSR	RVEC3	;HOOK INTO RAM THE BOOK SAYS (BUT WHY I ASK)
	PSHS	B
	LDB	DEVNUM
	INCB
	PULS	B
	BMI	LA2BF
	BNE	LA30A
;SEND TO CASSETTE NOT NEEDED

LA2BF:	RTS

LA30A: 	PSHS	A,B,X
	LDX	CURPOS
	CMPA	#BS
	BNE	LA31D
	CMPX	#VIDRAM
	BEQ	LA35D
	LDA	#$60
	STA	,-X
	BRA	LA344
LA31D:	CMPA	#CR
	BNE	LA32F
	LDX	CURPOS
LA323:	LDA	#$60
	STA	,X+
	TFR	X,D
	BITB	#$1F
	BNE	LA323
	BRA	LA344
LA32F:	CMPA	#SPACE
	BLO	LA35D
	TSTA
	BMI	LA342
	CMPA	#$40
	BLO	LA340
	CMPA	#$60
	BLO	LA342
	ANDA	#$DF
LA340:	EORA	#$40
LA342:	STA	,X+
LA344:	STX	CURPOS
	CMPX	#VIDRAM+511
	BLS	LA35D
	LDX	#VIDRAM

LA34E:	LDD	32,X
	STD	,X++
	CMPX	#VIDRAM+$1E0
	BLO	LA34E
	LDB	#$60
	BSR	LA92D
LA35D:	PULS	A,B,X,PC

LA92D:	STX 	CURPOS
LA92F:	STB	,X+
	CMPX	#VIDRAM+511
	BLS	LA92F
	RTS

;----------------------------------
;COPY OF DISK CODE FROM ROM SOURCES
;----------------------------------


MYCON:	PSHS	U,Y,X,D		;AT $D75F IN LISTING
	LDA	#5
	PSHS	A
LD672:	CLR	RDYTMR
	LDB	DCDRV
	LDX	#LD7AA
	LDA	DRGRAM
	ANDA	#$A8
	ORA	B,X
	ORA	#$20
	LDB	DCTRK
	CMPB	#22
	BLO	LD68B
	ORA	#$10
LD68B:	TFR	A,B
	ORA	#8
	STA	DRGRAM
	STA	DSKREG
	BITB	#8
	BNE	LD69F
	JSR	LA7D1
	JSR	LA7D1
LD69F:	BSR	LD6DE
	BNE	LD6AD
	CLR	DCSTA
	LDX	#LD7A2
	LDB	DCOPC
	ASLB
	JSR	[B,X]
LD6AD:	PULS	A
	LDB	DCSTA
	BEQ	LD6BE
	DECA
	BEQ	LD6BE
	PSHS	A
	BSR	LD6C5
	BNE	LD6AD
	BRA	LD672
LD6BE:	LDA	#120
	STA	RDYTMR
	PULS	PC,U,Y,X,D

LD6C5:	LDX	#DR0TRK
	LDB	DCDRV
	CLR	B,X
	LDA	#3
	STA	FDCREG
	EXG	A,A
	EXG	A,A
	BSR	LD6DE
	BSR	LD6FD
	ANDA	#$10
	STA	DCSTA
LD6DD:	RTS

LD6DE:	LDX	ZERO
LD6E0:	LEAX	-1,X
	BEQ	LD6EC
	LDA	FDCREG
	BITA	#1
	BNE	LD6E0
	RTS
LD6EC:	LDA	#$D0
	STA	FDCREG
	EXG	A,A
	EXG	A,A
	LDA	FDCREG
	LDA	#$80
	STA	DCSTA
	RTS

LD6FD:	LDX	#8750
LD700:	LEAX	-1,X
	BNE	LD700
	RTS

LD705:	LDA	#$80
	.DB 	SKP2
LD708:	LDA	#$A0
	PSHS	A
	LDX	#DR0TRK
	LDB	DCDRV
	ABX
	LDB	,X
	STB	FDCREG+1
	CMPB	DCTRK
	BEQ	LD739
	LDA	DCTRK
	STA	FDCREG+3
	STA	,X
	LDA	#$17
	STA	FDCREG
	EXG	A,A
	EXG	A,A
	BSR	LD6DE
	BNE	LD737
	BSR	LD6FD
	ANDA	#$18
	BEQ	LD739
	STA	DCSTA
LD737:	PULS	PC,A

LD739:	LDA	DSEC
	STA	FDCREG+2
	LDX	#LD798
	STX	DNMIVC
	LDX	DCBPT
	LDA	FDCREG
	LDA	DRGRAM
	ORA	#$80
	PULS	B
	LDY	ZERO
	LDU	#FDCREG
	COM	NMIFLG
	ORCC	#$50
	STB	FDCREG
	EXG	A,A
	EXG	A,A
	CMPB	#$80
	BEQ	LD782

	LDB	#2
LD768:	BITB	,U
	BNE	LD778
	LEAY	-1,Y
	BNE	LD768
LD770:	CLR	NMIFLG
	ANDCC	#$AF
	JMP	LD6EC


;WRITE A SECTOR

LD778:	LDB	,X+
	STB	FDCREG+3
	STA	DSKREG
	BRA	LD778

LD782:	LDB	#2
LD784:	BITB	,U
	BNE	LD78E
	LEAY	-1,Y
	BNE	LD784
	BRA	LD770

LD78E:	LDB	FDCREG+3
	STB	,X+
	STA	DSKREG
	BRA	LD78E

LD798:	ANDCC	#$AF
	LDA	FDCREG
	ANDA	#$7C
	STA	DCSTA
	RTS

LD7A2:	.DW	LD6C5
	.DW	LD6DD
	.DW	LD705
	.DW	LD708

LD7AA:	.DB	1
	.DB	2
	.DB	4
	.DB	$40

	END

unix.superglobalmegacorp.com