Lost Password?


Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-11-2008, 06:17 PM
err0r err0r is offline
Newbie
 
Join Date: Sep 2008
Posts: 3
Rep Power: 0
err0r is on a distinguished road
Default ASM question. Which assembler?

Which assembler should I use?
For windows.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 09-11-2008, 06:46 PM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is online now
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 15
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: ASM question. Which assembler?

MASM TASM FASM, take your pick...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-30-2008, 03:05 AM
outsid3r's Avatar   
outsid3r outsid3r is offline
Programming Professional
 
Join Date: Jul 2008
Location: Portugal
Age: 20
Posts: 291
Rep Power: 4
outsid3r has a spectacular aura aboutoutsid3r has a spectacular aura about
Default Re: ASM question. Which assembler?

Quote:
Originally Posted by MeTh0Dz|Reb0rn View Post
MASM TASM FASM, take your pick...
NASM eats that 3 assemblers at same time

NASM is a great choice, is considered on of best assemblers or maybe the best, and is portable, also the code is simplier, more closer to machine instructions but doesn't mean that is more harder that others, in fact, it's more acessible in every points. NASM is really great.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-30-2008, 03:12 AM
outsid3r's Avatar   
outsid3r outsid3r is offline
Programming Professional
 
Join Date: Jul 2008
Location: Portugal
Age: 20
Posts: 291
Rep Power: 4
outsid3r has a spectacular aura aboutoutsid3r has a spectacular aura about
Default Re: ASM question. Which assembler?

Quote:
Originally Posted by err0r View Post
Which assembler should I use?
For windows.
I wrote a lib with some C like basic IO functions, take a look to get an idea of what is NASM:

Code:
%ifndef	_IO
%define	_IO


;BYTE COLOR VALUES
%define	BLACK		00000000b
%define	BLUE		00000001b
%define	GREEN		00000010b
%define	CYAN		00000011b
%define	RED		00000100b
%define	MAGENTA	00000101b
%define	BROWN		00000110b
%define	WHITE		00000111b
%define	GRAY		00001000b
%define	LIGHTBLUE	00001001b
%define	LIGHTGREEN	00001010b
%define	LIGHTCYAN	00001011b
%define	LIGHTRED	00001100b
%define	LIGHTMAGENTA	00001101b
%define	YELLOW		00001110b
%define	LIGHTWHITE	00001111b


	SECTION	.data
txtatt:	db	WHITE
c_x:	dw	0
c_y:	dw	0


	SECTION	.code
itoa:
	push	bp
	mov	bp, sp

	mov	bx, word [bp+4]
	mov	ax, word [bp+6]
.loop:
	mov	dx, 0
	mov	cx, 10
	div	cx

	cmp	ax, 0
	je	.end

	add	dx, 48
	mov	[bx], dx

	inc	bx
	jmp	.loop
.end:
	add	dx, 48
	mov	[bx], dx
	inc	bx
	mov	byte [bx], 0

	push	word [bp+4]
	call	near reverse

	pop	bp
	retn	4


reverse:
	push	bp
	mov	bp, sp

	sub	sp, 5			;alloc 5 bytes
	mov	byte [bp-1], 0		;c
	mov	word [bp-3], 0		;i

	push	word [bp+4]
	call	near strlen
	mov	bx, word [bp+4]
	dec	ax
	mov	word [bp-5], ax		;j
.loop:
	mov	ax, word [bp-3]
	cmp	ax, word [bp-5]
	jae	.end

	mov	si, word [bp-3]
	mov	al, byte [bx+si]
	mov	[bp-1], al		;c = bx[i]

	mov	si, word [bp-5]
	mov	al, byte [bx+si]
	mov	si, word [bp-3]
	mov	[bx+si], al		;bx[i] = bx[j]

	mov	si, word [bp-5]
	mov	al, byte [bp-1]	
	mov	[bx+si], al		;bx[j] = c

	inc	word [bp-3]
	dec	word [bp-5]

	jmp	.loop
.end:
	mov	sp, bp
	pop	bp
	retn	2


strcmp:
	push	bp
	mov	bp, sp

	mov	si, word [bp+6]
	mov	di, word [bp+4]
.loop:
	mov	al, byte [di]
	cmp	al, byte [si]
	jne	.end
	cmp	byte [si], 0
	je	.end

	inc	si
	inc	di

	jmp	.loop
.end:
	mov	al, [si]
	sub	al, byte [di]

	pop	bp
	retn	4


strlen:
	push	bp
	mov	bp, sp
	mov	bx, [bp+4]
	mov	cx, 0
.loop:
	cmp	byte [bx], 0
	je	.end
	inc	bx
	inc	cx
	jmp	.loop
.end:	
	mov	ax, cx
	pop	bp
	retn	2


strcpy:
	push	bp
	mov	bp, sp

	mov	si, [bp+6]
	mov	di, [bp+4]
.loop:
	cmp	byte [si], 0
	je	.end

	mov	al, byte [si]
	mov	byte [di], al

	inc	si
	inc	di
	jmp	.loop
.end:
	mov	byte [di], 0
	pop	bp
	retn	4


cprint:
	push	bp
	mov	bp, sp
	mov	si, [bp+4]
