-
Notifications
You must be signed in to change notification settings - Fork 0
/
at.info.s
123 lines (120 loc) · 3.21 KB
/
at.info.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
; %help
; at.info -- Display AppleTalk info.
;
; syntax: at.info
;
; Displays AppleTalk node number, bridge node, and (for IIgs) hardware
; ID and ROM version.
;
; If AppleTalk is offline, will print the slot number of an installed
; Workstation Card.
; %hend
.pc02
.include "davex-mg.inc"
cardptr = xczpage
DX_start $ae00 ; load address
DX_info $01,$12,dx_cc_iie_or_iigs,$00
DX_ptab
DX_end_ptab
DX_desc "Display AppleTalk info."
DX_main
cli ; appletalk requires interrupt
ATcall inforeq
bcs noatalk
lda thisnet
ldy thisnet+1
jsr xprdec_2
jsr xmess
asc_hi "."
.byte $00
lda #$00
ldy nodenum
jsr xprdec_2
ldy abridge
beq :+
phy
jsr xmess
asc_hi ", bridge "
.byte $00
ply
lda #$00
jsr xprdec_2
: lda #$8d
jsr cout
sec
jsr checkmach
bcs :+
; display IIgs specific
jsr xmess
asc_hi "Hardware ID: "
.byte $00
lda #$00
ldy hwid
jsr xprdec_2
jsr xmess
asc_hi ", ROM version "
.byte $00
lda #$00
ldy romver
jsr xprdec_2
lda #$8d
jsr cout
: rts
noatalk: lda #$01
jsr xredirect
jsr xmess
asc_hi "AppleTalk offline!"
.byte $00
jsr FindCard
bcs :+ ; no card
and #$0f ; get slot #
pha
jsr xmess
asc_hi "Workstation Card in slot "
.byte $00
pla
tay
lda #$00
jsr xprdec_2
jsr xmess
.byte $8d,$00
: lda #$ff
jsr xredirect
jmp xerr
.proc FindCard
lda #$f9 ; offset to ID bytes
sta cardptr
lda #$c7 ; start at slot 7
sta cardptr+1
NextSlot: ldy #$03
: lda (cardptr),y
cmp idtbl,y ; check ID byte
bne NoMatch
dey
bpl :-
ldy #$04
lda (cardptr),y
beq NoMatch ; Skip IIgs AppleTalk
cmp #$01 ; Workstation card?
bne NoCard ; nope, something else
clc
lda cardptr+1 ; get slot
rts
NoMatch: dec cardptr+1
lda cardptr+1
cmp #$c0 ;are we finished scanning the slots?
bne NextSlot
NoCard: lda #$00
sec
rts
idtbl: .byte "ATLK" ; msb off
.endproc
inforeq: .byte 0,2 ; sync GetInfo
.word $0000 ; result code
.dword $00000000 ; completion address
thisnet: .word $0000 ; this network #
abridge: .byte $00 ; local bridge
hwid: .byte $00 ; hardware ID, IIgs only
romver: .word $00 ; ROM version, IIgs only
nodenum: .byte $00 ; node number
DX_end