VOGONS


Speedy3D support in DOSBox

Topic actions

Reply 20 of 32, by sharangad

User metadata
Rank Member
Rank
Member

What exactly does lar do?

lar  ebx,bx                                            EAX:0000B101 EBX:00000168
bt ebx,16 EAX:0000B101 EBX:00CF9200 ECX:0000C000 EDX:00000A3C ESI:00000002 EDI:00000015 EBP:001FB082 ESP:001FB07C DS:0098 ES:0168 FS:0000 GS:0020 SS:0168 CF:0 ZF:1 SF:0 OF:0 AF:1 PF:0 IF:0

jc 00000590 ($+4) (down) EAX:0000B101 EBX:00CF9200 ECX:0000C000 EDX:00000A3C ESI:00000002 EDI:00000015 EBP:001FB082 ESP:001FB07C DS:0098 ES:0168 FS:0000 GS:0020 SS:0168 CF:1 ZF:1 SF:0 OF:0 AF:1 PF:0 IF:0

The docs say Lar is supposed to return an access mask for a segment.
bit 16 is undefined.

Thanks for your help BTW.

Developer of RReady - Rendition Verité Wrapper.

Reply 21 of 32, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Perhaps 16 is hexadecimal? If so, bit 22 (decimal) refers to the D/B (Default operand size/Big) bit from the segment descriptor: 0=16-bit, 1=32-bit, and in your example the bit is set.

Reply 23 of 32, by sharangad

User metadata
Rank Member
Rank
Member

Sorry about this but:

mov  eax,[edx+0010]             ds:[001D4642]=00000001 EAX:001D4632 EBX:001FB1CC ECX:00000000 EDX:001D4632 

...

mov ebx,eax EAX:00000001 EBX:001FB1CC
mov al,00 EAX:00000001 EBX:00000001
mov ah,44 EAX:00000000 EBX:00000001
int 21 EAX:00004400 EBX:00000001

Function 44h- Device driver control (IOCTL)

EBX is supposed to be a handle. How does one set about getting a device handle and how can I identify the device?

[EDIT] AL=0:
IOCTL,0 Get Device Information

Also looking through the trace, I can't find any writes to 0x001D4642 where the device handle comes from.

I don't even know if this is relevant to Speedy3D or whether this is keyboard related.

[EDIT2] I should really think a bit before posting. There're references to EDX:001D4632 all over the dump.

Developer of RReady - Rendition Verité Wrapper.

Reply 24 of 32, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Presumably there is DPMI or some DOS extender that switches to real mode for calling DOS functions.

In any case, you get a handle for a device (probably a character device) by opening (INT 21/3D) its device name as if it were a file name.

Note that support for loaded device drivers (e.g., DEVICE=MYDEVICE.SYS in CONFIG.SYS) is limited in DOSBox's emulated DOS, so you may need to boot real DOS to work with related functions.

Reply 26 of 32, by sharangad

User metadata
Rank Member
Rank
Member

Ripsaw, where's the default handler for Int_1A.

I think this is a Rendition specific call with

AX=0xB101, 
Bx=0x0000
CX=C000
DX=0A3C (entry point for a specific V1000 board).
Int 1A

On an actual Rendition based system (with a V2200) what comes back is this:

Int 1Ah on exit (2) AX 0011, BX 0210, CX C001, DX 4350, ES 1B66, DI 0012, DS 1BCE, SI 0000, SP 0F6E

ES, DI, DS, SI and SP are unmodified.

Developer of RReady - Rendition Verité Wrapper.

Reply 29 of 32, by sharangad

User metadata
Rank Member
Rank
Member

Another quick question about dosbox:

if I wanted to set the carry flag on return from an int 10 call setting

reg_flags |=0x01;

doesn't cut it because of the iret.

This doesn't seem to work either:

unsigned short flags = phys_readw(PhysMake(SegValue(ss), reg_sp - 4));
phys_writew(PhysMake(SegValue(ss), reg_sp - 4), flags |=0x00000001);

Developer of RReady - Rendition Verité Wrapper.

Reply 30 of 32, by sharangad

User metadata
Rank Member
Rank
Member

Also I've seen weird things like mismatched int calls. There appear to be more irets than int's.

[EDIT] It also looks like the entire app runs as an int.

Developer of RReady - Rendition Verité Wrapper.

Reply 31 of 32, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You seem to have the stack order backwards: a push subtracts from SP, a pop adds to SP, so the flags are at SP+4 for code inside an interrupt handler.

Anyway, in cpu/callback.cpp are a few functions: CALLBACK_SZF, CALLBACK_SCF, and CALLBACK_SIF for setting the Z, C, and I flags on the return stack. You can find many examples of their use throughout interrupt handler callback code.

BTW, you only need to use the phys_* functions for writing to ROM areas. For RAM, use mem_* and real_*, with the latter preferred for stack operations because it handles segment wrap.

Reply 32 of 32, by sharangad

User metadata
Rank Member
Rank
Member

Thanks for that.

I thought the iret instruction pops 3 16 bit values in real mode so I used sp-4, so that after the iret eflags has sp-4.

[EDIT] Yeah I messed up.

Developer of RReady - Rendition Verité Wrapper.