Newsgroups: comp.os.msdos.djgpp From: "Arthur Bredrick" Subject: three .externs whose purpose and origin I know not Lines: 64 Message-ID: Date: Thu, 2 Oct 1997 22:12:22 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I have seen the following declared in Martynas Kunigelis' keyboard interrupt handler (the assembly file keyboard.s): .extern ___djgpp_base_address .extern ___djgpp_ds_alias .extern ___djgpp_dos_sel ___djgpp_ds_alias is used very early on in the code: ># ># Load DS with our data selector ># >movw %cs:___djgpp_ds_alias, %ds Later on, when the handler memory is being unlocked (in the handler shutdown procedure), ___djgpp_base_address is used: ># ># Unlock the region we locked at initialization ># >leal locking_region_start, %ecx >leal locking_region_end, %edi >subl %ecx, %edi >addl ___djgpp_base_address, %ecx >shldl $16, %ecx, %ebx >shldl $16, %edi, %esi >movw $0x0601, %ax # unlock linear region >int $0x31 Towards the end of the code, when the handler is chaining to the old handler, ___djgpp_dos_sel is used: ># ># void keyboard_chain(int toggle); ># >.align 4 >_keyboard_chain: >cmpl $0, 4(%esp) >je chain_off > >chain_on: ># ># Set the chain_flag and clear BIOS shift/ctrl/alt status bits: ># >movl $1, chain_flag > >push %es >movw ___djgpp_dos_sel, %es >andb $0xf0, %es:0x417 >pop %es >jmp chain_done > >chain_off: >movl $0, chain_flag >chain_done: ret I am very new to protected mode programming, DJGPP, and assembly in general. Where do these externals come from and what are they being used for? Thanks for any help. Art