forked from johnjones4/DinoDOS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
lib.asm
37 lines (31 loc) · 888 Bytes
/
lib.asm
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
;lib.asm
;Michael Black, 2007
;lib.asm contains assembly functions that you can use in the shell
.global _interrupt
.global _enableInterrupts
;int interrupt (int number, int AX, int BX, int CX, int DX)
_interrupt:
push bp
mov bp,sp
mov ax,[bp+4] ;get the interrupt number in AL
push ds ;use self-modifying code to call the right interrupt
mov bx,cs
mov ds,bx
mov si,#intr
mov [si+1],al ;change the 00 below to the contents of AL
pop ds
mov ax,[bp+6] ;get the other parameters AX, BX, CX, and DX
mov bx,[bp+8]
mov cx,[bp+10]
mov dx,[bp+12]
intr: int #0x00 ;call the interrupt (00 will be changed above)
;GWB - Allow all of AX to be returned so that we can return
; negative numbers on errors.
;mov ah,#0 ;we only want AL returned
pop bp
ret
;void enableInterrupts()
;call at the beginning of programs. allows timer preemption
_enableInterrupts:
sti
ret