Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Int15 handler example: IISP; chain other functions directly (Developers)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 15.05.2011, 18:30

A NASM example outlining how to construct an IISP header yourself (I usually use a macro for that), and with slightly different behaviour. (Yes, I know the flags are handled differently. And I don't know what to do with the AL value(s). Ignore these parts, they would have to be adjusted accordingly.) The part I want to point out specifically is that Bret's example would chain by calling the next handler every time, then check afterwards whether it was the correct function call. That unnecessarily increases the stack usage of every Int15 function and may or may not be less efficient than this one: It checks for the correct function first, and will chain directly (via jump) if it's another function.

; This stuff at the beginning is the IISP header (17 bytes).
; It allows other programs to walk the handler chain past this one.
int15.dummyhwreset:
    retf

int15:
    jmp short .actualhandler
.next:
    dd 0
    db "KB"
    db 0
    jmp short .dummyhwreset
    times 7 db 0

    ; Here the actual handler.
.actualhandler:
    ; push ax           ; (if saving al, see below)
    pushf
    cmp ah, 4Fh         ; Is this our function call?
    je .handle
    popf                ; Nope, chain quickly to the next handler:
    ; pop ax            ; (if saving al, see below)
.jumpnext:
    jmp far [cs:.next]

.handle:
    ; Save al here? (Modify it already?)

    push cs
    call .jumpnext
    ; pop ax            ; (if saving al)

    ; Process in some way.

    iret

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 248 users online (1 registered, 247 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum