Merge pull request #419 from oliverschmidt/master
Saved six more bytes ;-)
This commit is contained in:
commit
59c28bc32b
@ -73,8 +73,6 @@ fixup: .byte fixup02-fixup01, fixup03-fixup02, fixup04-fixup03
|
||||
.byte fixup14-fixup13, fixup15-fixup14, fixup16-fixup15
|
||||
.byte fixup17-fixup16, fixup18-fixup17, fixup19-fixup18
|
||||
.byte fixup20-fixup19, fixup21-fixup20, fixup22-fixup21
|
||||
.byte fixup23-fixup22, fixup24-fixup23, fixup25-fixup24
|
||||
.byte fixup26-fixup25
|
||||
|
||||
fixups = * - fixup
|
||||
|
||||
@ -112,7 +110,7 @@ init:
|
||||
lda reg+1
|
||||
sta (ptr),y
|
||||
dey
|
||||
|
||||
|
||||
; Advance to next fixup location
|
||||
inx
|
||||
cpx #fixups
|
||||
@ -136,11 +134,10 @@ fixup02:sta isq+1
|
||||
; Accept valid unicast + broadcast frames
|
||||
; PACKETPP = $0104, PPDATA = $0D05
|
||||
lda #$04
|
||||
jsr packetpp_01
|
||||
jsr packetpp_a1
|
||||
lda #$05
|
||||
ldx #$0D
|
||||
fixup03:sta ppdata
|
||||
fixup04:stx ppdata+1
|
||||
jsr ppdata_ax
|
||||
|
||||
; Set MAC address
|
||||
; PACKETPP = $0158, PPDATA = MAC[0], MAC[1]
|
||||
@ -148,11 +145,10 @@ fixup04:stx ppdata+1
|
||||
; PACKETPP = $015C, PPDATA = MAC[4], MAC[5]
|
||||
ldy #$58
|
||||
: tya
|
||||
jsr packetpp_01
|
||||
jsr packetpp_a1
|
||||
lda mac-$58,y
|
||||
ldx mac-$58+1,y
|
||||
fixup05:sta ppdata
|
||||
fixup06:stx ppdata+1
|
||||
jsr ppdata_ax
|
||||
iny
|
||||
iny
|
||||
cpy #$58+6
|
||||
@ -161,11 +157,10 @@ fixup06:stx ppdata+1
|
||||
; Turn on transmission and reception of frames
|
||||
; PACKETPP = $0112, PPDATA = $00D3
|
||||
lda #$12
|
||||
jsr packetpp_01
|
||||
jsr packetpp_a1
|
||||
lda #$D3
|
||||
ldx #$00
|
||||
fixup07:sta ppdata
|
||||
fixup08:stx ppdata+1
|
||||
jsr ppdata_ax
|
||||
rts
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
@ -175,11 +170,11 @@ poll:
|
||||
; are any valid unicast frames avaliable
|
||||
; PACKETPP = $0124, PPDATA & $0D00 ?
|
||||
lda #$24
|
||||
jsr packetpp_01
|
||||
fixup09:lda ppdata+1
|
||||
jsr packetpp_a1
|
||||
fixup03:lda ppdata+1
|
||||
and #$0D
|
||||
bne :+
|
||||
|
||||
|
||||
; No frame ready
|
||||
tax
|
||||
rts
|
||||
@ -190,13 +185,13 @@ fixup09:lda ppdata+1
|
||||
; Read receiver event and discard it
|
||||
; RXTXREG
|
||||
:
|
||||
fixup10:ldx rxtxreg+1
|
||||
fixup11:lda rxtxreg
|
||||
|
||||
fixup04:ldx rxtxreg+1
|
||||
fixup05:lda rxtxreg
|
||||
|
||||
; Read frame length
|
||||
; cnt = len = RXTXREG
|
||||
fixup12:ldx rxtxreg+1
|
||||
fixup13:lda rxtxreg
|
||||
fixup06:ldx rxtxreg+1
|
||||
fixup07:lda rxtxreg
|
||||
sta len
|
||||
stx len+1
|
||||
sta cnt
|
||||
@ -223,10 +218,10 @@ fixup13:lda rxtxreg
|
||||
; Read bytes into buffer
|
||||
: jsr adjustptr
|
||||
:
|
||||
fixup14:lda rxtxreg
|
||||
fixup08:lda rxtxreg
|
||||
sta (ptr),y
|
||||
iny
|
||||
fixup15:lda rxtxreg+1
|
||||
fixup09:lda rxtxreg+1
|
||||
sta (ptr),y
|
||||
iny
|
||||
bne :-
|
||||
@ -249,12 +244,12 @@ send:
|
||||
; Transmit command
|
||||
lda #$C9
|
||||
ldx #$00
|
||||
fixup16:sta txcmd
|
||||
fixup17:stx txcmd+1
|
||||
fixup10:sta txcmd
|
||||
fixup11:stx txcmd+1
|
||||
lda cnt
|
||||
ldx cnt+1
|
||||
fixup18:sta txlen
|
||||
fixup19:stx txlen+1
|
||||
fixup12:sta txlen
|
||||
fixup13:stx txlen+1
|
||||
|
||||
; Adjust odd frame length
|
||||
jsr adjustcnt
|
||||
@ -265,8 +260,8 @@ fixup19:stx txlen+1
|
||||
; Check for avaliable buffer space
|
||||
; PACKETPP = $0138, PPDATA & $0100 ?
|
||||
: lda #$38
|
||||
jsr packetpp_01
|
||||
fixup20:lda ppdata+1
|
||||
jsr packetpp_a1
|
||||
fixup14:lda ppdata+1
|
||||
and #$01
|
||||
bne :+
|
||||
|
||||
@ -284,10 +279,10 @@ fixup20:lda ppdata+1
|
||||
; Write bytes from buffer
|
||||
: jsr adjustptr
|
||||
: lda (ptr),y
|
||||
fixup21:sta rxtxreg
|
||||
fixup15:sta rxtxreg
|
||||
iny
|
||||
lda (ptr),y
|
||||
fixup22:sta rxtxreg+1
|
||||
fixup16:sta rxtxreg+1
|
||||
iny
|
||||
bne :-
|
||||
inc ptr+1
|
||||
@ -302,10 +297,17 @@ exit:
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
packetpp_01:
|
||||
packetpp_a1:
|
||||
ldx #$01
|
||||
fixup23:sta packetpp
|
||||
fixup24:stx packetpp+1
|
||||
fixup17:sta packetpp
|
||||
fixup18:stx packetpp+1
|
||||
rts
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
ppdata_ax:
|
||||
fixup19:sta ppdata
|
||||
fixup20:stx ppdata+1
|
||||
rts
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
@ -313,10 +315,10 @@ fixup24:stx packetpp+1
|
||||
skipframe:
|
||||
; PACKETPP = $0102, PPDATA = PPDATA | $0040
|
||||
lda #$02
|
||||
jsr packetpp_01
|
||||
fixup25:lda ppdata
|
||||
jsr packetpp_a1
|
||||
fixup21:lda ppdata
|
||||
ora #$40
|
||||
fixup26:sta ppdata
|
||||
fixup22:sta ppdata
|
||||
rts
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user