|
Register | Forum Rules | Members List | Today's Posts | Search | Bookmark & Share ![]() |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
![]()
Hi there.
This thread is intended for Sesame and me JohnDowe to comm about ASMembly language, but anybody can put in their $0.02 (that's 2 cents). Sasame did you get my last post in "I remember when"? I did get yours in "computer probem". Right now i'm looking at the program... JohnDowe. |
#2
|
||||
|
||||
![]() Quote:
In the meantime, I visited several web tutorials on ASM. Hopefully I will learn it soon. ![]()
__________________
Your life is unique, cherish it. Do something with your life. |
#3
|
||||
|
||||
![]()
Hi there.
Hey Sesame, what's with the new avatar? You joinned the mafia? JohnDowe. |
#4
|
||||
|
||||
![]()
Hi there.
Took a while but, i processed the info... Sesame if you want to learn ASM, just to understand your computer better, then read the manual included with the assember i found (link et the end), but, if you want to become an assembly language programmer, then you will need a few things and a lot of patience and determination, the reason i stopped programing in asm was because my first XP was home and it didn't support dos programs then i ans many others complainned and the home version was dropped, but i only found out much later, also my asm only worked on FAT16, not FAT32 or XP Pro's NTFS, at the time i was a bit bumed out and went on to other pastures, to be poetic. Learning asm to become an assembly language programmer, requires dedication, because you need to learn your cpu's processor's instructions, their addressing modes and the processor's structure and registers which is not too much to learn, many instructions you will use constantly, some you will use ocasionnally, and some you will rarely use, and there are some you will never use (unless you are programing an operating system). Once you have learned that, you will have to learn about your computer system's Basic Input Output System, the BIOS, the CMOS Ram, the RTC (real time clock) the bios system calls, and the various BIOS, DOS, and Win memory usage loctions which WILL help you alot in your programing endeavors, you will also need to learn about I/O devices like the Serial Port, the Paralel Port and a few others, most of the newer I/O devices are usually well supported by windows, so you will need a reference manual or three or more, you will also need an assembler, a text editor, notepad is not that great but wordpad is better and will serve you well here, if you have office you could use word but the spellcheck IS a pain it the arse since we are not writing a letter but a program and you have to make sure you save your files as text files, and with a .ASM extension, you will also heve to learn about ASCII characters, binary, octal and Hexadecimal numbers, which will be very usefull in dealing with bits, bytes, data and addresses, you will also have to learn about bolean algebra, which is binary logic. So you will need: An assembler. An X86+ processor reference. (registers, instructions, segments, flags etc.). A text editor. (that one you already have, Yay). A bolean logic guide of some kind. A hardware reference, for all the IRQ's (hardware interupt requests) the int vectors, the reset, the I/O Chipsets etc. A bios reference with all the memory locations & INT calls. A DOS programing reference for all the DOS memory locations and interrupt calls. These can be either a book (usually several books), as files from the internet, your choice but a book can be carried with you pretty much everywhere, but files can be searche more easily, you can also create your own files with the info you find in the previously mentionned sources, also computer electronic device manufacturers often suply free info about thier products that canbe very usefull, and you should as you progress, make a library of often used debuged and documented routines. A simple memory clear loop: CLRRAM: MOV AX,0 MOV CX,1024 MOV DI,AX CLEARING: MOV [RAM+DI],AX INC DI INC DI DEC CX JNZ CLEARING CLC RETN The first line you see a label, which is used to reference program entry points, loop points and data, the names can be anything you want, but id MUST begin with a letter and end with a ":" and you may not use names that are also ASM DIRECTIVES like BYTE, WORD etc, it is better to use label names that are reltive to the segment of code is used for, instead of an arbitrary name like banana, because a few months later you see " CALL BANANA", then you think what does BANANA do and where is it? but " CALL CLRRAM" is self explanatory. The ASM code "MOV AX,0" which puts 0 in the register called AX, that was the long and slower way, you could use "SUB AX,AX" substracting ax from itself will always = 0 it is faster and saves the 2 bytes from the program, but the fastest is "XOR AX,AX" why is it the fastest? Because unlik the first and like the second it doesn't have a second word of memory to fetch, but it is a logical operation instead of a mathematical one like the second one whitch has to set the carry and other flags, while the logical one only sets the zero and negative flag which makes it quicker, but one shoust not go crazy with the compactness or speed of execution, the fact that your progam is programmed in asm will ensure that it is way smaller and way faster than anything programmed with an "evolved" language, i just wanted to demonstrate that in asm there are more than one way to accomplish the same thing, but if you wanted to fill the memory block with "0101 0101 0101 0101" binary you would have to use " MOV AX,5555H", "0101 0101 0101 0101" is binary, HEXADECIMAL is grouping 4 bits togather which comes out to 5555 Hex, the AX register is the Accumulator and is used primarily for math, but not exclusively. The second line sets the Register CX to 1024, and the loop will repeat 1024 times, the CX register is primarily used as a counter but again not exclusively. The third line sets the regidter DI to the same value as AX, which in this case it is 0. The fourth line is a bit different, why is there some square braclets? And RAM+DI? The square brackets mean that you are not using a register as a destination but a memeory location the label RAM is defined elsewhere and points to memory that this program uses for data, the DI is an index register and the effective address is: the value of RAM + the value of DI, the first time DI = 0, and stores the value of AX in it, and AX = 0. The fifth and sixth lines increment DI, do that the next time it will be equal 2, why 2? because we are moving words (16 bit at a time) and the address is referenced in bytes (8 bits at a time). The seventh line decrements CX. The eight line uses the result of the previous instruction and Jumps if the result was NotZero JNZ, since the first time result was 1023 the jump is taken and the loop re-iterates... The ninth line is "CLC" which clears the carry, i as many asm programers use the carry to check if there was an error, if the carry is clear there is no error, this sub routine is very simple and there are no possible errors, this instruction could be removed. The last line RETurns to the sending instruction the N specifies that it is a Near CALL that used the routine as oposed to a Far CALL. ASM With good doc: http://www.bestdiskrecovery.com/ngasm/index.html Follow it to D/L NGASM the tutorial is very good, all 275K's of it. JohnDowe. PS JohnDowe is MY CPU's name. |
#5
|
||||
|
||||
![]()
Hi there.
So Sesame, you like loooong posts? The previous one to your liking? JohnDowe. |
#6
|
||||
|
||||
![]()
What goes into the making of an Operating System?
What are the parts and how do they work? How do the mobile phones run? I guess they run with an OS? Where can ASM be applied in the modern world? I hope you have worked in UNIX? What basic difference do you find between windows and Linux os? By the way, there is an emulator(Like an os inside an os) called Wine, its a freeware. It runs as a virtual machine inside Linux, allowing you to run Windows applications. *wink wink* This way one can legally run windows applications and not pay Windows a single dime!!
__________________
Your life is unique, cherish it. Do something with your life. Last edited by sesame; 08-27-2009 at 04:49 PM. |
#7
|
||||
|
||||
![]()
Hi there.
Operating system? Ok, the thing that seperates operating system design with all other software design is that in designing an os you start with next to nothing software wise, as opposed with application programing which has an os to work with, so you have to create a program that will allow other software to function and use the system resources, so in essence you do the "dirty" work so that application designers don't have to reinvent the wheel when dealing with the i/o the os takes care of that. Parts of the os... There is the BIOS, what allows the cpu to start up self test suppoer the os and load the said os. then there is the os itself, with i/o management and support. then there are the drivers that allow different interfaces from different manufacturers to be used in a common standard way. then there is support software like "Format", "notepad" that allow the user to do some preparations and customisations of the operating system, and then there are applications, and we all know what they do. Mobile Phones. They have a microcontroler, a somewhat symplified microprocessor and it is programmed, os or not is more of a semantics question than anything else, all the software is in one chunk, and it is both "os" and application so it is integrated into the controler's non volatile memory, also Blackberry type phones have a few more features and can run other software but the whole phone software could be defined as the os, and the other saftware you D/L, the applications. Where does ASM stand now. ASM is a programming language, and it has good sides and bad sides, one of the bad sides is that you need to invest a lot of resources to get some dividends out of it, people are lazy and usually take the fast easy path, often missing out on the nice scenery, the relaxation or challenge and the pleasure of a slower less hectic path, on the good side the resulting code is VERY compact and VERY, VERY fast, and is not bound to the limitations of other languages, viruses behave as they will because they aren't bound to the rules that other programs are FORCED to follow, most were programmed in ASM, ASM is mostly for professionnal programers not casual weekend programers that only program tiny programs of dubious usefullness, but a programer that has pride in his craft and knows his computer inside out and doesn't compromise the quality of his work just to make an arbitrary often unrealistic deadline, which are rare these days looking at all the bugs in all the software these days. Never used unix or linux, why? one word; compatibility. Unix and his big brother xenix are now unfortunately almost obsolete by non use, linux is an open system which can be changed by anyone, and as such will always be a "work in progress" and i was told, programmed in asm at least in the begining, but will not run win apps and has comparatively, but a few apps that are designed to work under, and they are usually more expensive, because of the extra developpement time, limited market and lack of competition, the day linux runs win apps, win will perish soon after. JohnDowe. |
![]() |
|
|