TUTORIAL ON CREATING BATCH FILE REPLY PROGRAM WITH DEBUG IN REAL ASSEMBLY LANGUAGE AT THE DOS/8088 LEVEL All numeric entries in DEBUG are hexadecimal, the base sixteen number system. They are followed by an H in the 'remarks, but not in the left hand part which is what you will see. Hex counts from 0 to 9 and then 10 is A, 11 is B, and so on till 15 is F, and we carry to the next column, (NO "G".) Just like when we carry after 9 in decimal, except in hex we just wait longer. Get your DOS disk or hard disk running and find the DEBUG program. It uses the dash prompt: - . Don't confuse the dash with my arrows and spacing. Enter the commands right after the dash with no leading space. debug{Enter} 'type-in everything from >> to ' on each line - >>a100 'All .COM files start at 100H in the segment used, ^^ 'here segment 54B1: (doesn't matter, DEBUG knows.) ???????????'This actual code at the addresses won't appear till ? 'you load it and -u100, unassemble, to see it. This V 'is machine code for these commands to the processor! 54B1:0100 (B000) >> MOV AL,00 'clear reg:AL to 00H 54B1:0102 (B408) >> MOV AH,08 'load AH w/ DOS call 08H: "Wait for and 'get one keyboard byte." 54B1:0104 (CD21) >> INT 21 'call DOS to perform the key fetch. 54B1:0106 (B44C) >> MOV AH,4C 'load AH w/ DOS call 4CH; terminate and 'pass errorlevel or exit code in reg:AL 54B1:0108 (CD21) >> INT 21 'call DOS to exit program and pass the 'errorlevel to the batchfile or anything 'else using INT 21 w/ DOS call 4DH to *see below right 'fetch the errorlevel from reg:AL 54B1:010A >> {Enter} 'You hit {Enter} to stop in-line assembly of code. - >>n reply.com 'Give the program a name - >>rcx 'Reg:CX holds number of bytes to save in program so CX 0000 'we interrogate and change it. :>>000A{Enter} 'We enter 000AH or decimal 10 bytes because 010A 'is the first memory byte not used (see *), and 'bytes at addresses 0000 to 0009 are 10 bytes in all! - >>w 'We write the file to current directory - >>q 'We quit debug 'and then move file REPLY.COM where you want it! If you're curious to unassemble now, just type DEBUG REPLY.COM at your DOS prompt and at the dash prompt type u100{Enter}. You will see the command code you typed in and the bytes next to them shown above at their addresses. Each line shows only the address of the first byte of command data on that line. A byte is two HEX numerals. So the second pair of HEX numerals is the next byte at the unwritten address one greater. This little 10 byte program accepts answer bytes to prompts in batch files! They must be interpreted by their ASCII decimal code, of course, when going down the list of errorlevels, as below indicates; 53 is the decimal ASCII for the numeral 5, and so on. One could write a bunch of compares a la CMP AL,XX with JNZ YYYY or JZ YYYY's between the input and termination calls, of course, with appropriate MOV AL,ZZ's to simplify the batch files and speed things up, but this gives you the idea. BUT DON'T FREAK IF YOU DIDN'T UNDERSTAND THE STUFF ABOVE!!!!! If you didn't fathom anything above, you can still use the program in your batch files because the REPLY.COM file CREATED ABOVE accompanies this tutorial. Observe the usage in the batch file below: SAMPLE BATCH FILE {Curly bracket means remark here: {Don't type them in or remarks @echo off echo * User Menu * echo 0) File Management Tool echo 1) WordProcessing echo 2) DataBase echo 3) Spreadsheet echo 4) Telecommunications echo 5) Alien Blaster Game echo echo What Number Do You Want? reply {<-Solves the age old problem of rem {why Microsoft, in their "wisdom" if errorlevel 53 goto five {didn't turn their batch language if errorlevel 52 goto four {into a real language with decent if errorlevel 51 goto three {data entry conditionals, instead if errorlevel 50 goto two {of its crippled if.. & ...exist. if errorlevel 49 goto one {ERRORLEVEL's 53 to 48 are just if errorlevel 48 goto zero {decimal ASCII for 5,4,3,2,1,0!!! :zero {Or you could name :zero as :no echo You picked 0! {instead and have it carry out FileLost <---- File Management Program goto end {one batch of stuff and then do :one {a goto to the :end, and have echo You picked 1! {:one become :yes and have it WordFuck <---- Word Processor goto end {goto a totally different batch :two {and execute it before goto'ing echo You picked 2! {to the :end marker. Note the DataFuck <---- DataBase Program goto end {"at" symbol used in DOS 3.3 for :three {holding echo off on the echo off echo You picked 3! {line, and it can be used in the SprdShit <---- Etc. goto end {"echo on" if you like to use one :four {at the end. But 3.2 and below echo You picked 4! {must do without them, but DOS TeleFuck <---- Etc. goto end {3.3 still likes "echo off" and :five {"echo on", so you're ok anyway. echo You picked 5! AssBlstr <---- Etc. goto end :end ------------------------------------------------------------------------------- Slightly Cute huh???!!! copyright (c) 1990 for Public Domain by: Richard Steven Walz rstevew@armory.com 515 Maple Street - No.1 Santa Cruz, CA 95060-4920 (408) 429-1200
fred1144