- draw the boarder with numbers as displayed - make it somewhat playable (enteri
ID: 2291784 • Letter: #
Question
- draw the boarder with numbers as displayed
- make it somewhat playable (entering numbers)
- use Emu8086
Explanation / Answer
In this problem, your lecturer did nothing new. He only used rectangles of different sizes, you just need to develop them one into another and thats it.
The way of making lines/squares/rectangle in programming is explained here:- hope it will be more than helpful :)
; Draw a line in a graphics mode
;By extension, draws a yellow line in the upper-left.
;A good example of how to efficiently use INC, CMP,
;and a conditional jump for repetitive tasks.
mov ah,00h
mov al,13h
int 10h
;The above three lines just switch to 320x200 256-color VGA.
mov ds,40960
;a000h = 40960 decimal
mov ax, 44h
;44h is yellow! ;)
mov bx,0000
START:
mov [bx],ax
inc bx
cmp bx,20
JL START
;This waits until BX reaches 20, then exits!
mov ah,004C ;terminate program
As you can see, the above code puts the PC into 320x200x8 mode (int 0x0x10, mode 0x13), then draws 20 yellow pixels (0x44) to the video buffer (address 40960 == 0xa000). The video buffer is actually an array. The first pixel in the first row is 0xa000 + 0, the second pixel in the first row is 0xa000 + 1, etc. The first pixel in the second row is 0xa000 + 200, the second is 0xa000 + 201, etc. If you want to draw any pixel in any row, just compute the offset. To draw a horizontal line, just add "1". To draw a vertical line, just add "200". Make sense?
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.