;64Bit IRQ Demo Updated May 10, 2013
;int BF = AH=0 AL=IRQ# (IRQ# is 0 to F) Execute IRQ dq Hex Quad Word as Code
;int BF = AH=1 AL=IRQ# (Get IRQ) Returns ES:DI Pointer to IRQ (4 hex words)
;int BF = AH=2 AL=IRQ# (Display IRQ) Dump the IRQ To Screen as a HEX String
;int BF = AH=3 AL=IRQ# (Inject IRQ) DS:SI=4 word hex code
;int BF = AH=4 AL=IRQ# Trigger/Set an IRQ (Prints Purpose of IRQ)
;int BF = AH=5 AL=IRQ# Set the Current IRQ (operation phase)
;int BF = AH=6 Get the Current IRQ (operation phase) Returns AL=IRQ#
;int BF = AH=7 AL=IRQ# CX=Count (Add a number to an IRQ) Returns IRQ
;int BF = AH=8 AL=IRQ# CX=Count (Subtract a number to an IRQ) Returns IRQ
;int BF = AH=9 AL=IRQ# (Grab IRQ Number) Returns EBX:ECX
;int BF = AH=A AL=IRQ# (Post IRQ Number) Sets IRQ# To EBX:ECX
;int BF = AH=B AL=IRQ# Set Any 8 Byte IRQ to 00000000
;int BF = AH=C AL=IRQ# BH=Byte# BL=hex (Set IRQ Byte# 1 to 8 as Hex)
;int BF = AH=D AL=IRQ# EDX=Key (Encrypt/Decrypt IRQ)
;int BF = AH=E AL=IRQ# (Show IRQ) Display IRQ as Plain Text
Org 0x0100
jmp StartDemo
CurrentIRQ db 0
IRQ0RR dq 0x9090909090909090 ;IRQ0 = COM#/AUX#/LPT#/USB#/PS2/JOY STICK
IRQ1RR dq 0x9090909090909090 ;IRQ1 = CD/DVD/Floppy/USB/Hard Drive/Disk
IRQ2RR dq 0x9090909090909090 ;IRQ2 = Hardware/Video/Sound/Keyboard/Mouse
IRQ3RR dq 0x9090909090909090 ;IRQ3 = Imagination/Creativity/Spiritual
IRQ4RR dq 0x9090909090909090 ;IRQ4 = Error/Mistake/Invalid Link/Failure
IRQ5RR dq 0x9090909090909090 ;IRQ5 = Win/Amaze/Treasure/AweWow/Fantasy
IRQ6RR dq 0x9090909090909090 ;IRQ6 = Device/Connect/Transfer/Data/OS
IRQ7RR dq 0x9090909090909090 ;IRQ7 = FAT12/FAT32/NTFS/File System/Root
IRQ8RR dq 0x9090909090909090 ;IRQ8 = Math/Logic/Text/Output/Results
IRQ9RR dq 0x9090909090909090 ;IRQ9 = Internet/Client/Server/Packets
TxtIRQ dq "FILENAME" ;IRQA = FileName
DecIRQ dq 9999999999999999999 ;IRQB = Decimal Max
MaxIRQ dq 0xFFFFFFFFFFFFFFFF ;IRQC = Hex Max
MinIRQ dq 0x0000000000000000 ;IRQD = Dec/Hex 0
OneIRQ dq 0x0000000000000001 ;IRQE = Dec/Hex 1
ExeIRQ dq 0xB40EB003CD100000 ;IRQF = For Int 0xBF (Execute IRQ as HEX)
StartDemo:
push cs
pop ds
mov dx, IntBF
mov al, 0xBF
call SetV
;Display 64bit IRQ as Hex
mov ah, 0x02
mov al, 0x0F ;IRQ#
int 0xBF
;Execute 64bit IRQ as Code
mov ah, 0x00
mov al, 0x0F ;IRQ#
int 0xBF
mov ah, 0x4C
int 0x21
IntBF:
cmp ah, 0
je RunIRQ
cmp ah, 1
je GetIRQ
cmp ah, 2
je PrintIRQ
cmp ah, 3
je InjectIrq
cmp ah, 4
je TriggerIrq
cmp ah, 5
je SetIrq
cmp ah, 6
je GetIrq
cmp ah, 7
je AddIrq
cmp ah, 8
je SubIrq
cmp ah, 9
je GrabIrq
cmp ah, 0x0A
je PostIrq
cmp ah, 0x0B
je ResetIrq
cmp ah, 0x0C
je SetIrqByte
cmp ah, 0x0D
je CryptIrq
cmp ah, 0x0E
je ShowIRQ
jmp NoIrq
RunIRQ:
push ax
push bx
push cx
push dx
push ds
push es
push bp
push di
push si
push cs
pop es
push cs
pop ds
mov si, IRQ0RR
mov ah, 0
mov cx, 0x0008
mov dx, 0
mul cx
add si, ax
mov di, BuffIRQExe
lodsw
xchg ah, al
mov word [cs:BuffIRQExe+4], ax
lodsw
xchg ah, al
mov word [cs:BuffIRQExe+6], ax
lodsw
xchg ah, al
mov word [cs:BuffIRQExe+0], ax
lodsw
xchg ah, al
mov word [cs:BuffIRQExe+2], ax
BuffIRQExe:
dw 0x9090
dw 0x9090
dw 0x9090
dw 0x9090
pop si
pop di
pop bp
pop es
pop ds
pop dx
pop cx
pop bx
pop ax
jmp NoIrq
GetIRQ:
push ax
push bx
push cx
push dx
push ds
push bp
push si
push cs
pop ds
mov si, IRQ0RR
mov ah, 0
mov cx, 0x0008
mov dx, 0
mul cx
add si, ax
mov di, si
push cs
pop es
pop si
pop bp
pop ds
pop dx
pop cx
pop bx
pop ax
jmp NoIrq
PrintIRQ:
push ax
push bx
push cx
push dx
push ds
push es
push bp
push di
push si
push ax
push bx
mov bx, 000fh
mov al, '['
call putc
pop bx
pop ax
push cs
pop es
push cs
pop ds
mov si, IRQ0RR
mov ah, 0
mov cx, 0x0008
mov dx, 0
mul cx
add si, ax
lodsw
mov word [cs:Irq2Hex+6], ax
lodsw
mov word [cs:Irq2Hex+4], ax
lodsw
mov word [cs:Irq2Hex+2], ax
lodsw
mov word [cs:Irq2Hex+0], ax
mov cx, 4h
mov bx, 0
PrintIrqLoop:
mov ax, word [cs:Irq2Hex+BX]
call PrintAX
add bx, 2
loop PrintIrqLoop
push ax
push bx
mov bx, 000fh
mov al, ']'
call putc
pop bx
pop ax
pop si
pop di
pop bp
pop es
pop ds
pop dx
pop cx
pop bx
pop ax
jmp NoIrq
InjectIrq:
push ax
push bx
push cx
push dx
push ds
push es
push bp
push di
push si
push cs
pop es
mov di, IRQ0RR
mov ah, 0
mov cx, 0x0008
mov dx, 0
mul cx
add di, ax
lodsw
xchg ah, al
mov word [es:di+6], ax
lodsw
xchg ah, al
mov word [es:di+4], ax
lodsw
xchg ah, al
mov word [es:di+2], ax
lodsw
xchg ah, al
mov word [es:di+0], ax
pop si
pop di
pop bp
pop es
pop ds
pop dx
pop cx
pop bx
pop ax
jmp NoIrq
TriggerIrq:
mov byte [cs:CurrentIRQ], AL
push si
push ds
push cs
pop ds
mov si, TheIrqList
call PointP
call Show
pop ds
pop si
jmp NoIrq
SetIrq:
mov byte [cs:CurrentIRQ], AL
jmp NoIrq
GetIrq:
mov AL, byte [cs:CurrentIRQ]
jmp NoIrq
AddIrq:
cmp cx, 0
je NoIrq
int 0xEA
push ax
mov BP,CX
mov ah, 9
int 0xBF
mov EAX, ECX
CXAdd:
mov ECX, EAX
cmp ECX, 0xFFFFFFFF
jne NotECXMax
mov ECX, 0x00000000
inc EBX
jmp SkewSwish1
NotECXMax:
inc ECX
SkewSwish1:
mov EAX, ECX
mov CX,BP
dec BP
loop CXAdd
mov ECX, EAX
pop ax
mov ah, 0x0A
int 0xBF
int 0xEB
jmp NoIrq
SubIrq:
cmp cx, 0
je NoIrq
int 0xEA
push ax
mov BP,CX
mov ah, 9
int 0xBF
mov EAX, ECX
CXSub:
mov ECX, EAX
cmp ECX, 0x00000000
jne NotEBXMin
mov ECX, 0xFFFFFFFF
dec EBX
jmp SkewSwish2
NotEBXMin:
dec ECX
SkewSwish2:
mov EAX, ECX
mov CX,BP
dec BP
loop CXSub
mov ECX, EAX
pop ax
mov ah, 0x0A
int 0xBF
int 0xEB
jmp NoIrq
GrabIrq:
push ax
push dx
push si
push ds
push cs
pop ds
mov esi, 0
mov si, IRQ0RR
mov ah, 0
mov cx, 0x0008
mov dx, 0
mul cx
add si, ax
lodsd
push eax
lodsd
push eax
pop ebx
pop ecx
pop ds
pop si
pop dx
pop ax
jmp NoIrq
PostIrq:
int 0xEA
push ebx
push ecx
push cs
pop es
mov edi, 0
mov di, IRQ0RR
mov ah, 0
mov cx, 0x0008
mov dx, 0
mul cx
add di, ax
pop eax
pop ebx
stosd
xchg eax, ebx
stosd
int 0xEB
jmp NoIrq
ResetIrq:
push ax
push ebx
push ecx
mov ah, 0x09
int 0xBF
mov EBX, 0
mov ECX, 0
mov ah, 0x0A
int 0xBF
pop ecx
pop ebx
pop ax
jmp NoIrq
SetIrqByte:
push ax
push bx
push cx
push dx
push ds
push es
push bp
push di
push si
push ax
cmp bh, 1
jne BHNot1
mov di, MyHexSerum1
BHNot1:
cmp bh, 2
jne BHNot2
mov di, MyHexSerum2
BHNot2:
cmp bh, 3
jne BHNot3
mov di, MyHexSerum3
BHNot3:
cmp bh, 4
jne BHNot4
mov di, MyHexSerum4
BHNot4:
cmp bh, 5
jne BHNot5
mov di, MyHexSerum5
BHNot5:
cmp bh, 6
jne BHNot6
mov di, MyHexSerum6
BHNot6:
cmp bh, 7
jne BHNot7
mov di, MyHexSerum7
BHNot7:
cmp bh, 8
jne BHNot8
mov di, MyHexSerum8
BHNot8:
push cs
pop es
mov al, bl
stosb
pop ax
push cs
pop ds
mov AH, 0x03
mov si, MyHexSerum1
int 0xBF
pop si
pop di
pop bp
pop es
pop ds
pop dx
pop cx
pop bx
pop ax
jmp NoIrq
CryptIrq:
push ax
push ebx
push ecx
mov ah, 0x09
int 0xBF
xor ebx, edx
xor ecx, edx
mov ah, 0x0A
int 0xBF
pop ecx
pop ebx
pop ax
jmp NoIrq
ShowIRQ:
push ax
push bx
push cx
push dx
push ds
push es
push bp
push di
push si
push cs
pop es
push cs
pop ds
mov si, IRQ0RR
mov ah, 0
mov cx, 0x0008
mov dx, 0
mul cx
add si, ax
lodsw
mov word [cs:Irq2Hex+6], ax
lodsw
mov word [cs:Irq2Hex+4], ax
lodsw
mov word [cs:Irq2Hex+2], ax
lodsw
mov word [cs:Irq2Hex+0], ax
mov cx, 4h
mov bx, 0
ShowIrqLoop:
mov ax, word [cs:Irq2Hex+BX]
call PrintAXTxt
add bx, 2
loop ShowIrqLoop
pop si
pop di
pop bp
pop es
pop ds
pop dx
pop cx
pop bx
pop ax
jmp NoIrq
TheIrqList:
db "IRQ0 = COM#/AUX#/LPT#/USB#/PS2/JOY STICK",0
db "IRQ1 = CD/DVD/Floppy/USB/Hard Drive/Disk",0
db "IRQ2 = Hardware/Video/Sound/Keyboard/Mouse",0
db "IRQ3 = Imagination/Creativity/Spiritual",0
db "IRQ4 = Error/Mistake/Invalid Link/Failure",0
db "IRQ5 = Win/Amaze/Treasure/AweWow/Fantasy",0
db "IRQ6 = Device/Connect/Transfer/Data/OS",0
db "IRQ7 = FAT12/FAT32/NTFS/File System/Root",0
db "IRQ8 = Math/Logic/Text/Output/Results",0
db "IRQ9 = Internet/Client/Server/Packets",0
db "IRQA = TxtIRQ FileName",0
db "IRQB = DecIRQ Decimal Max",0
db "IRQC = MaxIRQ Hex Max",0
db "IRQD = MinIRQ Dec/Hex 0",0
db "IRQE = OneIRQ Dec/Hex 1",0
db "IRQF = ExeIRQ For Int 0xBF (Execute IRQ as HEX)",0
MyHexSerum1 db 0
MyHexSerum2 db 0
MyHexSerum3 db 0
MyHexSerum4 db 0
MyHexSerum5 db 0
MyHexSerum6 db 0
MyHexSerum7 db 0
MyHexSerum8 db 0
NoIrq:
iret
SetV:
pusha
push ds
push es
cli
xor bx, bx
mov es, bx
mov bl, 4
mul bl
mov bx, ax
mov word [es:bx], dx
add bx, 2
mov word [es:bx], ds
sti
pop es
pop ds
popa
ret
putc:
mov ah, 0x0e
mov bx, 0x0007
int 0x10
ret
PrintAX:
push AX
push BX
push CX
push DX
mov CX, 2
Prax:
xchg AH, AL
push AX
push CX
MOV CL,10h
MOV AH,0
DIV CL
ADD AL,30h
ADD AH,30h
CMP AL,'9'
JBE pCA4B
ADD AL,7
pCA4B:
CMP AH,'9'
JBE pCA5B
ADD AH,7
pCA5B:
mov CX,AX
mov al,CL
mov ah, 0eh
mov bh, 0
mov bl, 1
int 10h
mov al,CH
mov ah, 0eh
mov bh, 0
int 10h
pop CX
pop AX
loop Prax
pop DX
pop CX
pop BX
pop AX
ret
PointP:
push AX
push CX
push DX
mov DL, AL
mov CX, 64000
cmp DL, 0
je cAllOverPc
cCounterLoopc:
cmp byte [DS:SI], 0
jne cNotUpCountc
inc SI
dec DL
cmp DL, 0
je cAllOverPc
cNotUpCountc:
inc SI
loop cCounterLoopc
cAllOverPc:
pop DX
pop CX
pop AX
Int 0xE8
ret
Show:
push ax
push bx
push si
Show1:
lodsb
cmp al, 0
je Okay
mov ah, 0x0E
mov bh, 0x00
mov bl, 0x07
int 0x10
jmp Show1
Okay:
pop si
pop bx
pop ax
ret
PrintAXTxt:
push ax
push bx
mov bx, ax
mov ah, 0x0E
mov al, bh
int 0x10
mov ah, 0x0E
mov al, bl
int 0x10
pop bx
pop ax
ret
Irq2Hex:
dw 0x9090
dw 0x9090
dw 0x9090
dw 0x9090