KOCD2001 MB128 driver

こちらのが前回よりプログラムがきれいです. ただしやってることはほとんど同じでした.

ec1b8:
	jsr	lc08e ;send 10x3+3 bits, check detection bits
	bcc	lc1c0
	lda	#$FF
	rts
lc1c0:
;operation = read
	ldx	#$01
	ldy	#$01
	jsr	lc070
;send address
	ldx	<$8d
	ldy	#$08
	jsr	lc070
	ldx	<$8e
	ldy	#$02
	jsr	lc070
;send length
	lda	<$8b
	pha
	tax
	lda	<$8c
	pha
	sta	<$8b
	stz	<$8c
	txa
;(snip)

;---- initialize ----
lc08e:
	stz	$1000
	ldy	#$03
lc093:
	phy
	ldx	#$A8
	ldy	#$08
	bsr	lc070
	clx
	ldy	#$01
	bsr	lc070
	nop
	lda	$1000
	and	#$0F
	pha
	ldx	#$01
	ldy	#$01
	bsr	lc070
	nop
	lda	$1000
	and	#$0F
	plx
	ply
	cpx	#$00
	bne	lc0bd
	cmp	#$04
	clc
	beq	lc0c7
lc0bd:
	dey
	bne	lc093
	clx
	ldy	#$03
	jsr	lc070
	sec
lc0c7:
	rts

;---- send 1 bit into MB128 ----
lc070:
	txa
	and	#$01
	sta	$1000
	nop
	nop
	nop
	ora	#$02
	sta	$1000
	pha
	txa
	lsr	a
	tax
	pla
	and	#$FD
	dey
	bne	lc070
	nop
	nop
	sta	$1000
	rts