Optimizing Code for Domain-Specific Connections and Data Structures

In summary, the individual wants to learn assembly language to write code for a new Operating System, without taking help from any predefined functions. They also want an editor window to aid in their programming.
  • #1
pairofstrings
411
7
Hello everyone.

I have lot of extra time. So, I thought why don't I do some pure assembly language programming. So, basically, first I want to target 80x86 architecture processor. And get solid idea and understanding on programming through pure Assembly language. I don't want to learn assembly language in a way which will make me use pre-defined functions later. I mean, I want to write all of the code in pure assembly language, as if I am creating a new Operating System. I have learned somewhere that no Operating system gives any random user a privilege to interact with the HDD and other critical components of a computer and if random user wants to access any of those critical components, he/she is suppose to take help of pre-defined functions described by the Operating system. I believe, by taking use of these predefined functions, the user will be confined to do the usual things that Operating System will allow you to do. If someone needs extra control over the system, he/she must reverse engineer the entire targeted Operating System and figure out everything and then exploit the flaws and gain access to the critical components. I don't want to go into doing exploitation business. I want to learn genuinely and just for fun. I don't have any big goals. But I want to learn pure assembly language seriously.

Objectives:

1. Just for instance: If I want to draw a curve on my display console I must be able to this through pure assembly language. I don't want to take help of any pre-defined functions. I mean I want to interact with the three color guns (Red,Blue,Green) of CRT monitor directly and be able to draw my desired curves.

2. I want to learn the assembly language such that if someone gives me any processor of any architecture and whether it is 8 bit, 16 bit, 32 bit, 64 bit, 128 bit ... or any custom built multi-core microprocessor with 17 bits or 19 bits and an added extra register segment and additional control unit segment inside this custom built microprocessor with other components and peripherals as well, I must be able to look at the manual and must be able to implement my logic. Logic which even includes writing the entire Operating System and/or Graphical User interface through pure assembly language.

I know, this is going to be very very very hard for me who just knows the basics of a particular processor and about it's architecture. And I am certainly not a master at it. But, as I said earlier, I don't have any big goals just looking to pass my immense amount of free time by doing some pure assembly language programming. Please help.

So, I require:

1. A good assembler which, should I say, meets my requirement (please read further to know more about the requirement and will help you get an idea). I know there are assemblers like FASM, MASM, NASM, TASM. I think, I used NASM earlier. I don't know if it supports any predefined functions. But I don't want to use any predefine functions as I described my intentions earlier. So, help me in selecting the best assembler that could be nice for me and which don't support any predefined functions and will enable me to write pure assembly language code.
Also, I want to do my pure assembly programming without interacting with installed Operating System as if I am in 1960s - 1980s and where all I have is DOS. And I am trying to develop a revolutionary Operating System from scratch. So, that after I develop this Operating System, which even includes support(device drivers) for monitor and other peripherals, I want to burn this code into another machine's HDD(generally create .ISO image file, I guess) and get the machine work using my developed Operating System. Tell me if that is possible today.

2. Editor window. I don't remember what editor window I used earlier. So, I need your help here also.

I also want to say that, I am serious in learning pure assembly language as much as I could. Maybe, if I find it not very very complex I might go ahead and think about developing device drivers or an Operating System or Graphical User Interface through pure assembly language, in a way where I don't have to use any predefined functions. I think, I have already stressed a lot on learning pure assembly language.

In addition to all the above that I have said, which is the main objectives and goals and aims. I also want to say the following, so that it gives you some idea, I want to get the ground knowledge of using pure assembly language and experience the era when there was only DOS and how people felt happy when they first created games using pure assembly language and when sounds devices were included with the computers, those people learned to put sounds in their games through pure assembly language. I think this paragraph will give you an idea about what I am looking for. I don't care how efficient or fast or execution or assembling of pure assembly language will be, unless we had different versions of same type of assemblers in those days. I don't want to talk more details on this. But I think you certainly have an idea by now about my requirements. I only want to learn pure assembly language. All the above may look very lofty ambitions but this is just for fun and I am serious in learning pure assembly language.

Thanks.
 
Last edited:
Technology news on Phys.org
  • #2
Even if you were to do development in MSDOS, you'd still run into issues trying to communicate with some of the hardware. For example, most video card manufactures will not release the direct interface specifications for their hardware. Instead you have to go through BIOS calls to change between text and graphics modes on the video cards, load fonts, ..., . Once it's in graphics mode, you can directly write to a portion of the graphical memory, but then you need BIOS calls to switch between banks of video card memory.

You can still get specification the comon components on older PC's, timer, keyboard, serial port, game port, floppy disk port, IDE hard drive port, but I'm not sure where you can buy an older PC. Newer PC's don't have game ports or floppy ports, and emulate the old IDE interface for use with SATA drives.

If your goal is to learn assembly language, learning to program the hardware would be a secondary goal. In the meantime, you could focus on writing MSDOS programs that use the standard BIOS and MSDOS function calls (these are INT instructions). If you wanted to program hardware, the timer chip would probably be the easiest to learn, perhaps writing a program that determines run time with a high degree of accuracy.

You might consider some type of "hobbyist" project kit with a single board, cpu, ram, and some hardware, but I don't know if these exist anymore. Another possibility is some type of virtualized hardware: for example, a development kit for the ARM cpu includes an emulator with source code level debugger, but it doesn't have any virtual devices, and it's expensive (unless there's a student version of the kit). I don't know if there are any cheap or free virtualized machines that include virtualized hardware and a proper development environment.
 
Last edited:
  • #3
Okay. I want to try the following. Tell me if it's possible. First, I want to buy a single core processor, video card, basic RAM, HDD, Processor compatible Motherboard, keyboard, a mouse, CRT Monitor, HDD cables, CMOS battery, and I guess, internally, all the components in the computer system runs on Switched-mode Power supply, so, I would want to buy that too. And now I am thinking about connecting all of these component together. Please guide me if I am missing any component here. So, if everything is right here. I have my home-assembled computer ready. Now, if I switch on my home assembled computer, I will not see anything on my monitor because there is no System Software. So, now I am thinking about making my own System software. Even writing the interface which helps me edit the settings of the hardware. I mean, the interface which we get when we press DEL during boot time.

Basiccomputeredited.jpg


Tell me if I understood this correctly:

As you pointed out manufacturers of video card do not provide their interface and I am suppose to use their functions, and make function calls to display text or to display graphics on my CRT monitor by making use of BIOS(drivers that are already burned inside the ROM). The BIOS is connected to video card. So, that means, I have to call the function from BIOS code. And once the control is in graphics mode, I can directly write to a portion of graphical memory and display graphics but I have to switch between banks of video card to display text message on my CRT monitor.
Do you think I definitely need to include video card in my set up? I mean, I am not going to write any intense game logic. And should I definitely include a video card? I thought there is always a built-in circuitry inside the CRT monitor. And this built-in circuitry inside the CRT monitor will have registers and some processor or perhaps a micro controller, attached to color guns(Red,Blue,Green). And I could just use pure Assembly language to target those chips on the mother board as well as inside the CRT monitor. I don't want to learn about the interface that these video card manufacturers provide if you say that I don't need video card just to display few 2-D lines and curves on my CRT monitor. Is this interface, that you mentioned, does it have specifications of how the electronic circuitry of video card is built?

