Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* What does this Code Do? PDP-11 Please Help?
@ 2004-03-18 15:44 newsgroup
  2004-03-18 19:39 ` Jeff Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: newsgroup @ 2004-03-18 15:44 UTC (permalink / raw)



PDP-11

I just need to know what it does I am slightly lost :-(

MOV  R1,  -(R6)
MOV  R0, R1
DEC  R0
BGT  3016
MOV  R1, R0
MOV  (R6)+, R1
RTS  R7
MUL  #1, R0

Please let me know if anyone can sorta make out whats going on here?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What does this Code Do? PDP-11 Please Help?
  2004-03-18 15:44 What does this Code Do? PDP-11 Please Help? newsgroup
@ 2004-03-18 19:39 ` Jeff Campbell
  2004-03-18 20:07   ` John Laird
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Campbell @ 2004-03-18 19:39 UTC (permalink / raw)


"newsgroup" <blah@rogers.com> wrote in message news:<7tj6c.51050$TxJ.28277@news04.bloor.is.net.cable.rogers.com>...
> PDP-11
> 
> I just need to know what it does I am slightly lost :-(
> 
> MOV  R1,  -(R6)
> MOV  R0, R1
> DEC  R0
> BGT  3016
> MOV  R1, R0
> MOV  (R6)+, R1
> RTS  R7
> MUL  #1, R0
> 
> Please let me know if anyone can sorta make out whats going on here?


MOV  R1,  -(R6)   push r1 onto stack
MOV  R0, R1       copy r0 to r1
DEC  R0           subtract one from r0
BGT  3016         branch to location 3016 if r0's contents are greater than zero
MOV  R1, R0       copy r1 to r0, restores r0's contents
MOV  (R6)+, R1    pop stack into r1, restores r1's contents
RTS  R7           return from subroutine using the program counter, r7, for linkage
MUL  #1, R0       multiple r0 by 1

HTH,

Jeff Campbell
n8wxs@arrl.net


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What does this Code Do? PDP-11 Please Help?
  2004-03-18 19:39 ` Jeff Campbell
@ 2004-03-18 20:07   ` John Laird
  0 siblings, 0 replies; 3+ messages in thread
From: John Laird @ 2004-03-18 20:07 UTC (permalink / raw)


On 18 Mar 2004 11:39:01 -0800, n8wxs@arrl.net (Jeff Campbell) wrote:

>MUL  #1, R0       multiple r0 by 1

This had me scratching my head.  However, it appears that this puts a 32-bit
result into R0 and R1.  I would guess it leaves R0 unchanged and sets R1 to
either 0 or -1 depending on the sign of R0.  BICBW.

-- 
If the good die young, then I'm gonna live forever. 

Mail john rather than nospam...


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-03-18 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-18 15:44 What does this Code Do? PDP-11 Please Help? newsgroup
2004-03-18 19:39 ` Jeff Campbell
2004-03-18 20:07   ` John Laird

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox