Mini x86 MS-DOS .COM disassembler

[Github] [TL;DR documentation]

Demos:

@hexdisassembled asmoriginal asm (for comparison)Screen capture
0100
0102
0103
0105
0107
010A
010B
010F
0111
0116
0117
011A
011B
011E
0120
0122
0124
0126
0127
0128
0129
012A
012B
012C
012D
012E
012F
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
013A
013B
013C
013D
013E
013F
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
014A
014B
014C
014D
014E
014F
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
015A
015B
015C
015D
015E
015F
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
016A
016B
016C
016D
016E
016F
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
017A
017B
017C
017D
017E
017F
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
018A
018B
018C
018D
018E
018F
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
019A
019B
019C
019D
019E
019F
01A0
01A1
01A2
01A3
01A4
01A5
01A6
01A7
01A8
01A9
01AA
01AB
01AC
01AD
01AE
01AF
01B0
01B1
01B2
01B3
01B4
01B5
01B6
01B7
01B8
01B9
01BA
01BB
01BC
01BD
01BE
01BF
01C0
01C1
01C2
01C3
01C4
01C5
01C6
01C7
01C8
01C9
01CA
01CB
01CC
01CD
01CE
01CF
01D0
01D1
01D2
01D3
01D4
01D5
01D6
01D7
01D8
01D9
01DA
01DB
01DC
01DD
01DE
01DF
01E0
01E1
01E2
01E3
01E4
01E5
01E6
01E7
01E8
01E9
01EA
01EB
01EC
01ED
01EE
01EF
01F0
01F1
01F2
01F3
01F4
01F5
01F6
01F7
01F8
01F9
01FA
01FB
01FC
01FD
01FE
01FF
8E E0
5D
B0 13
CD 10
68 00 A0
07
F7 C5 00 01
74 05
80 36 16 01 08
4D
B9 FF 00
99
BE 40 01
89 CB
89 F8
F6 D3
F7 F6
E8
97
00
E8
94
00
BE
6C
04
64
02
1C
12
34
02
64
01
88
F0
10
C5
20
DE
B7
30
B2
20
E8
86
00
74
21
53
B2
10
B7
14
64
2A
1C
64
2A
1C
30
ED
E8
74
00
5B
74
0E
B2
18
B7
1C
64
02
1C
E8
67
00
74
02
E2
B3
92
80
FE
40
74
2A
9C
58
9E
7A
21
84
C9
74
04
FE
C6
75
04
B0
FF
EB
1D
20
D8
30
F0
30
DA
20
F2
C0
E0
02
80
E2
01
0F
45
C1
B4
FF
28
C4
88
E0
EB
04
F6
D4
20
E0
FC
D4
12
B0
10
D5
01
85
FF
7A
01
40
AA
0F
85
6B
FF
C7
04
11
37
64
C7
44
E4
01
17
B4
09
BA
F7
01
CD
21
E9
4B
FF
92
29
E8
0F
AF
C3
05
7F
06
C3
50
F6
C3
40
75
1B
38
FC
73
17
38
D4
72
13
F6
C3
78
75
0C
84
ED
75
05
A8
78
75
04
FD
80
C4
18
30
EC
F6
C6
10
75
02
00
C6
08
F4
9E
58
C3
6D
65
67
61
70
6F
6C
65
24
mov fs, ax
pop bp
mov al, 13h ; = 19
int 10h ; = 16
push A000h ; = 40960
pop es
test bp, 0100h ; = 256
jz 0116h ; = 7
xor 278, 08h ; = 8
dec bp
mov cx, 00FFh ; = 255
cwd
mov si, 0140h ; = 320
mov bx, cx
mov ax, di
not bl
div si
db E8h ; 'Φ'
db 97h ; 'ù'
db 00h ; ' '
db E8h ; 'Φ'
db 94h ; 'ö'
db 00h ; ' '
db BEh ; '╛'
db 6Ch ; 'l'
db 04h ; '♦'
db 64h ; 'd'
db 02h ; '☻'
db 1Ch ; '∟'
db 12h ; '↕'
db 34h ; '4'
db 02h ; '☻'
db 64h ; 'd'
db 01h ; '☺'
db 88h ; 'ê'
db F0h ; '≡'
db 10h ; '►'
db C5h ; '┼'
db 20h ; ' '
db DEh ; '▐'
db B7h ; '╖'
db 30h ; '0'
db B2h ; '▓'
db 20h ; ' '
db E8h ; 'Φ'
db 86h ; 'å'
db 00h ; ' '
db 74h ; 't'
db 21h ; '!'
db 53h ; 'S'
db B2h ; '▓'
db 10h ; '►'
db B7h ; '╖'
db 14h ; '¶'
db 64h ; 'd'
db 2Ah ; '*'
db 1Ch ; '∟'
db 64h ; 'd'
db 2Ah ; '*'
db 1Ch ; '∟'
db 30h ; '0'
db EDh ; 'φ'
db E8h ; 'Φ'
db 74h ; 't'
db 00h ; ' '
db 5Bh ; '['
db 74h ; 't'
db 0Eh ; '♫'
db B2h ; '▓'
db 18h ; '↑'
db B7h ; '╖'
db 1Ch ; '∟'
db 64h ; 'd'
db 02h ; '☻'
db 1Ch ; '∟'
db E8h ; 'Φ'
db 67h ; 'g'
db 00h ; ' '
db 74h ; 't'
db 02h ; '☻'
db E2h ; 'Γ'
db B3h ; '│'
db 92h ; 'Æ'
db 80h ; 'Ç'
db FEh ; '■'
db 40h ; '@'
db 74h ; 't'
db 2Ah ; '*'
db 9Ch ; '£'
db 58h ; 'X'
db 9Eh ; '₧'
db 7Ah ; 'z'
db 21h ; '!'
db 84h ; 'ä'
db C9h ; '╔'
db 74h ; 't'
db 04h ; '♦'
db FEh ; '■'
db C6h ; '╞'
db 75h ; 'u'
db 04h ; '♦'
db B0h ; '░'
db FFh ; ' '
db EBh ; 'δ'
db 1Dh ; '↔'
db 20h ; ' '
db D8h ; '╪'
db 30h ; '0'
db F0h ; '≡'
db 30h ; '0'
db DAh ; '┌'
db 20h ; ' '
db F2h ; '≥'
db C0h ; '└'
db E0h ; 'α'
db 02h ; '☻'
db 80h ; 'Ç'
db E2h ; 'Γ'
db 01h ; '☺'
db 0Fh ; '☼'
db 45h ; 'E'
db C1h ; '┴'
db B4h ; '┤'
db FFh ; ' '
db 28h ; '('
db C4h ; '─'
db 88h ; 'ê'
db E0h ; 'α'
db EBh ; 'δ'
db 04h ; '♦'
db F6h ; '÷'
db D4h ; '╘'
db 20h ; ' '
db E0h ; 'α'
db FCh ; 'ⁿ'
db D4h ; '╘'
db 12h ; '↕'
db B0h ; '░'
db 10h ; '►'
db D5h ; '╒'
db 01h ; '☺'
db 85h ; 'à'
db FFh ; ' '
db 7Ah ; 'z'
db 01h ; '☺'
db 40h ; '@'
db AAh ; '¬'
db 0Fh ; '☼'
db 85h ; 'à'
db 6Bh ; 'k'
db FFh ; ' '
db C7h ; '╟'
db 04h ; '♦'
db 11h ; '◄'
db 37h ; '7'
db 64h ; 'd'
db C7h ; '╟'
db 44h ; 'D'
db E4h ; 'Σ'
db 01h ; '☺'
db 17h ; '↨'
db B4h ; '┤'
db 09h ; '○'
db BAh ; '║'
db F7h ; '≈'
db 01h ; '☺'
db CDh ; '═'
db 21h ; '!'
db E9h ; 'Θ'
db 4Bh ; 'K'
db FFh ; ' '
db 92h ; 'Æ'
db 29h ; ')'
db E8h ; 'Φ'
db 0Fh ; '☼'
db AFh ; '»'
db C3h ; '├'
db 05h ; '♣'
db 7Fh ; '⌂'
db 06h ; '♠'
db C3h ; '├'
db 50h ; 'P'
db F6h ; '÷'
db C3h ; '├'
db 40h ; '@'
db 75h ; 'u'
db 1Bh ; '←'
db 38h ; '8'
db FCh ; 'ⁿ'
db 73h ; 's'
db 17h ; '↨'
db 38h ; '8'
db D4h ; '╘'
db 72h ; 'r'
db 13h ; '‼'
db F6h ; '÷'
db C3h ; '├'
db 78h ; 'x'
db 75h ; 'u'
db 0Ch ; '♀'
db 84h ; 'ä'
db EDh ; 'φ'
db 75h ; 'u'
db 05h ; '♣'
db A8h ; '¿'
db 78h ; 'x'
db 75h ; 'u'
db 04h ; '♦'
db FDh ; '²'
db 80h ; 'Ç'
db C4h ; '─'
db 18h ; '↑'
db 30h ; '0'
db ECh ; '∞'
db F6h ; '÷'
db C6h ; '╞'
db 10h ; '►'
db 75h ; 'u'
db 02h ; '☻'
db 00h ; ' '
db C6h ; '╞'
db 08h ; '◘'
db F4h ; '⌠'
db 9Eh ; '₧'
db 58h ; 'X'
db C3h ; '├'
db 6Dh ; 'm'
db 65h ; 'e'
db 67h ; 'g'
db 61h ; 'a'
db 70h ; 'p'
db 6Fh ; 'o'
db 6Ch ; 'l'
db 65h ; 'e'
db 24h ; '$'
  mov fs,ax                ; ax=0? was pop bp before rewrite for non-zero fs seg  
  pop bp                   ; bp=0 cs:[0fffeh]=ss:[sp]=0000 if not debug executed
  mov al,13h               ; function switch to video mode 13h 320x200x256 & cls
  int 10h                  ; general video bios service for all mode 13h vga api
  push w 0a000h            ; was les cx,[bx] es=9fffh cx=20cdh & lea ax,[di-10h]
  pop es                   ; ms-dos v6.22 or freedos not "les rr,[0]" compatible
