sorcerer_see: (Default)
I hereby share with you the link to my new website.

sorcerer-see.dev

Where Dreamwidth is essentially an editable blog site, I built my new site from scratch in HTML and CSS. And on it I represent what I learn in a less linear, more organic manner.

Consider
sorcerer-see.dreamwidth.org
as part 1
and 
sorcerer-see.dev
as part 2

of my trajectory to full-blown pcb designer and hardware-level software developer.


Cheers

sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and add own comments cursively in blue. I list pages done vs total pages, including any roman and appendix numbered pages.

DDaCA R-VEd Page28 - Phase1 0028/2316


Generally, when one talks about architecture one speaks about a computer from the the perspective of a programmer. The Intel x86 architecture, according to which most microprocessors in modern PC's are built, is defined by a set of instructions and registers that programmers are allowed to use.
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and add own comments cursively in blue. I list pages done vs total pages, including any roman and appendix numbered pages.

DDaCA R-VEd Page27 - Phase1 0027/2316


1.2 THE ART OF MANAGING COMPLEXITY
 
Computer engineers and scientists have learned a systematic approach to managing complexity. The idea is to understand how these things work in a broad sense, without getting bogged down in endless detail.

1.2.1 Abstraction

The essential method to keep complexity at bay is abstraction. This method hides what is not important The mind does this all the time. Since being aware of everything that exists all the time would drive us mad. We simplify things by using simplistic concepts to classify everything that arises within our awareness.

Overview of possible layers of abstraction of a computer system
from 'Application Software' = high-level to 'Physics' = low-level



All the way down the ladder of abstractions exists the motion of electrons. Their behavior is described by quantum mechanics and Maxwell's equations. Computer systems are constructed with electronic components such as transistors, in the case of modern pc's, or were, for example, built with vacuum tubes, decennia ago. Both these components have connection points called terminals. These points can be modeled by the measured relationship between voltage and current.

At this level of abstraction we can ignore the individual electrons. The next level upwards, we perceive the analog circuits. These are used to develop components like for example amplifiers. Analog circuits input and output a continuous range of voltages. Digital circuits, such as logic gates, on the contrary, restrict voltages to discrete ranges, which we label 0 and 1. Within Logic Design we build complex structures with digital circuits such as adders or memories.

Micro architecture links the logic and architecture levels of abstraction. When we talk about the architecture level of abstraction we describe a computer from the programmer's perspective.
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and add own comments cursively in blue. I list pages done vs total pages, including any roman and appendix numbered pages.

DDaCA R-VEd - Phase1 0026/2316

1 From Zero to One

1.1 THE GAME PLAN

The continuous innovation in the field of CPU's, during the past 30 years, has advanced our way of life tremendously. This book teaches the reader how to design their own microprocessor. Along the way readers obtain skills that prepare them to design many other digital systems as well.

It is expected from students who want to study this book that they have
  • basic familiarity with electricity
  • some programming experience
  • genuine interest in what goes on under the hood of a computer
This book focuses on the design of digital systems, which operate on 1's and 0's.
we:
  • explore digital logical gates that can receive 1 or 0 as input and produce 1 or 0 as output
  • show how logic gates are put together in complicated combinations (modules)
  • teach programming in assembly language
  • build a microprocessor
The building blocks to build a microprocessor are simple, but the end product is very complex. One of the themes of this book is how to manage complexity.
sorcerer_see: (Default)
My current curriculum (2316+3385=5701 pages)

I revised my curriculum after I realized that both hardware books, one in each of the 2 phases, neglected the circuit level of computer hardware. 

The 3 Books I target now, in my PRE-Earn Phase 
(733+879+704=2316 pages)

1. Digital Design and Computer Architecture RISC-V Ed. -  S.L Harris & D.M Harris, 2021. (733 pages)
This book covers the fundamentals of computer architecture.

2. x64 Assembly Language Step-By-Step Programming 4Ed. - J. Duntemann, 2023. (879 pages)
This book covers the fundamentals of ASM programming.

