In osd8/video.c
This looks like an error:
....
* init VCs, with a different foreground color for each */
for(i = 0; i < _num_vcs; i++)
{
_curr_vc = _vc + i;
_curr_vc->attrib = i + 1;
_curr_vc->fb_adr = _vga_fb_adr + _vc_width * _vc_height * i;
....
shouldn't the last line read "_curr_vc->fb_adr = _vga_fb_adr + _vc_width * _vc_height * 2i" ? (since each char takes two bytes?)
To Chris Giese
RE:To Chris Giese
>shouldn't the last line read
>"_curr_vc->fb_adr = _vga_fb_adr + _vc_width * _vc_height * 2i"
>(since each char takes two bytes?)
Both _curr_vc->fb_adr and _vga_fb_adr are pointers to unsigned short,
which is 16 bits (2 bytes), so I don't need the factor of 2.
>"_curr_vc->fb_adr = _vga_fb_adr + _vc_width * _vc_height * 2i"
>(since each char takes two bytes?)
Both _curr_vc->fb_adr and _vga_fb_adr are pointers to unsigned short,
which is 16 bits (2 bytes), so I don't need the factor of 2.
RE:To Chris Giese
Yes, but they are still pointers. You are adding addresses right?
So for example in the case of xres = 80 chars, yres = 25, i=1 chars you are adding 0x7D0 to 0xb8000 instead of 0xFA0, no?
So for example in the case of xres = 80 chars, yres = 25, i=1 chars you are adding 0x7D0 to 0xb8000 instead of 0xFA0, no?
RE:To Chris Giese
In the source code, I add 0x7D0 (80*25), but in the compiled code, the address has 0xFA0 added to it. That's just the weird way that C pointers work. If the pointer variables pointed to "unsigned long" (4 bytes each), then the multiplier would be 4 instead of 2.
C:\TMP>type test.c
int main(void) {
static unsigned short *foo = (unsigned short *)0xDEADBEEF;
foo += 1; /* adding 1 */
return 0; }
C:\TMP>gcc -fomit-frame-pointer -c -O2 -Wall -W test.c
C:\TMP>ld --oformat binary -o test.bin -e0 -Ttext=0 test.o
C:\TMP>ndisasm -u test.bin
00000000 83050002000002 add dword [0x200],byte +0x2 <-- adding 2
00000007 31C0 xor eax,eax
00000009 C3 ret
...
00000200 EF out dx,eax
00000201 BEADDE0000 mov esi,0xdead
C:\TMP>type test.c
int main(void) {
static unsigned short *foo = (unsigned short *)0xDEADBEEF;
foo += 1; /* adding 1 */
return 0; }
C:\TMP>gcc -fomit-frame-pointer -c -O2 -Wall -W test.c
C:\TMP>ld --oformat binary -o test.bin -e0 -Ttext=0 test.o
C:\TMP>ndisasm -u test.bin
00000000 83050002000002 add dword [0x200],byte +0x2 <-- adding 2
00000007 31C0 xor eax,eax
00000009 C3 ret
...
00000200 EF out dx,eax
00000201 BEADDE0000 mov esi,0xdead