6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 6:13 pm

All times are UTC




Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4  Next

The most human-friendly instruction set
6502 19%  19%  [ 5 ]
65816 (I made it a separate option due to the nature of this Forum) 7%  7%  [ 2 ]
Z80 0%  0%  [ 0 ]
68000 30%  30%  [ 8 ]
MIPS 0%  0%  [ 0 ]
ARM 11%  11%  [ 3 ]
RISC-V 15%  15%  [ 4 ]
X86 4%  4%  [ 1 ]
PowerPC 0%  0%  [ 0 ]
PDP-11 15%  15%  [ 4 ]
Total votes : 27
Author Message
PostPosted: Wed Feb 14, 2024 1:43 am 
Offline

Joined: Tue Nov 10, 2015 5:46 am
Posts: 215
Location: Kent, UK
Chromatix wrote:
PowerPC is a funny one.
EIEIO...

Indeed.


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 14, 2024 5:55 am 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 660
Location: Potsdam, DE
BillG wrote:
The PDP-11 had data rotate instructions. Why were there no rotation operators in C?


Similarly, why is there no (programmer visible) carry stored/used in C? There are times when it would be really handy :mrgreen:

Neil


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 14, 2024 2:43 pm 
Offline

Joined: Sat Dec 12, 2015 7:48 pm
Posts: 122
Location: Lake Tahoe
For me, it really comes down to instruction scheduling. Being able to hold most of the instruction set and cycle counts in my head (harder and harder the older I get!) is key to "human friendly" assembly programming. I think the 6502 is tops in that category. But other 8 bitters fall into line pretty well. Really like the 6809, even the 8051, especially modernized cores, are fun. The 8086/8088 offer some interesting pipeline challenges but still manageable. One can claim the architecture is a mess, but I don't find it all that much different than the 65816's approach to 16 bit-ness. The 68000 and 80386 (in flat 32 bit mode) are pretty straight forward to program efficiently. I wrote a significant amount of MIPS R3000 code and could pound out optimized code like no tomorrow - probably my favorite ISA.

But this was all before super-scalar became mainstream. Now it becomes a game of trying to figure out the underlying hardware scheduler and avoiding stalls. No longer is it a matter of writing compact and efficient code which will often run *slower* than seemingly randomized code. So many second and third order effects one has to contend with place a real burden on the human. Really, only a few routines can be focused on to extract the highest performance in assembly. All the rest, meh, I'll program it in C.


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 26, 2024 7:05 pm 
Offline
User avatar

Joined: Tue Dec 12, 2023 7:00 pm
Posts: 25
Location: London, UK
Below my quick comments/questions related to few different posts from this thread. Btw - it looks like my poll definitely misses 6800/6809, as these architectures were mentioned number of times here.

The story

barrym95838 wrote:
> I bought a book about 35 years ago that sampled several different 16-bit
> microprocessors, giving a large chapter to each one and providing
> architecture info and assembly code examples. I think that it covered
> the 8086, 68000, 16000 (later renamed to 32000), 9900, and pdp-11.
>
> I was reading the chapter on the pdp-11, and had reached the detailed
> description of the addressing modes. My friend was sitting nearby, and
> suddenly asked if I was crying. I actually was, a little bit, proving
> beyond a shadow of a doubt that I was a true nerd.
>
> Mike B.

Thanks so much for quoting this story, Barry. I found it touching and poetic and it just proves that being a nerd does not necessarily mean (as some may think) being unhumanistic. Btw - do you have an idea what book that story may be referring to? 

68k and PDP-11
Chromatix wrote:
68K and PDP-11 can arguably be considered together, as the latter inspired the design of the former. Both were explicitly designed to be friendly to hand-coding assembler.

Oh - I didn't know about that inspiration and you made me curious about it, although a quick search didn't give me many details, aparat a short statement on Wikipedia. I found, though, one interesting comment (by Antron Argaiv) on Hackaday under A PDP-11 on A Chip article (interesting on its own):

Quote:
Motorola 68000 had a lot of similarities to the PDP-11 (paird A & D registers, auto-increment/decrement, etc).
I talked to a Moto sales rep who said that some of the designers had liked these features of the 11 so much , they included them.
Remember, at the time the 68000 was designed, DEC was donating or selling at a discount, a LOT of 11’s to colleges and universities under the assumption that if you did your assembly language course on an 11, you would be predisposed to buy them when you got into industry…