3. Sams Teach Yourself C Programming, 7Ed. -  B.L. Jones, P.G. Aitken, D. Miller, 2013. (704 pages)
Decent, praised book on the basics of C programming. 



3 Books I want to target in my POST-Earn Phase (864+1999+522=3385 pages)

1. Fundamentals of Digital Logic with Verilog Design 3Ed. (864 pages)
It covers details of computer hardware in relation to logic gates.

2. Assembly Programming for x86 Processors 8th Ed. - K. Irvine, 2019. (1999 pages)
This book covers assembly programming, the low-level programming language that sits between hardware and high-level programming.

3. Modern C 3th Ed. -  J. Gustedt, 2025. (522 pages)
This book covers intermediate level C programming, according to the C23 standard.
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and comment cursively. I list pages done vs total pages, including any roman and appendix numbering.

SCO Ed6 Page9 - Phase1 0009/2384

The invention of Microprogramming


In the 1940's, computers had only two levels:
  • the digital logic level (Level 0)
here programs were executed
  • the ISA level (Level 1)
here the programming was done 
 
Hardware then was complicated, difficult to understand and built, and unreliable.
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and comment cursively. I list pages done vs total pages, including any roman and appendix numbering.

SCO Ed6 Page8 - Phase1 0008/2384

The set of
  • data types
  • operations
  • features
of each level is called the architecture of that level. Architecture of a level refers to the visible aspects of the level as they present themselves to the user of that level. 

Implementation aspects are not part of the architecture. The study of the design of those parts of a computer system that are visible to programmers is called computer architecture.

But, essentially, computer architecture and computer organization are the same thing.

1.1.3 Evolution of Multilevel Machines

Programs written in machine language (level 1) can be directly executed by the electronic circuits (level 0),
without the need for interpretation or translation.

Hardware
Level 0

Tangible objects:integrated circuits, printed circuit boards,
cables, power supplies, memories, printers ...

Software
Level 1 - ...
Abstract ideas, algorithms, instructions, computer graphical or additive representations (applications)

History
With the first computers the separation between hardware and software was clear. It got gradually more blurred due to the addition, merging and removal of layers of abstraction, as the machines developed and computing became ever more complex. 

But, in the end, hard- and software are logically equivalent, since one can be resembled the other, and, at least theoretically, even be replaced by the other.

The choice between hardware vs software solutions is one of cost, speed, reliability and the expected frequency of changes/additions.
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and comment cursively. I list pages done vs total pages, including any roman and appendix numbering.

SCO Ed6 Page7 - Phase1 0007/2384


To sum up: some level 3 instructions are interpreted by the operating system and some directly by the data path controller, whether that is done by the microprogram, or embedded in the hardware. Because of these different sources of instructions coming together at the same level, we call it a hybrid level. Onward the book will call the hybrid level the operating system level.

Between level 3 and 4 we can see a clear break.
  • Levels 0 to 3
Are not normally accessed by the average programmer, rather programs like interpreters and translators are running on those levels, to support applications of the higher levels. Such level 3 programs are written by system programmers. These people specialize in designing and implementing virtual machines.
Level 2 and 3 are always interpreted. Levels 1. 2 and 3 code is always numeric. Easy to read for machines but hard to read for humans.
  • Level 4 and up
Are used by application programmers. These levels are usually translated but sometimes also interpreted. These programs are human readable to different degrees.
Level 4: assembly language (ASM), is a symbolic form of the levels below and is particularly well suited to write programs that levels 1-3 can understand, while still being reasonably readable to humans. Assembly is first translated to the destined level by the assembler program and then there interpreted by the respective virtual machine or directly by the hardware.
Level 5 consists of the high level languages, used for applications with specific functionality. Many exist: C, C++, Java, Perl, Python, PHP, etc., etc. These are most often translated to level 4 or 3 by translaters called compilers, but sometimes also interpreted: Java, for example is first translated to Java byte code, an ISA-like language, which is then interpreted. On level 5 here are also specialized interpreters for specific application domains, like for example symbolic mathematics.

The main point to understand about computer organization is that computing consists of layers of abstraction and interpretation/translation, which are brought forth by different kinds of software programs and hardware operations. 

