Do not do this code it's is a MASM that kinda went wrong ...
byte1 BYTE '0111h'
:biggrin:
BYTE's contain 8 bits
111h is 9 bits - you need at least a WORD
A word is bigger than a byte.
BYTE, 8 bits
WORD, 16 bits
DWORD, 32 bits (same size as REAL4)
QWORD, 64 bits (same size as REAL8)
OWORD, 128 bits
TBYTE, 80 bits (same size as REAL10)
Would
byte1 BYTE '0100h'
work?
9 bits
0001 0000 0000
for 8 bits, the max is 0FFh
1111 1111
you could use 2 bytes
db 0,1
very similar to
dw 100h
Quote from: Evan on December 09, 2013, 06:50:32 PM
Would
byte1 BYTE '0100h'
work?
Is it this?
byte1 BYTE '0FFh'
or
byte1 BYTE 'FFh'What does a full byte in hex look like?Is 0xFF a full byte?
Quote from: dedndave on December 09, 2013, 06:51:26 PM
9 bits
0001 0000 0000
for 8 bits, the max is 0FFh
1111 1111
Quote from: dedndave on December 07, 2013, 05:38:32 PM
:biggrin:
BYTE's contain 8 bits
111h is 9 bits - you need at least a WORD
Yes. If 8 bits is a byte.
:D
So 0xFF is like 99(base ten)
and my calculator says 256 or 255 base ten must be a full byte.
a byte holds 8 bits, in common parlance
in binary
11111111
or
1111 1111
in hexadecimal
FF
or
0FFh
in decimal
255
the range for a signed byte is -128 to +127
the range for an unsigned byte is 0 to 255
Quote from: dedndave on December 09, 2013, 07:34:34 PM
a byte holds 8 bits, in common parlance
in binary
11111111
or
1111 1111
in hexadecimal
FF
or
0FFh
in decimal
255
the range for a signed byte is -128 to +127
the range for an unsigned byte is 0 to 255
How do I figure out the explanation of making negative numbers on the computer?
Is that how signing works somehow?
Is this it?
http://en.wikipedia.org/wiki/Signedness (http://en.wikipedia.org/wiki/Signedness)
Is this MASM friendly?
[quote source='wikipedia']For example, 0xFFFFFFFF gives −1, but 0xFFFFFFFFU gives 4,294,967,295 for 32-bit code.[/quote]
Would 0xFF be -1(base ten) and 0xFFU be 256(base ten) or 255(base ten)?
I would like to believe 0xFFU is 256(base ten) with all numbers being natural numbers including zero.
Evan, you and dave seem to be talking about two different things.
This code works because it is a string due to using quotes
byte1 BYTE '0111h'
Without the quotes it is a number which is too big for a byte
byte1 BYTE 0111h
hi sinsi - i saw the quotes - my assumption was that was how he got it to assemble without error
but, the intent was to define a value as hexadecimal - not a string
Evan - you may want to do some reading on basic data concepts
signed values normally use "two's compliment" form
you can google that term and find many descriptive texts
https://courses.engr.illinois.edu/ece390/books/artofasm/artofasm.html (https://courses.engr.illinois.edu/ece390/books/artofasm/artofasm.html)
start with chapter 1 - then, ask questions when something isn't clear :t
you can put that url into translate.google.com (http://translate.google.com) and it will translate the entire site for you
by the way - what is your native language ???
QuoteQuote from: dedndave on December 10, 2013, 03:20:28 AM
hi sinsi - i saw the quotes - my assumption was that was how he got it to assemble without error
but, the intent was to define a value as hexadecimal - not a string
Evan - you may want to do some reading on basic data concepts
signed values normally use "two's compliment" form
you can google that term and find many descriptive texts
https://courses.engr.illinois.edu/ece390/books/artofasm/artofasm.html (https://courses.engr.illinois.edu/ece390/books/artofasm/artofasm.html)
start with chapter 1 - then, ask questions when something isn't clear :t
you can put that url into translate.google.com (http://translate.google.com) and it will translate the entire site for you
by the way - what is your native language ???
Yeah well don't we always need a 0 in computers?
Does 0xFFU meaning 256(baseten) make sense?
Where I know that register is a positive one?
Including zero?
Or can I not use zero in this register and did my machine break?
Would my machine be okay if I don't use 0 in the register?
Do I then get to count up 1 to 256
Or can I count 0 to 256 in 0xFFU this whole time?
0 to 255
1 to 256
0 to 256
In 0xFFU
I am not sure.
Should I go with 0xFF meaning 255(baseten) and 0xFFU meaning ((-255 to 255))(base ten)?
Evan,
Quote from: Evan on December 10, 2013, 07:15:32 AM
Yeah well don't we always need a 0 in computers?
in most cases. Otherwise we would give away one digit.
Quote from: Evan on December 10, 2013, 07:15:32 AM
Does 0xFFU meaning 256(baseten) make sense?
0xffh = 255 decimal.
Gunther
Quote from: Gunther on December 10, 2013, 07:24:10 AM
Evan,
Quote from: Evan on December 10, 2013, 07:15:32 AM
Yeah well don't we always need a 0 in computers?
in most cases. Otherwise we would give away one digit.
Quote from: Evan on December 10, 2013, 07:15:32 AM
Does 0xFFU meaning 256(baseten) make sense?
0xffh = 255 decimal.
Gunther
Gunther I hope it is recognized we tried to declare hexadecimal notation twice in the assembler.
With
0x
and
h
Or could you please explain the one way to declare an hexadecimal number in the assembler?
Or where do we use one or the other?
the 0xFF notation is used in C and other languages
normal MASM syntax is 0FFh
the leading 0 is only required if the first hex digit is a letter
so, 96h is also acceptable form
hexadecimal format values are not generally used for signed values
we would use decimal format
bNeg db -128
bPos db 127
I just ran this
MOV EAX, cons1mille
with many code exits.
Defining the cons1mille using this
INCLUDE CONS.INC
By making a CONS.INC file.
i don't know what you defined it as, but ok
Quote from: dedndave on December 10, 2013, 09:31:55 AM
the 0xFF notation is used in C and other languages
normal MASM syntax is 0FFh
the leading 0 is only required if the first hex digit is a letter
so, 96h is also acceptable form
hexadecimal format values are not generally used for signed values
we would use decimal format
bNeg db -128
bPos db 127
Would
96(base hex) = FF(base hex)
Annihilate the hex number system then?
-----------------------------------------------------------
0FFhvs0x01vs01hvs1hMy question is 0FFh going to be the way of the byte?Basically there are many variations of a full byte.
I'll try to figure out more about hex and bytes later.I take it0FFh0FEh0FDh0FCh
0FBh
0FAh
0F9h0F8h
0F7h
0F6h
0F5h0F4h0F3h0F2h0F1h0F0h; lol
0E0h0E1h0E2h0E3h0E4h0E5h0E6h0E7h0E8h0E9h0EAh0EBh0ECh0EDh0EEh0EFh
will work too for a byte.
Quote from: dedndave on December 10, 2013, 09:40:49 AM
i don't know what you defined it as, but ok
I defined it like this
cons1mille EQU 1000
.
here's a good exercise....
write a little program that display all the hex values from 0 to FF, seperated by a space
so - you want to make 256 passes through a single loop
or - 16 passes on an outer loop and 16 passes on an inner loop
Quote from: dedndave on December 10, 2013, 10:49:08 AM
here's a good exercise....
write a little program that display all the hex values from 0 to FF, seperated by a space
so - you want to make 256 passes through a single loop
or - 16 passes on an outer loop and 16 passes on an inner loop
That sounds like a really fun time. I will try.