flat assembler
Message board for the users of flat assembler.

Index > Main > unsigned char db 255 ?

Author
Thread Post new topic Reply to topic
muratselim



Joined: 21 Aug 2007
Posts: 13
muratselim 22 Aug 2007, 06:52
defining byte like
char db 65
signed by default
is there a way to define unsigned or
we have to convert it to/from twos complement before writing and after reading?
Post 22 Aug 2007, 06:52
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
DOS386 22 Aug 2007, 07:21
Quote:
defining byte like
char db 65
signed by default


NO Shocked

Code:
qqhar: db 65
    

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 22 Aug 2007, 07:21
View user's profile Send private message Reply with quote
muratselim



Joined: 21 Aug 2007
Posts: 13
muratselim 22 Aug 2007, 07:37
but this variable can have -128 --> 255
what is the size of this type
Post 22 Aug 2007, 07:37
View user's profile Send private message Reply with quote
muratselim



Joined: 21 Aug 2007
Posts: 13
muratselim 22 Aug 2007, 07:45
i dont want to be misunderstood . but im trying to implement a crc32 calculation . so i need precious variable and clear code.
thanks for the response
Post 22 Aug 2007, 07:45
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
DOS386 22 Aug 2007, 07:49
> but this variable can have -128 --> 255

NO. Shocked

> but im trying to implement a crc32 calculation . so i need precious variable and clear code.

Use UINT32 - dd Idea
Post 22 Aug 2007, 07:49
View user's profile Send private message Reply with quote
muratselim



Joined: 21 Aug 2007
Posts: 13
muratselim 22 Aug 2007, 07:52
qqhar: db -128
compiling succesfully
qqhar: db -129
error:value out of range

qqhar: db 255
compiling succesfully
qqhar: db 256
error:value out of range
Post 22 Aug 2007, 07:52
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
DOS386 22 Aug 2007, 07:55
Quote:
qqhar: db -128
compiling succesfull


into + 128 !!! Shocked


Last edited by DOS386 on 22 Aug 2007, 07:59; edited 2 times in total
Post 22 Aug 2007, 07:55
View user's profile Send private message Reply with quote
muratselim



Joined: 21 Aug 2007
Posts: 13
muratselim 22 Aug 2007, 07:56
qqhar: db -129
error:value out of range

why not +129
Post 22 Aug 2007, 07:56
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
DOS386 22 Aug 2007, 07:58
Because (optional) signed understanding of byte has a range -128 ... +127 !!! Shocked
Post 22 Aug 2007, 07:58
View user's profile Send private message Reply with quote
muratselim



Joined: 21 Aug 2007
Posts: 13
muratselim 22 Aug 2007, 08:01
what is the deal with colon ( : )

qqchar: db 123

qqchar db 123

and if i use with other types what is the effect?
Post 22 Aug 2007, 08:01
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
DOS386 22 Aug 2007, 08:08
http://flatassembler.net/docs.php?article=design

> types what is the effect?

The effect is FATAL !!! Shocked
Post 22 Aug 2007, 08:08
View user's profile Send private message Reply with quote
muratselim



Joined: 21 Aug 2007
Posts: 13
muratselim 22 Aug 2007, 08:25
thanks everything is clear now...
Post 22 Aug 2007, 08:25
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7103
Location: Slovakia
vid 22 Aug 2007, 08:37
muratselim: learn how signed numbers work.

In assembly, there is not much difference between signed and unsigned numbers, and you don't have any separate types for signed and unsigned. thy both are just 8 bit values, which you can treat as signed, or as unsigned.

Sorry, i am lazy to go into deeper explaination right now.

PS: difference between "x: db 10" and "x db 10" is that "x: db 10" declares label without size assigned, and "x db 10" declares label with byte size assigned. try this:

Code:
a db 10
b: db 10

mov ax, [a]  ;error, trying to move byte value into word register
mov ax, [b]  ;same effect as "mov ax, word [b]"
    
Post 22 Aug 2007, 08:37
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan 22 Aug 2007, 10:30
In addition - how fasm treats signed/unsigned comparison in HLL like sintax? Say masm check - BYTE/WORD/DWORD for unsigned and SBYTE/SWORD/SDWORD for signed comparison via .if/.while and other runtime HLL written operations.
Post 22 Aug 2007, 10:30
View user's profile Send private message Reply with quote
muratselim



Joined: 21 Aug 2007
Posts: 13
muratselim 22 Aug 2007, 15:08
what i understand is
fasm is an OS (construction) assembler. not for general purpose althoug have some extensions for win32, dos etc..
i have never tried hla . in my opinion assembler must be bare in most cases.
this what makes assembly programming.

i have a look some nasm samples. it's look like another choice.
it has macro capability but yet plain intel syntax.
gasm not for programming. it's a tool for gcc to embemded assembly.
tasm and masm(micro$oft) os specific...

the only reason for trying fasm before nasm was the idea behind fasm.
compiler coded bare assembly as i know and nasm not as you know.

have good time and appriciated for responses....
Post 22 Aug 2007, 15:08
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7103
Location: Slovakia
vid 22 Aug 2007, 18:56
FASM and NASM are basically the same, except that NASM is written in C (and is thus portable), and FASM has better assembling/macro capabilities
Post 22 Aug 2007, 18:56
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
DOS386 24 Aug 2007, 00:19
> fasm is an OS (construction) assembler. not for general purpose althoug have some extensions for win32, dos etc..

Wrong. FASM is a general purpose assembler ... but good for OS construction also Wink
Post 24 Aug 2007, 00:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.