Você está na página 1de 7

George Barney 6/6/12 Experiment 1

Names: George Barney and Date: 6/5/12 Experiment number: 1 Desk number: Question 5A- What is the initial address of the program both as a physical address and in the form code segment : offset. Physical address = CSx10h + IP (IP = offset) = 07000h + 0100h = 07100h PA = 07100h Question 5B- The first instruction of the program and its op-code. The first instruction is mov ax, 3 This instruction will move 0003h into AX, which means AH = 00h and AL = 03H The op-code for this instruction is B8 03 00

Page 1 of 7

George Barney 6/6/12 Experiment 1

Question 6A Including MOV AX, 3 in the count, this program executes 11 instructions when it reaches code MOV DS, AX. Question 6A The extra instructions were caused by the interrupts we had in our code. They changed value of the CS and IP registers, causing a jump to a different part of the code in order to load the cursor size, position, and specify intensity/blinking settings. The instructions were BIOS DI and IRET.

Page 2 of 7

George Barney 6/6/12 Experiment 1

Question 7

Page 3 of 7

George Barney 6/6/12 Experiment 1

Question 10A The program skips two bytes and then writes the ASCII value for H into the RAM. After this, one byte is skipped and then the next characters ASCII value is stored into the RAM. After all the values have been loaded into the RAM, aka when the ! is written, the program jumps back to 1 byte after the memory location holding the value H. Now the program loads the code for red lettering with yellow highlight into the extra segment location pointed to by DI. As we increment DI by 2, we skip over each ASCII value and write our color code, which happens to be the infinity symbol, into the open space between our ASCII values in the RAM. Each time this code is written it causes the immediately preceding character to change to red lettering with yellow highlight. This process repeats until the counter CX = 0, so 12 times. The infinity symbol occupies the memory locations originally containing BEEP, and our characters are loaded into locations originally loaded with NULL. Question 10B Each location on the emulator screen uses two memory cells in the RAM window. The even addressed RAM locations hold the ASCII values for the characters we wish to print and the odd locations specify the color of the font and highlight/background for each character/location on the emulator screen. Question 10C White character with black background code: 00001111b Red character with a yellow background code: 11100100b Question 10D The memory that starts at the address 0B8000 is used as video memory for color graphics adaptors. This stores the data needed to display multiple pages (8 to be specific) of information stored in the RAM. This consequentially means that the size of the window the memory must display to affects the memory required. However, EMU8086 always uses 4096 bytes for each page. To summarize, this memory section is used to store data needed for graphical interfaces. This memory section will be dedicated to holding numerous pages of graphical data, so that the information needed to display each page is readily available.

Page 4 of 7

George Barney 6/6/12 Experiment 1

Question 11A Yes, these two addresses are the same. SS holds 0700 and SP holds FFFE. The current address of the stack is 0700:FFFE, which is the same as SS:SP. Question 11B As we step through the first two instructions, the stack has three values loaded into it and the stack address decreases by 6. The first instruction loads the AX register. The second instruction introduces an interrupt, which loads the memory locations which appears to load the previous values of CS and IP into the stack, along with another number.

Question 11C Yes, this does coincide with what happens with the stack, and explains the origin of the third number I encountered. Question 11D The value of the flag register is the number which I failed to identify in question 11B. It has the value of 0202h. It is also the first register to be PUSHed to the stack.

Page 5 of 7

George Barney 6/6/12 Experiment 1

PROGRAM CODE: name "hi-world"

;For George Barneys Lab report

; this example prints out "hello world!" ; by writing directly to video memory. ; in vga memory: first byte is ascii character, byte that follows is character attribute. ; if you change the second byte, you can change the color of ; the character even after it is printed. ; character attribute is 8 bit value, ; high 4 bits set background color and low 4 bits set foreground color. ; hex bin ; ;0 0000 ;1 0001 ;2 0010 ;3 0011 ;4 0100 ;5 0101 ;6 0110 ;7 0111 ;8 1000 ;9 1001 ;a 1010 ;b 1011 ;c 1100 ;d 1101 ;e 1110 ;f 1111 org 100h ; set video mode mov ax, 3 ; text mode 80x25, 16 colors, 8 pages (ah=0, al=3) int 10h ; do it!
Page 6 of 7

color black blue green cyan red magenta brown light gray dark gray light blue light green light cyan light red light magenta yellow white

George Barney 6/6/12 Experiment 1

; cancel blinking and enable all 16 colors: mov ax, 1003h mov bx, 0 int 10h ; set segment register: mov ax, 0b800h mov ds, ax ; print "hello world" ; first byte is ascii code, second byte is color code. mov [02h], 'H' mov [04h], 'e' mov [06h], 'l' mov [08h], 'l' mov [0ah], 'o' mov [0ch], ',' mov [0eh], 'W' mov [10h], 'o' mov [12h], 'r' mov [14h], 'l' mov [16h], 'd' mov [18h], '!' ; color all characters: mov cx, 12 ; number of characters. mov di, 03h ; start from byte after 'h' c: mov [di], 11101100b ; light red(1100) on yellow(1110) add di, 2 ; skip over next ascii code in vga memory. loop c ; wait for any key press: mov ah, 0 int 16h ret

Page 7 of 7

Você também pode gostar