a:test bp,100h             ; script idx bounds reached? bp E [0;255] i.e aam 255
  jz c                     ; if hibyte OR rollover sign propagated to hibyte lsb
  xor b[c],8h              ; xor mutex modify next opcode to keep idx normalized
c:dec bp                   ; follow through and advance script idx dec bp/inc bp
e:mov cx,0ffh              ; cl=visibility fostrum, null ch implicit object mask
g:cwd                      ; shorter xor dx,dx with ah<128 for div moved for agi
  mov si,140h              ; vga vid mode 19 horizontal scanline width in pixels
  mov bx,cx                ; bl=distance nullify bh raymarch object height limit
  mov ax,di                ; di=beam spot absolute vga coord, no dos para fix-up
  not bl                   ; bl=distance/z axis orientation= -visibility fostrum
  div si                   ; main 3d projection returns with ax=y dx=x  ; dh = x
  call q                   ; main 3d projection returns withah=(y-y0)*z ; bl = z
  call q                   ; main 3d projection returns withah=(x-x0)*z ; ah = y
  mov si,46ch              ; 46ch=bda rtc off in zero seg plus ad hoc off buffer
  add bl,[fs:si]           ; bl=z+=rtc word in bda advances camera, assumed fs=0
  adc dh,[si]              ; dh+=beam spot camera x coordinates cs/ds:46ch & rtc
  add ah,[si+1]            ; ah+=beam spot camera y coordinates cs/ds:46dh & rtc
  mov al,dh                ; push/pop preserve texture x>>8 texel base for later   
  adc ch,al                ; this object's implicit form xor /w building overlay
  and dh,bl                ; dh=x bl=x i.e x+=y bh and dl used as generic params
  mov bh,30h               ; bh=y height max of overpass, function generic param
  mov dl,20h               ; dl=y height min of overpass, function generic param
  call r                   ; function returns if this object or building ray hit
  jz h                     ; if objects volume intersect with ray texture former
  push bx                  ; preserve prev rtc time to avoid costly seg override
  mov dl,10h               ; dl=y height max of spaceship function generic param
  mov bh,14h               ; bh=y height min of spaceship function generic param
  sub bl,[fs:si]           ; bl=z+=rtc word in bda advances spaceship1 camera<--
  sub bl,[fs:si]           ; bl=z+=rtc word in bda advances spaceship1 camera<--
  xor ch,ch                ; flag differenciates between spaceship* and overpass
  call r                   ; function returns if this object or building ray hit
  pop bx                   ; restore prev rtc time also implicit ch val returned
  jz h                     ; if objects volume intersect with ray texture former
  mov dl,18h               ; dl=y height max of spaceship function generic param
  mov bh,1ch               ; bh=y height min of spaceship function generic param
  add bl,[fs:si]           ; bl=z+=rtc word in bda advances spaceship2 camera-->
  call r                   ; function returns if this object or building ray hit
  jz h                     ; if objects volume intersect with ray texture former
  loop g                   ; if no object volumes intersect then continue z rays
