segxxx SEGMENT BYTE 'CODE'
ASSUME cs:segxxx, ds:segxxx

IF EXEID eq 91
G8326_      db 04Dh, 008h, 003h, 0E5h, 0FEh, 002h, 002h, 006h, 015h, 000h, 01Dh, 000h
                db 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h, 000h, 006h, 000h, 007h
                db 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h, 050h, 00Fh, 002h, 0E5h
                db 0F9h, 002h, 007h, 00Eh, 035h, 000h, 051h, 000h, 000h, 002h, 000h, 003h
                db 000h, 004h, 000h, 005h, 000h, 006h, 000h, 007h, 000h, 008h, 000h, 009h
                db 000h, 00Ah, 000h, 00Bh, 000h, 00Ch, 000h, 00Dh, 000h, 00Eh, 000h, 00Fh
                db 001h, 001h, 001h, 002h, 001h, 003h, 001h, 004h, 001h, 005h, 001h, 006h
                db 001h, 007h, 001h, 008h, 001h, 009h, 001h, 00Ah, 001h, 00Bh, 001h, 00Ch
                db 001h, 00Dh, 001h, 00Eh, 050h, 008h, 002h, 0E5h, 0FBh, 002h, 002h, 007h
                db 079h, 000h, 081h, 000h, 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h
                db 000h, 006h, 000h, 007h, 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h
                db 001h, 004h, 050h, 009h, 002h, 0E5h, 0F9h, 002h, 002h, 008h, 09Bh, 000h
                db 0A3h, 000h, 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h, 000h, 006h
                db 000h, 007h, 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h, 001h, 004h
                db 001h, 005h
ENDIF
IF EXEID eq 105
G8326_      db 04Dh, 008h, 003h, 0E5h, 0FEh, 002h, 002h, 006h, 014h, 000h, 01Ch, 000h
                db 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h, 000h, 006h, 000h, 007h
                db 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h, 050h, 00Fh, 002h, 0E5h
                db 0F9h, 002h, 007h, 00Eh, 034h, 000h, 050h, 000h, 000h, 002h, 000h, 003h
                db 000h, 004h, 000h, 005h, 000h, 006h, 000h, 007h, 000h, 008h, 000h, 009h
                db 000h, 00Ah, 000h, 00Bh, 000h, 00Ch, 000h, 00Dh, 000h, 00Eh, 000h, 00Fh
                db 001h, 001h, 001h, 002h, 001h, 003h, 001h, 004h, 001h, 005h, 001h, 006h
                db 001h, 007h, 001h, 008h, 001h, 009h, 001h, 00Ah, 001h, 00Bh, 001h, 00Ch
                db 001h, 00Dh, 001h, 00Eh, 050h, 008h, 002h, 0E5h, 0FBh, 002h, 002h, 007h
                db 078h, 000h, 080h, 000h, 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h
                db 000h, 006h, 000h, 007h, 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h
                db 001h, 004h, 050h, 009h, 002h, 0E5h, 0F9h, 002h, 002h, 008h, 09Ah, 000h
                db 0A2h, 000h, 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h, 000h, 006h
                db 000h, 007h, 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h, 001h, 004h
                db 001h, 005h
ENDIF
IF EXEID eq 96
G8326_      db 04Dh, 008h, 003h, 0E5h, 0FEh, 002h, 002h, 006h, 019h, 000h, 021h, 000h
                db 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h, 000h, 006h, 000h, 007h
                db 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h, 050h, 00Fh, 002h, 0E5h
                db 0F9h, 002h, 007h, 00Eh, 039h, 000h, 055h, 000h, 000h, 002h, 000h, 003h
                db 000h, 004h, 000h, 005h, 000h, 006h, 000h, 007h, 000h, 008h, 000h, 009h
                db 000h, 00Ah, 000h, 00Bh, 000h, 00Ch, 000h, 00Dh, 000h, 00Eh, 000h, 00Fh
                db 001h, 001h, 001h, 002h, 001h, 003h, 001h, 004h, 001h, 005h, 001h, 006h
                db 001h, 007h, 001h, 008h, 001h, 009h, 001h, 00Ah, 001h, 00Bh, 001h, 00Ch
                db 001h, 00Dh, 001h, 00Eh, 050h, 008h, 002h, 0E5h, 0FBh, 002h, 002h, 007h
                db 07Dh, 000h, 085h, 000h, 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h
                db 000h, 006h, 000h, 007h, 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h
                db 001h, 004h, 050h, 009h, 002h, 0E5h, 0F9h, 002h, 002h, 008h, 09Fh, 000h
                db 0A7h, 000h, 000h, 002h, 000h, 003h, 000h, 004h, 000h, 005h, 000h, 006h
                db 000h, 007h, 000h, 008h, 001h, 001h, 001h, 002h, 001h, 003h, 001h, 004h
                db 001h, 005h