(but in essence, there is only hardware, and all the abstraction happens within the human mind)
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and comment cursively. I list pages done vs total pages, including any roman and appendix numbering.

SCO Ed6 Page6 - Phase1 0006/2384


Each register can hold starting from minimum 1 binary up to a certain maximum of binaries, defined by the specific hardware architecture. Gates also form the main computing engine itself.

The proceeding level, level 1, is the micro-architecture level. Here we see a collection of typically 8 to 32 registers that form a local memory and a circuit called Arithmetic Logic Unit (ALU). The ALU does simple arithmetic operations. Certain registers are connected to the ALU and together form a data path over which data flows. The data path selects registers and has the ALU operate on them, for example, adding them together, and then storing the result in another register.

On some machines, especially older machines, these operations are controlled by a program called microprogram. But on other machines, especially newer machines, the data path is directly controlled by the hardware. In older editions of the book level 1 was called the micro programming level, since a interpreter software was involved. In newer editions the name of this level is renamed into micro architecture level.

Software control of the data path was instructed with a level 2 language program that then was interpreted by level 1 software. Such a program would fetch, examine, and execute instructions one by one, via the data path. On a modern machine with hard-wired control of the data path, similar steps take place but without an explicitly stored program directing these..

The book calls level 2 the Instruction Set Architecture level (ISA level). Computer manufacturers publish manuals for each computer they sell that describe the principles that apply to the ISA level of their product.

The level above the 2nd is usually a hybrid level. This 3th level carries some of the same instructions as level 2 + some additional instructions and a different memory organization, the ability to run two or more programs simultaneously and more. Level 3 designs can differ widely between computers on the contrary to level 1 and 2 designs which are more universal (on the same level). The new level 3 instructions are interpreted by a level 2 interpreter. This interpreter has historically been called an operating system. Those instructions on level 3 that are also used on level 2 are executed directly by the microprogram or the equivalent hardwired hardware control.
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and comment cursively. I list pages done vs total pages, including any roman and appendix numbering.

SCO Ed6 Page5 - Phase1 0005/2384


1.1.2 Contemporary Multilevel Machines

Almost all computers consist of 2 or more levels of abstraction. Some even up to 6 levels. The circuits at level 0 carry out the machine level instructions. There is one more layer below level 0,- that of the internals of circuits, which we will call the device level. We do not go into this very lowest level since this is the level of electrical engineering,- we are then talking about solid state physics, which is truly beyond our scope as programmers.

The 6 level computer. Below each level we list the support method of said level

The lowest level that we will study, level 0, is the digital logic level. It consists of the most essential elements of computing: gates. In the underlying level these digital devices are composed of analog components, such as transistors. A gate receives one or more digital signals, called input, which are represented in level 1 as 0 or 1, and they compute as output combinations such as AND or OR. Each gate is composed of at max a handful of transistors. A small number of such gates are combined to form a 1-bit memory, which can store a state of 0 or 1. These 1-bit memories can be combined in groups to form registers of, for example, 8, 16, 32 or 64-bit memory.
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and comment cursively. I list pages done vs total pages, including any roman and appendix numbering.

SCO Ed6 Page3-4 - Phase1 0004/2384


Another way of looking at the problem: imagine a computer or virtual machine who's language is L1. In this example we will call this machine M1 and the machine using L0 M0. M1 uses L1 as it's base language. If this were the case we would not need L0 or any M0 machines. People could just write L1 and have their M1 execute their programs directly without the need for conversion/translation.

This thus is a third method of bridging the gap: creating a M1 virtual computer running on L0 hardware and write L1 programs directly for the M1 virtual machine.

For translation or interpretation to be practical, the difference between L0 and L1 should not be too great. Because of this limitation, L1, while being more suitable for programming by humans than L0, will still not be very suitable, for most applications.

The answer to this, is the development of yet another, again more abstract, set of constructions that is yet more easy to be understood by humans. We will call this language L2. A virtual machine that uses L2 as it's own language, we will call M2. We will need software to translate L2 into L1, for running at a M1 machine/. And we can use L1 interpreters to interpret L2 interpreted languages.

This process of creating language upon language theoretically can go on indefinitely, until the theoretic perfect language is achieved. We could see these as layers of abstraction within the organization of computing.

Theoretically we can also perceive of a machine that functions on each of these layers, as if the language at the same level can be run natively on it. The writer things such machines are even possible as hardware, but that such machines are not cost effective since it is much easier to use software to achieve higher levels of abstraction upon low level hardware.
In this sense 1 computing machine can be seen as, in effect, consisting of several (virtual) computing machines of the respective degrees of abstraction.


A multilevel machine

In this book the words 'level' and 'virtual machine' will be used interchangeably.  Just keep in mind that computer terms can mean different things within different contexts and the term 'virtual machine' can mean several things.

Although only at level 0 instructions are put in effect, a programmer, writing at any of the different levels of abstraction need not know what his program is converted into before reaching the hardware, in order to write solid programs.

High-level programmers are generally not interested in what happens at the low-level. People designing new computers must understand at least the lower levels of computing. People who really want to understand how computing works must study all the levels.

The description of the computer as a series of levels of abstraction in relation to the effect the existence of such levels has on computing methods, is the central theme of this book.
sorcerer_see: (Default)
I find myself challenged by friction between wanting to gain specific knowledge and the urgency of landing jobs to make money.

This morning I have been contemplating deeply on the pressure to get ready to earn money and the depth of knowledge I want to obtain. And consequently I have been juggling with books that I want to study in terms of page count and contents, to create a suitable curriculum.

I concluded that I want to aim for income asap but without compromising on the knowledge I eventually want to obtain.

To achieve this balance I defined 2 phases: a Pre-Earn Phase and a Post-Earn Phase (2384+5135=7519 pages)

The 3 Books I target now, in my PRE-Earn Phase 
(801+879+704=2384 pages)

1. Structured Computer Organization 6th Ed. -  A.S. Tanenbaum & T. Austin, 2013. (801 pages)
This book covers the fundamentals of computer hardware in relation to programming as well as an introduction to ASM programming.

2. x64 Assembly Language Step-By-Step Programming 4Ed. - J. Duntemann, 2023. (879 pages)
This book covers the fundamentals of ASM programming.

3. Sams Teach Yourself C Programming, 7Ed. -  B.L. Jones, P.G. Aitken, D. Miller, 2013. (704 pages)



3 Books I want to target in my POST-Earn Phase (2614+1999+522=5135 pages)

1. Computer Systems: A Programmer's Perspective, 3Ed. -  R.E. Bryant & D.R. O'Hallaron, 2016. (2614 pages)
This book was already on my list since I started me study, but back then I decided not to use it because I assumed using Linux OS was a per-requisite and I was using Windows XP. Now I am using Windows 10, which offers the Windows Subsystem for Linux, so the barrier to use it is now out of the way. It covers detailof computer hardware in relation to programming.

2. Assembly Programming for x86 Processors 8th Ed. - K. Irvine, 2019. (1999 pages)
This book covers assembly programming, the low-level programming language that sits between hardware and high-level programming.

3. Modern C 3th Ed. -  J. Gustedt, 2025. (522 pages)
This book covers intermediate level C programming, according to the C23 standard.
sorcerer_see: (Default)
P.S. I synthesize and re-write in my own words what books teach, write any example programs they contain, solve all exercises they offer, and comment cursively. I list pages done vs total pages, including any roman and appendix numbering.

SCO Ed6 Page1-2 - Phase1 0002/2384


1 INTRODUCTION

A digital computer = a machine that does (computing) tasks for people. To make the machine do specific tasks, instructions are given to it. A set of such instructions is called a program. These instructions are directed to the core of the computer, which consists of circuits that are affected by these instructions. At the (near to) base level those instructions are very simple:
  • check the state of what is already set
  • add 2 digits
  • check whether a digit stored is zero
  • copy a state of one memory location to another memory location
  • ...
