delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/29/19:09:34

Date: Thu, 30 Oct 1997 13:11:44 +1100
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: Syntax differences between TASM and NASM
In-reply-to: <01bce494$62ce20e0$LocalHost@none>
To: "J.A. Bijsterbosch" <bijster AT worldonline DOT nl>, djgpp AT delorie DOT com
Message-id: <199710300008.NAA07381@teleng1.tait.co.nz gatekeeper.tait.co.nz>
Organization: Tait Electronics Limited
MIME-version: 1.0
Comments: Authenticated sender is <billc AT blackmagic DOT tait DOT co DOT nz>

On 29 Oct 97 at 18:08, J.A. Bijsterbosch wrote:

> 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

This looks right. However, one thing: I assume the double dots are a 
result of mail/news formatting, otherwise you will have some 
problems.

> 
> 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.
> ;-))

Flex (look in v2gnu).
Bill
--
Leave others their otherness.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019