A89: Help with Link Routine
[Prev][Next][Index][Thread]
A89: Help with Link Routine
I've cut a snippet of code from Tetris 89, which I'm guessing is the backbone
of the link routine. I, however, don't fully understand it and would
appreciate some clarification. Below is the code and what I think I know
about it.
SendByte:
movem.l d0-d1/a0-a1,-(a7) ;saves the registers in stack
move.b d0,linkbuf ;moves value of d0 to linkbuf? or address?
move.w #1,-(a7) ;moves the value 1 into stack
pea linkbuf(PC) ;help? something about program counter
jsr tios::transmit ;rom call to send data (what exactly are the
;parameters and what registers are destroyed?
;i'm guessing that d0-d1/a0-a1 are affected)
addq #6,a7 ;moves the stack pointer back
movem.l (a7)+,d0-d1/a0-a1 ;restores register values.
rts
ReceiveByte:
movem.l d1/a0-a1,-(a7) ;saves register values
clr.b linkbuf ;clears linkbuf
move.w #1,-(a7) ;moves the value 1 into stack
pea linkbuf(PC) ;help again
jsr tios::receive ;rom call (again, what parameters etc.)
addq #6,a7 ;moves stack pointer back
clr.l d0 ;clears d0
move.b linkbuf(PC),d0 ;help here
movem.l (a7)+,d1/a0-a1 ;restores registers
rts
somebody please help. as you can see, i don't know very much on account of my
being an idiot. i desperately await your wisdom.