Mail Archives: djgpp/1997/10/29/18:30:56
From: | "J.A. Bijsterbosch" <bijster AT worldonline DOT nl>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Syntax differences between TASM and NASM
|
Date: | 29 Oct 1997 18:08:20 GMT
|
Organization: | Bijsterbosch Productions
|
Lines: | 72
|
Message-ID: | <01bce494$62ce20e0$LocalHost@none>
|
NNTP-Posting-Host: | asd1-p106.worldonline.nl
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hello All,
After some years in C/C++ programming and a quote in mind of Michael
Abrash that "the best optimiser is between the ears" <g>, I found it time
to start learning a little bit assembler as well.
I found a nice book that starts from zero knowledge by Peter Norton & John
Socha about this subject, but it uses MASM and/or TASM as assembler.
Because I don't want to spend money immediately, I thought of using NASM,
however some derictives used in the book are not recognised by this last
one.
I have been digging through nasm.doc to see if there where replacements for
these, and found some solutions with which the revised code compiles
alright, but
since I'm a total newbie in assembler and it's terminology still, It would
be nice if someone could tell whether the two following code snippets
evolve
to the same result and functionality.
TASM code:
PUBLIC WRITE_HEX_DIGIT
WRITE_HEX_DIGIT PROC
PUSH DX ; Save registers used
CMP DL,10 ; Is this nibble <10?
JAE .HEX_LETTER ; No, convert to a letter
ADD DL,"0" ; Yes, convert to a digit
JMP Short WRITE_DIGIT ; Now write this character
HEX_LETTER:
ADD DL,"A"-10 ; Convert to hex letter
WRITE_DIGIT:
CALL WRITE_CHAR ; Display letter on screen
POP DX ; Restore old value of DX
RET
WRITE_HEX_DIGIT ENDP
NASM code:
[ORG 0x100] ; for creating .com file direct
[GLOBAL WRITE_HEX_DIGIT]
WRITE_HEX_DIGIT:
PUSH DX ; Save registers used
CMP DL,10 ; Is this nibble <10?
JAE .HEX_LETTER ; No, convert to a letter
ADD DL,"0" ; Yes, convert to a digit
JMP Short .WRITE_DIGIT ; Now write this character
..HEX_LETTER:
ADD DL,"A"-10 ; Convert to hex letter
..WRITE_DIGIT:
CALL WRITE_CHAR ; Display letter on screen
POP DX ; Restore old value of DX
RET
Finally before someone calls out: "Use JAS", and to stay a little bit on
topic. ;-)
I tried to compile this assembler that seems to use these TASM directives,
but, while linking, Make reported a missing library -lfl
Since I have all the required files for DJGPP C and C++ as stated in
readme.1st, I don't know which packet this lib belongs to. Anyone?
A binary version of jas of course would do too. ;-))
Thanks in advance.
--
Greetings from sunny Amsterdam,
Jan Bijsterbosch
email: bijster AT worldonline DOT nl
http://www.worldonline.nl/~bijster
- Raw text -