Starting assembly language in assembler ?

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

36 Replies - 2819 Views - Last Post: 04 August 2018 - 12:11 PM

#1 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Starting assembly language in assembler ?

Posted 15 April 2018 - 09:46 PM

I am mostly confused about the arrangements of these parts of the code in

DOS
Linux
Windows
NASM
MASM

Posted Image

.model small

.data

.code

.startup

.exit

Is this OS specific or Assembler specific ?

This post has been edited by sunshine33: 15 April 2018 - 09:49 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Starting assembly language in assembler ?

#2 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 06:15 AM

Quote

Program Structure
I won't say there is any defined pattern or structure an assembly language program should appear unlike what we have in some high level languages but i'll say this is a very good way to start.


TITLE
.MODEL
.STACK
.DATA ;Begining of data segment.
.CODE ;Begining of code segment.
start: ;Indicates the beginning of instructions.
PROC ;Begining of procedure (if neccessary)
ENDP;End of procedure.
END start ;End of instruction.



TITLE: identifies the program listing title. Any text typed to the right side of the directive is printed at the top of each page in the listing file.
.MODEL: selects a standard memory model for the programs.
.STACK: sets the size of the program stack which may b any size up to 64kb.
.DATA: all variables pertaining to the program are defined in the area following this directive called data segment.
.CODE: identifies the part of the program that contains instructions .
PROC: creates a name and a address for the beginning of a procedure.
ENDP: indicates the end of the procedure.
END: terminates assembly  of the program. Any lines of text placed after this directive is ignored.

Was This Post Helpful? 0
  • +
  • -

#3 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6734
  • View blog
  • Posts: 31,197
  • Joined: 10-May 07

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 06:52 AM

MASM has a lot of OS specific items. NASM will be a more platform independent language to learn with.
Was This Post Helpful? 0
  • +
  • -

#4 Programmer2004   User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 96
  • Joined: 25-October 17

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 08:16 AM

If you're writing applications for some OS, then most of these commands are probably OS-specific. For example, when programming applications for DOS in TASM, you can use "proc", which allows you to create subroutines, ".model tiny" which allows you to create standard 64 kB .COM application, etc., etc.

Another example: When you're writing a Windows application in FASM, you'll use "section '.text' read executable" (or something like this, the code section is mostly named as .text"), and in the beginning of code you'll use "entry .text" to tell the assembler where the code section starts. I don't know if I wrote these commands correctly, because I didn't write any Windows programs in assembly for a long time, but you can always find information about it on the Internet.
Was This Post Helpful? 0
  • +
  • -

#5 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 09:41 AM

Thanks no2pencil , Programmer2004

Yes, after some researching i have decided to use MASM , they have a lot more documentation than NASM
That is not all MASM syntax is a bit more user friendly than NASM .

Why do you guys have avatar and sig , and i cant upload any?
It helps staring into our own creations for the purpose of studying all these .
Was This Post Helpful? 0
  • +
  • -

#6 Programmer2004   User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 96
  • Joined: 25-October 17

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 10:08 AM

Quote

Why do you guys have avatar and sig , and i cant upload any?


Do you get any error message when you try to upload an avatar?
Was This Post Helpful? 0
  • +
  • -

#7 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 10:40 AM

I think they have disabled it .
That is a bad idea in my opinion .
Avatar and sig is half the fun .
Was This Post Helpful? 0
  • +
  • -

#8 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6734
  • View blog
  • Posts: 31,197
  • Joined: 10-May 07

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 10:44 AM

There are a number of issues with the site. This is one of them.
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14867
  • View blog
  • Posts: 59,319
  • Joined: 12-June 08

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 10:46 AM

You can update a signature by having the image hosted on a site like imgur. Same with the display avatar can be referenced to a similar hosting site.

Uploading the image to the DIC server is a no-go at the moment.. for, I don't know, safety... and the children.
Was This Post Helpful? 0
  • +
  • -

#10 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 12:43 PM

Oh i had an option like that all these time ? lol

Thanks , it worked

I really don't like forums with too much avatar and sig restrictions .Its takes away the fun element from the discussions

I double love this forum right now
Was This Post Helpful? 0
  • +
  • -

#11 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14867
  • View blog
  • Posts: 59,319
  • Joined: 12-June 08

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 12:46 PM

Quote

I really don't like forums with too much avatar and sig restrictions .Its takes away the fun element from the discussions

That being said - make sure you review the rules (My Account -> forum rules)

Quote

Signatures should not be excessive in length. (about 4 lines of 65 characters)
Graphics must not exceed 400x80 (total width of entire signature)

Was This Post Helpful? 0
  • +
  • -

#12 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Re: Starting assembly language in assembler ?

Posted 16 April 2018 - 12:55 PM

Thanks .
One min , let me resize my sig :)/>

Edit :

Thanks for the info , i will upload something new after some time
Right now cant fit the sig properly .

This post has been edited by sunshine33: 16 April 2018 - 01:08 PM

Was This Post Helpful? 0
  • +
  • -

#13 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Re: Starting assembly language in assembler ?

Posted 28 April 2018 - 03:25 AM

.model small

.data
	max_temp DB 92h       
	min_temp DB 52h
	avg_temp DB ?
.code
.startup

	mov ax,@data          
	mov ds,ax
	mov al, max_temp      
	add al, min_temp      
	mov ah, 00h           
	adc ah, 00h           
	mov bl, 02h          
	div bl               
	mov avg_temp, al     
.exit
end                           
 

This post has been edited by sunshine33: 28 April 2018 - 03:26 AM

Was This Post Helpful? 0
  • +
  • -

#14 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Re: Starting assembly language in assembler ?

Posted 28 April 2018 - 06:24 AM

Which one has more examples available on the internet ?

My first try ended up in different hello worlds , that is all

Any book suggestions ?

Thanks
Was This Post Helpful? 0
  • +
  • -

#15 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14867
  • View blog
  • Posts: 59,319
  • Joined: 12-June 08

Re: Starting assembly language in assembler ?

Posted 28 April 2018 - 09:30 AM

I swear you have asked this repeatedly, but so it goes.

#1 - who is counting things on the internet?
#2 - The best option is to hit amazon, search by your topic, and then sort by most recent. Skim through books on your topic that are fairly new, and have a good rating. Once you see about three or four eyeball their reviews, and also compare chapters.. you should get a pretty solid idea which covers what part and then it's an issue of finding a used copy (or buy new if you want).
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3