Reverse Engineering for Beginners

(avery) #1
CHAPTER 83. DEMOS CHAPTER 83. DEMOS

53 loop MandelLoop
54
55 MandelBreak:
56 xchg ax,cx
57 stosb
58 cmp di, 0FA00h
59 jb FillLoop
60
61 ; wait for keypress
62 xor ax,ax
63 int 16h
64 ; set text video mode
65 mov ax, 3
66 int 10h
67 ; exit
68 int 20h


The author of these lines made an attempt to fix all these oddities: now the palette is smooth grayscale, the video buffer
is at the correct place (lines 19..20), the picture is drawn on center of the screen (line 30), the program eventually ends and
waits for the user’s keypress (lines 58..68). But now it’s much bigger: 105 bytes (or 54 instructions)^9.

Figure 83.3:My “fixed” version

(^9) You can experiment by yourself: get DosBox and NASM and compile it as:nasm fiole.asm -fbin -o file.com

Free download pdf