VOGONS


First post, by zb10948

User metadata
Rank Member
Rank
Member

Hello,

I have a situation with graphics on the system with integrated board that supports Plantronics modes. I'm unable to engage it from my own code, yet I have working examples of other software together with the source. I'm missing something, and I don't know why.

Using latest FreeGEM and sdpla.cga driver, which is available in source format as pla_drv.a86, I can see following is performed;

  	mov	ah,0
mov al,5 ;hi-res graphics
int screen
.
.
.
mov dx, 03DDh
mov al, 20h ; 640x200 4-colour mode
out dx, al
mov ax, 1 ; Switch to palette 1
call setpal
.
.
.
setpal:
.
.
.
mov bl, al
mov bh, 1
mov ah, 0Bh
int screen

I've also contacted the author of the driver, 'hi-res graphics' comment was leftover from template code, and there is nothing special about this initialization sequence, it's per Plantronics documentation.

So I tried to replicate it in C :

union REGS reg;
reg.h.ah = 0;
reg.h.al = 5;
int86(0x10, &reg, &reg);

outp(0x03DD, 0x20);

reg.h.ah = 0x0B;
reg.h.bh = 1;
reg.h.bl = 0;
int86(0x10, &reg, &reg);

The following code puts video at 640x200 but BIOS still outputs 'fat letters' which is correct because it's in CGA mode 5...meaning the Plantronics register worked.

However if I try to write pixels to two planes like this

unsigned char far *plane1 = (unsigned char far *)MK_FP(0xB800,0x0000);
unsigned char far *plane2 = (unsigned char far *)MK_FP(0xBC00,0x0000);

unsigned char p1h = 0x55;
unsigned char p2h = 0x33;

for(i = 0; i < 80; i++) {
memcpy(plane1 + i, &p1h, 1);
memcpy(plane2 + i, &p2h, 1);
}

There is no effect in second memcpy. Expected is one row filled with repeated colour combinations. I get on-off pattern, which is standard CGA 640x200 behaviour.

If I adapt this code to work at 320x200x16 I get same thing. Writing repeatedly FF AA 55 00 and E4 E4 E4 E4 to banks row 0 should give me a repeated 16 colour gradient. I get 4 colours there.

I'm attaching the source of the GEM driver that works correctly. I'm left without ideas and looking for tips.

Reply 1 of 2, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
zb10948 wrote on 2024-10-14, 13:33:
[…]
Show full quote
	mov	ax, 1			; Switch to palette 1
call setpal
.
.
.
setpal:
.
.
.
mov bl, al
mov bh, 1
mov ah, 0Bh
int screen

In this code both al and bl are set to 1 when the interrupt is called. Your C code is setting bl to 0.

Reply 2 of 2, by zb10948

User metadata
Rank Member
Rank
Member
jmarsh wrote on 2024-10-14, 15:14:

In this code both al and bl are set to 1 when the interrupt is called. Your C code is setting bl to 0.

Good catch, it's a typo in post but I've not set them both in the code.
Now it's a different shade, but still single shade.