超出范围

时间:2018-05-02 09:50:09

标签: assembly x86 x86-16 tasm

我正在开展有关大学考试的装配项目。它是在8086处理器上使用Tasm 4.1的科学计算器应用程序。

我面临的问题是跳跃超出范围。我试图在互联网上找到一个解决方案,并尝试了多种方法来处理它,但没有一个工作。

最后,当我尝试将.386放入我的程序时它确实解决了问题,但现在我面临计算问题,所以请帮我解决这个问题......

这是我的代码。

  PRINT MACRO MSG
  LEA DX,MSG
  MOV AH,09H
  INT 21H
  ENDM     

  READ MACRO N,J1,J2
  J1: MOV AH,01H
  INT 21H
  CMP AL,0DH
  JE J2
  SUB AL,30H
  MOV BL,AL
  MOV AX,N
  MOV DX,0AH
  MUL DX
  XOR BH,BH
  ADD AX,BX
  MOV N,AX
  JMP J1
  J2: NOP
  ENDM     

  PRINTMUL MACRO N1,L2,L3
  MOV BX,000AH
  MOV AX,N1
  XOR CX,CX 

  L2: XOR DX,DX
  DIV BX
  PUSH DX
  INC CX
  CMP AX,0000H
  JNE L2      
  L3: POP DX
  ADD DL,30H
  MOV AH,02H
  INT 21H
  LOOP L3
  ENDM  


  intro macro
  print msg1
  nw_line
  print msg2
  nw_line
  print msg3
  nw_line
  print msg4
  endm

  nw_line macro
  mov dl,0ah
  mov ah,02
  int 21h
  endm

  addm macro
  PRINT MS
  READ N,U1,U2

  PRINT MT 
  READ M,G1,G2 

  PRINT ANS 
  MOV AX,N       
  ADD M,Ax

  PRINTMUL AX,H1,J5 
  endm

  square macro
  endm

  cube macro

  endm

  divm macro

  endm

  kill macro
  mov ah,4ch
  int 21h
  endm

  .model large
  .stack 100h
  .data
  wrg db 13,10,"Wrong Choice ","$"
  ch0 db 'Press Keys for the below Operations:$'
  ch1 DB 13,10,"1 For Addition ","$"
  ch2 DB 13,10,"2 For Subtraction ","$"
  ch3 DB 13,10,"3 For Multiplication ","$"
  ch4 DB 13,10,"4 For Division ","$"
  ch5 DB 13,10,"5 For Square of a Number ","$"
  ch6 DB 13,10,"6 For Cube of a Number ","$"
  choice db ?
  msg1 db ' ___________________________________________________$'
  msg2 db '|            Scientific Calculator               |$'
  msg3 db '|    By kABIR kHAN & Muneeb Ur Rehman        |$'
  msg4 db '|___________________________________________________|$'
  MS DB 13,10,"INPUT FIRST NUMBER: ","$"
  MT DB 13,10,"INPUT SECOND NUMBER: ","$"  
  MF DB 13,10,"INPUT NUMBER: ","$"
  ANS DB 10,13,"RESULT IS : $"
  N DW ?
  M DW ?
  .code
  start:
  mov ax,@data
  mov ds,ax

  intro
  nw_line
  nw_line
  print ch0
  print ch1

  print ch2
  print ch3

  print ch4
  print ch5
  print ch6
  nw_line

  mov ah,01
  int 21h
  mov choice,al

  nw_line
  cmp choice,31h
  je addition

  cmp choice,32h
  je subtraction

  cmp choice,33h
  je multi

  cmp choice,34h
  je division

  cmp choice,35h
  je squ


  cmp choice,36h
  jmp cue


  addition:
  addm
  loop addition

  subtraction:
  loop subtraction

  multi:
  loop multi

  division:
  divm
  loop division

  squ:
  square
  loop squ

  cue:
  cube
  loop cue


  kill
  end start

0 个答案:

没有答案