[Coco] 6809 Push/Pull
Robert Gault
robert.gault at att.net
Sat Jun 6 05:07:38 EDT 2020
There is no reason to research such a question when you only need to run a simple test. After all,
programs like EDTASM are readily available.
So here are the results of two tests. The sources are listed and the debug results for EDTASM.
100 START LDX #1
110 LDY #2
120 PSHS X,Y
130 PULS X
140 SWI
150 END
A/IM assembles the above in memory
Z enter Debug
G START run the above and stop automatically at SWI
R display the register contents
X=0001 Y=0002
100 START LDX #1
110 LDY #2
120 PSHS X,Y
130 PULS Y
140 SWI
150 END
gives
X=0001 Y=0001
100 START LDX #1
110 LDY #2
120 PSHS X,Y
130 LDX #0
140 LDY #0
130 PULS Y,X
140 SWI
150 END
X=0001 Y=0002
100 START LDX #1
110 LDY #2
120 PSHS X,Y
130 LDX #0
140 LDY #0
130 PULS X,Y
140 SWI
150 END
X=0001 Y=0002
So, when EDTASM assembles the above, both PSH and PUL put the registers involved in a "post byte"
where the registers become bits. That makes the post bytes for PULS X,Y and PULS Y,X identical and
$30. It also means the 6809/6309 will ignore the order in which you write the involved registers and
the stack order will be determined by the values in the post byte.
push/pull post byte
bit7 bit0
PC, S/U, Y, X, DP, B, A, CC
That is easily seen by examining the stack using EDTASM's debug program.
Robert
Lee wrote:
> I did a quick Google search and this article seems to cover it pretty
> well. https://silicon-heaven.com/howel/parts/6809_instruction_set.htm
>
> It looks like registers (on a single PSHS/PSHU) are pushed in the order PC,
> U/S, Y, X, DP, B, A, CC. They are PULS/PULU'd in the opposite order.
>
> So if you did PSHS X,Y it would push Y first, then X. If you did PULS X,Y
> it would pull in the opposite order, X first, then Y.
>
> -----
> Lee
>
>
> On Fri, Jun 5, 2020 at 9:44 PM Salvador Garcia via Coco <
> coco at maltedmedia.com> wrote:
>
>> Adding to this thread...
>>
>> Is the developer allowed to do some thing like:
>>
>> PSHS X
>>
>> PULS Y
>>
>>
>> What if I try something like this:
>>
>> PSHS X,Y
>>
>> PULS X
>>
>>
>> Like others, just curious. :-) Thanks, Salvador
>>
>>
>>
>>
>> On Friday, June 5, 2020, 03:10:58 PM CDT, Arthur Flexser <
>> flexser at fiu.edu> wrote:
>>
>> The order of registers in PSHS and PULS is a fixed property of the
>> processor. PSHS X,Y and PSHS Y,X generate identical opcodes, so it makes
>> no difference which you use.
>>
>> Art
>>
>> On Fri, Jun 5, 2020 at 4:06 PM Jim OKeefe <jimokeefe39 at gmail.com> wrote:
>>
>>> For all you ML gurus out there.
>>>
>>> PSHS X,Y
>>>
>>> To return registers to their original values is the correct pull
>>>
>>> PULS Y,X
>>>
>>> Or
>>>
>>> PULS X,Y
>>>
>>> Thanks Jim
>>>
>>> --
>>> Coco mailing list
>>> Coco at maltedmedia.com
>>> https://pairlist5.pair.net/mailman/listinfo/coco
>>>
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco
>>
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco
>>
>
More information about the Coco
mailing list