home *** CD-ROM | disk | FTP | other *** search
/ Chestnut's Multimedia Mania / MM_MANIA.ISO / graphics / povsrc20 / gccfix.asm < prev    next >
Assembly Source File  |  1993-06-01  |  3KB  |  97 lines

  1. ;   File To Fix DJGCC V1.09 bug that doesn't allow IOCTL read/writes
  2. ;
  3. ;   Written 2/9/93 by Aaron A. Collins
  4. ;   This file is hereby placed in the public domain.
  5. ;
  6. ;   Version 1.1 - minor entry/exit fixes 6/1/93 - AAC
  7. ;
  8. ;   Things that need IOCTL read/write operations simply need to be
  9. ;   recoded to use 0x440A and 0x440B (which DJGCC's go32 passes).
  10. ;   This converts them to the proper 0x4402 or 0x4403 as required,
  11. ;   then executes the DOS interrupt.
  12. ;        
  13.     .RADIX    16
  14. CSEG    segment para public 'CODE'
  15.     assume cs:CSEG, ds:CSEG, ss:CSEG, es:CSEG
  16. ;
  17. main    proc    near
  18. ;
  19.     org    100
  20. ;
  21. begin:    jmp    start            ; entry point according to 'end' statement
  22. ;
  23. olddv:    dw    0000
  24. oldds:    dw    0000
  25. ;
  26. ;
  27. start:    push    es
  28.     push    ds
  29.     push    cs            ; litter seg registers with our CS
  30.     pop    ds
  31.     cli
  32.     mov    ah,35            ; get vector, save and effect mine.
  33.     mov    al,21            ; get vector of DOS fn. interrupt
  34.     int    21
  35.     mov    word ptr [olddv],bx    ; store vector offset of old...
  36.     mov    ax,es
  37.     mov    word ptr [oldds],ax    ; store vector segment of old...
  38.     lea    dx,dosint        ; get effective address of int srvr.
  39.     mov    ah,25            ; set new interrupt vector
  40.     mov    al,21            ; set vector of DOS fn. interrupt
  41.     int    21
  42.     sti
  43.     pop    ds
  44.     pop    es
  45.     mov    dx,((finish-begin+115) SHR 4) ; add file length to PSP >> para
  46.     mov    ax,3100            ; DOS TSR with retcd = 00.
  47.     int    21
  48.     mov    ax,4c01            ; DOS Program Terminate, retcd = 01
  49.     int    21            ; we should never get here...
  50.     ret
  51. ;
  52. main    endp
  53. ;
  54.     even
  55. ;
  56. ;dosint    proc    far            ; DOS function int. service routine
  57. ;
  58. ;    pushf                ; simulate building Int stack structure
  59. ;    pushf                ; save flags we are about to trash
  60. ;    cmp    cx,1E            ; make sure this is a Targa read/write?
  61. ;    jnz    around
  62. ;    cmp    ax,440A            ; bogus IOCTL read call?
  63. ;    jz    yup            ; Yes - modify it, else do DOS call
  64. ;    cmp    ax,440BH        ; bogus IOCTL write call?
  65. ;    jnz    around            ; No - do DOS call straight away...
  66. ;yup:    sub    al,8
  67. ;    jmp    around
  68. ;wierd:    iret                ; this is really strange but it works!
  69. ;around: popf                ; restore saved flags
  70. ;    push    cs            ; simulate building Int stack structure
  71. ;    call    wierd
  72. ;    jmp    dword ptr cs:[olddv]     ; simulated far call to prev. INT 21 vector
  73. ;
  74. ;dosint    endp
  75. ;
  76. dosint    proc    far            ; DOS function int. service routine
  77. ;
  78.     pushf                ; save flags we are about to trash
  79.     cmp    cx,1E            ; make sure this is a Targa read/write?
  80.     jnz    around
  81.     cmp    ax,440A            ; bogus IOCTL read call?
  82.     jz    yup            ; Yes - modify it, else do DOS call
  83.     cmp    ax,440BH        ; bogus IOCTL write call?
  84.     jnz    around            ; No - do DOS call straight away...
  85. yup:    sub    al,8
  86. around: popf                ; restore saved flags
  87.     jmp    dword ptr cs:[olddv]     ; simulated far call to prev. INT 21 vector
  88. ;
  89. dosint    endp
  90. ;
  91. finish:    db    0
  92. ;
  93. CSEG    ends
  94. ;
  95.     end    begin
  96.