12 December 2003 Record segment Back on 2 December, I wrote about the system's record segment — a 64KB chunk of memory set aside to hold variable-length strings of data useful to the system, such as the contiguous chunk of memory available for system use. Now that I have a working hex-dump routine, I can verify that my record-writing code works properly. Today I'll keep it simple. I'll just initialize the record segment, then verify that the memory in the segment contains the values it should. What a blank record segment contains To review: The segment is first filled with zeroes, then space is reserved for the start block. The start block is 64 bytes long and consists of sixteen records, each containing two two-byte fields. The first record contains these two fields:
All of the other records should contain only zero. In other words, if I dump the contents of the record segment to the screen, it should look like this: 1000:0000: 40 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 1000:0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1000:0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1000:0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 That is, all bytes should be zero — except the first and third bytes, each of which should be 0x40 (64 in decimal). Code The code in my latest boot sector simply initializes the record segment,... cld mov ax, 0x1000 mov es, ax xor di, di xor ax, ax mov cx, 32768 rep stosw mov al, 64 mov [es:0], al mov [es:2], al ...sets FS:BX to 1000:0000 (the start of the record segment), and calls my hex-dump routine four times. call clear_screen mov ax, 0x1000 mov fs, ax xor bx, bx call dump_16 call dump_16 call dump_16 call dump_16 jmp $ Check the index for other entries. |