|
-
Aug 19th, 2000, 11:17 PM
#1
Thread Starter
Lively Member
I have MASM32. It seems to be pretty good. Go to this site for compilers and tutorials. By the way, could you send me the code that you used to open/close your cd drive? Thanks.
-
Aug 19th, 2000, 11:41 PM
#2
Thank you very much
-
Aug 20th, 2000, 07:28 PM
#3
Fanatic Member
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Aug 20th, 2000, 07:45 PM
#4
damn, I dont know why I didnt ever try that URL before 
BTW Thanks!
[Edited by denniswrenn on 08-20-2000 at 08:48 PM]
-
Aug 21st, 2000, 09:00 AM
#5
-
Aug 21st, 2000, 09:56 PM
#6
Fanatic Member
Yeah, I've been through that one.
I tend to find that you're better of with a book when it comes to ASM. (not that I'm an experienced ASM programmer) I also find that books cover the topic in much more depth and that has been very important to me so far in learning ASM.
I got this book...
http://www.amazon.com/exec/obidos/AS...470099-9752032
[Edited by Paul282 on 08-21-2000 at 10:59 PM]
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Aug 22nd, 2000, 03:10 AM
#7
Thread Starter
Lively Member
$73.00?!?!?! Jeez!! That's way too much for me!
-
Aug 22nd, 2000, 04:09 AM
#8
Fanatic Member
I'm always happy to spend money on books. Net tutorials are good but if I buy a book I'm more inclined to sit down and actually learn the topic in depth.
Sort of like an investment in myself, the payback comes when I ask for twice as much in my next job :-)
It's worked well so far anyway, I'm not 30 yet, I didn't even finish school let alone go to college and I earn over US$100k a year in the IT industry!
I have a problem with modesty though 
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Aug 22nd, 2000, 08:34 AM
#9
Fanatic Member
It shines through like a supernova
-
Aug 22nd, 2000, 08:59 AM
#10
Fanatic Member

