Hey guys! As you can probably tell I am not only new to this forum, but to the Assembly language as a whole.
We are programming in 16-bit in my college class and well, the problem I'm having is that nothing my teacher writes down on the board works.
The laptop I'm using has Win 7-32bit installed, so I know that it should be able to run 16 bit programs. But it's not running the programs that's the problem it's that the programs themselves are useless.
Let me use an example, day 1 of my class we went over the cliche "Hello world" greeting code. Here is how my teacher wrote it:
.model small
.stack 100h
.data
msg db 10,13, 'Hello World!$'
.code
main proc
mov AX,@data
mov DS,AX
mov AH,9h
lea dx,msg
int 21h
mov ah,04ch
int 21h
main endp
end main
After using masm and linking it, it spouted out a paragraph of gibberish in the dos box.
After wanting to punch myself in the face, I finally found some help online to rewrite it as follows:
.model small
.586
.stack 100h
.data
msg db 10,13, 'Hello, my name is Bubbah.$'
.code
hello proc
mov AX, @data
mov ds, AX
mov dx, OFFSET msg
mov AH ,9h
int 21h
mov al,0
mov ah, 04ch
int 21h
hello endp
end hello
This code works no problem, flawlessly, pristine, excellent.
Can anybody explain to a noob like me why that is? I'm still in the stage of trying to absorb the basics of assembler, so for my own teachers' code not to work makes my mind blow a piston out of my skull.
I have thousands of other questions to ask, but if you guys could start out by explaining this to me I would be so grateful you have no idea.
I'm at my wits end here ;_;
Thank you!