Now I am reading a book about assembly language.
and it give an infamous example:
.model tiny
.code
ORG 100H
HOST:
mov ah,9
mov dx,OFFSET HI
int 21h
mov ax,4C00H
int 21H
HI DB 'Have a nice days!$'
END HOST
I want to assemble this program to a .com file. but it can't . I use the command : ml ***.asm to assemble. but failed. can someone help me. thank you very much.
You "book" is old and obsolete and should NOT be used for learning modern ASM.
Your program contains INT21h and in consequence it is old 16 bits DOS kind of code. (and should be posted in to old 16 bits dedicated area of the forums)
You will need an old 16 bits linker and maybe an old version of ML in order to assemble and link this kind of examples and the resulted .com binary will NOT run on Win7 64 bits.
Make yourself a favor and start learning from modern 32 bits ASM and then eventually move towards 64 bits asm ....
Bogdan is right, its an old 16 bit COM file. You can build it with MASM32 using the LINK16 exe file as the linker and build it as a 16 bit COM file in MASM but its old stuff that will not run on a very later version of Windows. Try the 32 bit code as Bogdan recommended, its far more powerful and has many more instructions.
BogdanOntanu , hutch--
thank you very much. :UI have done it successfully.
Yes, It is an old book , It was published in 1995. it seems very old in computer science. but It is fantastic book and seems not have a new copy. It discuss something about AI in practise way
thanks :thumbu
This kind of book is not old because of the publishing date.
Instead it is old because of the old and obsolete concepts that it teaches. Learning such concepts is detrimental to learning modern ASM especially at start up.
It will move you into the wrong direction and it will give you a bad attitude.
Learning 16 bits ASM programming from such an "book" is in no way a help for doing AI programming...
in fact being limited to 16 bits and using such obsolete concepts in AI design is a problem for any kind of AI IMHO.
Hopefully Your brain AI should have understood this by now ;)
Hi,
Your can do the following:
Assemble without linking:
ml /c /AT hello.asm
Link with 16 bit linker:
link16 /TINY hello.obj;
This will produce a .com file
math_ai,
Just keep this in mind, in a 16 bit COM file you have a maximum of 64k combined code and data, in 32 bit Windows you can have up to 2 gigabytes and this means for AI design you can store massive amounts of data in memory where you need it.
32 bit code has far less restrictions as it uses a later instruction set with instructions that were not available back in the 16 bit days.
Bogdan is correct here, learning 16 bit segmented architecture is a waste of time when you can do less learning a protected mode architecture and get far more powerful results. You can also access 64 bit and 128 bit MMX and XMM instructions if you are using a later computer that perform certain types of repetitive data movements much faster than the normal integer instructions and of course you can work in 32, 64 and 80 bit floating point if you need it.
The suggestion here is before you go down an old path learning stuff that does not matter any longer, look at the much later, simpler and cleaner code and you will get better results a lot faster.
thank you all for valuable suggestion. when I reading this book ,meanwhile,I will find a book that cover mordern ASM :boohoo: