Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Combined .com executable/DOS driver (Announce)

posted by Arjay, 12.06.2010, 16:33

> I've "produced" a lot of the kind, they come out handy. Others may have
> found and used the same trick independently, though I have not seen any.
Ok, well I couldn't wait until this evening and have already started one :)

> Good to know. I don't pack my drivers - they've been generally small
> enough by themselves :=)
heh

> Y.W.! Watch out the necessary segment adjustments between .sys and .com
> formats, to compensate for the DOS PSP in the latter.

Indeed. Anyway for the curious here is my current work in progress as it stands. Unfortunately I need to do some other things (housework!) but hope to finish something later on this evening (and test on a FreeDOS box).



; ***************************************************************************
;                     SYSCOM v0.01 (a work in progress version)
; ***************************************************************************

Org     0000h               ; Device drivers do NOT have a PSP, so no org 100h
assume cs:code, ds:code     ; ...remember that COM files do have a PSP though!


; ***************************************************************************
SysHead:                    ; SYS Device Driver header (18 bytes in total)
  jmp   short COMEntry      ; Offset address of next driver (patched below)
  dw    0FFFFh              ; Segment address of next driver
  dw    08000h              ; Device attributes (1000000000000000b=basic char)
  dw    (Strategy-SysHead)  ; Offset address of strategy routine
  dw    (Interrupt-SysHead) ; Offset address of Interrupt routine
  db    'SYSCOMv1'          ; Device driver name (8 bytes)
; ***************************************************************************

ict_tab dw offset Initialize  ; Function 0
        dw offset dummy       ; Function 1
        dw offset dummy       ; Function 2
        dw offset dummy       ; Function 3
        dw offset dummy       ; Function 4
        dw offset dummy       ; Function 5
        dw offset dummy       ; Function 6
        dw offset dummy       ; Function 7
        dw offset dummy       ; Function 8
        dw offset dummy       ; Function 9
        dw offset dummy       ; Function 10
        dw offset dummy       ; Function 11
        dw offset dummy       ; Function 12
        dw offset dummy       ; Function 13
        dw offset dummy       ; Function 14
        dw offset dummy       ; Function 15
        dw offset dummy       ; Function 16

ptr2db  dw (?), (?)           ; Pointer to Data Block


; ***************************************************************************
COMEntry:
  mov word [SysHead+100h], 0ffffh ; Set Offset address of next driver to FFFFh
  jmp dummy


Strategy:
  mov   cs:ptr2db,   bx
  mov   cs:ptr2db+2, es
  ret


Interrupt:
  ret  ; apparently ret not an iret


Initialize:
  mov   word ptr es:di, offset Initialize
  mov   es:di, cs
  xor   ax, ax
  ret


dummy:
;  mov   ax, 8003h    ; Call not supported
  xor   ax, ax        ; Pretend we've done something!


exit:
  ret                 ; Returns to first 2 bytes of PSP under DOS (Int 20h!)

; ***************************************************************************
;                                END OF SYSCOM.ASM
; ***************************************************************************



Compiled binary as it stands:

00000000:  EB 36 FF FF-00 80 41 00-4C 00 53 59-53 43 4F 4D
00000010:  76 31 4D 00-58 00 58 00-58 00 58 00-58 00 58 00
00000020:  58 00 58 00-58 00 58 00-58 00 58 00-58 00 58 00
00000030:  58 00 58 00-00 00 00 00-C7 06 00 01-FF FF E9 17
00000040:  00 2E 89 1E-34 00 2E 8C-06 36 00 C3-C3 26 C7 05
00000050:  4D 00 26 8C-CF 33 C0 C3-33 C0 C3


[EDIT: Just to add: Yes, I know several optimizations and SYS side "broken"]

 

Complete thread:

Back to the forum
Board view  Mix view
22781 Postings in 2123 Threads, 402 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum