Assmebly Language?

General questions

Page 1 of 1

9 Replies - 2799 Views - Last Post: 04 March 2005 - 12:07 AM Rate Topic: -----

#1 BlackJesus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 161
  • Joined: 10-February 05

Assmebly Language?

Posted 28 February 2005 - 11:13 PM

Does anyone here use assembly language?
Is This A Good Question/Topic? 0
  • +

Replies To: Assmebly Language?

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1866
  • View blog
  • Posts: 20,278
  • Joined: 17-March 01

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

Was This Post Helpful? 0
  • +
  • -

#3 BlackJesus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 161
  • Joined: 10-February 05

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?
Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1866
  • View blog
  • Posts: 20,278
  • Joined: 17-March 01

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
Was This Post Helpful? 0
  • +
  • -

#5 BlackJesus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 161
  • Joined: 10-February 05

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!
Was This Post Helpful? 0
  • +
  • -

#6 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

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 ;) :)...
Was This Post Helpful? 0
  • +
  • -

#7 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

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.
Was This Post Helpful? 0
  • +
  • -

#8 BlackJesus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 161
  • Joined: 10-February 05

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.
Was This Post Helpful? 0
  • +
  • -

#9 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

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.
Was This Post Helpful? 0
  • +
  • -

#10 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Assmebly Language?

Posted 04 March 2005 - 12:07 AM

This Tutorial seems perfect for beginning writing 16-bit Assembly. Go Check it out...

It's attached....

Attached File(s)

  • Attached File  ASM.txt (109.5K)
    Number of downloads: 178

This post has been edited by born2c0de: 04 March 2005 - 12:11 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1