flat assembler
Message board for the users of flat assembler.

Index > DOS > made my first Code [resolved]

Author
Thread Post new topic Reply to topic
packet_50071



Joined: 31 Oct 2007
Posts: 15
packet_50071 02 Nov 2007, 23:24
this is my code
Code:
Ary db 123,145,143,146,0

lea ecx,[Ary]

startl:
mov eax,[ecx]
cmp eax,0
je quit
cmp ebx,eax
jle startl
mov ebx,eax
inc ecx
jmp startl

quit:
mov ax,4C00h
int 21h
    


I want to check if it works - i want it to show the highest value [which is in the ebx --- I hope]

Any help would be great Smile


Last edited by packet_50071 on 03 Nov 2007, 18:59; edited 1 time in total
Post 02 Nov 2007, 23:24
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 03 Nov 2007, 01:55
Some brief comments:
Code:
startl:
mov eax,[ecx]  ; Ary is bytes, but you load DWORD!
cmp eax,0
je quit
cmp ebx,eax      ; what is in EBX the first time?!
jle startl ; this will loop, but ECX hasn't been changed
mov ebx,eax
inc ecx                ; this should be in innerloop
jmp startl

quit:
mov ax,4C00h
int 21h    
This looks like DOS code - should be posted in the DOS section, imho.
Post 03 Nov 2007, 01:55
View user's profile Send private message Visit poster's website Reply with quote
packet_50071



Joined: 31 Oct 2007
Posts: 15
packet_50071 03 Nov 2007, 16:06
Code:
mov eax,[ecx]   ; Ary is bytes, but you load DWORD!     


How do I load the byte !

Should I repost this in DOS !
Post 03 Nov 2007, 16:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 03 Nov 2007, 16:30
use byte-sized register:
Code:
mov al, [ecx]
mov bh, [ecx]
    
Post 03 Nov 2007, 16:30
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 03 Nov 2007, 17:40
I used DEBUG from DOS when I first moved to Intel land. Hopefully, there are better debuggers in DOS, but I don't know what is availible in that regard. A good debugger will allow you to program in memory and test as you go - interactively. I piped instruction from a batch file to 'compile' my programs. Smile

Ollydbg works well for this in Windows.

In a debugger you will see a representation of internal machine state to better understand what is happening with each instruction. This is a good start.
Post 03 Nov 2007, 17:40
View user's profile Send private message Visit poster's website Reply with quote
packet_50071



Joined: 31 Oct 2007
Posts: 15
packet_50071 03 Nov 2007, 18:50
Thx for the help Smile

I will stick with fasm for now - when I move to Windows I will use Visual studio
its a good debugger for Windows Wink

My working code Smile


Code:
org 100h

mov ah,2
lea ecx,[Ary]
mov dl,0

startl:
mov al,[ecx]

cmp al,0
je quit

inc ecx

cmp al,dl
jle startl

mov dl,al
jmp startl

quit:
int 21h
mov ax,4C00h
int 21h

Ary db 109,108,102,0       
Post 03 Nov 2007, 18:50
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 03 Nov 2007, 19:47
Here are some DOS tools:
http://www.japheth.de/
Post 03 Nov 2007, 19:47
View user's profile Send private message Visit poster's website Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth 04 Nov 2007, 08:36
For such a simple program DEBUG is good enough:

http://www.japheth.de/Download/debug107.zip


David Lindauer has coded GRDB, which also has the nice and superior DEBUG interface + some goodies:

http://members.tripod.com/~ladsoft/grdb.htm


For those loving warm showers, there are fullscreen debuggers available as well:

http://www.bttr-software.de/products/insight/
http://www.programmersheaven.com/download/21643/download.aspx
Post 04 Nov 2007, 08:36
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.