A collection of possible instructions forms a language that users use to communicate with the computer. This language, to which the computer can respond, we call machine language.

People who design a new computer also record the body of instructions with which to operate it. Because the machine can only understand very simplistic instructions, this language is tedious to handle by humans, especially once instruction sets become elaborate.

For this reason people created a language that consist of prepared instruction sets that are triggered by human-understandable commands. These commands are easier to understand, oversee and organize by humans. This language formed a first layer on top of the machine language. Later more layers were built, each on top of the former, in the same way. These languages became ever more clear and intuitive to use by humans.

The way that computer instructions are thus organized, is called structured computer organization. This is also the name of this book, and in the next section we will explain what this term exactly means. After this explanation we will look into historical developments, and the current state of the art of programming computers.


1.1 STRUCTURED COMPUTER ORGANIZATION

Computers can not understand human language and humans can not easily understand computer language This book explains how this gap can be bridged.

1.1.1 Languages, Levels, and Virtual Machines
There are 2 main methods in vogue to solve the problem. Both ways involved designing a new,set of instructions that is more convenient for humans to use. These sets form each a new language which we will, for the sake of example, call Level 1 languages. The collection of machine instructions we already had, we will call the Level 0 language. Our 2 L1 languages differ from one another in their approach and we will call them A and B.
  • In the case of the L1 A  language, a compiler replaces all instructions in a program with the equivalent sequence of instructions in L0 machine language before executing the newly begotten program in its entirety. This method is called translation, and the program that replaces the original text a compiler.
  • In the case of the L1 B language, a runtime environment replaces and immediately runs the program's instructions, one after the next. This method is called interpretation and the program that interprets the interpreted instructions the interpreter.
In both cases the program is created in L1 language and then converted and ran as L0 instructions. But in the first case the program is first converted entirely and only then ran, while in the second case the program is converted and ran instruction per instruction. Both types of languages are commonly used today and even mixed with one another.
sorcerer_see: (Default)
My curriculum = 3661 pages
Based on my various learning experiences of the past months I evolved to the following study situation, which should get me to a level of comprehensive understanding of modern computer programming.

Basically I build my knowledge from the bottom up:

1. Structured Computer Organization 6th Ed. -  A.S. Tanenbaum & Tod Austin, 2013. 801 pages.
This book covers the fundamentals of computer hardware in relation to programming..

2. Assembly Programming for x86 Processors 8th Ed. - Kip Irvine, 2019. 1999 pages
This book covers assembly programming, the medium between hardware and software.

3. C Programming: A Modern Approach 2nd Ed. -  K.N.K King, 2008. 861 pages
This book I already followed, but this is the more recent 2th Edition, which includes the C99 standard.
It covers the C programming language, which is the best language to connect low-level programming with high-level programming.

Understanding these 3 levels of programming will make me a solid programmer who can fill in various kinds of programming jobs.
sorcerer_see: (Default)
Sound of Frankfurt, trance in the Dorian Gray club in 1996
https://youtu.be/eK4hxAvcQB4?si=yKb5zEfPyBAB2I4s


sorcerer_see: (Default)
To achieve programming mastery I add 2 subjects: x86 Assembly and Hardware Architecture

To reach my goal, I need to add a few other, necessary, subjects to my curriculum.

I got my eye on a popular study text book that in itself might be enough to do that.

"Assembly Language for x86 Processors 8th Ed." Kip Irvine, 2019

This book teaches low level programming and programming-related hardware knowledge.

Tools used: Microsoft Visual Study 2022 + MASM for x86 assembly programming

sorcerer_see: (Default)
ASM Programming
Assembly is the oldest form of short hand coding used to create machine language (object code) instruction sets (programs) for CPU's. High level programming languages were meant to improve on it, making programming even more short-handed, but at the cost of familiarity with the hardware: the computers that programmers are creating the instruction sets for.

Because mastery to me means really knowing what one is doing, I learn ASM as a basic and C and C++ as complementary languages to that basic, all in order to write the best programs I can.

MASM, GAS, TASM, NASM, FASM, are the most prominent softwares for assembly programming.