If you have ever seen Matlab program and the graphics display ability that this software has, does Matlab software developer guys knows the interface of video card which is enabling them to display graphs on the monitor? Or are they just using the functions in BIOS code which is permanently burnt inside ROM. I mean, putting 3-D graphics on the display is demanding operation and if BIOS is taking care of all of this then that is great.
I know if I have full-fledged Operating system installed and if I want to attach a video card to my computer, I just have to put the video card in the PCI slot and install the drivers which is provided by the video card manufacturer and the installed driver software of video card will rest on the Operating system.

So, after analyzing all of the above, I think I came to a conclusion if I really need to use video card for processing high graphics data coming from the processor through RAM ( I am assuming that video card drivers are installed on a full-fledged Operating system and I intend to use video card to serve my purpose) then I need to get hold of the interface(drivers) provided by the manufacturer and meddle with it.

That will be a lot of reverse software engineering that I don't intend to do at all.

But please, answer my other requirement about Assembler and editor. I still want to learn pure assembly language. But, now I want to use drivers that are burned inside ROM to make use of video card to display simple 2-D lines and curves. And the same pure assembly language I want to use to program Embedded systems. I don't have interest in writing code for Embedded system using C/C++ language and doing cross-compilation. I like C/C++ as mush as I like pure Assembly language. I think, code written in C/C++ language require more number of clock cycles of the processor to perform a task and will require more memory space when compared to code written in pure assembly language. I know all the above mentioned issues are not a big problem today because processor gives you high speed and we have plenty of memory. But still I want to learn pure Assembly language.

I will feel a lot happier even if I just get to see the best assembler and editor which will enable me and help me write pure assembly language. So, please suggest an Assembler and editor so that I could learn pure assembly language. I will just give it a try to program some system, perhaps an Embedded system using pure assembly language and shall try to use pre-defined functions, if I could not achieve my programming feat without using video cards and the pre-defined functions of video cards.

Please, suggest an assembler and editor for writing code in pure assembly language.

Thanks again.
 
Last edited:
  • #4
pairofstrings said:
First, I want to buy a single core processor ...
If this doesn't have to be a PC, you might consider buying a hobby type single board computer that uses an Intel 8088 or 8086.

CRT Monitor
The monitor is driven by a graphics card. You can use an LCD monitor if it works with VGA output.

switched-mode Power supply
How the power supply works doesn't matter.

I have my home-assembled computer ready.
You should be able to by a pre-built hobbyist type single board computer.

have to switch between banks of video card to display text message
You have to switch between banks of memory to access all of the video card's memory even when in graphics mode.

Do you think I definitely need to include video card in my set up? CRT circuitry
A monitor connects to a video card, not directly to a computer. You need a video card.

does Matlab software developer guys knows the interface of video card?
No, the program probably uses the direct x interface which is part of the video card driver that is installed into windows. The bios is not used.

I still want to learn pure assembly language.
It would be a lot easier to buy a hobby project board that just includes a processor and something like a small LCD display chip. I did a web search for "hobby single board project computer" and found a few hobby type boards. I would avoid the ones you have to wire up yourself.

If the goal is to learn pure assembly language, then why not start with some simple programs that run under a dos console window, using the standard c libraries to input from keyboard and output to video card? The point here is to learn assembly language programming in general, instead of learning to write device drivers.
 
Last edited:
  • #5
rcgldr said:
Even if you were to do development in MSDOS, you'd still run into issues trying to communicate with some of the hardware. For example, most video card manufactures will not release the direct interface specifications for their hardware. Instead you have to go through BIOS calls to change between text and graphics modes on the video cards, load fonts, ..., . Once it's in graphics mode, you can directly write to a portion of the graphical memory, but then you need BIOS calls to switch between banks of video card memory.

For MSDOS there are standard interrupts. Also if the OP installs a VESA TSR (video driver), then he can use the appropriate interrupts to setup complex video modes, which include those using 24-bit colour.

The interrupt lists are pretty comprehensive for MSDOS if he wants to go down that route.

The only problem I see if is if video cards don't have the legacy chipsets for old standardized support however with a good enough emulator, the calls to hardware ports and interrupts should be emulated correctly if this has to be the case.

If your goal is to learn assembly language, learning to program the hardware would be a secondary goal. In the meantime, you could focus on writing MSDOS programs that use the standard BIOS and MSDOS function calls (these are INT instructions). If you wanted to program hardware, the timer chip would probably be the easiest to learn, perhaps writing a program that determines run time with a high degree of accuracy.

I agree in part but here is why I disagree in part.

One project that would be interesting for the OP is to create a simple WAV file player for the soundcard. This would have to be done in an emulated environment like DOSBox but it is a good project none-the-less.

Programming the sound card to play a sound file requires programming the Direct Memory Address controller and this is a pretty good exercise in configuring hardware using assembly. We take it for granted now, but its useful for the OPs purposes.

Also as you have suggested, programming interrupts is a good thing to do. Apart from the timer chip, the other standard one I would recommend is the keyboard driver. Coding a really simple keyboard driver that prints the keys that are being pressed (kinda like a simple DirectX test would) is also a good project.
 
  • #6
rcgldr said:
If the goal is to learn pure assembly language, then why not start with some simple programs that run under a dos console window, using the standard c libraries to input from keyboard and output to video card? The point here is to learn assembly language programming in general, instead of learning to write device drivers.

I want to create my own DOS, design and develop my own video card, CRT monitor, Microprocessor, and write device drivers in pure assembly language for video card. And I want to use pure assembly language to write softwares to whatever systems that I create. I don't like the compilers of any high level languages or mid level languages in general. I think, there are too many drawbacks with high level languages and their compilers. And I think I will begin to not like assemblers that we have today if I find any drawbacks in it. So, as a matter of fact, I even want to create my own assembler. If I find any drawbacks with my self developed assembler then I will directly work with binary digits 0s and 1s and start flipping switches and let people call me antique. I think flipping switches was the case even before 1960s, I guess. And if I find any problem in working directly with 0s and 1s then I will develop a new technology.
But the problem here is, I first want to understand how assembly language works and how data is assembled and converted into binary code by assemblers. I intend to design and develop my own microprocessor that is compatible with the currently available RAM and motherboard in the market. This is my project. I don't like to work on mundane concepts. I think that is very boring.
I intend to work in Research and Development domain in my country, specifically in Electrical engineering and computer language programming field, 30 years from now. I believe this is the amount of time that I will need to learn and investigate all of the above concepts. Not happy. And I think by then we will be using data processors of some other technology. But, no worries.

