Question

You have to put the input to the line(Linea), rectangle(rectangulo), triangle(triangulo) and circle(circulo) in assembly 8086...

You have to put the input to the line(Linea), rectangle(rectangulo), triangle(triangulo) and circle(circulo) in assembly 8086 please, Same as this code, add that input that I'm asking. Which user of the size and the area where the figure will be located on the screen.

.MODEL SMALL  

.STACK 100h

.DATA
   mensaje db 'Seleccione una opcion del siguiente Menu',13, 10
       db '1. Dibujar un Circulo', 13, 10
       db '2. Dibujar una Linea', 13, 10
       db '3. Dibujar un Rectangulo', 13, 10
       db '4. Dibujar un Triangulo', 13, 10
       db '5. Salir','$',13,10
   pideX db 'Entre la posicion en x',13,10
   pideY db 'Entre la posicion en y',13,10
   anchoL db 'Entre el largo de la linea',13,10
   ancho db 'Entre el ancho del rectangulo',13,10
   largo db 'Entre el largo',13,10
   triLar db 'Entre el largo del lado del triangulo',13,10
   rad db 'Entre el radio del circulo',13,10
   i dw 0
   j dw 0
   x dw 0
   xy dw 0
   xpos dw 100
   ypos dw 100
   length1 dw 50
   length2 dw 50
   TEMP DW 0000
    TEMP2 DW 0000
   TEMP3 DW 0000
    TEMP4 DW 0000

.CODE

jmp start


start:

MOV AX,@DATA
MOV DS,AX
mov ah,0
mov al,3h
int 10h

mov dx, offset mensaje
mov ah, 9
int 21h
jmp leeropcion

leeropcion:
mov ah, 00h
mov ah, 8h
int 21h

cmp al, 31h
je Circulo
cmp al, 32h
je Linea
cmp al, 33h
jne oofr2
jmp Rectangulo
oofr2: ; to avoid jump out of range
cmp al, 34h
jne oofr ; to avoid jump out of range
jmp Triangulo
oofr:
cmp al, 35h
jne oofr3
jmp forend
oofr3:


   jne leeropcion


Circulo:

   mov ah, 0
   mov al,13h
   int 10h

lin proc
mov ah,00h      ;set video mode
        mov al,12h      ;graphics 640x480
        int 10h

        ;draw a green color line
   mov cx, 0000h
   mov dx, 0000h
    mov cx, xpos    ;start from column xpos
   mov bx, length1
   mov temp,cx
   add temp,bx ;temp = length1 + xpos
        mov dx, ypos    ;
        mov ax, 0C02h   ;AH = 0ch and AL = pixel color green

    backlin:
   int 10h        ;draw a pixel
        inc cx          ;go to next column
        cmp cx,temp      ;check if column=xpos +length1
        jb backlin         ;if not reached column=xpos +length1, then continue
ret
lin endp

Linea:

        MOV AX,@DATA
        MOV DS,AX

        CALL lin

        MOV AX,0H ; PRESS ANY KEY
        INT 16H

        MOV AH,0H
        MOV AL,03H ; 80X25 16 COLOR TEXT MODE
        INT 10H
    

        jmp start

RECT PROC
        MOV AH,0H
        MOV AL,12H ; 640X480 16 COLOR VGA GRAPHIC MODE
        INT 10H

   mov cx, 0000h
   mov dx, 0000h
        MOV CX,length1
   mov temp,cx
        MOV DX,length2
   mov temp3,dx

   mov cx,xpos
   add temp,cx
   mov temp2,cx
   mov dx,ypos
   add temp3,dx
   mov temp4,dx
    

        MOV AX,0C02H ; TOP
BACK:
        INT 10H
        INC CX
        CMP CX,TEMP
        JNZ BACK

        MOV AX,0C02H ; RIGHT
BACK1:
        INT 10H
        INC DX
        CMP DX,TEMP3
        JNZ BACK1

        MOV AX,0C02H ; BOTTOM
BACK2:
        INT 10H
        DEC CX
        CMP CX,TEMP2
        JNZ BACK2

        MOV AX,0C02H ; LEFT
BACK3:
        INT 10H
        DEC DX
        CMP DX,TEMP4
        JNZ BACK3
RET
RECT ENDP
Rectangulo:

        MOV AX,@DATA
        MOV DS,AX

        CALL RECT

        MOV AX,0H ; PRESS ANY KEY
        INT 16H

        MOV AH,0H
        MOV AL,03H ; 80X25 16 COLOR TEXT MODE
        INT 10H

jmp start