h:xchg ax,dx               ; texture subroutine - clone ray collision height val
  cmp dh,40h               ; test if this ray collision height val is exactly 64
  jz l                     ; process as scenery bottom floor, al=depth was saved
  pushf                    ; ax disposed of in z-buffer order override data flow
  pop ax                   ; subroutine marked eflags /w bit10 df=spaceship true
  sahf                     ; convert this object's bit10 df to pf for conditions
  jp k                     ; if z-ray collided with a spaceship object then exit
  test cl,cl               ; else test if ray collision exited on loop condition
  jz i                     ; if distance=0=>no scenery intersection=open horizon
  inc dh                   ; test if this ray collision height=top=255=sky limit
  jnz j                    ; else ray hit other scenery building/overpass object
i:mov al,0ffh              ; is sky so apply old b/w film rear projection effect
  jmp m                    ; with brightest standard vga palette grayscale color
j:and al,bl                ; is building/overpass process texel window step #1/3
  xor al,dh                ; is building/overpass process texel window step #2/3
  xor dl,bl                ; is building/overpass process texel bricks step #1/2
  and dl,dh                ; is building/overpass process texel bricks step #2/2
  shl al,02h               ; is building/overpass process texel window step #3/3
  and dl,01h               ; test for building/overpass window or bricks texture
  cmovnz ax,cx             ; if window texel then color val=distance 586+ opcode
  mov ah,0ffh              ; colour for window or bricks of building or overpass
  sub ah,al                ; is dynamic for windows and static for all other obj
