io.asm

来自「一个小型的操作系统,采用gcc进行开发,几千行的代码,方便初学者学习」· 汇编 代码 · 共 88 行

ASM
88
字号
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Snixos Project version 1.0, 2003.6; (C) Copyright 2003,2004,2005 Jockeyson,KeqiangGao <Snallie@tom.com>; All Rights Reserved.; Distributed under the terms of the GNU General Public License.; This program is a free and open source software and you can redistribute ; it and/or modify it under the terms of the GNU General Public License as; published by the Free Software Foundation. As no any liability is assumed ; for any incidental or consequential damages in connection with the ; information or program fragments contained herein,so any exception arised; is at your own risk. It is ABSOLUTELY WITHOUT ANY WARRANTY.; Bug report please send to Snallie@tom.com .;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; io.asm : data transfer through low level I/O port ; Author : snallie@tom.com, snallie@tom.com; Time   : 2003.6 ;bits 32 global outb, inb, outb_delay, inb_delay ; prototype in C: void outb(int value,int port) ; send value sized in one byte to portoutb:	push ebp	mov ebp,esp	push eax	push edx        mov eax,dword [esp+16] ; arg value        mov edx,dword [esp+20] ; arg port	out dx,al	pop edx	pop eax	leave	ret ; prototype in C:  outb_b(int value,int port) ; send value sized in one byte to port but with a little more delayoutb_delay:	push ebp	mov ebp,esp	push eax	push edx        mov eax,dword [esp+16] ; arg value        mov edx,dword [esp+20] ; arg port	out dx,al	nop	nop	nop	nop	pop edx	pop eax	leave; prototype in C: unsigned char inb(int port); get a byte value from port and return what just gotinb:	push ebp	mov ebp,esp	push edx	mov edx,[esp+12] ; arg port	in al,dx         ; return value saved in ax	pop edx	leave	ret; prototype in C: unsigned char inb_delay(int port); get a byte value from port and return what just got, but with a little more delayinb_delay:	push ebp	mov ebp,esp	push edx	mov edx,[esp+12] ; arg port	in al,dx	 ; return value saved in ax	nop	nop	nop	nop	pop edx	leave	ret	

⌨️ 快捷键说明

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