Advertisement

05.03.2008 at 03:02PM PDT, ID: 23374307 | Points: 500
[x]
Attachment Details

Assembly Program to convert to any base

Tags: base, convert, assembly, any, program
Can you tell me what needs to be changed in the program in order to run? Thank you.


.model small
.386
.stack 100h
.data
.code


decimal                  proc            near

;print out number given in AX in decimal

                  xor            eax,eax
                  xor            ebx,ebx
                  mov            cx,2            ;this is to accept the base and the decimal value
                  
newchar:            
                  cmp            cx,0
                  jle            startConvert
                  dec            cx
                  mov            ah,1            ;This sets up to accept another input from keyboard
                  int            21h            ;this asks for an input and stores it in al
                  
                  ;mov            al,0h            ;This sets up to accept another input from keyboard
                  ;int            21h            ;this asks for an input and stores it in al
                  ;push            ax            ;stores the second input from keyboard
                  
                  
                  
                  sub            al,30h
                  jl            stloop            ;jumps if negative
                  cmp            al,9h
                  jg            stloop            ;jumps if greater than
                  
                  xor            ah,ah            ;to get only the digit they type
                  push            ax            ;this stores the first input from the keyboard
                  
                  cbw                        ;convert byte to word
                  ;jmp            newchar            ;to accept multiple digits

stloop:                  
                  mov            ah,2
                  mov            dl,0ah
                  int            21h            ;This section inserts a carrige return
                  mov            dl,0dh
                  int            21h
                  
                  
startConvert:            pop            bx
                  push            ax            ;given to routine to print out
                  ;push            bx
                  push            cx
                  push            dx
                  
                  mov            cx,0            ;starts a counter for the number of digits
                  ;mov            bx,10            ;base 10 conversion THIS IS THE LINE TO CHANGE FOR DIFFERENT BASES!!!!
                  
nonzero:            
                  xor            dx,dx            ;same as mov dx,0
                  div            bx
                  push            dx            ;this is the remainder of the divider
                  inc            cx            ;this will help determine the number of digits produced
                  or            ax,ax            ;sets flags to check is ax = 0
                  jne            nonzero            ;jump not equal to

write:                  
                  pop            dx            ;gets deciaml digit from stack
                  add            dl,'0'      ;ascii value of 30h THIS ALSO NEEDS TO CHANGES FOR DIFFERENT BASES!!! (what are the values for octal and binary - HELP)
                  mov            ah,2
                  int            21h
                  loop            write            ;loops number of times in cx, which is the number of digits
                  pop            dx
                  pop            cx
                  pop            bx
                  pop            ax
                  ret
decimal                  endp
                  end decimal
                  
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: RandR-bg
Question Asked On: 05.03.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.05.2008 at 02:19AM PDT, ID: 21498832

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.05.2008 at 02:19AM PDT, ID: 21498832

Rank: Master

Where does the code go wrong ? Any information you can give will aid us greatly !
 
 
20080236-EE-VQP-29 / EE_QW_Related_20080208