Let me ask you few more things by taking you to flash back scenes of the era when human beings found material to develop microprocessors.
Now, let us apply some Applied physics here and quickly sum up everything.

We discovered electron, electricity, magnetism and figured out all the concepts pertaining to this eventually. Eventually, we discovered material suitable to make solid state devices. We created few devices like vacuum tubes. We invented first computer. These computers were using switches as already discussed in this thread. Now, scientists did not like big things. So, they tried making them smaller. They succeeded. Next step, is the exact thing that I want to know. This is where I am stuck. If I can go back in time to 1960s and see the working of a computer, I would first want to investigate how data was stored on magnetic tapes, then work on designing assemblers with the people already working on this project. Investigate about Interpreters. And also investigate what events exactly made the computer geniuses to come up with DOS. And then investigate what events exactly ushered in an era to design softwares post DOS. And then came compilers and mid/high level language.

I want to use my 32 bit computer to write softwares and drivers for my systems. I will design my own hardware. They will not be much complex but hopefully I shall improve. This will be like developing some primitive system. Perhaps, an Embedded system.

So, please suggest me what is the best assembler and editor to learn pure assembly language. Suggest me the assembler and editor that were used even before DOS era and can even be used now to write pure assembly language code. I may come back and ask you more questions about assemblers.
Or simply, you can suggest me a good assembler and an editor that will work to do pure assembly language. No offense to anyone, but I do not like working with high level or mid level languages on my projects.

I do not think there are any books that will help me find all of this. Since, you guys have worked on those earlier computer systems I know that you all must be knowing a lot of things and can share your experience and knowledge.
 
Last edited:
  • #7
pairofstrings, hold on just a sec!

You need to realize that what you want to do is a lot of work!

As other posters in this thread have said (or alluded to), keep it simple! Start on one project and keep adding mini projects to your big project.

This is good because you may find that you really don't want to put in all the effort to learn something and you can leave it there and work on something else.

One recommendation I have for you is to get the MSDOS source code. It exists out on the web and a tonne of it is written in assembler code. Take a look at that before you make any serious decisions about writing your own mini OS.
 
  • #8
pairofstrings said:
What is the best assembler and editor to learn pure assembly language.
Any intel compatable assembler will be good enough. The editor isn't that important. You would want a debugger that can at least display the registers.

For 16 bit real mode (MSDOS), you can download Masm 6.11 (assembler) along with a linker, and CodeView (source level debugger) directly from Microsoft or other sites. You'll probably want QuickHelp, which include descriptions of the intel instruction set and masm directives that you use in source code. Programmer's WorkBench (the Microsoft one for MSDOS, not the one for Unix or the old one for Macs) can be used as an IDE (integrated development environment), that works with projects (multiple source files). If you ever do embedded programming, you'd want exe2bin, or something similar, to create an binary image file. I'm not sure of the download links for all of these old tools, which date back to the 1980's thru early 1990's, but a web search will produce quite a few hits.

Another option for 16 bit would be Borland Turbo Assembler which includes an IDE, assembler, linker, debugger, ...

For 32 bit or 64 bit mode, Visual C/C++ express (free) includes Masm 8.00.xx, and a source level debugger. You'll need to add a build step so a project knows to use masm (ml.exe) to create an object file from a .asm file.
 
Last edited:
  • #9
You might learn more from an open source OS that was intended to be educational, like MINIX, than trying to reverse engineer MSDOS. In fact you might even learn why about 99% of MINIX is not written in assembler...

But I think your ambition to "do everything yourself from scratch" is unlikely to get anywhere, unless you really have say 10 or 20 years to devote to this full time.
 
  • #10
rcgldr said:
Another option for 16 bit would be Borland Turbo Assembler which includes an IDE, assembler, linker, debugger, ...
I used the Borland assembler (TASM) and debugger (TDEBUG) extensively back in the early 90s, and IMO, they were much easier to use than the equivalent MS tools. Just my opinion...
 
  • #11
Mark44 said:
I used the Borland assembler (TASM) and debugger (TDEBUG) extensively back in the early 90s, and IMO, they were much easier to use than the equivalent MS tools. Just my opinion...

Absolutely agree. Too bad Borland had such poor marketing and faded away; they really DID have a superior product.
 
  • #12
Go to Source Forge and look at the source code for the operating systems that they list. It is all open source, usually well commented, and you can see what was done and why.
Today most OS's are a combination of C and assembler code. You can embed asm into C code and do what you want done faster that way.

Paul
 
  • #13
PaulS1950 said:
Go to Source Forge and look at the source code for the operating systems that they list. It is all open source, usually well commented, and you can see what was done and why.
Today most OS's are a combination of C and assembler code. You can embed asm into C code and do what you want done faster that way.

Paul
Did I understand Paul's words correctly? Please see the figure. Figure 1.
ASMinsideCandCcompiler.jpg


Okay. Thanks for your guidance. You all might have already understood that I was trying to draw an outline so that I can get good intuitional understanding of the subject and that will make me likely to grasp the subject in its entirety. And with considerable efforts, later I can connect the dots seamlessly. Sorry, I did not mean to ...rush in my earlier post.

Anyways, I have another general question.
My computer is running Windows Vista(TM) Home Premium, Service Pack 2 and the specifications are:
Processor: Intel(R) Pentium(R) Dual CPU T2310 @ 1.46GHz 1.47 GHz,
System type: 32-bit Operating System
RAM: 1.50GB

Question1:

I want to write assembly language code for 16, 32, 64, 128-bit processors on the machines that run 32-bit or 64-bit (or possibly even higher bits!) Operating system. I want to start with 16-bit, 80x86 processor architecture and later move to processors that support/accept more number of bits for processing, like 32-bit processor or 64 bit processor or 128 bit processor at once and so on. I may even change my machine on which I am going to write my code for the target machine. Currently I am using 32-bit processor, detail information about my machine is given above. Do I have to change my 32-bit processor computer machine if I want to target a processor that takes 8-bits or 32-bits or 64-bits of inputs? Which assembler should I used? Please see the figure below. Figure 2.

BasiccomputerforASMedited.png


As I already suspected and predicted earlier that there are going to be problems for me in using and finding a good assembler. I did some reading on FASM, NASM, MASM, TASM. Each of them have their limitations. MASM only good for windows. TASM not free and maintained properly, NASM supports few things but is only good for 32-bit processors. I found FASM to be good but it does not have much parsing power.

I am not a master in programming using Assembly language but I want to work dedicatedly on this so, I want and I wish atleast one assembler to be perfect. Like say, having AASM (Awesome assembler). Do we have anything like that? I mean someone should be able to say, "just take this assembler buddy and you should be able to use it to program anything using assembly language on any processor architecture whether 16-bit, 32- bit, 64 bit, 128 bit and so on and on any bit Operating system, like 16-bit, 32-bit, 64-bit ...and 128-bit!" No, I am not picky, I just want to be able to do my work perfectly, like everyone else in the league. Please see the figure below. Figure 3.

