AOA Forums AOA Forums AOA Forums Folding For Team 45 AOA Files Home Front Page Become an AOA Subscriber! UserCP Calendar Memberlist FAQ Search Forum Home


Go Back   AOA Forums > Software > Programming and Assembly Language

Programming and Assembly Language Please read this Topic's rules!!


Reply
 
LinkBack Thread Tools Rate Thread
  #1 (permalink)  
Old 6th September, 2004, 05:41 AM
DigitalKnight's Avatar
Member
 
Join Date: October 2003
Location: Jefferson City, MO, USA
Posts: 99

80x86 Assembly Trouble.

I trying to write a simple assmebly program for a lab class and I can't seem to get it to work right. It'll store the string entered but it will not print it back you. The trouble maybe something simple that I just can't see right now, but I would like any help anyone can give. I'm going to bed, maybe after a nights sleep I can see what I am missing.

Thanks.

Code is as follows:

;PROGRAM 3 OF LAB 1
;FILENAME: INTRO3.ASM
;FILE FORMAT: EXE
PAGE 55,132
.386

STACK_SEG SEGMENT STACK USE16
DB 255 DUP(0)
STACK_SEG ENDS

DATA_SEG SEGMENT 'DATA' USE16
MESSAGE DB 'ECE4210/ECE7210 LAB1 PART 3',0DH,0AH
DB 'ENTER A STRING FROM KEYBORD: $'
OUTMSG DB 0DH,0AH,'THE STRING YOU JUST ENTERED IS: $'
INCHAR DB 255,255 DUP(0)
NEWLINE DB 0DH,0AH,'$'
DATA_SEG ENDS

CODE_SEG SEGMENT PARA 'CODE' PUBLIC USE16
ASSUME CS:CODE_SEG, DSATA_SEG, SS:STACK_SEG

MAIN PROC FAR
PUSH DS ;INITIATE THE PROGRAM
XOR AX,AX
PUSH AX
MOV AX,DATA_SEG
MOV DS,AX

LEA DX,MESSAGE ;PRINT MESSAGE
MOV AH,9
INT 21H

LEA DX,INCHAR
MOV AH,0AH ;READ A STRING
INT 21H

LEA DX,OUTMSG ;PRINT A MESSAGE
MOV AH,09H
INT 21H

LEA DX,INCHAR ;OUTPUT THE CHARACTER TO THE SCREEN
MOV AH,09H
INT 21H

MOV DX,OFFSET NEWLINE
MOV AH,9 ;MOVE CURSOR TO NEXT LINE
INT 21H

RET
MAIN ENDP
CODE_SEG ENDS
END MAIN
__________________
No matter how big you are, there are always bigger fish...

Main Rig: - Down
Proc: P4 2.66 Ghz Mobo: MSI MS-6701 RAM: 768 Mb DDR333 Video Card: GeForce4 Ti 4200 OS: Windows XP SP2 / Mandrake Linux 9.0
Laptop:
Proc: P4 3.06 Ghz RAM: 1280 Mb DDR400 Video Card: ATI Radion Mobility 9000 OS: Windows XP SP2

AOA Team fah
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 6th September, 2004, 05:52 AM
robbie's Avatar
AOA Staff
 
Join Date: November 2001
Location: Out in the desert of Ca.
Posts: 12,548
Send a message via AIM to robbie Send a message via MSN to robbie Send a message via Yahoo to robbie Send a message via Skype™ to robbie

It's been about 9 years since I've done assembly, sorry I can't be more help. I'm sure one of our guru's will chime in soon enough.
Rob
__________________
Taking each day as it comes
Grow, learn and OVERCLOCK. Need help?? Ask me.
Your Mommy!! (Aug/02) Welcome to the fold.
Buy it, Sell it, or Trade it in the AoA classifieds!!
AOA Team fah
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 6th September, 2004, 07:05 AM
Gizmo's Avatar
Chief BBS Administrator
BassTeroids Champion, Global Player Champion, Aim & Fire Champion, Puzzle Maniax Champion, Othello Champion, Canyon Glider Champion, Unicycle Challenge Champion, YetiSports 9: Final Spit Champion, Zed Champion
 
Join Date: May 2003
Location: Webb City, Mo
Posts: 16,178
Send a message via ICQ to Gizmo Send a message via AIM to Gizmo Send a message via MSN to Gizmo Send a message via Yahoo to Gizmo Send a message via Skype™ to Gizmo

I believe your problem is that you are trying to print the string pointed at by MESSAGE, but that string is not terminated by the '$' symbol. As a consequence, your subsequent calls to int 21 don't do anything useful. But that is just a guess. It's been quite some time since I messed with x86 assembly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 8th September, 2004, 12:07 AM
Kaitain's Avatar
Member
Mars Rover Champion, Joust Champion
 
Join Date: September 2001
Location: MK10, UK.
Posts: 4,372
Send a message via MSN to Kaitain Send a message via Skype™ to Kaitain

On a barely related matter, is there an x86 chip simulator or similar? The only assembly I've ever done is for a teeny 8 bit controller that can be modelled entirely in software.
__________________
It is by coffee alone I set my mind in motion...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 24th September, 2004, 03:23 AM
DimViesel's Avatar
Member
 
Join Date: April 2003
Location: Earth
Posts: 517

I can see the problem...
You seem to have overlooked a smilie in the listing on the line which begins:
ASSUME CS:CODE_SEG, DSATA_SEG, SS:STACK_SEG
(Line 18 from the top of the listing)
The compiler will attempt to take this code & will give erratic output due to the smilie...

