Re: Sv: Sv: A83: Re: Re:


[Prev][Next][Index][Thread]

Re: Sv: Sv: A83: Re: Re:




I think he was just trying to expand on his, and everyone elses',
understanding of the ret instruction.  His version would obviously take more
clocks, more bytes (and destroy hl), but it does explain what is happening.

 ex (sp),hl
 inc sp
 inc sp
 jp (hl)

All possible!

Joe Wingbermuehle
http://www.usmo.com/~joewing/

-----Original Message-----
From: Linus Akesson <lairfight@softhome.net>
To: Thomas Turn Jensen <assembly-83@lists.ticalc.org>
Date: Wednesday, September 16, 1998 3:07 PM
Subject: Re: Sv: Sv: A83: Re: Re:


>
>Yes, it looks like assembler. But as you said yourself, some of the
>instructions are not possible on the z80. The code fragment is meant to
>explain/emulate a ret, which is exactly what it does.
>Why ret would trash hl? Well, it doesn't! But in your version of The Ret
>Emulator hl is in fact trashed. Thus, the code doesn't emulate a ret and
thus
>my message.
>
>Linus
>
>On 16-Sep-98, Thomas Turn Jensen wrote:
>
>>Honestly I don't see what you mean. First, it sure looked like assembler
to
>>me, 2nd why would ret trash hl (and what has that got to do with it?)
>
>>(sorry if I've gotten all this wrong... :-)
>
>>-----Oprindelig meddelelse-----
>>Fra: Linus Akesson <lairfight@softhome.net>
>>Til: Thomas Turn Jensen <assembly-83@lists.ticalc.org>
>>Dato: 15. september 1998 20:59
>>Emne: Re: Sv: A83: Re: Re:
>
>
>>>
>>>Oh please... That was pseudo code describing the ret instruction. Your
code
>>>might compile better, but ret doesn't trash hl, does it?
>>>
>>>Linus
>>>
>>>On 15-Sep-98, Thomas Turn Jensen wrote:
>>>
>>>>Not that it's very important but couldn't you just have this instead of
>ret:
>>>
>>>>lh hl,(sp)      ; not possible :(
>>>>dec sp
>>>>dec sp
>>>>ld pc,hl        ; not possible
>>>
>>>>Anyways, loading pc isn't possible according to the Tasm80.tab so this
is
>>>>quite meaningles.
>>>
>>>
>>>>***
>>>>Thomas Turn Jensen
>>>>Icq uin => 8128636
>>>>IRC, Undernet => Mukke
>>>>***
>>>>Får computeren dig til at sukke?
>>>>Så kald da blot på Mukke
>>>>***
>>>
>>>
>>>>-----Oprindelig meddelelse-----
>>>>Fra: Alan C Johnson <benjamin99@juno.com>
>>>>Til: assembly-83@lists.ticalc.org <assembly-83@lists.ticalc.org>
>>>>Dato: 13. september 1998 22:22
>>>>Emne: Re: A83: Re: Re:
>>>
>>>
>>>>>
>>>>>The stack pointer points to the memory location in the RAM that is used
>>>>>for the stack.  Now here's a little bit of useless info.  By the way,
>>>>>does anyone know where thestack memory starts and ends
>>>>>
>>>>>Basically, if there was no push command, you would have to do this:
>>>>>
>>>>> inc sp ; 2 because the stack locations are 16-bits
>>>>> inc sp
>>>>> ld (sp),rr
>>>>>
>>>>>Pop would be:
>>>>> ld rr,(sp)
>>>>> dec sp
>>>>> dec sp
>>>>>
>>>>>Call would be:
>>>>> inc sp
>>>>> inc sp
>>>>> ld (sp),pc
>>>>> jp xxxx ; jp actually being ld pc,xxxx
>>>>>
>>>>>Ret would basically be:
>>>>> ld pc,(sp) ; which would actually be impossible, because it would jump
>>>>>as soon as you
>>>>> dec sp ; loaded the pc register, so it wouldn't post-decrement the
>>>>>stack pointer
>>>>> dec sp
>>>>>
>>>>>
>>>>>>
>>>>>>Would someone like to explain the stack pointer in more detail?  I
>>>>>>know
>>>>>>*roughly* what it does...no, actually I don't :)...
>>>>>>
>>>>>>Later,
>>>>>>
>>>>>>James Matthews (matthews@tkb.att.ne.jp)
>>>>>>
>>>>>>ICQ: 7413754
>>>>>>http://home.att.ne.jp/gold/tomcat21/index.html
>>>>>>http://library.advanced.org/18242/
>>>>>>
>>>>>>----------
>>>>>>> From: Scott Dial (Revenant) <homosapian@geocities.com>
>>>>>>> To: assembly-83@lists.ticalc.org
>>>>>>> Subject: A83: Re:
>>>>>>> Date: Sunday, September 13, 1998 9:28 AM
>>>>>>>
>>>>>>>
>>>>>>> Exactly that...
>>>>>>>
>>>>>>> sp is a z80 register for the position of stack pointer... so that he
>>>>>>can
>>>>>>> return to that exact point later. spbak is defined at the bottom:
>>>>>>spbak
>>>>>>> .dw $0000
>>>>>>>
>>>>>>> Patrick W Bambrough wrote:
>>>>>>> >
>>>>>>> > hey can anyone tell me what this means and if there is an 83
>>>>>>equivelant??
>>>>>>> > ld (spbak),sp
>>>>>>>
>>>>>>> --
>>>>>>> Scott Dial
>>>>>>> revenant_1@hotmail.com
>>>>>>> ICQ#3608935
>>>>>>
>>>>>
>>>>>_____________________________________________________________________
>>>>>You don't need to buy Internet access to use free Internet e-mail.
>>>>>Get completely free e-mail from Juno at http://www.juno.com
>>>>>Or call Juno at (800) 654-JUNO [654-5866]
>>>>>
>>>
>>>
>>>
>>>
>
>
>


Follow-Ups: