Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have to put the input to the line(Linea), rectangle(rectangulo), triangle(tr

ID: 3843060 • Letter: Y

Question

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

Explanation / Answer

#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;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote