-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathasm_util.s
executable file
·49 lines (45 loc) · 881 Bytes
/
asm_util.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;
; Low-level utility functions
;
; prototypes declared in 'util.h'
.globl _outb
.globl _inb
.globl _jump
;----------------------------------------------------
; void outb( BYTE port, BYTE byte );
;
; outputs <byte> to i/o port <port>
;----------------------------------------------------
_outb::
push bc
ld hl, #0x0004
add hl, sp
ld c, (hl)
inc hl
ld b, (hl)
out (c), b
pop bc
ret
;----------------------------------------------------
; BYTE inb( BYTE port );
;
; returns byte on i/o port <port>
;----------------------------------------------------
_inb::
push bc
ld hl, #0x0004
add hl, sp
ld c,(hl)
in l,(c)
ld h, #0x00
pop bc
ret
;----------------------------------------------------
; void jump( addr_t addr );
;
; unconditionally jump to <addr>
;----------------------------------------------------
_jump::
ld hl, #0x0004
add hl, sp
jp (hl)