Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8965659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:51:26+00:00 2026-06-15T16:51:26+00:00

Question is in AVR GCC context. I have .s file with C function prototype

  • 0

Question is in AVR GCC context.

I have .s file with C function prototype as follows:

Mod_BigNum_by_u8: .global Mod_BigNum_by_u8 
; c-prototype ==> uint8_t Mod_BigNum_by_u8(uint8_t * pBigNum, uint8_t ByteCount, uint8_t Divisor); 

; Parameters 
    .set pBigNum, 24        ; (u16) pointer to the BigNum Dividend.  Highbyte first 
    .set ByteCount, 22      ; (u8) number of bytes in the BigNum 
    .set Divisor, 20        ; (u8) Divisor 

; Local Variables 
    .set BitCount, 23       ; (u8) Number of bits left in the current byte 
    .set CurrentByte, 21    ; (u8) Most recently used byte of BigNum 

; Return value 
    .set Dividend, 24       ; (u16) result (we only need 8bits, but WinAVR requires 16) 
... 

Above function works fine in Atmel Studio (I guess have to say “compiling with avr-gcc”).

GNU asm syntax 
Syntax: .set symbol, expression 

AVR asm 
.SET label = expression 

It means GNU syntax is used. Now what I am trying to understand is – what are those constants 24, 22, 20 means in terms of C function prototyping? Comments are suggesting that I’m loading function arguments, but I don’t understand how with .set and those constants it happens. I used to think that params are passed through stack and registers.

Secondary question – I know AVR asm is derived from GNU but can I really mix GNU asm syntax with AVR asm as above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:51:27+00:00Added an answer on June 15, 2026 at 4:51 pm

    AVR uses registers for passing the first few arguments. See the description of the calling convention here.

    The registers are memory-mapped at address zero. As such, the numbers you see in the pasted code are addresses that equal register numbers and can be used to reference the arguments through the memory mapping.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have what I hope is a simple question pertaining to the Atmel AVR
I'm developing for the AVR platform and I have a question. I don't want
Question context: let say that there is some really important row in config/locales/en.yml that
Question is already been asked in title. Here is a code: (function($){ var filter
Question in title pretty much sums it up. I have some resource object defined
Question Is there a way to have a method that will always run anytime
Question: I need to read a CSV file. I use the FileHelpers library to
Question Implement a function bool chainable(vector<string> v) , which takes a set of strings
Question is quite simple. Let's say I have an URL config with line: url(r'^models/(?P<model_group_id>[0-9]+)/(?P<page>\d+)/$',
Following on from my other question, Help optimising this C (AVR) code? :) ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.