Hello, the exercise says to define a group of locations to define months using a standard number of bytes, and to use 8 bit unsigned to set the number of days for each month... i wrote this

DB 'GEN',31D
DB 'FEB',28D
DB 'MAR',31D
DB 'APR',30D
DB 'MAG',31D
DB 'GIU',30D
DB 'LUG',31D
DB 'AGO',31D
DB 'SET',30D
DB 'OTT',31D
DB 'NOV',31D
DB 'DIC',31D

is this correct? how to define the unsigned option?

Recommended Answers

All 4 Replies

Whether a byte is signed or unsigned, depends on how you want to treat it. Maybe you want to study this thread. Whether the value of a byte in memory is teated as signed or unsigned all depends on the instruction you want to use. The value of the byte actually stored in memory can be considered sign-less until the program wants to use it for something.

>>is this correct?
Did you try to assemble it? If not, then you should and then you can answer your own question.

well even if i assemble it it is just part of data segment so how can I be sure it is what the exercises requested?
and i know the way they are represented in binary 2 complement etc but I dont how to say to the assembler to make the number of that byte unsigned...

>>but I dont how to say to the assembler to make the number of that byte unsigned...
You don't. This is not C or C++ languages. In assembler you can not declare a data item to be either signed or unsigned like you do in C/C++. Any byte can be treated as either one.

ah, ok thx, so technically what i have written should be right...3 byte for the name and 1 for the number, maybe it could be more detailed difining a byte for every day after every month, but it would be disorganized in memory, can you rhink to any better organozation of months and days in memory?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.