ENDIF
G8327_      dw 80h,  100h,  200h,  400h,  800h, 1000h, 2000h
G8328_      db 0
G8329_      db 0
G8330_      dw 0
G8331_      db 40h dup(0)
PUBLIC _F8426_
_F8426_      proc far
                push    bp
                mov     bp, sp
                push    es
                push    ds
IF (EXEID eq 105) OR (EXEID eq 96)
                cld
ENDIF
                mov     ax, cs
                mov     ds, ax
                mov     es, ax
                mov     al, 90h
                mov     G8328_, al
                mov     ax, [bp+6]
                dec     ax
                and     al, 1
                mov     G8329_, al
                call    F8430_
                mov     si, offset G8326_
                call    F8427_
IF (EXEID eq 105) OR (EXEID eq 96)
                pushf
ENDIF
                call    F8430_
IF (EXEID eq 105) OR (EXEID eq 96)
                popf
                mov     ax, 0
                jnb     loc_10548
                mov     al, G8332_
                mov     ah, G8333_
loc_10548:
ENDIF
                pop     ds
                pop     es
                pop     bp
                retf
_F8426_      endp

F8427_       proc near
                xor     bx, bx
                mov     bl, [si+2]
                add     bx, bx
                mov     bx, [bx+G8327_]
                mov     G8330_, bx
                mov     ah, [si]
                add     ah, ah
                mov     cl, 0
loc_10561:
                lea     di, G8331_
                mov     al, [si+1]
                mov     ch, [si+2]
                call    F8428_
                push    cx
                call    F8434_
                mov     dl, [si+3]
                xor     bx, bx
                mov     bl, [si+1]
                add     bx, bx
                add     bx, bx
                lea     di, G8331_
                call    F8431_
                pop     cx
IF (EXEID eq 105) OR (EXEID eq 96)
                jb      locret_1059E
ENDIF
                inc     cl
                dec     ah
                jnz     loc_10561
IF EXEID eq 91
                lea     di, loc_12451
ENDIF
                call    F8435_
IF EXEID eq 91
                lea     di, loc_12451
ENDIF
IF (EXEID eq 105) OR (EXEID eq 96)
                jb      locret_1059E
ENDIF
                call    F8437_
IF EXEID eq 91
                lea     di, loc_12451
ENDIF
IF (EXEID eq 105) OR (EXEID eq 96)
                jb      locret_1059E
ENDIF
                call    F8436_
IF EXEID eq 91
                lea     di, loc_12451
ENDIF
IF (EXEID eq 105) OR (EXEID eq 96)
                jb      locret_1059E
ENDIF
                call    F8438_
IF (EXEID eq 105) OR (EXEID eq 96)
locret_1059E:
ENDIF
                retn
F8427_       endp

F8428_       proc near
                push    ax
                push    bx
                push    cx
                push    dx
                push    di
                mov     dl, cl
                mov     bl, 1
loc_105A8:
                mov     cl, dl
                call    F8434_
                mov     [di], cl
                mov     [di+1], dh
                mov     [di+2], bl
                mov     [di+3], ch
                add     di, 4
                inc     bl
                dec     al
                jnz     loc_105A8
                pop     di
                pop     dx
                pop     cx
                pop     bx
                pop     ax
                retn
F8428_       endp

IF (EXEID eq 105) OR (EXEID eq 96)
F8429_       proc near
                retn
F8429_       endp
ENDIF

F8430_       proc near
                push    ax
                mov     al, G8329_
                and     al, 3
loc_105CE:
                or      al, G8328_
                mov     ah, 7
                int     1Bh
                pop     ax
                retn
F8430_       endp

IF EXEID eq 91
F8529_       proc near
                push    ax
                mov     ah, 4
                call    F8433_
                pop     ax
                retn
F8529_       endp
ENDIF

F8431_       proc near
                push    ax
                mov     ah, 5Dh
                call    F8433_
                pop     ax
                retn
F8431_       endp

F8432_       proc near
                push    ax
                mov     ah, 55h
IF (EXEID eq 105) OR (EXEID eq 96)
                push    es
                mov     di, 0A000h
                mov     es, di
                mov     di, 0
