AFPBridge/cmdproc.asm
Stephen Heumann 9ea3f1d2fb Don't call the ATalk driver's attention vector routine for DSI connections.
It is hard-coded to work with session numbers 1-8, and it may trash memory when passed higher session numbers. This was causing crashes after disconnecting in some cases.

This patch just bypasses the attention vector routine completely for DSI sessions (it's still called for sessions 1-8, i.e. ASP sessions). This should be OK, because its only real function was to display alerts about the connection being closed.
2017-04-25 18:30:39 -05:00

159 lines
2.5 KiB
NASM

case on
mcopy cmdproc.macros
SESSION_NUM_START gequ $F8
RamGoComp gequ $E1100C
RamForbid gequ $E11018
RamPermit gequ $E1101C
* Location of command rec ptr on entry to an AppleTalk command procedure
* (in the system zero page, which is the current direct page)
cmdRecPtr gequ $80
* Location to put completion routine ptr before calling RamGoComp
compPtr gequ $84
* AppleTalk command procedure (which acts as a dispatcher for all commands)
cmdProc start
lda cmdRecPtr+2
pha
lda cmdRecPtr
pha
jsl DispatchASPCommand
cmp #0
bne doOrig
cpx #0
bne doOrig
rtl
doOrig short i ;push original procedure ptr
phx
long i
dec a
pha
rtl ;jump to it
end
nbpCmdProc start
lda cmdRecPtr+2
pha
lda cmdRecPtr
pha
jsl DoLookupName
cmp #0
bne doOrig
cpx #0
bne doOrig
rtl
doOrig short i ;push original procedure ptr
phx
long i
dec a
pha
rtl ;jump to it
end
pfiLoginCmdProc start
lda cmdRecPtr+2
pha
lda cmdRecPtr
pha
jslOldPFILogin entry
jsl jslOldPFILogin ; to be changed
rep #$30 ; ensure full native mode
jsl SaveNames
rtl
end
pfiLogin2CmdProc start
lda cmdRecPtr+2
pha
lda cmdRecPtr
pha
jslOldPFILogin2 entry
jsl jslOldPFILogin2 ; to be changed
rep #$30 ; ensure full native mode
jsl SaveNames
rtl
end
pfiListSessions2CmdProc start
lda cmdRecPtr+2
pha
lda cmdRecPtr
pha
jslOldPFIListSessions2 entry
jsl jslOldPFIListSessions2 ; to be changed
rep #$30 ; ensure full native mode
jsl InsertCorrectNames
rtl
end
pfiLoginContCmdProc start
lda cmdRecPtr+2
pha
lda cmdRecPtr
pha
jslOldPFILoginCont entry
jsl jslOldPFILoginCont ; to be changed
rep #$30 ; ensure full native mode
jsl PostLoginCont
rtl
end
CallCompletionRoutine start
phb
jsl ForceLCBank2 ;use LC bank 2
pha
phd
lda #0 ;set direct page = system zero page
tcd
jsl RamForbid
lda 9,s
sta compPtr
lda 9+2,s
sta compPtr+2
ora 9,s
beq skip ;skip call if compPtr = 0
jsl >RamGoComp
skip jsl RamPermit
pld
jsl RestoreStateReg
pla
sta 3,s
pla
sta 3,s
plb
rtl
end
* Replacement attention vector to be called from PFI.
* This calls the previous attention vector (from the ATalk driver) for ASP
* sessions (numbered 1-8), but not for the higher-numbered DSI sessions.
* This is needed because ATalk's attention vector is hard-coded for session
* numbers 1-8 only and trashes memory when called with higher numbers.
attentionVec start
phd
phy
phx
tsc
tcd
lda [1]
plx
ply
pld
and #$00FF
cmp #SESSION_NUM_START
bge skip
jmlOldAttentionVec entry
jml attentionVec ;to be changed to old attention vec
skip clc
rtl
end