MASM
Microsoft Macro Assembler
Released in 1981.
Microsoft's x86 assembler for MS-DOS and Windows only.. Integrated with VS Code and the Windows SDK.
It comes in two versions:
  • one for 16-bit & re-bit
  • one for 64-bit
GAS
Gnu Assembler
Released in 1986.
It is principally cross-platform and cross-architecture,  good for Windows, also good for ARM/Android, especially suitable for Linux and Unix systems.. It is the default back-end of the GCC compiler and used to assemble the GNU OS and the Linux kernel. It is part of the GNU Binutils package. and is commonly used with the CLANG and GCC compilers. Uses AT&T syntax by default and Intel syntax can be enabled in some cases.

TASM
Turbo Assembler
Released in 1989.
By Borland. 16-bit & 32-bit x86 for MS-DOS and Windows. Comes with Turbo Linker and can works seamlessly with Turbo Debugger. It can be used in unison with the companies other programming products:  Turbo Pascal, Turbo Basic, Turbo C and Turbo C++

NASM
Netwide Assembler
Released in 1996.
One of the most popular assembler program for Linux, Windows and Mac OS. Does not support ARM so can not be used for Android OS. Netwide Assembler / dissembler  for Intel x86 architecture. For 16-bit, 32-bit (IA-32) and 64-bit (x86-64) programs. Uses only Intel syntax.

FASM
Flat Assembler
Released in 2000.
For Intel-style x86 CPU's. Cross-OS and cross-architecture, supporting Windows, Linux, MAC OS, Android - IA-32 and x86-64 architectures. free, and open-source.

*I use FASM for my programming.
sorcerer_see: (Default)
PS I synthesize here in my own words what K&R teach, re-write all their example programs, character by character, solve all the C exercises they hand out. I comment to what K&R teach cursively. I do not copy-paste anything from the book! In regards to the percentages listed: books often have prefaces with Roman numbers and often also lengthy Appendices. In my percentage calculation I include all pages that I effectively study and synthesize, including non-regular pages.

TCPL 2Ed - Page 018 - 8.30% Completion

1.5.2 Character Counting
Now a program, similar to the copy program, that counts characters:

sorcerer_see: (Default)
Macro's in C
Macro's are program-writing tools to write a program more efficiently. They are implemented BEFORE compilation, during preprocessing, and affect the language the compiler gets to compile but not the compilation itself.

EOF - End-Of-File in C
EOF is, in fact, a macro. The pre-processor replaces all the programmer's mentions in a program of EOF with an agreed to value.

Preprocessing
With C we instruct the compiler to create a program in machine language. We use instructions that the compiler understands, but not the hardware. The compiler makes our program understandable to the hardware., Many aspects of C guide the compiler, macro's are one element to that, but also headers and others, where as algorithms go deeper into the underlying mechanics of computation itself. Preprocessing, as it were, creates a form document , readable by the compiler, that is then entered into the compiler and compiled to machine language. These are all layers of abstraction to bridge the human mind and the hardware with one another.
sorcerer_see: (Default)
PS I synthesize here in my own words what K&R teach, re-write all their example programs, character by character, solve all the C exercises they hand out. I comment to what K&R teach cursively. I do not copy-paste anything from the book! In regards to the percentages listed: books often have prefaces with Roman numbers and often also lengthy Appendices. In my percentage calculation I include all pages that I effectively study and synthesize, including non-regular pages.

TCPL 2Ed - Page 017 to 018 - 8.30% Completion

Parentheses around assignments within a condition are essential. The precedence of != is higher than that of =, which means that, were there none, the relational test would happen before the assignment =.



is equal to



But they have a different effect depending on whether or not the call of getchar encountered end of file.

Exercise 1-6
Verify that the expression getchar () !=EOF is 0 or 1

tcpl_p17-3.c


tcpl_p17-3.exe


Exercise 1-7
Write a program to print the value of EOF

tcpl_p17-4.c


tcpl_p17-4.exe

Page generated Jan. 15th, 2026 07:42 pm
Powered by Dreamwidth Studios