F
FMorales
Hello all, quick hopefully easy question. Here goes.
I've started on the Art Of Assembly tutorial(s)
(http://webster.cs.ucr.edu/Page_asm/0_ArtOfAsm.html)
and got to the sample projects and kinda got stuck. I'm needing to use a
language of my choosing (which
i easily chose C) to do this project where it wants me to pack data into a
16 bit variable. Now i am
familiar with C to a pretty decent extent, just not bit manipulation. So
what i'm needing help on is getting
this data packed into an unsigned short int, data type.
The example it gives is : 0100 0001 0101 1000 or 4158h
0100 being a 4 for the month,
00010 being 2 for the day, and
1011000 being 88 for the year.
These will come into my function as 3 seperate variables.I'm using 2 single
characters for the month & day, then an array for the year.(they need to
enter
in say 1988 for the above example, and i just grab out the 88. Not a
problem).
So i would basically get something along the lines of, myFunc('4', '2',
"1988");
And i just need help getting those values in their correct "spot" packed
into my
16 bit data type. (I can get 1 of them, but after the first one i keep
messing
up the way it's packed in by trying to pack the next value in.). As i said
i'm
still learning this stuff, so i'm kinda picking up on things as i go. Any
help,
and or a comments are definatly welcome. I've been searching google and such
for
help but so far have found none. Thought i'd give here a shot. Thx in
advance all,
....Frank M...
I've started on the Art Of Assembly tutorial(s)
(http://webster.cs.ucr.edu/Page_asm/0_ArtOfAsm.html)
and got to the sample projects and kinda got stuck. I'm needing to use a
language of my choosing (which
i easily chose C) to do this project where it wants me to pack data into a
16 bit variable. Now i am
familiar with C to a pretty decent extent, just not bit manipulation. So
what i'm needing help on is getting
this data packed into an unsigned short int, data type.
The example it gives is : 0100 0001 0101 1000 or 4158h
0100 being a 4 for the month,
00010 being 2 for the day, and
1011000 being 88 for the year.
These will come into my function as 3 seperate variables.I'm using 2 single
characters for the month & day, then an array for the year.(they need to
enter
in say 1988 for the above example, and i just grab out the 88. Not a
problem).
So i would basically get something along the lines of, myFunc('4', '2',
"1988");
And i just need help getting those values in their correct "spot" packed
into my
16 bit data type. (I can get 1 of them, but after the first one i keep
messing
up the way it's packed in by trying to pack the next value in.). As i said
i'm
still learning this stuff, so i'm kinda picking up on things as i go. Any
help,
and or a comments are definatly welcome. I've been searching google and such
for
help but so far have found none. Thought i'd give here a shot. Thx in
advance all,
....Frank M...