Shop OBEX P1 Docs P2 Docs Learn Events
AUGS not cancelling after a ALTD instruction — Parallax Forums

AUGS not cancelling after a ALTD instruction

ozpropdevozpropdev Posts: 2,791
edited 2019-02-16 23:21 in Propeller 2
Hi Chip

I know it's a too late now but I discovered this bug this morning.
When I try to AUGS a ALTD instruction the AUG is not being cancelled afte the AUTD.

For example
	mov	pa,#myreg
	altd	pa,##1 << 9	'alter D in next instruction,increment pa
	mov	0-0,#$55	'returns $255 not $55 ****
	altd	pa,##1 << 9	'alter D in next instruction,increment pa
	mov	0-0,#$aa	'returns $2aa not $aa  ****

A simple fix is to use a register instead of a immediate.
	mov	pa,#myreg
	altd	pa,autoinc	'alter D in next instruction,increment pa
	mov	0-0,#$55	'returns $55 Ok
	altd	pa,autoinc	''alter D in next instruction,increment pa
	mov	0-0,#$aa	'returns $aa Ok
.
.
autoinc	long	1 << 9

BTW. The increment\decrement option for ALTD/ALTS needs to be added to the documentation.

Cheers
Brian

Comments

  • evanhevanh Posts: 15,126
    Ah, I had been wondering about that. I suspect the ALTx instructions and the AUGx instructions have an exclusion from each other. This will be so that they can both be stacked onto a target instruction.

    Not that I've tried to reason it completely.

  • If this is a bug that needs fixing, perhaps the issue of next S vs. next D for SCA/SCAS/GETXACC/XORO32 could be looked at the same time?
    http://forums.parallax.com/discussion/169585/xoro32-scrambler-output#latest
  • evanhevanh Posts: 15,126
    I'd guess pasm will be bug fixed to prevent ## with ALTx instructions.
  • Although it could be a deliberate feature...
  • evanhevanh Posts: 15,126
    heh, posted 2 seconds apart.
  • cgraceycgracey Posts: 14,133
    Thank you for finding this, Guys.

    This needs to be documented, but I don't count it as a bug, because if we used up the AUGx on the ALTx instruction, the instruction being modified by the ALTx couldn't have an augmented constant. I figured the ALTx instructions would be best served by registers containing any needed large constants.
  • Couldn't you have made ALTx not get used up until a non-AUGx instruction, similarly to how AUGx doesn't get used until an instruction with an immediate value?
  • cgraceycgracey Posts: 14,133
    Couldn't you have made ALTx not get used up until a non-AUGx instruction, similarly to how AUGx doesn't get used until an instruction with an immediate value?

    ALTx instructions affect the very next instruction in the pipeline through mux's. It would take a bunch of flops and more mux's to hold those states for later.
Sign In or Register to comment.