It seems that everyone thinks an OS is a huge project. It is. One of the hardest parts of writing an OS, for example, is flash control. In KnightOS, using the boot page routines is not an option. So I decided to tackle it myself, with raw flash control. Which is hard.

I have 3 years of experience coding in z80 assembly. I have 10 years experience coding in general.

**SirCmpwn wrote:**

When I mentioned that I have some trouble with bitwise arithmetic

The following is all you really need to know (Using C notation here, where & is and, | is or, ^ is xor, and ~ is bit-negation):

1 & 1 = 1

1 & 0 = 0

0 & 1 = 0

0 & 0 = 0

1 | 1 = 1

1 | 0 = 1

0 | 1 = 1

0 | 0 = 0

1 ^ 1 = 0

1 ^ 0 = 1

0 ^ 1 = 1

0 ^ 0 = 0

~0 = 1

~1 = 0

also, just for handy reference,

~(P&Q)=~P|~Q

~(P|Q)=~P&~Q

bit-arithmetic in 25 seconds. If you want a run down on the shifters, that takes a little bit longer since you have to also look at the carry-in/carry-out behavior for each instruction, but those are well documented for z80.
**SirCmpwn wrote:**

Thank you, elfprince13. It's only the arithmetic that I have problems with, I get bit shifting okay.

The easy way to remember without just memorizing that table is that for AND you need two 1s to get true (meaning either or both as 0s will be false), for eXclusive OR you need either of them to be 1s but not both (meaning if they have the same value you will get a 0), for inclusive OR you need either or both to be 1s (meaning if you have both false you'll get false). NOT just flips whatever you have, and the bottom two rules are called De Morgan's laws, and basically if you are NOTing both terms to an AND or an OR, you can switch the operator and pull the NOT outside (and vice versa).
**elfprince13 wrote:**

...and the bottom two rules are called De Morgan's laws, and basically if you are NOTing both terms to an AND or an OR, you can switch the operator and pull the NOT outside (and vice versa).

More tersely expressed as "break the line, change the sign" (where · is AND, + is OR and an overline is NOT):

**Code:** ```
___ _ _
```

Q = A·B = A+B

___ _ _

Q = A+B = A·B

The above notation is common with electronics, at least where I was taught.
I'm curious why this topic, which is a rant topic in the rant board, had the rant part edited out. I don't appreciate censorship.

**SirCmpwn wrote:**

I'm curious why this topic, which is a rant topic in the rant board, had the rant part edited out. I don't appreciate censorship.

Notice that Kerm and mine's posts were deleted as well?

Also, elf double posted, so I bet it was him.