asmfile.68k

来自「tasking ede调试环境编译程序。」· 68K 代码 · 共 22 行

68K
22
字号
*@(#)m/r/tutor/tutor682/asmfile.68k	1.1		XDEF _foo            ; make _foo public	XREF _bar            ; "extern" the _bar symbol so you can use it	SECTION fooseg,,"code"_foo	MOVE.L  D2,-(A7)     ; save D2, we'll be using it 	MOVE    8(A7),-(A7)  ; get value of a, push on stack for call to bar	JSR     _bar         ; call bar(a)	ADDQ.L  #2,A7        ; clean up stack (clear off a)	MOVE    D0,D2        ; D0 has return value from bar(a), save it* since it is a scratch register and our second call to bar will clobber it	MOVE    10(A7),-(A7)  ; get value of b, push on stack for call to bar        JSR     _bar         ; call bar(b)	ADDQ.L  #2,A7        ; clean up stack (clear off b)	ADD     D2,D0        ; D0 has return value from bar(b) this time,*we add in the value of bar(a) (still safe and sound in D2, since the compiler*will save and restore D2 if bar uses it)        MOVE.L  (A7)+,D2     ; restore D2 before exiting	RTS                  ; now we can return, since the return value*from foo currently resides in D0, which is what the compiler expects

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?