tri PROC
        MOV AH,0H
        MOV AL,12H ; 640X480 16 COLOR VGA GRAPHIC MODE
        INT 10H

   mov cx,xpos    ; cx = xpos
   mov dx,ypos    ; dx = ypos
   mov bx, length1   ; bx = size of length1

   mov temp, bx   ;
   add temp, cx   ; temp = xpos+ length1
   mov temp2,bx   ; temp2 = length1
   mov temp3,bx
   add temp3,bx   ; temp3 = length1+ length1
   mov bx,0000    ; bx = 0
   mov temp4,dx   ; temp4 = ypos

        MOV AX,0C02H ; TOP
triBACK:
        INT 10H
        INC CX
   inc dx
        CMP CX,TEMP    ; write pixels until cx = temp = xpos + length1
        JNZ triBACK  

        MOV AX,0C02H ; RIGHT
triBACK1:
        INT 10H
        dec CX
   inc bx
        CMP bx,temp3 ; write pixels until bx = temp3 = length1 + length1
        JNZ triBACK1

        MOV AX,0C02H ; BOTTOM

triBACK2:
        INT 10H
        INC CX
        DEC DX
        CMP dx,TEMP4 ; write pixels until dx = temp4 = ypos
        JNZ triBACK2
RET
tri ENDP
Triangulo:

   MOV AX,@DATA
        MOV DS,AX

        CALL tri

        MOV AX,0H ; PRESS ANY KEY
        INT 16H

        MOV AH,0H
        MOV AL,03H ; 80X25 16 COLOR TEXT MODE
        INT 10H

jmp start

forend:
mov ah,07h      ;wait for key press to exit program
        int 21h

        pop ax          ;retrieve original video mode
        mov AH, 00h
        int 10h         ;restore original video mode

        mov ax, 4c00h   ;exit to dos function
        int 21h

end start

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
ifstream fin;
fin.open("Dimensions.txt");
double a, b, c;
fin>>a>>b>>c;
ofstream fout;
fout.open("Areas.txt");
double triangleArea = 0.5 * a * c;
double circleArea = 3.14159 * c * c;
double trapeziumArea = (a+b)/2*c;
double squareArea = b * b;
double rectangleArea = a * b;
fout<<"TRIANGULO: "<<fixed<<setprecision(3)<<triangleArea<<endl;
fout<<"CIRCULO: "<<fixed<<setprecision(3)<<circleArea<<endl;
fout<<"TRAPEZIO: "<<fixed<<setprecision(3)<<trapeziumArea<<endl;
fout<<"QUADRADO: "<<fixed<<setprecision(3)<<squareArea<<endl;
fout<<"RETANGULO: "<<fixed<<setprecision(3)<<rectangleArea<<endl;
}

Add a comment
Know the answer?
Add Answer to:
You have to put the input to the line(Linea), rectangle(rectangulo), triangle(triangulo) and circle(circulo) in assembly 8086...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help with a code in assembly language MASM (x86)

    write an assembly language (x86) program to input in a string 10 multi-digit integers and displays them in ascending order. Modify the code below to comply with the requirement..model small.stack 100h.datastrg1 DB 'Insert numbers: $'strg2 DB 'Sorted numbers: $'Arr Db 10 dup(?)v dw ?.codemain procmov ax,@datamov ds,axmov ah,9lea dx,strg1int 21hmov dl,0ahmov ah,2int 21h;inputsmov di,0mov cx,10Input_loop:mov ah,1int 21hmov arr[di],almov dl,0ahmov ah,2int 21hinc diloop Input_loopmov v,0sort:mov di,0mov cx,10sub cx,vB:mov al,Arr[di]cmp al,Arr[di+1]jng Cmov al,Arr[di]xchg al,Arr[di+1]mov Arr[di],alc:inc diloop Binc vcmp v,10jne sort;Outputmov ah,9lea dx,strg2int...

  • Analyze this assembly program (emu 8086) line by line! and explain the purpose of the program!...

    Analyze this assembly program (emu 8086) line by line! and explain the purpose of the program! PROGRAM: .model small .stack 100h .data    num1 db ?    num2 db ?    num3 db ?    MSG1 DB 10,13,"ENTER FIRST NUMBER : $"    MSG2 DB 10,13,"ENTER SECOND NUMBER: $"      MSG3 DB 10,13,"ENTER SECOND NUMBER: $"      MSG4 DB 10,13,"SMALLER NUMBER IS : $"    avg db ? ends .code .start    main proc        mov ax,data       ...

  • Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF...

    Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF = 1.    Give the new contents of AL after each of the following instructions is executed.    Assume the above initial conditions for each part of this question. a. SHL AL,1 b. SHR AL,1 c. ROL AL,2 d. ROR AL,3 e. SAR AL,2 f. RCL AL,1 g. RCR AL,3 B. Suppose EAX contain ABCDH.    Show the contents of BX and CX after...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT