Posted in Personal, Programming on September 10, 2007|
Leave a Comment »
Old memory, I learned assembly first time when I were in Senior High School, 2nd grade. I learned how to write a .com program using debug. And now, after several struggle I managed to dig in my brain and wrote the tiny program 🙂
C:\>DEBUG
-A 100
0B32:0100 MOV AH,02
0B32:0102 MOV DL,41
0B32:0104 MOV CL,1A
0B32:0106 INT 21
0B32:0108 INC DL
0B32:010A LOOP 106
0B32:010C INT 20H
0B32:010E
-RCX
CX 0000
:E
-N C:\ABC.COM
-W
Writing 0000E bytes
-G
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Program terminated normally
-Q
C:\>DIR ABC.COM
Volume in drive C is WINDOWS
Volume Serial Number is C012-9F20
Directory of C:\
09/10/2007 06:12 PM 14 ABC.COM
1 File(s) 14 bytes
0 Dir(s) 11,225,669,632 bytes free
C:\>ABC
ABCDEFGHIJKLMNOPQRSTUVWXYZ
C:\>
I cannot remember which service interrupt used to put a single character into screen, well, here’s the reference:
Category: DOS kernel
INT 21 - DOS 1+ - WRITE CHARACTER TO STANDARD OUTPUT
AH = 02h
DL = character to write
Return: AL = last character output (despite the official docs which state
nothing is returned) (at least DOS 2.1-7.0)
Notes: ^C/^Break are checked, and INT 23 executed if pressed
standard output is always the screen under DOS 1.x, but may be
redirected under DOS 2+
the last character output will be the character in DL unless DL=09h
on entry, in which case AL=20h as tabs are expanded to blanks
if standard output is redirected to a file, no error checks (write-
protected, full media, etc.) are performed
SeeAlso: AH=06h,AH=09h
~Still remembering the first time I cracked a commercial software =P, lol, it was fun. Thx for the tutorial writer, sorry I forgot your name =D
Read Full Post »