forked from beretta42/zombie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simnic.s
66 lines (56 loc) · 1.04 KB
/
simnic.s
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
;;; A driver for sim6809 NIC interface
;;; based on the coconic driver
;;;
include "zombie.def"
export dev_init
export dev_send
export dev_poll
export dev_setaddr
section .code
;;; Called to initialize Device
;;; returns: C set on error
dev_init:
;; and return
clrb ; clear C
rts
;;; Send a packet to device
;;; takes: X ptr to eth0 frame, D size
dev_send
pshs d,x,y
tfr d,y
a@ ldb ,x+
stb $ff10
leay -1,y
bne a@
stb $ff11
clrb
puls d,x,y,pc
RXTX equ 42
;;; receive packet
;;; returns: C set on no packet waiting
;;; returns: insize = length
dev_poll
pshs d,x,y
;; test for something waiting
ldb $ff10
beq noth@ ; nothing waiting
;; is too big?
ldd $ff11
cmpd inmax,pcr ;
bhi errbig@
std insize,pcr ; save as returned length
;; get words from NIC
tfr d,y
ldx inbuf,pcr ; X = buffer
b@ ldb $ff13 ; get a word
stb ,x+ ; save in buffer
leay -1,y ; dec counter
bne b@ ; done?
;; return
clra
puls d,x,y,pc ; pull the rest
errbig@ stb $ff12 ; drop it
noth@ coma
puls d,x,y,pc ; pull the test
dev_setaddr
rts