27 lines
677 B
ArmAsm
27 lines
677 B
ArmAsm
global outb
|
|
; out b - send a byte to an I/O port
|
|
; stack: [esp + 8] the data byte
|
|
; [esp + 4] the I/O port
|
|
; [esp ] return address
|
|
outb:
|
|
mov al, [esp + 8]
|
|
mov dx, [esp + 4] ; move the address into dx
|
|
out dx, al ; send the data to the I/O port
|
|
ret ; return to the calling function
|
|
|
|
global inb
|
|
; inb - returns a byte from the given I/O port
|
|
; stack: [esp + 4] The address of the I/O port
|
|
; [esp ] The return address
|
|
inb:
|
|
mov dx, [esp + 4] ; move the address of the I/O port to the dx register
|
|
in al, dx ; read a byte from the I/O port and store it in the al register
|
|
ret ; return the read byte
|
|
|
|
|
|
global io_wait
|
|
io_wait:
|
|
mov al, 0x0
|
|
out 0x80, al
|
|
ret
|