![]() |
|
#1
|
|||
|
|||
Address errors with assembly language?first off here is my code:
page 60,132 TITLE HMWK6-13 (EXE) Chapter 6 ;---------------------------------------------------------- .MODEL SMALL .STACK 64 ;Define stack .DATA ;Define data BYTE1 DB 11 ;BH BYTE2 DB 15 ;FH WORD3 DW 0 ;---------------------------------------------------------- .CODE ;Define code segment MAIN PROC FAR MOV AL,BYTE1 ;move BYTE1 to AL ADD AL,BYTE2 ;add contents of BYTE2 to AL MOV DL,42H ;move the value of 42H to DL XCHG DL,AL ;exchange the contents of AL and DL MUL DL ;multiply the contents of AL by DL MOV WORD3, AX ;transfer the product from AX to WORD3 INT 21H MAIN ENDP ;End of procedure END MAIN ;End of program My issue is withe BYTE1, BYTE2 and WORD3. When i run DEBUG it shows my first command to be: MOV AL,[0002] which is fine but the value that i set BYTE1 equal to is in [0012] so AL is set to FF. As far as i can tell the code is right, but a second set of eyes may find my error. Any help would be great. Thanks. |
|||
|
#2
|
|||
|
|||
Re: Address errors with assembly language?When I assembled your code (with tasm32) into an object file, here's what the listing showed
Code:
When I unassembled the .obj file with DEBUG, here's what I got: Code:
Again, it looks to me as if can do what you had in mind. A few points: 1. I used Borland tasm32. I don't know what you used. 2. I just assembled it into an obj file. I couldn't execute the program on windows XP even if I had an executable, and I don't have an instruction set simulator for 80xx code. 3. I inspected the object file (by "eyeball" from a hex dump) to find where the actual code started in the file. 4. I started the Windows debug program from a command line. Then, knowing where the instructions started (at 0xbb in the .obj file), I entered the following: u 01bb (Since the object file is loaded by default at 0100 of whatever segment it is using.) If you are using another assembler or another procedure for assembling or another debugger or another procedure for debugging/disassembling, I doubt that I can help. In particular, I don't have a platform on which I could execute (or otherwise test) that program even if I had the correct executable. Good Luck! Regards, Dave "That's all I can do --- I can't do no more!" ---Popeye, the Sailor Man |
|
#3
|
|||
|
|||
Re: Address errors with assembly language?How do you look at the .obj file? I am running vista and it wont let me use notepad to read it legibly.
I use MASM611 to assemble and link and then use DEBUG (embedded in windows) to look at the registers and it shows nothing in registers [0000] - [0002]. But since it runs how it is suppose to i will be happy with that for now. Thanks for your help Dave. |
|
#4
|
|||
|
|||
Re: Address errors with assembly language?Quote:
I use vim for editing (gvim, actually) on Linux and Windows XP platforms. Vim is either supplied with or available for all Linux distributions that I have ever seen, and is upward compatible with "vi", which has been ubiquitous with UNIX since System V. (In Linux, when you enter "vi" on the command line you get vim. At least that's what I get.) It is a powerful productivity tool, but not exactly intuitive. It took me the better part of a day (yes, almost all day) to get comfortable with vi (about a hundred years ago, it seems), but the graphical version, gvim, has scroll bars, drop-down menus, etc., that make learning elementary operations pretty simple. (There is also a built-in tutorial and an extensive built-in help system.) Extra features abound, and, in conjunction with a program named xxd (supplied with vim), you can use vim as an editor of binary files as well as text files. just get into vim (or gvim), then enter: :%! xxd -g1 Windows versions of vim and gvim can be downloaded from many places on the web. I would just start at the home page: http://www.vim.org/ Of course, there are zillions of programs called "dump" or "hexdump" or some such thing that you can find on the web that let you look the contents of files in some binary mode. There are also a number of "hex editors" that allow you to inspect and edit contents of binary files. I use vim because it's there and I already use it as my main programming text editor. I'm thinking that if you are going to be doing any assembly language programming (even if it's just a little bit for a class), you might want to check some of them out. Regards, Dave |
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Assembly Language | alcoholic | Assembly Language | 2 | 28-Aug-2007 15:05 |
| Assemblers & assembly language | BlueFireCO. | Assembly Language | 2 | 26-Mar-2007 09:56 |
| Pointer Usage in C++: Beginner to Advanced | varunhome | C++ Forum | 0 | 19-Aug-2005 09:25 |
| which language ? | onauc | C++ Forum | 2 | 19-Nov-2004 02:53 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The