k:mov al,ah                ; thunk for building/overpass/window/bricks/spaceship
  jmp m                    ; proceed to last step of grayscale color normalizing
l:not ah                   ; floor grey bicolor flat-shaded for building shadows
  and al,ah                ; floor color multiplexes shadow depth=k*(255-height)
m:cld                      ; common thunk nullifies next spaceship=true obj flag
  aam 12h                  ; normalize with dithering add overlap ah=color/18+00
  mov al,16                ; normalize with dithering add overlap ah=color/18+16 
  aad 1                    ; dithering normalized and prepare for next frame cwd
  test di,di               ; test for all pixels plotted overrunning vga segment
  jp o                     ; preserve zf flag and test if absolute beam position
  inc ax                   ; parity even augmenting lighting for odd meta-pixels
o:stosb                    ; write screen pixel & advance absolute beam position
  jnz e                    ; if dst idx then continue automatic vga wrap-up fill
  mov w[si],3711h          ; post-assigns camera fixed value coordinates (17,55)
  mov w[fs:si-1ch],1701h   ; bda mem vid page 0 title curs position col=1 row=24
  mov ah,9                 ; dos 1+ write $ terminated string to standard output
  mov dx,p                 ; hardcoded 24h terminated ascii string of demo title
  int 21h                  ; general ms-dos api /w function 9 print ds:dx string
  jmp a                    ; process next demo frame (sorry no escape sequence!)
q:xchg ax,dx               ; 3-axis rotations require 2-axis ah=dh=x dh=(y-y0)*z
  sub ax,bp                ; translate to demo script idx arbitrary origin bp,bp
  imul ax,bx               ; project abcsisses/ordinates ah=(x-x0)*z dh=(y-y0)*z
  add ax,67fh              ; translate back to ~center=k*sqr(2) arbitrary fix-up
  ret                      ; --------------------------->return to caller (0c3h)
r:push ax                  ; isosurface discrimination preserve building overlay
  test bl,40h              ; is it time~depth (i.e z+rtc) displaying an overpass
  jnz v                    ; if not then process default buildings intersections
  cmp ah,bh                ; is y height>min of spaceship/overpass generic param
  jnc v                    ; if not then process default buildings intersections
  cmp ah,dl                ; is y height<max of spaceship/overpass generic param
  jc v                     ; if not then process default buildings intersections
  test bl,78h              ; is spaceship/overpass 120<z depth<128 static params
  jnz u                    ; if not then process modified building intersections
  test ch,ch               ; flag differenciates between spaceship* and overpass
  jnz t                    ; if overpass then proceed to translate it vertically
  test al,78h              ; is spaceship only objects 120<x width<128 in static
  jnz u                    ; if not then process modified building intersections
  std                      ; is spaceship and visible so set df flag accordingly
t:add ah,18h               ; translate spaceship/overpass objects vertically +24
u:xor ah,ch                ; this object's implicit form xor /w building overlay
v:test dh,10h              ; alternate scene vertical irregularity every step 16
  jnz x                    ; i.e : _||_||_||_||_||_||_||_||_||_||_||_||_||_||_||
  add dh,al                ; reduce scene horizontally = strech scene vertically
x:or ah,dh                 ; induce scene horizontal "y-colinear" irregularities
  sahf                     ; implicit isosurface volume x AND y AND z AND 64=64?
  pop ax                   ; isosurface discrimination preserve building overlay
  ret                      ; --------------------------->return to caller (0c3h)
p db "megapole$"           ; hardcoded 24h terminated ascii string of demo title


b equ byte
w equ word