English Amiga Board


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

 
 
Thread Tools
Old 06 June 2022, 18:52   #21
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,764
I always save all modified registers in the subroutines, unless something needs serious optimizing (most code doesn't).
Thorham is offline  
Old 10 June 2022, 23:33   #22
ovale
Registered User
 
Join Date: Jun 2014
Location: milan / italy
Posts: 174
A bit off topic Is it possible to instruct a C/C++ compiler to never use a set of registers? For example because I want to use them in an interrupt handler without saving registers.
ovale is offline  
Old 10 June 2022, 23:39   #23
Rst7
Registered User
 
Join Date: Jan 2022
Location: Kharkiv
Posts: 48
Quote:
Originally Posted by ovale View Post
Is it possible to instruct a C/C++ compiler to never use a set of registers? For example because I want to use them in an interrupt handler without saving registers.
Try to use
Code:
register volatile long SAVE __asm("d2");
as global variable.
Rst7 is offline  
Old 05 August 2022, 10:02   #24
Antiriad_UK
OCS forever!
 
Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
I use the OS convention for "slow" code like prototyping functions, and non time critical, where d0-d1/a0-a1 are assumed to be trashed on any call and everything else is saved/restored:

http://amigadev.elowar.com/read/ADCD.../node000F.html

Then for all other code that needs to be fast (demo stuff) I 99% of the time leave $dff000 in a6 and just document everything on subroutine definition and subroutine call. Yes, a bit of a pain when you change a function but there you go. If not documented assumption is that everything is trashed. Within a subroutine I use scratch registers in order from d0 first up to d7 so that when you start nesting function calls in loops the outer loop counters end up being higher up.

Code:
	;Load current palette into CL if needed
	bsr	Copper_Write_Palette	;I:a5, T:d0/a0-a2
..
..
..
..

*****************************************************************************
* Loads the current colors into the current copperlist if changed.
* IN:		a5, Controller_Info
* OUT:
* TRASHED:	d0/a0-a2
*****************************************************************************

Copper_Write_Palette:
Antiriad_UK 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
Memory Management Havie Coders. Blitz Basic 6 10 April 2022 21:38
File management marm New to Emulation or Amiga scene 21 04 November 2018 13:41
Assign Management Utility Daedalus Amiga scene 22 28 March 2017 12:54
Better (perhaps) config files management NewDeli request.UAE Wishlist 7 24 June 2008 15:43
Icon Management Makkinen support.WinUAE 3 16 October 2004 00:30

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 01:02.

Top

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