How do you make a makefile to build a c program? it seems that all the makefiles in the example programs are terminal-run apps, and I don't know how to make one. Thank you in advance! Very Happy
Makefiles are just text files - you should be able to copy the one from the template example and then open it in your plain-text editor of choice, then change the variables to the values you want.
it worked, thank you! I just had to rename the makefile to makefile.txt, and that changed it from being an "app", and I could read the text.
by the way, exactly how do flags work in ez80 asm, because EZ80 heaven skipped over a bunch of stuff that seems important, and flags were one thing that were't explained?
Flags are basically single-bits that certain instructions set or reset under certain conditions. I'd recommend checking the manual (UM0077.pdf) to see which instructions change which flags, as some instructions change flags for what initially seems like no reason.

Most of the instructions that affect control flow (e.g. call, jp, ret) have conditional versions that use flags. So, jp c,location will only jump if the carry (c) flag is 1, and jp nc,location will only jump if it's 0.

The flags you'll use most often:
The carry flag, c, is set when an addition or subtraction results in a carry or borrow.
The zero flag, z, is set when an addition, subtraction, or bitwise operation results in 0.
The sign flag is set when an operation results in a negative number. Rather than using s and ns, you use p and m for plus and minus.

For example, if you wanted to return if a is 42, you could do:

Code:
cp a,42
ret z

cp does a subtraction and then discards the result. If a is 42, the result of that subtraction will be 0 and the zero flag will be set. If the zero flag is set, ret z will return.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement