English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 21 November 2023, 14:11   #1
rcman
Long time Amiga Owner
 
rcman's Avatar
 
Join Date: Jun 2017
Location: Uxbridge Canada
Age: 57
Posts: 182
Assembly Code on other CPU's

Hi,

One thing I always liked about Amiga Assembler was the ability to move multiple registers to the stack with one command.

A lot use push and pop which I find annoying. Is there any modern processors that do that now?

Thanks
RC
rcman is offline  
Old 21 November 2023, 14:54   #2
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,539
PowerPC has
lmw
and
stmw
to load/store multiple words from/to registers. But you cannot pick the registers individually, as you can with m68k. You can only specify the start-register. Then all registers up to r31 will be read/written.
phx is offline  
Old 21 November 2023, 20:54   #3
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,307
Quote:
Originally Posted by rcman View Post
A lot use push and pop which I find annoying. Is there any modern processors that do that now?

The probable reason why modern processors avoid offering such an instruction is that its handling in case of access errors is quite tricky. Consider that you move multiple registers to memory and cross a page boundary. In such a case, the MMU would trigger an instruction in the middle of the pushed registers, one part being written, the other not. Now, if the Os repairs the page, it would need to start this instruction quite in the middle of the instruction...


The 68k family solves that in different ways. The 68030 and below stores rather extensive state information that allows restarting an instruction quite in its middle. The 68040 and onwards compute how many bytes such an instruction would populate, and then checks whether any of of the addresses touched by the instruction would cause a page exception, and then triggers the exception upfront without writing any bytes.


The latter of course does not work if the access error is a physical page fault, i.e. the RAM or some other system component refuses to accept the written bytes. In such a csae, the CPU is "stuck" and can only rerun the instruction, thus causing "double writes", which is probably not what you want if the target address belongs to an I/O device and not physical memory.


IOWs, instructions of this type are quite a headache for system designers, and there are reasons why they are not so popular.
Thomas Richter is offline  
Old 21 November 2023, 21:34   #4
Dunny
Registered User
 
Dunny's Avatar
 
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 2,088
x86 has pushad and popad (push/pop all dwords) which sends all the 32 bit registers to the stack and back in one op. Does that count?
Dunny is offline  
Old 21 November 2023, 22:50   #5
Karlos
Alien Bleed
 
Karlos's Avatar
 
Join Date: Aug 2022
Location: UK
Posts: 4,444
@Thor

I'd never really thought about that (page boundary crossing for movem). Presumably not an issue for 040 move16 due to the alignment requirement meaning it can never span a boundary, it's always one one side or the other.
Karlos is online now  
Old 21 November 2023, 23:15   #6
Bruce Abbott
Registered User
 
Bruce Abbott's Avatar
 
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,720
You might be interested to know that the MC6809 also had this feature. It can also optionally push/pull the condition code register and PC at the same time.

6809 INSTRUCTION SET
Bruce Abbott is offline  
Old 22 November 2023, 10:37   #7
mschulz
Registered User
 
Join Date: Nov 2018
Location: Germany
Posts: 110
ARM working in 32-bit mode features LDM and STM instructions which allow to load/store multiple registers in the manner known from m68k. Even better, since PC register can be accessed this way, the STM can be used to push, among other registers, return address on the stack and LDM can restore registers and load return address into PC register.

On the contrary, aarch64 can only load/store pair of registers with single instruction.
mschulz is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Amiga Assembly extension for Visual Studio Code prb28 Coders. Asm / Hardware 342 15 December 2023 21:22
View Amos generated assembly code? Brick Nash Coders. AMOS 7 01 May 2021 22:54
Could someone please sense check this assembly code? Ernst Blofeld Coders. Asm / Hardware 4 06 February 2021 15:26
Heatsink assembly for Pegasos II G4 CPU module. Locutus support.Hardware 1 02 June 2019 16:56
assembly code to test for assign (2.0+) jotd Coders. System 2 27 December 2017 23:16

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:11.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07343 seconds with 13 queries