forked from gardners/c65gs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
etherload_stub.a65
68 lines (55 loc) · 1.49 KB
/
etherload_stub.a65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.org $682c
; Routine to DMA copy the packet to its correct location.
; For simplicity we will have the destination address and
; length of the packet at a well known location in the packet.
; The packet is mapped at $6800, but to use an embedded DMA list we
; care about the true address, which is @ $FFDE800.
; so we need to set MB for DMA list, and also the source and destination
; MB of the DMA transfer
; Routine must begin with LDA #$xx for etherload to JSR to call this
; routine when it appears in a packet.
; Set DMA source and destination
; DMA source MB is in Mega-byte $FF
lda #$ff
sta $d705
; DNA destination MB
lda dest_mb
sta $d706
; DMA list lives at $DE85C
lda #$0d
sta $d702
lda #$e8
sta $d701
; DMA list lives in Mega-byte $FF ..
LDA #$ff
sta $d704
; set low byte of DMA list address and start DMA
lda #<dmalist
sta $d700
; All done.
ldx packet_number
txa
sta $0680,x
inc $0426
bne i2
inc $0427
i2:
rts
; Make sure we don't go past where we store the packet destination info
.checkpc $685c
.advance $685c
dmalist:
.byte $00 ; copy and non-chained
.word 0 ; length
.word $e880 ; source bottom 16 bits
.byte $0d ; source bank number
.word $0400 ; destination address bottom 16 bits
.byte $00 ; destination bank
.word $0000 ; modulo (unused)
packet_number:
.byte $50 ; use as a sequence number for debugging purposes
dest_mb:
.byte $00
.checkpc $6880
.advance $6880
.outfile "etherload_stub.bin"