WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
 

What is wrong with shr AL, 4 line ?, Compiling error that I don't understand why

VictorM
Quote Post


New Member
*

Group: Members
Posts: 8
Member No.: 52284
Joined: 21-June 12


Getting this error and I am using the latest download from MASM32 6.14.8444 and same for WinASM 5.1.5.5. According to most assembly sites the line below should work or is acceptable. Can anyone explain why the compiler is giving an error ?

Thanks in advance

C:\masm32\bin\ML /c /I"C:\masm32\include" "E:\DEVS\Projects\Assembly\DosExe\DosExe-8.asm"

Microsoft ® Macro Assembler Version 6.14.8444
Copyright © Microsoft Corp 1981-1997. All rights reserved.

Assembling: E:\DEVS\Projects\Assembly\DosExe\DosExe-8.asm
E:\DEVS\Projects\Assembly\DosExe\DosExe-8.asm(41) : error A2070: invalid instruction operands

Make finished. 1 error(s) occured

CODE

; A 16-bit DOS program that receives a character from STDIN and then proceeds to; print out the HEX value of the input character out to STDOUT


.MODEL small
.STACK 100h

.DATA

out_msg1   DB   'Please input a character: ','$'
out_msg2   DB          0DH, 0AH, '$'
out_msg3    DB   'The hex value of the character entered is:  ', '$'
   

.CODE
START:

mov  AX, @DATA ; Get the address of the data segment
mov  DS, AX  ; Set the DS segment
   
mov  DX, OFFSET out_msg1; Get the address of our message in the DX
mov  AH, 09H  ; Function 09h in AH means "WRITE STRING

int  21H   ; Call the DOS interrupt (DOS function call)
mov      AH, 01H  ; Get a character from the user. AL contains

       int      21H   ; after interrupt instruction

mov  DX, OFFSET out_msg2; Send CR and LF to STDOUT
mov  AH,09H  ; Function 09h in AH means "WRITE STRING
int  21H   ; Call the DOS interrupt (DOS function call)

mov  DX, OFFSET out_msg3; Send final output string to STDOUT  
mov  AH, 09H  ; Function 09h in AH means "WRITE STRING
int  21H   ; Call the DOS interrupt (DOS function cal

       mov  CX, 2  ; Loop 2 times for 2 HEX digits
mov  BL, AL  ; Move AL into BL for safe keeping

shr      AL, 4   ; Shift highest nibble to the right

start_hex_conversion:

cmp  AL, 9   ; Check if value is greater then 9
jg  A_To_F  ; Jump to A_To_F conversion

add  AL, '0'  ; Convert our 0-9 value to its CHAR
jmp  skip   ; Jump to print converted HEX digit
     
A_To_F:

add  AL, 'A' - 10 ; Conversion of Alpha digit to its CHAR equivalent

skip:      
mov      DL, AL  ; Print out our converted HEX value
mov      AH, 02h
       int      21h

mov  BL, AL  ; Get our saved AL value in BL move to AL

       loop  start_hex_conversion
         
       mov  AX, 4C00h  ; the exit fuction  [4C+no error (00)]
int  21H   ; call DOS interrupt 21h

END START

Sponsored Links
PMEmail Poster
Top
shoorick
Quote Post


Extremely Active Member
******

Group: Admins
Posts: 2309
Member No.: 160
Joined: 22-June 04


it is unsupported value for 8086. put ".286" at the start of code. refer to "opcodes.hlp" in masm32 package when unsure.
PMEmail PosterUsers Website
Top
VictorM
Quote Post


New Member
*

Group: Members
Posts: 8
Member No.: 52284
Joined: 21-June 12


QUOTE (shoorick @ Jun 24 2012, 09:21 PM)
it is unsupported value for 8086. put ".286" at the start of code. refer to "opcodes.hlp" in masm32 package when unsure.

Thanks that worked !! After taking your suggestion I could not find any help topics related to .286 directive.
PMEmail Poster
Top
shoorick
Quote Post


Extremely Active Member
******

Group: Admins
Posts: 2309
Member No.: 160
Joined: 22-June 04


PMEmail PosterUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google