PossibilitiesofASMedited.png


Question 2:

Please tell me about 128-bit processors and can the number of bits supported by a processor go beyond 128-bits. Can we see 128-bit Operating system in the future? And can we create a HDD that can allocate so many(how much exactly?) memory location and give each memory location a unique address, so that I can store data into those memory locations? How will RAM that supports 128-bit of information and carry 128-bit of information to the processor and HDD going to look like? Is there a possibility to go beyond 128-bit on HDD, RAM, Processor?

EDIT:
Figure 4.

HDDandRAM.png


I am going to change my picture. Please wait. ...Fixed. Please answer my questions that are in the figures of this post (post#13).
 
Last edited:
  • #14
pairofstrings said:
Question 2:

Please tell me about 128-bit processors and can the number of bits supported by a processor go beyond 128-bits. Can we see 128-bit Operating system in the future? And can we create a HDD that can allocate so many(how much exactly?) memory location and give each memory location a unique address, so that I can store data into those memory locations? How will RAM that supports 128-bit of information and carry 128-bit of information to the processor and HDD going to look like? Is there a possibility to go beyond 128-bit on HDD, RAM, Processor?

There is no conceptual limit to processor word size, but it will not be compelling for quite a few years to move beyond 64 bits for normal computer use.

HDD and RAM have little, if anything to do with each other. They are totally different technologies and your confusing the two / equating the two is not helping your understanding of computers.

EDIT: also, you continue to confuse O.S. size and computer word size. They are not the same. You can run a 32 bit operating system just fine on a 64-bit machine (but you can't do the reverse).

I find your colored graphics / lettering unreadable, so can't comment on any of them
 
  • #15
pairofstrings said:
I want to start with 16-bit, 80x86 processor architecture.
Just use MSDOS either directly or in a virtual machine. MSDOS runs in real mode, which is 16 bit. Just don't use any 32-bit prefixes on the instructions.

pairofstrings said:
32-bit processor or 64 bit processor.
You can get XP, Vista, or Windows 7 in 32 bit or 64 bit mode. The 64 bit OS's can run 32 bit code.

pairofstrings said:
MASM only good for windows.
Early versions of MASM predate any version of Windows. Masm 6.11 can be used to generate code for MSDOS or any environment that will run with 8088 (8 bit) or 8086 (16 bit) processors.

pairofstrings said:
128-bit processors.
From Wiki: There are currently no mainstream general-purpose processors built to operate on 128-bit integers or addresses:

http://en.wikipedia.org/wiki/128-bit
 
  • #16
rcgldr said:
Early versions of MASM predate any version of Windows. Masm 6.11 can be used to generate code for MSDOS or any environment that will run with 8088 (8 bit) or 8086 (16 bit) processors.

Hey, good point. Gads. MASM 6.11 ... boy, THAT'S been a while!

I used to write BIOS code with that for both DOS and CPM (a different, and better, version of the DOS BIOS, that never really caught on)

LATER EDIT: OOPS ... I did NOT use MASM 6.11 for CPM ... that was earlier. And CPM was not a DOS BIOS replacement, it was an alternate OS to DOS but used the same BIOS's
 
Last edited:
  • #17
pairofstrings,
If you want to use assembler code exclusively then you can disregard C programming but in C programs you can use embedded assembler code. Like I said - most OS's since DOS are written in C with embedded assembler code.

Writing the entire OS in machine language is going to be a monumental task.
I run DOS 6.22 on a quad core Intel processor (boot to CD or USB 1.44 floppy).
I think you can run a 16 bit OS on any Intel chip from 80286 on as long as you use the proper syntax for the older chip. The older commands are compatible with the newer chips. (backward compatability at the machine code level)
Processes get added with newer chips.

by the way, you must be a bit masochistic to want to do this all in machine code. :)

Paul
 
  • #18
phinds said:
MASM 6.11 ...! I used to write BIOS code with that for both DOS and CPM (a different, and better, version of the DOS BIOS, that never really caught on)
That would be CPM-86. Wiki article:

http://en.wikipedia.org/wiki/CPM-86

CPM ran on the older 8080 compatable instruction set. You could also run CPM with an 8085 or Z80.
 
  • #19
PaulS1950 said:
pairofstrings,
If you want to use assembler code exclusively then you can disregard C programming but in C programs you can use embedded assembler code. Like I said - most OS's since DOS are written in C with embedded assembler code.

Writing the entire OS in machine language is going to be a monumental task.
I run DOS 6.22 on a quad core Intel processor (boot to CD or USB 1.44 floppy).
I think you can run a 16 bit OS on any Intel chip from 80286 on as long as you use the proper syntax for the older chip. The older commands are compatible with the newer chips. (backward compatability at the machine code level)
Processes get added with newer chips.

by the way, you must be a bit masochistic to want to do this all in machine code. :)

Paul

Thanks for writing. You can call me "a bit masochistic" or ...whatever. I set challenges on myself because I like it. And if you have read my first post of this thread, I have already mentioned that I have immense amount of time and I want to learn pure assembly language. I think learning pure assembly language is going to help me a lot in understanding complicated functions of a computer and I can design some impressive system as my project when I take higher studies in electrical engineering. I have also mentioned my method of learning in post#13. Hope that answers your curiosity. Please read all of my posts. I write nice stories, you will not get bored.
Please tell me if I have correctly understood the meaning of embedded ASM and C language programming.

EDIT: Sorry, I wrote "embedded ASM and C language programming" above. I was actually referring to the part where I can use assembly language code in my C language program in the C language editor, like in Turbo C/C++ version 3.0 editor and compiler.
Anyways, thanks for the information in post#20. But my two questions in figure 1 of post#13 is still not resolved. It is about (Turbo) C/C++ compiler and C program containing ASM code. And there is another question in same figure 1 of post#13 as well. Please see figure 1. Please comment on my first figure of post#13.

phinds said:
There is no conceptual limit to processor word size, but it will not be compelling for quite a few years to move beyond 64 bits for normal computer use.
I find your colored graphics / lettering unreadable, so can't comment on any of them

I have found some interesting things on the internet regarding a Processor and RAM limits. But could not understand the text. I shall come back to this topic for discussion once I get answers to all my questions in the figures of post#13.

I have fixed all my pictures in post#13. So, please write. All the comments and corrections and discussions and analysis are welcome. Please see my post#13 and tell me what is wrong and how it could be correct and please answer my questions from all the figures. Thanks.
 
Last edited:
  • #20