.loop:
	cmp	byte [si], 0
	je	.end

	mov	ah, 09h
	mov	al, byte [si]
	mov	bh, 0
	mov	bl, byte [txtatt]	
	mov	cx, 1
	int	10h

	mov	ah, 03h
	mov	bh, 0
	int	10h

	mov	ah, 02h
	mov	bh, 0
	inc	dl
	mov	dh, dh
	mov	dl, dl
	int	10h

	inc	si
	jmp	.loop
.end:
	pop	bp
	retn	2


cputc:
	push	bp
	mov	bp, sp
	mov	si, [bp+4]

	mov	ah, 09h
	mov	al, [si]
	mov	bh, 0
	mov	bl, [txtatt]
	mov	cx, 1
	int	10h

	pop	bp
	retn	2


txtcl:
	push	bp
	mov	bp, sp

	mov	ah, [bp+4]		;save new color attrib
	mov	al, [txtatt]		;save current atrib

	shr	al, 4
	shl	al, 4			;discard old text color nibble
	xor	al, ah			;set color nibble  	
	mov	[txtatt], al

	pop	bp
	retn	2


txtbg:
	push	bp
	mov	bp, sp

	mov	ah, [bp+4]		;save new color attrib
	shl	ah, 4			;move LO nibble to HO nibble
	mov	al, [txtatt]		;save current atrib

	shl	al, 4
	shr	al, 4			;discard old bg color bits nibble
	xor	al, ah			;set new bg nibble
	mov	[txtatt], al

	pop	bp
	retn	2


getxy:
	push	bp
	mov	bp, sp

	mov	ah, 03h
	mov	bh, 0
	int	10h

	mov	si, [bp+6]
	mov	byte [si], dl
	mov	si, [bp+4]
	mov	byte [si], dh

	pop	bp
	retn	4


setxy:
	push	bp
	mov	bp, sp

	mov	ah, 02h
	mov	bh, 0
	mov	dh, byte [bp+4]
	mov	dl, byte [bp+6]
	int	10h

	pop	bp
	retn	4


input:
	push	bp
	mov	bp, sp
	mov	si, [bp+4]
.loop:
	mov	ah, 00h
	int	16h

	cmp	al, 1Bh		;if ESC key
	je	.loop
	cmp	al, 09h		;if TAB key
	je	.loop	
	cmp	al, 4800h	;if UP ARROW key
	je	.loop
	cmp	al, 4B00h	;if LEFT ARROW key
	je	.loop
	cmp	al, 5000h	;if DOWN ARROW key
	je	.loop
	cmp	al, 4D00h	;if RIGHT ARROW key
	je	.loop
	cmp	al, 08h		;if BS key
	je	.back_one
	cmp	al, 0Dh		;if RETURN key
	je	.end

	mov	ah, 0Eh
	mov	al, al
	xor	bx, bx
	int	10h

	mov	[si], al
	inc	si

	jmp	.loop
.back_one:
	cmp	byte [si-1], 0
	je	.loop

	mov	ah, 0Eh
	mov	al, al
	xor	bx, bx
	int	10h

	mov	ah, 0Ah
	mov	al, ' '
	xor	bx, bx
	mov	cx, 1
	int	10h

	dec	si
	mov	byte [si], 0

	jmp	.loop
.end:
	mov	byte [si], 0
	pop	bp
	retn	2


getch:
	mov	ah, 00h
	int	16h
	retn


getchar:
	push	bp
	mov	bp, sp
	mov	ah, 00h
	int	16h
	mov	si, [bp+4]
	mov	[si+0], al
	mov	ah, 0Eh
	mov	al, al
	xor	bx, bx
	int	10h
	pop	bp
	retn	2


putch:
	push	bp
	mov	bp, sp
	mov	ah, 0Ah
	mov	al, [bp+4]
	xor	bx, bx
	mov	cx, 1	
	int	10h
	pop	bp
	retn	2


putchar:
	push	bp
	mov	bp, sp

	mov	ah, 0Eh
	mov	al, [bp+4]
	xor	bx, bx
	int	10h
	pop	bp
	retn	2


print:
	push	bp
	mov	bp, sp
	mov	si, [bp+4]
.loop:
	cmp	byte [si], 0
	je	.end
	mov	ah, 0Eh
	mov	al, [si]
	xor	bx, bx
	int	10h
	inc	si
	jmp	.loop
.end:
	pop	bp
	retn	2

%endif	;_IO

NASM also have many great tutorials around the web, there's some:

NASM Manual
PC Assembly Language


And finally, there's also an operating system build purely with NASM code ! named dynatOS, take a look:

Latest News - The DynatOS Project


Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
asm, assembler



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ FAQ: Read this before you post! v0id C and C++ 7 08-05-2008 01:08 PM
Newbe C# Platform question cob98tp C# Programming 28 07-30-2008 09:01 AM
Question johnny The Lounge 3 03-17-2008 08:08 AM
n00b class question MerakSpielman C and C++ 15 02-20-2008 11:37 PM
Majoring in Computer Science, got a question shimmy General Programming 7 02-03-2008 12:09 PM


All times are GMT -5. The time now is 01:09 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads