English Amiga Board


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

 
 
Thread Tools
Old Today, 13:22   #1
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 200
Beginner question: How to use an Include file for own functions (sub routines)

Suppose I have an assembler program that consists of the file main.asm and works. In this program there is a call

Code:
	bsr test_func
In test_func some things are done and then it ends with rts:

Code:
test_func
	moveq #111,d0         ; Imagine something useful here
	rts
I now refactor the code and move test_func to its own file my_functions.asm. And in main.asm I add the follwing line at the beginning:

Code:
	include my_functions.asm
The problem now is, by doing so my_functions.asm becomes the program entry and terminates the program right from start with rts.

I come from C, and there includes are included at the beginning of the file and the functions are called further down.

How is this properly done in assembler; are the own helper files included below the main code to avoid the entry point problem?
thyslo is offline  
Old Today, 14:46   #2
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,077
Don't include at the beggining, or add "bra your_main_function" before the include statement (that bra will become the first instruction of your program).
a/b 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
Include file path priorities for assemblers phx Coders. General 20 07 July 2020 16:30
C Include file with hardware registers sparhawk Coders. General 4 20 November 2019 20:59
Beginner question about WHLoad (2 different methods?) c0dehunter support.Apps 17 13 January 2019 20:29
NDK 3.1 Include file problem. Thorham Coders. General 4 04 February 2011 20:58
beginner question - how to use USB joystick/pad with WINUAE??! extentofmysin support.WinUAE 7 23 August 2006 18:56

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 19:14.

Top

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