========================= Week 12 Notes for CST8214 ========================= - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Lab answers will be posted after the due date. Not all questions will be marked. Check all your answers against the posted set. Class Notes http://teaching.idallen.com/cst8214/07f/ text_errata.txt Errors and updates for the course textbook ----------------------------------------------------------------------------- Review of addition, base 16 (hexadecimal): ABCD + EEFE A = 10, B = 11, C = 12, D = 13, E = 14, F = 15 Do each column, right-to-left, and propagate the carry: 1111 ABCD + EEFE ------ 9ACB ------ 1. D+E = 13+14 = 27 = 16+11 = 1B hex, write B carry 1 2. 1+C+F = 1+12+15 = 28 = 16+12 = 1C hex, write C carry 1 3. 1+B+E = 1+11+14 = 26 = 16+10 = 1A hex, write A carry 1 4. 1+A+E = 1+10+14 = 25 = 16+9 = 19 hex, write 9 carry 1 5. Carry flag comes on (addition needs 17 bits). ----------------------------------------------------------------------------- Segment:Offset addresses and 20-bit addresses: A123:0115 | +----> 0115 +---------> + A1230 (shift segment left 4 bits before adding) ------- A1345 (result of adding is a 20-bit address) ------- Other addresses that give the same 20 bit answer A1345: A123:0115 = A1230+0115 = A1345 A134:0005 = A1340+0005 = A1345 A130:0045 = A1300+0045 = A1345 A100:0345 = A1000+0345 = A1345 A000:1345 = A0000+1345 = A1345 9F00:2345 = 9F000+2345 = A1345 ...etc... ----------------------------------------------------------------------------- Adjusting Segment:Offset addresses for different segments (e.g. if you want to look up a value in a DOS DEBUG dump listing): 1. a dump shows segment C000: - at what offset does byte C007A appear? Method: shift the dumpt segment C000 left, solve for offset 'X': dump segment C0000 + X = C007A X = C007A - C0000 X = 007A therefore the byte is found at offset 007A, in the dump at address C000:007A 2. a dump shows segment C000: - at what offset does byte C000:007A appear? Method: The C000:007A address uses the same segment C000: as the dump; therefore the offset is simply 007A, no math needed (if you like math: dump segment C0000 + X = C007A, solve for X) 3. a dump shows segment C000: - at what offset does byte C003:004A appear? Method: Address segment C003: is not the same as the dump segment C000: Convert C003:004A to a 20bit addres: C0030 + 004A = C007A Now apply the method in 1. above and solve for offset X: offset is 007A (dump segment C0000 + X = C007A, solve for X) 4. a dump shows segment C000: - at what offset does byte C007:000A appear? same method as 3. above: offset is 007A (dump segment C0000 + X = C007A, solve for X) 5. a dump shows segment C007: - at what offset does byte C000:007A appear? same method as 3. above: offset is 000A (dump segment C0070 + X = C007A, solve for X) 6. a dump shows segment C007: - at what offset does byte C004:003A appear? same method as 3. above: offset is 000A (dump segment C0070 + X = C007A, solve for X) 7. a dump shows segment 8888: - at what offset does byte 8999:0000 appear? same method as 3. above: offset is 1110 (dump segment 88880 + X = 89990, solve for X) 8. a dump shows segment 8888: - at what offset does byte 8900:0990 appear? same method as 3. above: offset is 1110 (dump segment 88880 + X = 89990, solve for X) 9. a dump shows segment 8888: - at what offset does byte 8000:9990 appear? same method as 3. above: offset is 1110 (dump segment 88880 + X = 89990, solve for X) ----------------------------------------------------------------------------- DOS ROM Video Character Table: ROM bit map table for ASCII characters (and others) starts at FFA6E. 8x8 bit map for ASCII letter 'A' (41h) is 8 bytes at FFC76. Table start address FFA6E + (41h x 8) = FFC76. (Note: 41h x 8 is *NOT* 328, it is 208h, and FFA6E+208=FFC76) Dump of FFC76 gives 8 bytes: 30 78 CC CC FC CC CC 00 30h = _ _ 1 1 _ _ _ _ 78h = _ 1 1 1 1 _ _ _ CCh = 1 1 _ _ 1 1 _ _ CCh = 1 1 _ _ 1 1 _ _ FCh = 1 1 1 1 1 1 _ _ CCh = 1 1 _ _ 1 1 _ _ CCh = 1 1 _ _ 1 1 _ _ 00h = _ _ _ _ _ _ _ _ 8x8 bit map for ASCII letter 'K' (??h) is 8 bytes at ?????. Table start address FFA6E + (??h x 8) = ?????. Dump of ????? gives 8 bytes: ?? ?? ?? ?? ?? ?? ?? ?? Draw the 8x8 bit map for this character.