6502 beginner question: where is the carry flag? - 6502

I'm following this tutorial: https://skilldrick.github.io/easy6502/
and in the Registers and flags section there is a part that says "If you were looking carefully enough, you’ll have noticed that the carry flag was set to 1 after this operation. So that’s how you know."
The trouble is, I can't identify where the carry flag is shown.
Right before the Instructions it states: "The last section shows the processor flags. Each flag is one bit, so all seven flags live in a single byte."
Here's what I'm seeing:

According to this site, the last line in your screenshot which is 10110001 is the flags sections and the rightmost bit is the Carry Flag
7 bit 0
---- ----
NVss DIZC
|||| ||||
|||| |||+- Carry
|||| ||+-- Zero
|||| |+--- Interrupt Disable
|||| +---- Decimal
||++------ No CPU effect, see: the B flag
|+-------- Overflow
+--------- Negative

Related

Please clarify values for STM32 SYSCFG_EXTICR registers

The following is an excerpt from the STM32F0x1 reference manual:
There are a lot of x's in play here. They all seem to be referring to the external interrupt number (i.e. EXTIx), but what is the x circled in red? It's a part of the binary number, so it is either 0 or 1, not the interrupt number or pin number. The documentation mentions nothing about what it means when it's 0 and when it's 1. If I dig through the header files, it seems this x is always zero.
Is the documentation just incomplete, or did I miss something or am I misunderstanding?
The documentation states that the meaning of the x-bit (the left-most bit) is reserved - i.e. it has no documented meaning for the time being.
As you indicate that the header-files always leave it as 0, this is what you want to use yourself.
It is usually documented this way because a new variant of the MCU might be offered later with a different configuration (i.e. other peripherals or similar) - and in those configurations the bit could then be documented to have a distinct meaning.

Tags in vowpal wabbit

I am doing binary classification using vowpal-wabbit. A particular record(set of features) has 10 zeroes and 5 ones. So, I am creating two lines in vowpal-format
-1 10 `50 |f f1
1 5 `50 |f f1
Since the prediction(probability) for both these records would be same, I want to keep the same tag, so that I can dedupe the predictions({tag,prediction}) later and join with my original raw-data.
Is it possible to keep the same tag for more than one record in vowpal-wabbit?
First, the syntax above isn't correct
To be identified as such, tags should either:
Touch the | separator (no space between them) OR
The leading quote, needs to be a simple quote, not a backquote, by convention.
(or both).
Otherwise you get:
warning: `50 is not a good float, replacing with 0
warning: `50 is not a good float, replacing with 0
Which hints that vw interprets these "tags" as prediction-base.
For details, see Input format in the official documentation
Once the example is fixed to the correct syntax:
-1 10 '50|f f1
1 5 '50|f f1
Which runs fine, we can answer the question:
Is it possible to keep the same tag for more than one record in vowpal-wabbit?
Yes, you can. The tag is merely a simple way to connect input and output (when predictions are involved), there's no check for uniqueness anywhere. If you duplicate tags on input, you'll simply get the same duplicate tags on prediction output as well.
More notes:
Even if two examples are identical, you may get different predictions, if the model has changed somewhat in between them. Remember vw is an online learner, so the model can continuously change with each example unless you add the -t (test-only, don't learn) option.
Features whose value is zero are ignored, so you can drop them. The standard way in vw to say this is 'positive' and this is 'negative' is to use the values {+1, -1}. This is true for both labels and input features.

Can I "fix" heading levels in rST on GitHub?

On GitHub, in a .md file I'm able to specify heading levels that are respected in they way they are displayed on there, but my .rst files are not: the "highest" level heading is treated as a level 1 heading,
For example,
## Heading
Stuff
## Sub-heading
More stuff
in a .md will treat the first as a second-level heading and the second as a third-level heading, while its equivalent (e.g as generated by pandoc),
Heading
-------
Stuff
Sub-heading
~~~~~~~~~~~
More stuff
is treated as a first-level and second-level headings.
Is there a way to overcome this? Can I "fix" the heading level in rST, at as GitHub interprets it?
No, this is not possible.
Docutils does not allow header levels to be skipped. In fact, it will crash hard on inconsistently nested levels. Additionally, here is no hard rule for which characters in the ReST syntax represent which level. It is simply assumed that they appear in the order they are found (the inconsistency comes when you step back up, then down again -- it is assumed that you use the same pattern going back down). Therefore, the first header is always a level 1 header (<h1>) regardless of which character you use. However, in Markdown the levels are explicit in the syntax. If a user starts with ### Header, then that first header in the document must be level 3 (<h3>). Under the hood, Docutils has no mechanism for retaining that info. It only knows whether a header is the "next higher" or "lower" level in consecutive order.

How to print all states in Promela/SPIN

I would like to print all states when checking my model. We do get a trail file when an assertion violation occurs but I want to see the states even when there are no assertion violations. How can I do that?
One option is to compile pan with the gcc flag -DVERBOSE and watch the full details of the verification run. Of course the run will take a while and will spit excessive output, but you will see all the states as they are visited (the format is not very easy to read, but may be sufficient for your purposes).
Another option to see the state graphs of individual processes is
./pan -D | dot -Tps | ps2pdf - pan.pdf
This will create a multi-page PDF where each page is a process (including the never claim).

How to use ADC and set flag in Assembly

I understand what ADC does but I'm not sure how to manage the carry flag. If I use a regular ADD and it overflows, will it automatically set the carry flag to be 1? And if I use ADC and the CF is 1 and it doesn't overflow, will it set the CF to be 0? Thanks.
Assuming intel x86 assembler:
Both ADD and ADC will set the Carry Flag on high-order bit carry or borrow and it will be cleared otherwise.
Using ADC when the CF is 1 and there is no overflow, will result in CF=0.
For details, see the official reference at www.intel.com, page 498.
Description
Adds the destination operand (first operand), the source operand (second operand), and the carry (CF) flag and stores the result in the destination operand. The destination operand can be a register or a memory location; the source operand can be an immediate, a register, or a memory location. (However, two memory operands cannot be used in one instruction.) The state of the CF flag represents a carry from a previous addition. When an immediate value is used as an operand, it is sign-extended to the length of the destination operand format.
[...]