Based on this thread I see there are some on this Forum with hands-on experience on both platforms. I'm curious your opinions.

Instruction schedulling
resman wrote:
For me, it really comes down to instruction scheduling. Being able to hold most of the instruction set and cycle counts in my head (harder and harder the older I get!) is key to "human friendly" assembly programming. I think the 6502 is tops in that category. But other 8 bitters fall into line pretty well.

I see the point and it makes lot of sense to me. I'd also add number of registers that fit in "cognitive capacity" of a human being. But 65xx family, with a single usable rigister drives into ZP trickery and - in my opinion - reduces the friendliness of that (overal friendly) architecture. I remember moving from 65xx to 68k and the feeling of "freedom" it gave me.

RISC-V
drogon wrote:
all I need to do now is find the right RISC-V platform to use which may well end up being an FPGA but that's for another place...
(...)
I've seen many - the issue is that broadly speaking they fall into 2 categories: One is the "microcontroller" types - a few 100 KB of flash and a few 10s of K of RAM... OR many MB -> GB of RAM, 64-bit, multi-core designed for Linux. There are very few ones in the range I want for a hobby project - so that same few 100KB of Flash but 0.5 to 1MB of RAM and easy to use peripherals. Everyone wants to cram as much as possible, so you end up with Wi-Fi, AI, Encryption, USB systems on the chip which then makes it as hard to write a bare-metal thing from scratch for as the Raspberry Pi (Which I have done).


I'm getting the point, especially in the context od moving your '816 project to RISC-V platform. Some little, simple computer (not a microcontroller) would make a lot of sense here. I'm curious whether you've found something that matches your criteria. Looks like some of the Forum members are interested in that architecture, so would be good to know about some good platform to try (a topic for a separate thread, though).


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 26, 2024 8:20 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1399
Location: Scotland
ytropek wrote:
RISC-V
drogon wrote:
all I need to do now is find the right RISC-V platform to use which may well end up being an FPGA but that's for another place...
(...)
I've seen many - the issue is that broadly speaking they fall into 2 categories: One is the "microcontroller" types - a few 100 KB of flash and a few 10s of K of RAM... OR many MB -> GB of RAM, 64-bit, multi-core designed for Linux. There are very few ones in the range I want for a hobby project - so that same few 100KB of Flash but 0.5 to 1MB of RAM and easy to use peripherals. Everyone wants to cram as much as possible, so you end up with Wi-Fi, AI, Encryption, USB systems on the chip which then makes it as hard to write a bare-metal thing from scratch for as the Raspberry Pi (Which I have done).


I'm getting the point, especially in the context od moving your '816 project to RISC-V platform. Some little, simple computer (not a microcontroller) would make a lot of sense here. I'm curious whether you've found something that matches your criteria. Looks like some of the Forum members are interested in that architecture, so would be good to know about some good platform to try (a topic for a separate thread, though).


I've found a couple of devices that are almost, but not quite what I'd like. They are the ESP32-C3 and ESP32-C6 devices. They have 400KB of usable RAM (or 512 in the C6, I think). They are also bloated with much additional hardware, some of which needs binary blobs to run but that's neither here nor there right now, however I did boot my BCPL OS in a C3 device (an M5 Stamp unit - the size of a small USB memory stick...)

Another route I started down, but stalled was FPGA. I have an FPGA that will run the RISC-V core I want (RV32IM) and have up to 1MB of RAM and be able to drive an HDMI or local LCD... But getting my head round the FPGA is proving problematic in both learning curve and my own time & energy.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 27, 2024 6:05 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1927
Location: Sacramento, CA, USA
ytropek wrote:
Thanks so much for quoting this story, Barry. I found it touching and poetic and it just proves that being a nerd does not necessarily mean (as some may think) being unhumanistic. Btw - do you have an idea what book that story may be referring to?

ISBN 0-672-21805-4

The Z8000 was in there too. I still have the book buried somewhere in my attic.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 27, 2024 2:07 pm 
Offline
User avatar

Joined: Tue Dec 12, 2023 7:00 pm
Posts: 25
Location: London, UK
barrym95838 wrote:
ISBN 0-672-21805-4
The Z8000 was in there too. I still have the book buried somewhere in my attic.

Thank you, Barry. Luckily I found it on ebay - and it's already on the way to me :-)


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 28, 2024 4:39 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 690
Location: North Tejas
A reason the 68000 is not my favorite instruction set.

How do you determine whether a register contains a zero without affecting the carry flag?


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 28, 2024 5:04 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 690
Location: North Tejas
barnacle wrote:
BillG wrote:
The PDP-11 had data rotate instructions. Why were there no rotation operators in C?


Similarly, why is there no (programmer visible) carry stored/used in C? There are times when it would be really handy :mrgreen:

The only language which does that is PL/M which allows specifying add with carry.

And they warn about using that feature because the flags are so easy to disturb.


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 23, 2024 8:04 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 565
I'd like to nominate the VAX as the most human friendly instruction set. It was a 32 bit extension to the PDP-11 architecture with the explicit goal of bridging the gap between high level languages and assembly. While successful, by the end of the 80s the design's performance began to lag other processors.

Specifically, the MIPS used in the DECstation line which supported an instruction pipeline and dual issue. Those features made MIPS assembly explicitly unfriendly to humans because of squirrelly behaviors like the instruction after a taken branch still getting executed.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 24, 2024 1:34 am 
Offline

Joined: Wed Jan 03, 2007 3:53 pm
Posts: 50
Location: Sunny So Cal
The branch delay slot was definitely a black eye on MIPS (see also SPARC and some others).

_________________
Machine room: http://www.floodgap.com/etc/machines.html


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 24, 2024 2:29 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 565
6502inside wrote:
The branch delay slot was definitely a black eye on MIPS (see also SPARC and some others).


I lost touch with the whole RISC versus CISC sometime in the 90's. But I haven't heard gripes about this recently, so I assume modern RISC chips don't do this anymore?

MIPS also had the unaligned address fault which made porting code from byte-oriented machines a real headache. The C compiler could pad your structures to align elements to their native boundaries, but some code would break if it expected packed structures. With the coding I did it was usually code trying to squeeze code onto a single virtual memory page to avoid a page table fault during an interrupt.

I did a Google search and unaligned address faults are still a thing, so I guess people have gotten used to those now.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 24, 2024 2:31 pm 
Offline

Joined: Sat Nov 26, 2016 2:49 pm
Posts: 24
Location: Tejas
6502inside wrote:
The branch delay slot was definitely a black eye on MIPS (see also SPARC and some others).


Not at all...it just requires one to pay attention. Just drop a NOP and replace that later if needed.

In my experience (46+ years) the very best instruction set was the (long-forgotten) Motorola MC88000. It was actually fun to write assembly.

The 88000 was yet another demonstration in this industry that the very best ideas don't always rise above.


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 24, 2024 5:46 pm 
Offline

Joined: Wed Jan 03, 2007 3:53 pm
Posts: 50
Location: Sunny So Cal
I think you misunderstand me. Certainly you can compensate for the delay slot and there are technical reasons why it existed. But it's not an intuitive concept for people to program with and therefore not very human-friendly, especially since not every RISC required it - not even every RISC of the era (POWER1 and PowerPC, for example, have never required a delay slot).

_________________
Machine room: http://www.floodgap.com/etc/machines.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 25, 2024 1:47 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 690
Location: North Tejas
The MIPS designers should have defined two varieties of branching instructions: the normal one for which the assembler automatically and silently inserts a nop into the delay slot and a special bonus form which allowed specifying a "free" slot instruction.

I'm posting this again because it was apparently missed the first time.

"Everybody's favorite", the 68000 also trapped on odd addresses.

The 486 and the original Pentium were fun for optimizing code. The 486 was "RISClike" in that simple instructions took only a single cycle when in the pipeline. So avoid unnecessary branching and some well documented "cycle eaters" and the code flies.

The original Pentium had two integer execution units. The second can only execute a subset of the instruction set, but if there were no data dependencies, can operate in parallel with the primary one. My fast code looked like two interdigitated threads because that was what it was.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: