|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
Assembly Language beginner question.
Hi. I've been learning assembly languages for a couple weeks with Kip Irvine's book, and I was working on one exercise program and I could never figure out why program was doing this.
It starts like... .data array2 WORD 10, blah, blah, blah, blah index WORD 0 .code main PROC mov bp, index mov ax, array2[ bp ] .... main ENDP end main The problem was that "mov ax, array[ bp ]" line tried to read out of the allocated memory. By default, the address of array2 was 00405000h, and the default value was 0012FFF0h. First, I set bp value to 0(index). So EBP was 00120000h. However, Instead of reading array2[ 0000h ], it tried to read array[00120000h] and the error message "Tried to read 00525000h (which is the offset of array2 + ebp)" poped up. Do you have any idea why the program did this? I certainly wanted array2[bp], not array2[ebp]. Oh, when I used "movzx ebp, index" instead of "mov bp, index" the program worked just fine. I'm just wondering why it uses bp instead of ebp when compiling. The version of my assembler is MASM 8.0. Thanks for reading! ![]() |
|
#2
|
|||
|
|||
|
This is an "Other programming languages" problem.
But I seem to remember something about real/protected modes and the two different sizes of the registers. I could be wrong, but my generally faulty memory tells me that ebp is "extended base pointer" register and bp is just "base pointer" register. I think the ebp is 32 bits (64 on the 64 bit processors?) and bp is 16 or 24 (again, faulty memory). You should definitely consult a reference on x86 architectures.
__________________
It's not always a matter of what you can do with a language, but whether you should. [JwD] |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Assembly Language beginner question. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|