Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a simple program in emu8086 that draws something on the screen that resembles a face, including two eyes and a mouth. You can use

Write a simple program in emu8086 that draws something on the screen that resembles a face, including two eyes and a mouth. You can use any colors you want.image text in transcribedimage text in transcribed

Couple of hints: Pixel offset from the base of video memory = x + SCREEN_WIDTH * y Try to start by writing a function drawDot that draws a square on the screen at a given (x,y) location. Use that function to make the eyes. You can make a basic mount with a straight flat line. Refer to the code example from 1/31 on the course website for how to set up video mode and draw graphics on the screen. 1 #fasm# ; this code is for flat assembler 3 SCREEN_WIDTH EQU 320 FRAME_BUFFER_SEGMENT EQU OXA000 DOT_SIZE EQU 5 5 8 org 100h ; set location counter to 100h 10 main: call vesaSetup ; video mode, no characters can be printed to the screen call drawDot ; Draw a dot for one eye... hlt 17 18 19 20 21 ; ; drawDot ; ; Draws a rectangular dot on the screen. Pass the (x,y) location of the dot ; either in the registers or on the stack. 22 23 drawDot: ret 27 28 29 ; ; vesaSetup ; Configures the BIOS video to 320x200 graphics mode vesasetup: mov ax, 19 int 16 ret ; declaring global variable, everyone can see it and they have to share all the variables 47 48 49 50 ; 1. bring xo into AX ;2. xl into BX ;3. ADD x+x1 add AX, BX ;4. put it back in memory Couple of hints: Pixel offset from the base of video memory = x + SCREEN_WIDTH * y Try to start by writing a function drawDot that draws a square on the screen at a given (x,y) location. Use that function to make the eyes. You can make a basic mount with a straight flat line. Refer to the code example from 1/31 on the course website for how to set up video mode and draw graphics on the screen. 1 #fasm# ; this code is for flat assembler 3 SCREEN_WIDTH EQU 320 FRAME_BUFFER_SEGMENT EQU OXA000 DOT_SIZE EQU 5 5 8 org 100h ; set location counter to 100h 10 main: call vesaSetup ; video mode, no characters can be printed to the screen call drawDot ; Draw a dot for one eye... hlt 17 18 19 20 21 ; ; drawDot ; ; Draws a rectangular dot on the screen. Pass the (x,y) location of the dot ; either in the registers or on the stack. 22 23 drawDot: ret 27 28 29 ; ; vesaSetup ; Configures the BIOS video to 320x200 graphics mode vesasetup: mov ax, 19 int 16 ret ; declaring global variable, everyone can see it and they have to share all the variables 47 48 49 50 ; 1. bring xo into AX ;2. xl into BX ;3. ADD x+x1 add AX, BX ;4. put it back in memory

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions