## turboscrew's Profile User Rating:

Reputation: 133 Stalwart
Group:
Expert
Active Posts:
889 (0.6 per day)
Joined:
03-April 12
Profile Views:
17,207
Last Active:
Apr 22 2016 01:25 PM
Currently:
Offline

### Previous Fields

Country:
FI
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Who Cares
Dream Kudos:
0

### Latest Visitors

turboscrew has not set their status

1. #### In Topic: Overflow problems with shift command

Posted 22 Apr 2016

Basically the problems are the same with shifts and multiply/divide. You also get funny results if you use unsigned multiply/divide with signed values and vice versa. You can think of arithmetic shifts as "signed shifts" and logical shifts as "unsigned shifts".

Another thing is "larger" overflow. Not just overflow to sign-bit, but overflow off the register altogether. In general n bit number x m bit number can result to (m + n - 1) bit number. Addition can result at most to number one bit longer than the longer of the added numbers.

That is: it depends on whether you do signed or unsigned arithmetics - one could say, the error is mixing signed/unsigned operations with unsigned/signed data. It's not specific to using shifts.
2. #### In Topic: program to determine the next (and/or) prior business day

Posted 20 Apr 2016

Out of curiosity, which architecture is this?
Some old IBM comes to mind.
3. #### In Topic: Overflow problems with shift command

Posted 20 Apr 2016

Actually that "wrong answer" is overflow situation and that can also happen in arithmetical instructions like addition or multiplication.
Usually the flags are also set so that the overflow/underflow can be detected. BTW, that's why there are often both arithmetical and logical right shifts. Arithmetical does sign extending, logical does not.
For left shifts the thing is a bit different, and in many architectures there is only one kind of left shift.

Arithmetic shift right makes 1001 -> 1100.
The lsb drops off and the msb is "duplicated".
4. #### In Topic: Storing 8 bits into a register?

Posted 15 Apr 2016

You shift a bit in it's place and OR it in the result.
Most processor architectures have those operations.
5. #### In Topic: Java to Pep8 Assembly

Posted 13 Apr 2016

This might be of help: http://www.ecs.csun....s/PDFChap05.pdf.

For initial values you might want to use .WORD

While loop can be made by first testing the condition and branching over loop if the condition is false. Otherwise execute loop code and branch back to the test.

The documentation of pep/8 in web is bad now that google code is no more. I wonder if the book is better. I've never seen the book.

### My Information

Member Title:
Age:
53 years old
Birthday:
February 6, 1963
Gender:
Location:
Nokia (town), Finland
Interests:
Computers, programming, different branches of science, different branches of technology
Full Name:
Juha Aaltonen
Years Programming:
30
Programming Languages:
C, C++, Ada, Pascal, Lisp, Occam, Forth, Fortran and some assembly
(6502, 6800, 6809, 68000, 8085, 8031, PDP11/70, basics of C64x+ and PPC)

E-mail:
Private

### Friends

Page 1 of 1
1. #### jon.kiparsky

28 Feb 2016 - 01:27
I did not realize that you were a Finn! My father is Finnish. Unfortunately I never learned the language, but I do have the dual citizenship. (it was the mention of the sauna that gave it away :) )

06 Apr 2013 - 19:42
would you like tom give me some help doing a programm in aseembly MIPS to verify if a number is power of two?
3. #### cool_moon

24 Apr 2012 - 03:49
I didnt undestand ur explanation will u please explain it clearly
4. #### cool_moon

23 Apr 2012 - 23:29
hi..Im new to lpc1768 please help me to understand the GPIO selection. how to select the gpio. i worked in mc8051 but it is entirly different from that. kindly help me
5. #### jon.kiparsky

10 Apr 2012 - 23:53
Well, I've tried to set up a discussion. Let's see what comes of it.
In answer to your question, I found my way to Finnish because my father is a Finn, and I'm interested in languages. As I say, though, Finnish defeated me pretty soundly.
Page 1 of 1