How to use Assembler? part 1: introduction

How to use Assembler? part 1: introduction

3 Comments
This article will come in 4 parts and will cover everything you will ever need to know about programming in assembler in Flowstone 3.0.5 and lower (including Synthmaker). This part will cover the introduction to assembler.

 How your mom does math and how your computer do it

Everybody who ever used a computer noticed the language and mentality gap between us. And those of us who ever tried making a program noticed how deep and wide the gap actually is. Fortunately many tools are here to help us with the task and Flowstone is one of them. Apart from the easy-to-follow wires and modules, Flowstone allows you to write parts of your schematics the old-fashioned way. Naturally I’m talking about Ruby, DSP code and x86 Assembler, which is the topic today.

To get a glimpse of what assembler is, why it looks like the way it looks and how to use it, we have to start from the number 1 question of 21st century humans, which only a few know the answer too: “How do computers work?”

I will try to make the answer as simple as possible. The “brain” of your computer is made of two parts:

1. RAM (random access memory) – A big array of flip-flop circuits (on/off switches). They are in groups of 8 and each group has its number called address (which is 32bit or 64bit integer that’s why there are 32bit and 64bit systems).

2.CPU (central processing unit) – a nerd-ish brother of a calculator. Instead of pressing buttons it reads the instructions (operational codes or shortly opcodes) from your RAM. Some instructions naturally require some values which he also reads from your RAM or stores them in his own personal short-term memory called registers and flags.

When you compile your code/schematic your operating system stores the instructions in your RAM and also makes place there for your variables. CPU then reads the instructions one by one and performs them. That may involve reading data from RAM, writing data to RAM from registers, jumping to different instructions or doing stuff with the registers and flags. Most of the opcodes do basic “elementary school” level math and assumptions. The power of computer is, that while a student needs several seconds to add two 8digit numbers your computer does in splits of a microsecond.

How do I make a computer do what my mom says?

Making common programs by writing the binary of opcodes (referred to as machine code) is superhuman task. Just try to remember that operation 0000001100001100 adds contents of “ebx” register to “eax” register. Luckily someone give each instruction a name and thus created  assembly code and also wrote a program that can convert these names to instruction numbers (the assembler). Both machine code and assembly code are low-level programming languages. High level languages are even more practical – they convert more complex terms like c=a+b to sequence of assembly/machine code instructions, letting you write more complex programs very easily.

code-chain

 

Here you can see the transition from what your mom would easily understand to what your computer understands. From top to bottom: word-based thoughts, DSP code (high-level language), x86 assembly (low-level language), machine code (in hexadecimal numbers). Notice how things transform from simple thoughts to math notation to some babble with bliss of structure to utter nonsense. Well… from your computer’s point of view it’s other way around.

Next time we will have a look at some basic programming in Assembler using SSE operations…

 

 

 

0 0 0 0 0
kohugaly

About the author:

Hello Synthmakers and Flowstoners! I'm 22 years old pharmacy student. You may know me form the FS and SM forums as KG_is_back. I'm using Flowstone since the times It was Synthmaker2. Whenever I'm not fiddling on a double-bass in some caves I'm lurking on the Flowstone forum ready to help if I can.

3 Comments

    • kohugaly
      kohugaly  - November 2, 2014 - 1:18 pm

      Hi Luke! Flowstone GUI is transmitted via wireless links upwards. You may use “wireless link” primitive to capture all GUI elements shown on that modules GUI. In this topic on the flowstone support forum you may find a schematic that shows exactly the thing you are looking for. Also I recommend signing up in there – the community of Flowstone users is really great and ready to help with any such problems.

  1. Luke Wilson  - November 2, 2014 - 6:43 pm

    thanks. that is what i am taking about but i have no clue how to use the file on there, i dont understand how to change between the GUI’s.

    ps, thanks for the twitter follow. there will be something VERY interesting there in a week or so.

    lukeandsiti.com/MKP for more info

Add Comment Register



Leave a comment

You must be logged in to post a comment.

Back to Top