📄 sc.s
字号:
/*
* File: sc.s
* Purpose: System Call handler for dBUG.
*
* Notes:
*
*/
/*
* This file contains the low level interrupt service routines
* for implementing a user system call interface into the monitor.
*/
#ifndef _UNDERSCORE_
#define _asm_sc_exit_to_dbug asm_sc_exit_to_dbug
#define _board_getchar board_getchar
#define _board_putchar board_putchar
#define _board_getchar_present board_getchar_present
#define _dbug_sc_handler dbug_sc_handler
#endif
.extern _asm_sc_exit_to_dbug
.extern _board_getchar
.extern _board_putchar
.extern _board_getchar_present
.global _dbug_sc_handler
/*
* NOTE: This handler uses the convention that D0,D1,A0,A1 are
* scratch registers. Thus these registers are not preserved.
*/
.text
_dbug_sc_handler:
lea -12(sp),sp /* room for used regs */
movem.l d2/a0-a1,(sp)
ext.l d0
/* Serial I/O routines, port A */
cmpi.l #0x0010,d0
beq.w _in_char
cmpi.l #0x0013,d0
beq.w _out_char
cmpi.l #0x0014,d0
beq.w _char_present
/* Not a supported system call, jump back to monitor */
movem.l (sp),d2/a0-a1
lea 12(sp),sp
move.l sp,-(sp)
jsr _asm_sc_exit_to_dbug
_in_char:
jsr _board_getchar /* char returned in D0 */
move.l d0,d1
moveq.l #0,d0
bra.w _done
_out_char:
move.l d1,-(sp)
jsr _board_putchar
lea 4(sp),sp
moveq.l #0,d0
bra.w _done
_char_present:
jsr _board_getchar_present /* value returned in D0 */
bra.w _done
_done:
movem.l (sp),d2/a0-a1
lea 12(sp),sp
rte
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -