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 4230504
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:52:22+00:00 2026-05-21T01:52:22+00:00

I tried to simulate IF() …. ELIF …. ENDIF in assembly for PIC16F84, but

  • 0

I tried to simulate IF() …. ELIF …. ENDIF in assembly for PIC16F84, but it doesn’t seem to work for more than one usage. I tried to use something like this in two places, but it gives some error that a label is duplicated. Shouldn’t the parameter from the macro be replaced in the labels too? (name in true_name:)

_f macro name
  btfsc EQUAL,0
  goto true_name
  goto false_name
  true_name:
endm

_lse macro name
  goto next_name
  false_name:
endm

_ndif macro name
  goto next_name
  next_name:
endm

;; usage example
_f label1
  ...
_lse label1
  ...
_ndif 
  • 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-05-21T01:52:23+00:00Added an answer on May 21, 2026 at 1:52 am

    I kinda solved this problem with MPLAB variables, here’s an example for testing equality between a register and a literal:

    _f_equal_literal macro register,literal,name
        movlw literal
        subwf register,0
        btfss STATUS,2 ;bit indicating result is zero
        goto _false#v(name)
        endm
    
    _lse macro name
        goto _next#v(name)
    _false#v(name):
        endm
    
    _ndif macro name
    _next#v(name):
        endm
    

    Notice that I didn’t use goto _true#v(name) and _true#v(name): label, you’ll just have to figure if you need btfss or btfsc.

    You can have a single _lse and _ndif macro, and have multiple macros for _f statements.

    GJ’s solution doesn’t have a next label, so the true branch will execute the false branch.


    You need to define a variable for each if-else-endif construct.
    It might even useful if the variable name describes what the if-else-endif is used for.

    Example:

    variable testing_something=123

    _f_equal_literal some_register,some_value,testing_something
                    ...       
    
    _lse testing_something
                    ...        
    
    _ndif testing_something
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Tried a bunch of things but I can't get it to work consistently amid
tried to research on that but sometimes I seem to lack some googling skills...
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
tried to find the answer by googling and in MSDN but with no luck.
Tried examples from 'php.net' but don't understand what's the problem. Any suggestions? <?php $_SESSION['test']
Tried to install some program, it gives above message requiring 1.1.4322. BUT as the
Can jquery click event simulate mousewheel up and down? I tried to reach some
I have one IP packet, which includes IGMP packet. I want to simulate this
Any idea how to simulate qHD screen on android emulator. I tried to manually
I've tried keybd_event(keyByte, 0, KEYEVENTF_KEYDOWN, 0); Thread.Sleep(3000); keybd_event(keyByte, 0, KEYEVENTF_KEYUP, 0); But it only

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.