From:  Fredxx <fredxx@spam.invalid>
Date:  30 Oct 2024 08:35:26 Hong Kong Time
Newsgroup:  news.alt119.net/uk.d-i-y
Subject:  

RE: OT: Arithmetic order of operations

NNTP-Posting-Host:  null

On 24/10/2024 22:19, Joe wrote:
> On Thu, 24 Oct 2024 17:41:21 +0100
> Fredxx  wrote:
> 
>> On 23/10/2024 13:13, SteveW wrote:
>>> On 23/10/2024 10:55, The Natural Philosopher wrote:
>>>> On 23/10/2024 09:44, SteveW wrote:
>>>>> On 23/10/2024 08:40, Andy Burns wrote:
>>>>>> Tim Streater wrote:
>>>>>>   
>>>>>>> I wrote a histogram package in assembler once, as almost my
>>>>>>> first serious bit
>>>>>>> of programming (this was about 1970). That teaches you
>>>>>>> discipline and how
>>>>>>> important it is not to write spaghetti.It also teaches you to
>>>>>>> avoid GOTO.
>>>>>> In assembly language, every branch is a GOTO.
>>>>>
>>>>> I'm pretty sure that as far back as the Z80, Zilog included CALL
>>>>> and RET instuctions that call and return from a subroutine,
>>>>> automatically incrementing, pushing and setting the Program
>>>>> Counter during a CALL and popping the Program Counter during a
>>>>> RET.
>>>> Of course, but how is that relevant?
>>>>
>>>> CALL ADDRESS  is simply
>>>>
>>>> PUSH IP, JMP ADDRESS in one instruction
>>>>
>>>> and RET is simply POP IP in one instruction
>>>>
>>>> Are you trying to make the point that a call is actually a GOTO?
>>>
>>> I'm making exactly the opposite point. Andy burns stated that "In
>>> assembly language, every branch is a GOTO".
>>>
>>> I was pointing out that that was incorrect, as there are specific
>>> instructions that are "GOSUBs", not GOTOs, as GOTOs don't store the
>>> return address.
>>
>> In a CISC instruction set I would agree with you. However for RISC
>> instruction sets that's not always the case. For example the ARM
>> processor uses a Link Register (LR) and register have to be
>> "manually" pushed onto the stack. There is no "call" or "return"
>> instruction as such.
>>
>> Mind, no one in their right mind would code in ARM assembler in all
>> but the most extreme cases. Even the open sourced GCC compiler
>> produces compact, fast code.
>>
>>
> I had a play with ARM assembler about 35 years ago, and was struck by
> how similar the machine code was to that of the old DG Nova, with
> individual instruction bits directly driving hardware pins, so that
> jumps and arithmetic instructions could be assembled like Meccano, with
> a 'not zero' or 'on carry' condition or 'shift left' bit added to the
> basic instruction. The Nova did have explicit JMP and JSR instructions,
> though not return, you just used the contents of accumulator 3 as an
> indirect jump address.

I confess I haven't had any dealings with the DG Nova. Just looked and 
it was popular in the 1970s when I was still wearing short trousers!