ENDIF
                call    F8433_
IF (EXEID eq 105) OR (EXEID eq 96)
                pop     es
ENDIF
                pop     ax
                retn
F8432_       endp

IF (EXEID eq 105) OR (EXEID eq 96)
G8332_      db 0
G8333_      db 0
ENDIF

F8433_       proc near
                push    ax
                push    bx
                push    cx
                push    dx
                push    si
                push    di
                push    bp
                mov     bp, di
                mov     al, G8329_
                and     al, 3
                or      al, G8328_
IF (EXEID eq 105) OR (EXEID eq 96)
                mov     byte ptr G8332_, ah
ENDIF
                int     1Bh
IF (EXEID eq 105) OR (EXEID eq 96)
                mov     byte ptr G8333_, ah
ENDIF
                pop     bp
                pop     di
                pop     si
                pop     dx
                pop     cx
                pop     bx
                pop     ax
                retn
F8433_       endp

F8434_       proc near
                xor     dh, dh
                shr     cl, 1
                rcl     dh, 1
                retn
F8434_       endp

F8435_       proc near
                push    ax
                push    cx
                push    dx
                push    di
IF EXEID eq 91
                mov     dx, di
ENDIF
IF (EXEID eq 105) OR (EXEID eq 96)
                push    es
                mov     ax, 0A000h
                mov     es, ax
                mov     di, 0
ENDIF
                mov     ah, [si+6]
loc_1062F:
                mov     cx, G8330_
                xor     al, al
IF (EXEID eq 105) OR (EXEID eq 96)
                cld
ENDIF
                rep stosb
                dec     ah
                jnz     loc_1062F
IF EXEID eq 91
                mov     di, dx
ENDIF
IF (EXEID eq 105) OR (EXEID eq 96)
                mov     di, 0
ENDIF
                mov     al, [si+4]
                stosb
                mov     ax, 0FFFFh
                stosw
IF (EXEID eq 105) OR (EXEID eq 96)
                pop     es
ENDIF
                pop     di
                pop     dx
                pop     cx
                pop     ax
                retn
F8435_       endp

F8436_       proc near
                push    ax
                push    cx
                push    dx
                push    di
IF EXEID eq 91
                mov     dx, di
ENDIF
IF (EXEID eq 105) OR (EXEID eq 96)
                push    es
                mov     ax, 0A000h
                mov     es, ax
                mov     di, 0
ENDIF
                mov     cx, G8330_
                mov     al, [si+3]
IF (EXEID eq 105) OR (EXEID eq 96)
                cld
ENDIF
                rep stosb
                mov     cx, G8330_
                shr     cx, 1
                shr     cx, 1
                shr     cx, 1
                shr     cx, 1
                shr     cx, 1
IF EXEID eq 91
                mov     di, dx
ENDIF
IF (EXEID eq 105) OR (EXEID eq 96)
                mov     di, 0
ENDIF
                xor     al, al
loc_10677:
                stosb
                add     di, 1Fh
                loop    loc_10677
IF (EXEID eq 105) OR (EXEID eq 96)
                pop     es
ENDIF
                pop     di
                pop     dx
                pop     cx
                pop     ax
                retn
F8436_       endp

F8437_       proc near
                mov     bp, [si+8]
                mov     bx, G8330_
                mov     ch, [si+2]
                mov     ah, [si+5]
loc_10690:
                mov     al, [si+6]
                push    di
loc_10694:
                mov     cl, ds:[bp+0]
                call    F8434_
                mov     dl, ds:[bp+1]
                call    F8432_
IF (EXEID eq 105) OR (EXEID eq 96)
                jnb     loc_106A6
                pop     di
                retn
loc_106A6:
ENDIF
                add     bp, 2
                add     di, bx
                dec     al
                jnz     loc_10694
                pop     di
                dec     ah
                jnz     loc_10690
                retn
F8437_       endp

F8438_       proc near
                mov     bp, [si+0Ah]
                mov     bx, G8330_
                mov     ch, [si+2]
                mov     al, [si+6]
loc_106C2:
                push    di
                mov     cl, ds:[bp+0]
                call    F8434_
                mov     dl, ds:[bp+1]
                call    F8432_
IF (EXEID eq 105) OR (EXEID eq 96)
                jnb     loc_106D5
                pop     di
                retn
loc_106D5:
ENDIF
                add     bp, 2
                pop     di
                dec     al
                jnz     loc_106C2
                retn
F8438_       endp
IF EXEID eq 91
loc_12451:
ENDIF
ENDS
END