(yes I know... I'll get me coat...)
On a serious note - if you are working on a self developed algorithm after working on it for considerable amounts of time you being to see not what it actually is... I used to pass my listings to someone else who had a nack for seeing the 'obvious mistake' that was just not eviendent to myself... I believe it is because when you are concerning yourself with bringing to existance the machanics of the algorithm you cannot read it literally - which is the mode of reading that will bring to your attention the 'typos' or logical errors to you.
__________________
Searched near & far across networked lands for a sig. that would do.
I searched thorough, & wide, for a signature just right,
I explored far & wide, blocked by lulling tide, all I found was you.
Needless to impart,
I want my money back...

Last edited by DimViesel; 24th September, 2004 at 03:37 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 7th October, 2004, 11:54 PM
Kaitain's Avatar
Member
Mars Rover Champion, Joust Champion
 
Join Date: September 2001
Location: MK10, UK.
Posts: 4,372
Send a message via MSN to Kaitain Send a message via Skype™ to Kaitain

Quote:
Originally Posted by gizmo
I believe your problem is that you are trying to print the string pointed at by MESSAGE, but that string is not terminated by the '$' symbol. As a consequence, your subsequent calls to int 21 don't do anything useful. But that is just a guess. It's been quite some time since I messed with x86 assembly.
Ya you're right. x86 assembly keeps me sane while Excel is updating cells (yes, really, it is that bad). At least in NASM, losing the $ from the end of the "MESSAGE DB 'ECE4210/ECE7210 LAB1 PART 3',0DH,0AH" line causes it to stall there.
__________________
It is by coffee alone I set my mind in motion...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 8th October, 2004, 04:34 AM
Gizmo's Avatar
Chief BBS Administrator
BassTeroids Champion, Global Player Champion, Aim & Fire Champion, Puzzle Maniax Champion, Othello Champion, Canyon Glider Champion, Unicycle Challenge Champion, YetiSports 9: Final Spit Champion, Zed Champion
 
Join Date: May 2003
Location: Webb City, Mo
Posts: 16,178
Send a message via ICQ to Gizmo Send a message via AIM to Gizmo Send a message via MSN to Gizmo Send a message via Yahoo to Gizmo Send a message via Skype™ to Gizmo

Quote:
Originally Posted by Kaitain
Ya you're right. x86 assembly keeps me sane while Excel is updating cells (yes, really, it is that bad). At least in NASM, losing the $ from the end of the "MESSAGE DB 'ECE4210/ECE7210 LAB1 PART 3',0DH,0AH" line causes it to stall there.
Dude, now that is truly sad.

Try assembly on a sane architecture, like the 68k, or even Z80.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 8th October, 2004, 06:20 AM
DimViesel's Avatar
Member
 
Join Date: April 2003
Location: Earth
Posts: 517

Yeah 68k - that is the way to go, or Zilogs are pretty neat too
I don't even have to go with an emulator if I do not wish to - my grandmother has a brand new unopened Z80 based machine & I have 4 Amiga machines:
68000, 68020 & 68030 CPUs respectively.
All OC'd of course

(Not.)
__________________
Searched near & far across networked lands for a sig. that would do.
I searched thorough, & wide, for a signature just right,
I explored far & wide, blocked by lulling tide, all I found was you.
Needless to impart,
I want my money back...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 8th October, 2004, 08:26 AM
Kaitain's Avatar
Member
Mars Rover Champion, Joust Champion
 
Join Date: September 2001
Location: MK10, UK.
Posts: 4,372
Send a message via MSN to Kaitain Send a message via Skype™ to Kaitain

Yeah well unfortunately I don't have a monitor capable of handling the range of screen modes my '030 accelerated A1200 can produce. I think I left it last using the VGA screenmode so that a normal PC monitor can handle it. Since the most reliable machines I have are x86-based (sad but true) and the limits of my prior knowledge are Intel 8bit controllers, the x86 is the easiest logical progression.

Unless I want to learn the pseudo-assembly required for a Core War
__________________
It is by coffee alone I set my mind in motion...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 8th October, 2004, 08:37 AM
DimViesel's Avatar
Member
 
Join Date: April 2003
Location: Earth
Posts: 517

Heh I'm sure you will miss the raw power of your 25MHz '030 A1200.

What really brought home how obsolete the hardware performance of these machines is, was when I looked at my £20 cable router & saw that it ran @ 40MHz (Amiga 68040 anyone?) & had 4MB of RAM (double that of the std. A1200).

If we want to exorcise any remainingCBM nostalgia I propose it should have a thread of its own.
__________________
Searched near & far across networked lands for a sig. that would do.
I searched thorough, & wide, for a signature just right,
I explored far & wide, blocked by lulling tide, all I found was you.
Needless to impart,
I want my money back...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 23rd October, 2004, 02:33 PM
barneygumble742's Avatar
Member
 
Join Date: June 2003
Posts: 397
Send a message via AIM to barneygumble742 Send a message via Yahoo to barneygumble742

Quote:
Originally Posted by gizmo
Try assembly on a sane architecture, like the 68k, or even Z80.
Ditto!
__________________
Core 2 Quad Q9300 @ 2.50GHz
GTX 260
2GB RAM
32in + 24in LCD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why program in Assembly!? Garfield Programming and Assembly Language 61 4th October, 2012 11:55 AM
Oh God! I'm in big trouble! mookydooky Mookydooky's Just for laughs! 0 14th August, 2002 02:25 AM
The Assembly Language Garfield Random Nonsense! 16 7th August, 2002 09:24 PM
Assembly Programmers Garfield Programming and Assembly Language 13 29th June, 2002 02:37 AM


All times are GMT +1. The time now is 07:17 AM.


Copyright ©2001 - 2010, AOA Forums
Don't Click Here Don't Click Here Either

Search Engine Friendly URLs by vBSEO 3.3.0