pairofstrings said:
embedded ASM and C language programming.
Embedded applications are ones that go into devices other than than a typical computer. This could include a hard drive, a cell phone, a microwave oven, an ECU for a car, ... . The basic coding methods are the same, but the interfaces that the code works with are different than a PC and how the code is initially loaded on the device is different. The operating system, if any, will be different than the ones normally used on a PC.

Wiki article for embedded system.

http://en.wikipedia.org/wiki/Embedded_system
 
  • #21
pairofstrings,
To embed another language in a C program you write the assembler code (or pascal, fortran, whatever) and compile to obj file. Then you link the obj file to your C file with the linker and build the program from there.
It is a way to expand the capabilities of C to include routines in other languages. Those who use assembler (machine code) in their C programs do so for the added speed or to address a machine specific attribute on an otherwise portable code. The problem for me is that embedded code is rarely portable outside of the specific processor family. That doesn't work for me and it is why I only use ANSI C (C-89) currently. I give up some of the easy processes but I gain speed and portability.

Paul
 
  • #22
PaulS1950 said:
pairofstrings,
To embed another language in a C program you write the assembler code (or pascal, fortran, whatever) and compile to obj file. Then you link the obj file to your C file with the linker and build the program from there.

I would hardly call that embedded code. That's just linking to a separate library and nothing to do with embedded code.

EMBEDDED code, in C is literally that. You put ("embed") assembly language statements IN the C program (with the appropriate surrounding statements so that the C compiler knows to assemble it instead of try to treat it like C.
 
  • #23
phinds said:
EMBEDDED code, in C is literally that, you put ("embed") assembly language statements IN the C program (with the appropriate surrounding statements so that the C compiler knows to assemble it instead of try to treat it like C.

Above mentioned trick is interesting. It shows how compiler developers have managed to make things easier but I think they did it by doing some compromise with the performance.
Anyways. So, if I want to embed some chunks of assembly language code in C code. Then, I could just pick up my Turbo C/C++ compiler, version 3.0 and type my assembly language code inside this Turbo C/C++ editor along with the C code. And then compile(?) the code (containing mix Assembly language code and C language code) by pressing ALT F9 and run the compiled(?) program by pressing CTRL F9. Right?

Speaking of assemblers...

After my post#13 I figured out that there are assemblers specifically designed to support a group of specific processors/microprocessors. For instance, Intel processors have their own assemblers, though there are of different types like FASM, MASM, NASM,TASM.
Let us assume range from 80x86 to the (present) i7 processor from Intel, whether 16-bits, 32-bits, 64-bits. I am yet to find out why there is no sole assembler that could work on all these types of microprocessors. I mean, I want an assembler that could target all microcontrollers and all microprocessors which are following Intel's internal architecture design of microprocessor whether 16-bit , 32-bit, 64-bit. I mean, I can have three different assemblers that targets 16-bits microprocessor or 32-bit microprocessor or 64-bit microprocessor individually. Or maybe, I would just have a single assembler that could target all the microprocessor whether 16-bit, 32-bit or 64-bit, provided that these microprocessors are manufactured by Intel because then these microprocessors would have same Internal architecture except the input/output pins changes. And only the size of the registers changes but the quantity of registers are same. True?

ARM processors have their own assembler. Perhaps, the instruction set of these two different types of microprocessors manufactured by Intel and ARM could vary. So, I think the point is if the microprocessor designer includes an extra register (and other component inside microprocessor?) then an existing assembler becomes obsolete for this newly custom designed microprocessor. And I think this was discussed earlier that the instruction set varies from one Operating system to another. For instance, the instruction set of Windows Operating system is different than Unix Operating system. The point here is instruction set varies from one Operating system to another depending on the code design of the Operating system. True?Another point here is, if the microprocessors are SAME in both Windows Operating system and Unix Operating system but code design is DIFFERENT. Then going by my discussion in this post, I will not require a new assembler but the instruction set varies. True?

The overall point here is
1. If I have SAME microprocessor used in Windows Operating system and Unix Operating system then there is no need to design and develop a new assembler. But the instruction set may vary depending on the code design of the each Operating system. True?

2. If microprocessor used in Windows Operating system is DIFFERENT than what is used in Unix Operating system then there is a certain need to design and develop a new assembler. Again, here the instruction set may vary depending on the code design of the Operating system. True?

I am still under dilemma to choose a good, powerful assembler that could help me target all types of microprocessor, manufactured by all manufacturers like Intel, ARM, AMD etcetra.

Let me know if all of my above reasonings are correct or am I just wandering.

I cannot deduce answer to the following text :
Suppose, I have a Unix Operating system running on 32-bit Intel's microprocessor. So, I don't need to develop an assembler. I can use the existing ones. It is not necessary that there must always be an assembler installed in a PC to make an Operating system run. So, since I am running Unix, we all know that instruction set of Unix is different from Windows.
My confusion is : Is it because of code design of Operating system or is that the instruction set to implement a logic in a PC can change irrespective of code design of Operating system and design of microprocessor. Is there a possiblity like this?

Let me put it in simple terms. Suppose, I have a "64-bit Operating system1" running on Intel's 64-bit microprocessor. And I have the same "64-bit Operating system1" running on the same Intel's 64-bit microprocessor. My confusion is: Is there a possibility that even though Operating systems are same, the microprocessors used are same, can the instruction set used to implement the logic to achieve the same objective in both the machines be different?

Please tell me if the above written reasoning s are true. So, that I can learn something. Thanks.

I need to clear my confusion between Operating system size and computer word size. I need to find the purpose of each register in any given microprocessor. I need to find how the loop mechanism in assembly language works. I need to find more about INT instruction in assembly language. So, I will write my explanations here. So that you guys can evaluate my answers. And I will paste some text that I got from the web, which is related to question#2 in my post#13. So, that you all can explain me the meaning of that paragraph. I will write a separate post on all of this in this thread later.

My next post will be on making a home made computer from scratch. Not really from scratch. I will describe it in detail in my next post. So, that you guys can help me a bit.
 
Last edited:
  • #24
pairofstrings said:
Above mentioned trick is interesting. It shows how compiler developers have managed to make things easier but I think they did it by doing some compromise with the performance.

No that is not correct. there is no compromise with performance. Embedded code is generally done to IMPROVE performance.

Anyways. So, if I want to embed some chunks of assembly language code in C code. Then, I could just pick up my Turbo C/C++ compiler, version 3.0 and type my assembly language code inside this Turbo C/C++ editor along with the C code. And then compile(?) the code (containing mix Assembly language code and C language code) by pressing ALT F9 and run the compiled(?) program by pressing CTRL F9. Right?

I haven't used that compiler in so long that I don't remember the specifics, but generically, yes, that's correct.

Speaking of assemblers...

After my post#13 I figured out that there are assemblers specifically designed to support a group of specific processors/microprocessors.

Well, duh! Assembly language === machine language in another form. That is, assembly language follows machine language according to the principle of one-to-one correspondance. Assembly language is an EXACT representation of machine languge. Different machine have different machine languages, so OF COURSE they have different assembly languages by definition.

Microprocessor series (such as the x86 series) generally add registers / capabilities in the newer versions, so while assemblers COULD be made completely backwards compatible, that's a design (of the assembler) issue.

ARM processors have their own assembler. Perhaps, the instruction set of these two different types of microprocessors manufactured by Intel and ARM could vary

ya think ?

I think this was discussed earlier that the instruction set varies from one Operating system to another.
You really need to drop this belief that assembly languages / machine languages and operating system have anything to do with each other. They are different level constructs entirely. You can write any operating system on any machine, if you so choose.


2. If microprocessor used in Windows Operating system is DIFFERENT than what is used in Unix Operating system then there is a certain need to design and develop a new assembler. Again, here the instruction set may vary depending on the code design of the Operating system. True?

WAY off --- the "code set" of an assembler is EXACTLY the code set of the machine and has NOTHING to do with any operating system than may be written for that machine.

I am still under dilemma to choose a good, powerful assembler that could help me target microprocessor, manufactured by all manufacturers like Intel, ARM, AMD etcetra.
Yeah, since such a beast doesn't exist, I'm sure you're having a hard time choosing one.

I cannot deduce answer to the following text :
Suppose, I have a Unix Operating system running on 32-bit Intel's microprocessor. So, I don't need to develop an assembler. I can use the existing ones. It is not necessary that there must always be an assembler installed in a PC to make an Operating system run. So, since I am running Unix, we all know that instruction set of Unix is different from Windows.
My confusion is : Is it because of code design of Operating system or is that the instruction set to implement a logic in a PC can change irrespective of code design of Operating system and design of microprocessor. Is there a possiblity like this?

AGAIN --- drop this idea that machine language and operating system have anything to do with each other.

I need to clear my confusion between Operating system size and computer word size.
They have NOTHING to do with each other except to the extent that if you have a 64-bit machine and the operating system takes full advantage of it, it is called a 64-bit operating system, but if the operating system was written for a 32-bit version of the machine and yet is running on a 64-bit version of the machine, it is NOT taking full advantage of the 64-bit machine and it is called a 32-bit operating system.
 
  • #25
embedded code ... embedded asm in c code
It's not clear which meaning of "embedded code" that you want. "Embedded code" could mean software that runs on some device, such as a hard drive, cell phone, ... or it could mean embedding assembly code into C code.

pairofstrings said:
embedded assembly code in c ... It shows how compiler developers have managed to make things easier but I think they did it by doing some compromise with the performance.

phinds said:
There is no compromise with performance. Embedded code is generally done to IMPROVE performance.
Performance may be comprimised. In some cases, optimization, especially register based optimization, is reduced or disabled if embedded assembly code is used, since it would be difficult for the compiler to know which registers or which locations in memory are modified or preserved by the assembly code.

pairofstrings said:
Let us assume range from 80x86 to the (present) i7 processor from Intel, whether 16-bits, 32-bits, 64-bits. I am yet to find out why there is no sole assembler that could work on all these types of microprocessors.
You'll probably need two assemblers. MASM (actually ML.EXE) 8.0 from Visual Studio supports 32 bit and 64 bit code. Masm 6.11 supports 16 bit and 32 bit code. The syntax for Masm 6.11 and later is the same. Masm 5.xx versions are lacking some of the features of Masm 6.11. MASM 8.0 supports 16 bit mode, but I doubt Visual Studio's linker or libraries support 16 bit real mode code, so you'll need a different tool set, even though MASM could be the same.
 
Last edited:
  • #26
rcgldr said:
Performance may be comprimised. In some cases, optimization, especially register based optimization, is reduced or disabled if embedded assembly code is used, since it would be difficult for the compiler to know which registers or which locations in memory are modified or preserved by the assembly code.

In practice, the compiler documentation will tell you want conentions your assembler code has to follow. For example the compiler wll have some program-wide coventions about how it calls and returns from subroutines and allocates local temporary data items on the stack, and if your assembler code doesn't respect those, most likely nothing will work.

But that isn't really a "restriction". It just means you can't invent your own arbitrarily different way to do something that you would need to do anyway, for a non-trivial-sized progam - and the compiler writers are not likely to have invented a deliberately inefficient and dumb way to do it, just out of cussedness!

I think much of this discussion about what is different from what is getting somewhat fanciful, because the days when programs like compilers and assemblers were hand-coded by "expert programmers" have long gone. Any decent computer science course should teach you how to build your OWN working compiler for a high level language, as a term project. It probably won't be super-efficient, or generate super-efficient code, but at least it will work - which is better than many "hand-crafted" products from the past!

Most of the code making up compilers for completely diferent languages (as different as traditional Fortran, is from C++) is absolutely identical - which is why you no longer have "compilers" but "compiler systems" like
http://gcc.gnu.org/ , which support a whole range of languages across a whole range of CPU types (including Intel, ARM, and several more besides) and different operating systems.

Most modern compilers don't generate machine code directly, but output an assembler language program, which then gets processed by (big surprise!) an assembler - and you can run the assembler yourself on your own assembler code if you want to.
 
  • #27
embedding assembly code into c code ... performance

rcgldr said:
Performance may be comprimised. In some cases, optimization, especially register based optimization, is reduced or disabled if embedded assembly code is used, since it would be difficult for the compiler to know which registers or which locations in memory are modified or preserved by the assembly code.

AlephZero said:
In practice, the compiler documentation will tell you want conventions your assembler code has to follow.
The main issue is the usage of registers for variables by the compiler to optimize code. In the case of microsoft c compilers, embedding asm source generally requires the compiler to store any register based variables into memory before the embedded assembly segment and then to restore them back into registers if optimization warrants it.

One way to avoid this issue is to keep the assembly code and C code in separate source modules (separate object files that get linked together), and have the C code call the assembly code or vice versa.
 
Last edited:
  • #28
God, my English is horrible and so is my ability to portray my thoughts in written format. I know, I must work on that.
Sorry that this discussion is beginning to look fancy. But, I want to know, and I think that this is useful information for me.
Anyways.

AlephZero said:
Decent computer science course should teach you how to build your OWN working compiler for a high level language, as a term project. It probably won't be super-efficient, or generate super-efficient code, but at least it will work - which is better than many "hand-crafted" products from the past! Most of the code making up compilers for completely diferent languages (as different as traditional Fortran, is from C++) is absolutely identical - which is why you no longer have "compilers" but "compiler systems" like http://gcc.gnu.org/ , which support a whole range of languages across a whole range of CPU types (including Intel, ARM, and several more besides) and different operating systems.

Most modern compilers don't generate machine code directly, but output an assembler language program, which then gets processed by (big surprise!) an assembler - and you can run the assembler yourself on your own assembler code if you want to.

Okay. Thanks for making it clear for me. I now know about 'compiler systems'. Thanks for bringing it up.

1. But you mentioned that compilers made by not-so-expert programmers these days are able to run a piece of high level language code nicely. And these compilers created by not-so-expert programmers are better at giving the performace when compared with the performance of the code that were "hand-crafted" products from the past. Are you saying that these "hand-crafted" programs written by expert programmers were written in pure Assembly Language? And still the most of these "hand-crafted" programs written by expert programmers using Assembly Langauge are not as efficient (performance wise) when compared with the programs written in high level language and then use compilers created by not-so-expert programmers to compile and machine code generated is good enough that it is better than "hand-crafted" Assembly Langauge programs written by expert programmer.

If that is what you are saying, then I believe that it is perfectly possible that an expert-programmer can write a code whether intentionally or unintentionally to run with low performance. Simply, because I think it is possible to write bad code even in Assembly Langauge which is the same case with writing code in any high level language. Your thoughts, please.

2. What is "assembler code" in your last paragraph (please, see above)? Are you referring to assembler(translator) design code? Or is it "assembly language code" and you typed it as "assembler code" ?
I get a feeling that, what you basically meant is that when a compiler system tries to generate a binary code (machine code), this compiler system translates the high level language code to "assembly language code" ( the code which contains mnemonics like ADD, MOV, SUB, MUL, etcetra). And I can simply extract this "assembly language code" and run it on my beautiful assembler. And by "extract", if I can do that, that will also mean that I can "hand-craft" this extracted-compiler system generated-assembly language code to make it more good. Right? Possible?

rcgldr said:
It's not clear which meaning of "embedded code" that you want. "Embedded code" could mean software that runs on some device, such as a hard drive, cell phone, ... or it could mean embedding assembly code into C code.

This comes as a big of surprise for me that there is an assembly language program running inside the HDD! I did not know that. I was always thinking that Operating system was in-charge of extracting/writing the data from/to the memories of a computer (like HDD, RAM). And I also thought that when I attach a pen drive to my USB port, even then the Operating system is in-charge of extracting/writing data from/to the pen drive. Am I right about this thing or is there an assembly language code sitting inside this pen drive as well. The reason why I thought that there is no assembly language code running inside HDD and pen drive is that, I assumed that, if suppose, I buy a new HDD and pen drive and attach it to my computer which has no Operating system installed. And if the monitor is also connected and there are device drivers for my display then when I connect my HDD and switch my computer ON with no Operating system installed in it then, I thought the HDD will be only consuming power and nothing else. But, if I can write an assembly language program inside an HDD then that means if I connect this HDD to my computer which has no Operating system installed in it then the assembly language program running inside HDD can be programmed to inform the user by saying "there is no Operating system installed and you must install the Operating system to enjoy full benefits of HDD technology." I mean that is great. Now, I think that assembly language code cannot be written inside RAM. If assembly language code can be written inside RAM, then I can program my RAM to inform the user by saying "not enough RAM, please insert more RAM" whenever computer is running out of RAM. That will be cool. Right? If I may add, the same programming ability can be applied to Graphics card. If a user is trying to play games that require powerful Graphics card. And if I can write assembly language code inside Graphics card then I can program my Graphics card to inform the user by saying "Not enough power inside Graphics card, please upgrade." Your thoughts, please.

And I was actually pointing to the concept were I can write my Assembly Langauge code inside C Langauge code in the same editor window. But, thanks for information in post#20 and post#27 on "Embedded system programming". I might be starting Embedded system programing using only Assembly Langauge and using only C Langauge and using 'mixed Assembly and C code'. People say 'mixed Assembly and C coding' is difficult. But, I am just trying to do something useful and learn something.
Your thoughts, please.

phinds said:
No that is not correct. there is no compromise with performance. Embedded code is generally done to IMPROVE performance.

Well, duh! Assembly language === machine language in another form. That is, assembly language follows machine language according to the

principle of one-to-one correspondance. Assembly language is an EXACT representation of machine languge. Different machine have different machine languages, so OF COURSE they have different assembly languages by definition.

Microprocessor series (such as the x86 series) generally add registers / capabilities in the newer versions, so while assemblers COULD be made

completely backwards compatible, that's a design (of the assembler) issue.

You really need to drop this belief that assembly languages / machine languages and operating system have anything to do with each other.

They are different level constructs entirely. You can write any operating system on any machine, if you so choose.

WAY off --- the "code set" of an assembler is EXACTLY the code set of the machine and has NOTHING to do with any operating system than may be written for that machine.

AGAIN --- drop this idea that machine language and operating system have anything to do with each other.

Thanks for making it clear. I now know that instruction sets written in assembly language are not linked with Operating systems in any way and and I can write my Operating system on any machine. This was also my doubt. But the real thing that I wanted to know was...

Objective:

Suppose, if I am running Unix Operating System on one machine. And Windows Operating system on another machine. Let us assume that the microprocessors used are same in both the machine. Because, by making assumptions like this, I do not have to consider using two separate assemblers on these different Operating system, and it gets simple to write my query here. So, so far hardware and assembler is same on both the machine. But, only the Operating system is different from one another. Now, my objective is to write a software for these two machines. Let us write a software called EditPad. Similar to MS Notepad. Let us remind ourselves again that we are using same hardware and assembler on both the machine but the Operating system is different.
Now, I want to create minimize button, maximize button, close button, title bar, menu bar and outer frame for my software called EditPad.
So, since we are having different Operating systems, I think that code required to build all those components of that software (EditPad) must be programmed separately if I want to include this software (EditPad) in each Operating system software package.

Please look at it this way...

On Unix if I want to create a close button then I may write following steps :
.
.
.
MOV [somenumber], [somenumber]
ADD [somenumber], [somenumber]
MUL [somenumber], [somenumber]
.
.

and other instructions which will help me create the button.

On Windows if I want create the same close button then I may have to include extra steps/instructions which is not similar to instruction/steps used in creating the same close button in Unix Operating system.

.
.
.
MOV [somenumber], [somenumber] -----> possibly, there could be different numbers than used in Unix Operating system to create the same close button
ADD [somenumber], [somenumber]
MUL [somenumber], [somenumber]
SUB [somenumber], [somenumber]
myloop: ------> extra instruction used here, not used in Unix Operating system to create the same close button
.
.
.
end loop
.
.
.
and other instructions which will help me create the button.

I am not trying to reverse engineer any software or Operating system. I am just trying to realize the possibilities how instruction set a.k.a instruction can vary between two Operating System when trying to achieve the same objective. In this case the objective is to create a software called EditPad which will look exactly similar in appearance and will have exact operations to perform for both Unix Operating system and Windows Operating system.

Unix:
Instruction set to achieve an similar objective: (In this case same button creation in software called "EditPad")
.
.
A
B
C
D
E
. (Instruction F is missing here but F is present in Windows)
.

Windows:
Instruction set to achieve the similar objective: (In this case same button creation in software called "EditPad")

.
A
C
D
F (instruction E is missing here but E is present in Unix)
.
.
.

True?
So, so far I know that instruction sets varies from one OS to other (different) OS but this variation is independent of what assembler I use. And the industry still do not have the ideal assembler that I spoke about earlier.
But can you put some light on my objective in this regard.

Your thoughts, please.
 
Last edited:
  • #29
pairofstrings said:
Unix:
Instruction set to achieve an similar objective: (In this case same button creation in software called "EditPad")
.
.
A
B
C
D
E
. (Instruction F is missing here but F is present in Windows)
.

Windows:
Instruction set to achieve the similar objective: (In this case same button creation in software called "EditPad")

.
A
C
D
F (instruction E is missing here but E is present in Unix)
.
.
.

True?
So, so far I know that instruction sets varies from one OS to other (different) OS but this variation is independent of what assembler I use. And the industry still do not have the ideal assembler that I spoke about earlier.
But can you put some light on my objective in this regard.

Your thoughts, please.

Hey pairofstrings.

The main differences between the two mostly deals with OS specific routines (as your probably realize) and these usually are implemented in a variety ways depending on the design and execution constructs of the operating system.

If you want to learn the specifics, you need to learn about the execution constructs like process and threads and all about them. You need to know how memory and other resources are allocated to processes and threads.

You also need to know how DLL's (or SO's in linux) are organized. Knowing this won't only help you understand custom applications that use custom DLL's, it will also help you understand how operating system routines are called from executables which will help you see automatically the difference between 'windows code' and 'linux code'. This is what happens when you want to call windows code like opening a file or creating a thread: you are calling a routine in an external library (DLL) and that will do what it has to do and modify objects in memory that it has to modify for the calling program.

Typically we don't do things like we used to which has based on software and hardware interrupts. This was back when developers just directly interacted with the hardware: for various reasons we don't do that (this is a good thing) so if we want to do OS specific things instead we call routines in an OS library which do things for us and also protect different processes from accessing other processes objects like memory, file handles and other things.

The other thing has to do with all the structures in an executable. Knowing these will help you understand all the code that gets called to initialize the program. EXE files are usually in the portable executable format, and this has a whole bunch of information that will help you understand what gets setup specifically to the OS before your 'non-OS' specific code gets called. Linux has its own structures for executables in the same way that Windows has.
 
  • #30
pairofstrings said:
Unix ... Windows... write a software called EditPad.
The problem here is that Unix / Linux systems typically use an X Windows graphical user interface while Windows uses it's own graphical user interface. These are not compatable. If you wanted to share code on both systems, you would need to select some common graphical user interface, which wouldn't be native to Linux or Windows or both, such as using an X Windows interface on Windows 7.
 
  • #31
rcgldr said:
The problem here is that Unix / Linux systems typically use an X Windows graphical user interface while Windows uses it's own graphical user interface. These are not compatable. If you wanted to share code on both systems, you would need to select some common graphical user interface, which wouldn't be native to Linux or Windows or both, such as using an X Windows interface on Windows 7.

Yes, something like QT. http://en.wikipedia.org/wiki/Qt_(framework)

http://qt.nokia.com/qt-in-use/story/app/vlc-player/
 
  • #32
Am I saying anything? Yes.

Please see the figure below.

ObjectivesGenerationsofComputerLanguages.png


Question 1:
In the above figure, I chose figure 1 as my answer. And I do not know if I can develop graphics and GUI using pure assembly language. But, I think that it is possible to even draw figures, graphics and develop graphical user interfaces/windows and applications/softwares using pure assembly language. Correct me if my understand is wrong.

I know that, C language was used to build JVM and JVM makes codes run independent of all architectures. And if C language is third generation language which came after assembly language which is second generation language. Then I get an impression that C language was designed by taking the ideas of Assembly language, then how come we cannot write web applications in pure assembly language if we intend to write the same web application in terms of implementing it by implementing JVM code indirectly and Web application code in the same assembler's editor. And then assemble it. Create an assembler file compatible with web standards and put it on the web.

ASMforeverything.png


Question 2:
I mean, If I want to write web application code in such a way that it is able to run on all platforms then I can write it by even implementing the 'JVM' code and the web-code in the same assembly language's editor window. Is not that a possibility? I am not trying to reinvent the wheel. I am sure that the elite peers and the researchers have already worked and studied it. But I am just curious to know if there is any tiny possibility of doing this using pure assembly language. Please see the figure above.

I get an impression that the mere purpose of doing all of this (going to higher level of abstraction) is to get/impose security in a wayward manner which is not elegant at all.

Thanks and appreciation.
 
Last edited:
  • #33
The statement
And I do not know if I can develop graphics and GUI using pure assembly language
and others you have made tells me that you have a fundamental misunderstanding.

ANYTHING that can be done on a computer can be done in assembly language.

You would be utterly insane to actually DO it, but it CAN be done. To recreate the OS utilities, including graphics routines, that make many thing easy to do COULD be redone by you in assembly language, but probably not in one lifetime.

After all, whatever code you start out with, it RUNS as machine code and assembly language is just a literal translation of machine code into human-readable form.
 
  • #34
Regarding your question #2, I'm not sure that I understand exactly what you are proposing. You keep talking about "pure assembly language" and then talk about running it on different platforms.

Do you not understand that each CPU has ITS OWN assembly language? You cannot run one machine's assembly language on another machine and if you write code to try to convert one machine's assembly language to another machine's assembly language, that will be somewhere between near-impossible and possible but just plain dumb.

Implementing something like the JVM on each machine would be much more reasonable, but when you do that you HAVE to get rid of this concept you have of "pure assembly language" running on different platforms.
 
  • #35
phinds said:
Implementing something like the JVM on each machine would be much more reasonable, but when you do that you HAVE to get rid of this concept you have of "pure assembly language" running on different platforms.

Thank you for the responses.

Please tell me if the following is correct and tell me something more related to it if possible*.

  • Java Virtual Machine software is able to execute programs of Assembly (architecture known), C, CPP, SQL and PL/SQL (code if needed must connect to database), Java (given) and the part of the JVM architecture that takes care of this is "Native Method Stacks".

    How will I do it, is:
    1. I will open a notepad, and I will type my program/software in Java language predominantly and then when the need arise I will type programs/subprogram/code belonging to a different language ( Assembly (architecture known), C, CPP, SQL and PL/SQL) in the same notepad window.

    2. Save it by name "mix".

    3. Compile the program written in the notepad window as usual
    c:/>javac mix.java

    4. Run the code as usual
    c:/>java mix

    Correct? Possible?
  • Native Method Interface is a program that copies native method libraries (C,CPP header files) into the JVM.

I am trying to get a big picture of how I can approach something that is related to programming.

Thank you very much. The above might appear specific to Java but since assembly language is related to it I am putting the post here.
 
Last edited:
Back
Top