Does anyone here use assembly language?
Assmebly Language?General questions
Page 1 of 1
9 Replies - 2643 Views - Last Post: 04 March 2005 - 12:07 AM
Replies To: Assmebly Language?
#2
Re: Assmebly Language?
Posted 28 February 2005 - 11:18 PM
Nope, but I like this:
; 99 Bottles of Beer program in Intel 8086 assembly language. ; Assemble to a .COM file for MS-DOS. ; ; Author: Alan deLespinasse ; aldel@alum.mit.edu ; www.aldel.com code segment assume cs:code,ds:code org 100h start: ; Main loop mov cx, 99 ; bottles to start with loopstart: call printcx ; print the number mov dx,offset line1 ; print the rest of the first line mov ah,9 ; MS-DOS print string routine int 21h call printcx ; print the number mov dx,offset line2_3 ; rest of the 2nd and 3rd lines mov ah,9 int 21h dec cx ; take one down call printcx ; print the number mov dx,offset line4 ; print the rest of the fourth line mov ah,9 int 21h cmp cx, 0 ; Out of beer? jne loopstart ; if not, continue int 20h ; quit to MS-DOS ; subroutine to print CX register in decimal printcx: mov di, offset numbufferend ; fill the buffer in from the end mov ax, cx ; put the number in AX so we can divide it printcxloop: mov dx, 0 ; high-order word of numerator - always 0 mov bx, 10 div bx ; divide DX:AX by 10. AX=quotient, DX=remainder add dl,'0' ; convert remainder to an ASCII character mov [ds:di],dl ; put it in the print buffer cmp ax,0 ; Any more digits to compute? je printcxend ; if not, end dec di ; put the next digit before the current one jmp printcxloop ; loop printcxend: mov dx,di ; print, starting at the last digit computed mov ah,9 int 21h ret ; Data line1 db ' bottles of beer on the wall,',13,10,'$' line2_3 db ' bottles of beer,',13,10,'Take one down, pass it around,',13,10,'$' line4 db ' bottles of beer on the wall.',13,10,13,10,'$' numbuffer db 0,0,0,0,0 numbufferend db 0,'$' code ends end start
#3
Re: Assmebly Language?
Posted 28 February 2005 - 11:26 PM
wow! i dont know what all that means...it looks fun tho..lol i just was wondering if anyone knew it so i could ask if its even worth learnig or if i should just stick to c++ and such...any idea?
#4
Re: Assmebly Language?
Posted 28 February 2005 - 11:27 PM
*shrugs* I'd focus on more current languages... but that's just me.
Anytime I wanna see what a language looks like, I head over to http://www.99-bottles-of-beer.net
Anytime I wanna see what a language looks like, I head over to http://www.99-bottles-of-beer.net
#5
Re: Assmebly Language?
Posted 28 February 2005 - 11:34 PM
wow, very interesting site there. i didnt even know that there were that many different languages!
#6
Re: Assmebly Language?
Posted 01 March 2005 - 12:38 AM
Yea...I use Assembly language very frequently...There are 2 ways of writing Assembly...the tedious 16-bit way and the easier 32-bit way. The 16-bit example is shown by skyhawk133's posted example.
If you want to learn ASM then you can ask me...It's a great language with lots of power....including enough complications to keep you sleepless for days
...
If you want to learn ASM then you can ask me...It's a great language with lots of power....including enough complications to keep you sleepless for days
#7
Re: Assmebly Language?
Posted 01 March 2005 - 07:29 AM
BlackJesus, on Mar 1 2005, 01:26 AM, said:
wow! i dont know what all that means...it looks fun tho..lol i just was wondering if anyone knew it so i could ask if its even worth learnig or if i should just stick to c++ and such...any idea?
Depends on your goal. Learning how to program in Assembly teaches you more about how computers work than any higher level language. In school, I had to learn many of them, and I've found that those lessons have allowed me to quickly debug things like stack overflows and register problems.
I'd reccommend Assembly for the knowledge it imparts, without a doubt. If you're looking at it from a job point of view, however, you only really need assembly if you plan to be the developer coding the interfaces between hardware and software, and with today's emulators, even then it's not always necessary.
#8
Re: Assmebly Language?
Posted 01 March 2005 - 04:19 PM
so would i use assembly to make an OS or another programming language? cuz whenever i debug something it shows all this assembly code and it looks complicated, but cool. so i want to learn it.
#9
Re: Assmebly Language?
Posted 01 March 2005 - 08:04 PM
No, operating systems are generally programmed in higher level languages, like c or c++.
New programming languages are also often programmed in hihger level languages (I had to program a compiler many years ago as part of a school project).
A good practical example for assembly would be programming the interface that was designed to interpret analog signals generated from a peripheral device and translate those signals to digital events. Keyboards used to work on this principle.
New programming languages are also often programmed in hihger level languages (I had to program a compiler many years ago as part of a school project).
A good practical example for assembly would be programming the interface that was designed to interpret analog signals generated from a peripheral device and translate those signals to digital events. Keyboards used to work on this principle.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|