p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Other Programming > Assembly Language
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Assembly Language section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 23rd, 2009, 04:29 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display with puthex help

I am trying to write a simple program to manipulate some values and display them at certain "checkpoints." I have the first checkpoint, checkpoint A, at the beginning of the program before anything has been moved, but I still am getting unexpected values in the output. Can someone please tell me where my mistake lies?


;================================================= ==
DOSSEG
.MODEL SMALL,BASIC
;================================================= ========

EXTRN PUTHEX:FAR
EXTRN PUTSTRNG:FAR ;DISPLAY CHARACTER STRING
EXTRN NEWLINE:FAR ;DISPLAY NEWLINE CHARACTER

;
; S T A C K S E G M E N T D E F I N I T I O N
;
.STACK 256
;================================================= ========
;
; D A T A S E G M E N T D E F I N I T I O N
;
.DATA
ALPHA DB 250
BETA DW 01ABH
GAMMA DW 45EFH
LAMDA DB CONSTANT
OMEGA DW 67CDH
CONSTANT EQU 10001001B
;
;================================================= ========
;
; C O D E S E G M E N T D E F I N I T I O N
;
.CODE
ASSUME DS:NOTHING,ES:DGROUP
PR_2_2:
MOV AX,DGROUP ;SET ES-REGISTER TO POINT TO
MOV ES,AX ;CONSTANT DATA SEGMENT
;*** CHECKPOINT A ***
MOV BL,0 ;CODE FOR 8 BIT
XCHG AL,ALPHA ;SWAP WITH AL
CALL PUTHEX ;DISPLAY AL IN HEX
XCHG AL,ALPHA ;RESTORE AL AND ALPHA TO PREVIOUS VALUES
CALL NEWLINE

MOV BL,1
XCHG AX,BETA
CALL PUTHEX
XCHG AX,BETA
CALL NEWLINE

MOV BL,1
XCHG AX,GAMMA
CALL PUTHEX
XCHG AX,GAMMA
CALL NEWLINE

MOV BL,0
XCHG AL,LAMDA
CALL PUTHEX
XCHG AL,LAMDA
CALL NEWLINE

MOV BL,1
XCHG AX,OMEGA
CALL PUTHEX
XCHG AX,OMEGA
CALL NEWLINE

MOV AH,CONSTANT
MOV AL,ALPHA
MOV BX,GAMMA
XCHG AH,BH
XCHG AX,BETA
MOV ALPHA,AH
MOV LAMDA,AL
;*** CHECKPOINT B ***
MOV BL,0 ;CODE FOR 8 BIT
XCHG AL,ALPHA ;SWAP WITH AL
CALL PUTHEX ;DISPLAY AL IN HEX
XCHG AL,ALPHA ;RESTORE AL AND ALPHA TO PREVIOUS VALUES
CALL NEWLINE

MOV BL,1
XCHG AX,BETA
CALL PUTHEX
XCHG AX,BETA
CALL NEWLINE

MOV BL,1
XCHG AX,GAMMA
CALL PUTHEX
XCHG AX,GAMMA
CALL NEWLINE

MOV BL,0
XCHG AL,LAMDA
CALL PUTHEX
XCHG AL,LAMDA
CALL NEWLINE

MOV BL,1
XCHG AX,OMEGA
CALL PUTHEX
XCHG AX,OMEGA
CALL NEWLINE


MOV CX,OMEGA
XCHG BL,CH
MOV GAMMA,BX
MOV OMEGA,CX
;*** CHECKPOINT C ***
MOV BL,0 ;CODE FOR 8 BIT
XCHG AL,ALPHA ;SWAP WITH AL
CALL PUTHEX ;DISPLAY AL IN HEX
XCHG AL,ALPHA ;RESTORE AL AND ALPHA TO PREVIOUS VALUES
CALL NEWLINE

MOV BL,1
XCHG AX,BETA
CALL PUTHEX
XCHG AX,BETA
CALL NEWLINE

MOV BL,1
XCHG AX,GAMMA
CALL PUTHEX
XCHG AX,GAMMA
CALL NEWLINE

MOV BL,0
XCHG AL,LAMDA
CALL PUTHEX
XCHG AL,LAMDA
CALL NEWLINE

MOV BL,1
XCHG AX,OMEGA
CALL PUTHEX
XCHG AX,OMEGA
CALL NEWLINE
.EXIT ;RETURN TO DOS

END PR_2_2

Last edited by humanic : September 24th, 2009 at 02:13 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Data Will Not Display When I Click On Display Button sprdave BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 7 March 13th, 2009 12:28 AM
display annumol Hibernate 1 March 21st, 2008 04:43 PM
Datagrid display Lovehead VB.NET 2002/2003 Basics 1 January 20th, 2007 05:12 PM
Display javaLös Java GUI 5 May 12th, 2005 01:29 PM
can't display syounger JSP Basics 3 February 12th, 2004 07:46 AM



All times are GMT -4. The time now is 04:45 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc