sampleFinal - Question 2 [21 marks] Array Programming and...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Question 2 [21 marks] Array Programming and Subroutines The address B800:0000h in the main memory of an 8086-based PC, is used as the starting address of an array with a specific purpose. We will call this the display array . (1) The display array is directly mapped to the display screen. This means that any write to an element in this array results in an update to your screen. (2) Each element in the array is a byte-pair that can be described as follows: struct { char ASCII; unsigned byte colour; } DISPLAY_CHAR; where colour = {07h(white), 08h(grey), 09h(blue), 0A(green) … (3) The array is 2-dimensional, and it represents a rectangular screen of 60 rows (screen height) and 80 characters per row (screen width). DISPLAY_CHAR displayArray[60][80]; Example : Write ‘A’ to the upper-left corner displayArray[0][0].ASCII = ‘A’; Example : Change the rightmost character on the 2 nd row to blue. displayArray[1][79].colour= 09h; a) [1 mark] How big is this array (total size in bytes) ? b) [3 marks] Write an equation that calculates the offset of the character in row r and column c . c) [5 marks] Write an ASM code fragment that fills the entire screen with green character ‘A’s. d) [2 marks] In class, we’ve said that the Intel 8086 supports isolated I/O and have studied several examples (timer, PIC, keyboard, switches, LEDs). This display array however is a form of memory-mapped I/O because writing to this array (at memory address B800:0000) causes a character to be displayed on the screen (an output device). Suggest one reason why memory-mapped I/O would be more convenient for displays (Hint : How would the code you wrote for the previous question change?) e)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

sampleFinal - Question 2 [21 marks] Array Programming and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online