can't even blame alcohol for that comment!
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Aug 26th, 2000, 04:15 AM
#11
Fanatic Member
I'm posting this here, because it's such a petty question it isn't worthy of a new thread:
Could somebody post just a little source code (ASM), because I'm really interested to see what it look like.
Thyroid.
-
Aug 26th, 2000, 06:17 AM
#12
Monday Morning Lunatic
From the MASM32 website:
Code:
; #########################################################################
.386
.model flat, stdcall
option casemap :none ; case sensitive
; #########################################################################
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
; #########################################################################
;=============
; Local macros
;=============
szText MACRO Name, Text:VARARG
LOCAL lbl
jmp lbl
Name db Text,0
lbl:
ENDM
m2m MACRO M1, M2
push M2
pop M1
ENDM
return MACRO arg
mov eax, arg
ret
ENDM
;=================
; Local prototypes
;=================
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
TopXY PROTO :DWORD,:DWORD
.data
szDisplayName db "Template",0
CommandLine dd 0
hWnd dd 0
hInstance dd 0
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke GetCommandLine
mov CommandLine, eax
invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
invoke ExitProcess,eax
; #########################################################################
WinMain proc hInst :DWORD,
hPrevInst :DWORD,
CmdLine :DWORD,
CmdShow :DWORD
;====================
; Put LOCALs on stack
;====================
LOCAL wc :WNDCLASSEX
LOCAL msg :MSG
LOCAL Wwd :DWORD
LOCAL Wht :DWORD
LOCAL Wtx :DWORD
LOCAL Wty :DWORD
;==================================================
; Fill WNDCLASSEX structure with required variables
;==================================================
mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW \
or CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc, offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
m2m wc.hInstance, hInst
mov wc.hbrBackground, COLOR_BTNFACE+1
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset szClassName
invoke LoadIcon,hInst,500 ; icon ID
mov wc.hIcon, eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor, eax
mov wc.hIconSm, 0
invoke RegisterClassEx, ADDR wc
;================================
; Centre window at following size
;================================
mov Wwd, 500
mov Wht, 350
invoke GetSystemMetrics,SM_CXSCREEN
invoke TopXY,Wwd,eax
mov Wtx, eax
invoke GetSystemMetrics,SM_CYSCREEN
invoke TopXY,Wht,eax
mov Wty, eax
szText szClassName,"Template_Class"
invoke CreateWindowEx,WS_EX_OVERLAPPEDWINDOW,
ADDR szClassName,
ADDR szDisplayName,
WS_OVERLAPPEDWINDOW,
Wtx,Wty,Wwd,Wht,
NULL,NULL,
hInst,NULL
mov hWnd,eax
invoke LoadMenu,hInst,600 ; menu ID
invoke SetMenu,hWnd,eax
invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd
;===================================
; Loop until PostQuitMessage is sent
;===================================
StartLoop:
invoke GetMessage,ADDR msg,NULL,0,0
cmp eax, 0
je ExitLoop
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
jmp StartLoop
ExitLoop:
return msg.wParam
WinMain endp
; #########################################################################
WndProc proc hWin :DWORD,
uMsg :DWORD,
wParam :DWORD,
lParam :DWORD
.if uMsg == WM_COMMAND
;======== menu commands ========
.if wParam == 1000
invoke SendMessage,hWin,WM_SYSCOMMAND,SC_CLOSE,NULL
.elseif wParam == 1900
szText TheMsg,"Assembler, Pure & Simple"
invoke MessageBox,hWin,ADDR TheMsg,ADDR szDisplayName,MB_OK
.endif
;====== end menu commands ======
.elseif uMsg == WM_CLOSE
szText TheText,"Please Confirm Exit"
invoke MessageBox,hWin,ADDR TheText,ADDR szDisplayName,MB_YESNO
.if eax == IDNO
return 0
.endif
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage,NULL
return 0
.endif
invoke DefWindowProc,hWin,uMsg,wParam,lParam
ret
WndProc endp
; ########################################################################
TopXY proc wDim:DWORD, sDim:DWORD
shr sDim, 1 ; divide screen dimension by 2
shr wDim, 1 ; divide window dimension by 2
mov eax, wDim ; copy window dimension into eax
sub sDim, eax ; sub half win dimension from half screen dimension
return sDim
TopXY endp
; ########################################################################
end start
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 26th, 2000, 09:40 AM
#13
Fanatic Member
Hmmm. It's not as harsh as I thought it would be.
Thanks, parksie.
-
Aug 26th, 2000, 12:33 PM
#14
Monday Morning Lunatic
Having started to learn this morning, I can confidently say that it is definitely not as hard as people say.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 26th, 2000, 02:02 PM
#15
Fanatic Member
Yeah, I was expecting something where you had to intercept all the mouse messaages and keyboard messages, and you had to create the window yourself and set the pixels yourself. It just seems like a primitive C++, though.
-
Aug 26th, 2000, 04:41 PM
#16
Monday Morning Lunatic
Not really. You do need to set up a window procedure and all that, but a basic program in C++ takes up about 25K, and that program I gave assembles into 5K, and uses NO DLLs WHATSOEVER. Also, when doing asm, you can optimise it by hand by method, because there are new, more efficient ways to do certain algorithms.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 27th, 2000, 06:26 AM
#17
Fanatic Member
bit of a reality check though. That's MASM32! which has quite a bit added to make it easier. to actually write your own code you'd need a better understanding of ASM in it's normal form.
Here's hello world
Code:
title Hello World Program (hello.asm)
; This program displays "Hello, world!"
.model small
.stack 100h
.data
message db "Hello, world!",0dh,0ah,'$'
.code
main proc
mov ax,@data
mov ds,ax
mov ah,9
mov dx,offset message
int 21h
mov ax,4C00h
int 21h
main endp
end main
There is a lot to learn before you can really start. Don't get me wrong, what you learn about CPU's, registers and memory is valuable in any language. But you'd need to know basic ASM syntax before you used MASM32.
You should be able to look at the above code and see it is only using 16 bit registers.
Int 21h is a dos interrupt, but other than that you'd need understanding of the AX, DS and quite a few other register's functions. I've only been in this for a few months and have hardly written anything, but it's fascinating. The commands are one for one based on machine code!
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Aug 27th, 2000, 06:29 AM
#18
Monday Morning Lunatic
Paul - thanks for that, I needed some example code to do this. Why is the string terminated with a '$' not '\0'?
Also, when you write your program, do you need to worry about the register state before or after your program runs?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 1st, 2003, 04:13 PM
#19
Fanatic Member
The string is terminated with a '$' because INT 21h function 09h stops displaying characters once a '$' is reached.
I really don't think you have to worry about register states before and after your application runs.
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|