================================================================ Assignment #10 - Disk & Intel Assembly Language and Machine Code ================================================================ - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Available online: Sunday November 22, 2009 Due date in the Blackboard Assignment Area: due at 23:59 PM on Wednesday December 2, 2009 Do *not* use the DigitalDropbox to submit your answers. Answers will be posted after the due date/time so that you can check your answers before coming to class and ask questions in class. Please check your answers (and my answers!). I go over each assignment in class if there are questions about the answers. No questions means no review. Submission method: Via the "Assignments" DAT2343_Assignment_10 upload. Due to bugs in Blackboard, you can only submit your Assignment to me *once*. After that, you cannot submit any more times. If you need to re-submit it, you have to ask me to clear your previous submission. Do *not* use the DigitalDropbox to submit your answers. Answers will be posted shortly after the due date/time. Upload Assignment file name: assignment10.txt The name must be exactly as given. Typing mistakes in the name mean no credit. Be precise. (Your userid is not required.) Upload only plain text, not HTML, not MSWord. No fonts. Plain text only. Plain text only. Did I mention that the format is plain text? ------------------ 1. Given the following boot sector dump from a MS-DOS disk: 0000 EB 3C 90 4D 53 57 49 4E-34 2E 31 00 02 40 01 00 .<.MSWIN4.1..@.. 0010 02 00 02 00 00 F8 99 00-3F 00 80 00 3F 00 00 00 ........?...?... 0020 C1 24 26 00 80 00 29 09-AD 62 36 4E 4F 20 4E 41 .$&...)..b6NO NA 0030 4D 45 20 20 20 20 46 41-54 31 36 20 20 20 FA 33 ME FAT16 .3 Use the chart in 19PhysicalFiles.htm to determine what is the start sector of the start of the File Allocation Space (in hex)? ANSWER: 2. Given the following partial dump of an MS-DOS disk root directory: 0000 53 55 48 44 4C 4F 47 20-44 41 54 03 00 1E 1A 7C SUHDLOG DAT....| 0010 8E 21 77 29 00 00 30 67-8E 21 02 00 2E 14 00 00 .!w)..0g.!...... 0020 42 4F 4F 54 4C 4F 47 20-54 58 54 22 00 00 00 00 BOOTLOG TXT".... 0030 00 00 77 29 00 00 1D 73-7A 25 03 00 1C 64 00 00 ..w)...sz%...d.. 0040 41 55 54 4F 45 58 45 43-44 4F 53 21 00 11 CB 70 AUTOEXECDOS ...p 0050 59 22 77 29 00 00 C1 65-8E 21 7C 47 2D 02 00 00 Y"w)...e.!|G-... 0060 4D 4F 55 53 45 20 20 20-45 58 45 20 00 63 CE 70 MOUSE EXE .c.p 0070 59 22 A1 2E 00 00 40 41-F9 1E 28 48 38 A1 01 00 Y"....@A..(H8... 0080 41 66 00 66 00 61 00 73-00 74 00 0F 00 ED 75 00 Af.f.a.s.t....u. 0090 6E 00 30 00 2E 00 66 00-66 00 00 00 78 00 00 00 n.0...f.f...x... 00A0 46 46 41 53 54 55 4E 30-46 46 58 22 00 C5 14 77 FFASTUN0FFX"...w 00B0 85 28 77 29 00 00 17 77-85 28 59 90 00 50 0A 00 .(w)...w.(Y..P.. 00C0 43 4F 4E 46 49 47 20 20-53 59 53 20 00 83 D8 71 CONFIG SYS ...q 00D0 14 2D 55 2F 00 00 D9 71-14 2D 42 87 8C 00 00 00 .-U/...q.-B..... 00E0 E5 6C 00 6F 00 67 00 6F-00 5F 00 0F 00 27 62 00 .l.o.g.o._...'b. 00F0 6D 00 70 00 2E 00 6F 00-6C 00 00 00 64 00 00 00 m.p...o.l...d... 0100 E5 4F 47 4F 5F 42 4D 50-4F 4C 44 31 00 78 CE 70 .OGO_BMPOLD .x.p 0110 59 22 77 29 00 00 1D 6F-3F 22 2E 00 00 00 00 00 Y"w)...o?".H6... a. What kind of file (based on the attribute flags) is/was: i. SUHDLOG.DAT ANSWER: ii. BOOTLOG.TXT ANSWER: iii. AUTOEXEC.DOS ANSWER: iv. LOGO_BMP.OLD ANSWER: b. What kind of thing is the directory entry that starts at offset 0080? ANSWER: c. How large (in hex) is SUHDLOG.DAT? ANSWER: d. What is the first cluster number associated with SUHDLOG.DAT? ANSWER: e. What is the location of (d) as a hex disk-sector address, assuming this root directory is from the same disk as the earlier boot sector dump? ANSWER: f. What formula did you use to calculate the above sector number? ANSWER: 3. Given the following 8-bit byte: 10000010 (shown in binary; base 2) a) What is the decimal value of the byte as an unsigned integer? ANSWER: b) What is the decimal value of the byte as an 8-bit, 2's complement signed integer? ANSWER: c) What is the decimal value of the byte as a sign/magnitude integer? ANSWER: d) What is the decimal value of the byte as an excess-127 integer? ANSWER: e) Is the byte a valid ordinary ASCII character? ANSWER: If so, what ASCII character is it? ANSWER: 4. How many address wires does it take to address 32KB of memory? ANSWER: 5. What are the hexadecimal addresses of the two middle bytes of a 32KB address space? ANSWER: 6. If a DOS disk has 128-byte sectors and 4 sectors per cluster (per allocation unit), give the size (in decimal bytes) of the smallest non-empty file you can create on this disk. ANSWER: 7. If a DOS disk has 128-byte sectors and uses 32 sectors for its ROOT directory, what is the maximum number of files (in decimal) that you can store in the ROOT directory on this disk? ANSWER: 8. How many bits are needed to address 64KB of memory? ANSWER: 9. How many bits are needed to address 1MB of memory? ANSWER: 10. A DEBUG dump shows you this: 1026:0000 2E 20 20 20 20 20 20 20-20 20 20 10 00 00 00 00 . ..... 1026:0010 00 00 00 00 00 00 1A 40-99 19 53 00 00 00 00 00 .......@..S..... 1026:0020 2E 2E 20 20 20 20 20 20-20 20 20 10 00 00 00 00 .. ..... 1026:0030 00 00 00 00 00 00 1A 40-99 19 00 00 00 00 00 00 .......@........ 1026:0040 43 4F 55 4E 54 52 59 20-53 5A 53 20 00 00 00 00 COUNTRY SZS .... 1026:0050 00 00 00 00 00 00 00 28-89 16 2B 00 AD 42 00 00 .......(..+..B.. 1026:0060 45 47 41 20 20 20 20 20-53 59 53 20 00 00 00 00 EGA SYS .... 1026:0070 00 00 00 00 00 00 00 28-89 16 34 00 15 13 00 00 .......(..4..... What byte value is located at address 0FFE:02C9 in the above dump? (Note that the above dump is for segment 1026, not segment 0FFE.) ANSWER: 11. A DEBUG register dump shows you this: -R AX=0924 BX=001B CX=9770 DX=003A SP=FFDC BP=FFF2 SI=02AE DI=0C14 DS=17B8 ES=17BA SS=38A5 CS=2C6E IP=02E9 NV UP EI PL NZ NA PO NC 2C6E:02E9 9A78563412 CALL 1234:5678 Give, in hexadecimal notation, the segment:offset and real (absolute) memory addresses of these addresses: a) the address of the next instruction to be executed. ANSWERS: b) the address of the last value (the top entry) stored on the stack. ANSWERS: If the next instruction given in the above dump were executed: c) Which register values would change and what would their old and new values be? (see Notes file call_push_out.txt) ANSWERS: d) What value would appear in the byte addressed by the final value of the stack pointer? ANSWER: 12. Use DEBUG to assemble the instruction "CALL 0009" into memory at offset 0000 (zero). Un-assemble the instruction and look at the two bytes of address following the E8 opcode. (a) What is the hex value of that address? ANSWER: Use DEBUG to assemble the instruction "CALL 0109" into memory at offset 0100 (not at zero). Un-assemble the instruction and look at the two bytes of address following the E8 opcode. (b) What is the hex value of that address? ANSWER: Even though the two instructions "CALL 0009" and "CALL 0109" above look very different, they both result in exactly the same machine code. (c) Why? What value is stored in the address field of these instructions? ANSWERS: (d) Based on what you just learned about Intel "near" CALL instructions, are they relocatable? (Do their addresses need to be adjusted by a linker depending on where in memory the code is loaded?) Why or why not? ANSWERS: