; File : $Workfile$ ; ; Description : ; ; Original Author : DIGITAL RESEARCH ; ; Last Edited By : $CALDERA$ ; ;-----------------------------------------------------------------------; ; Copyright Work of Caldera, Inc. All Rights Reserved. ; ; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, ; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. ; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES ; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF ; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO ; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE ; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE ; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, ; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, ; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, ; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF ; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT ; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND ; CIVIL LIABILITY. ;-----------------------------------------------------------------------; ; ; *** Current Edit History *** ; *** End of Current Edit History *** ; ; $Log$ ; INIT.ASM 1.25 93/12/07 15:51:27 ; Move int13pointer to offset 0B4h as some app expects it there ; INIT.ASM 1.24 93/11/18 18:57:20 ; Increase amount reserved for COMMAND.COM by 256 bytes ; INIT.ASM 1.23 93/11/17 19:29:26 ; Change default DEBLOCK seg to FFFF for performance reasons ; INIT.ASM 1.19 93/07/22 19:43:59 ; switch over to REQUEST.EQU ; ENDLOG include biosgrps.equ include drmacros.equ include ibmros.equ include msdos.equ include request.equ ; request header equates include bpb.equ include udsc.equ include driver.equ include keys.equ ; common key definitions ; IBM AT Hardware equates COMPRESSED equ TRUE ; enables compressed changes. ; a little macro to help locate things ; it warns us when the ORG get trampled on orgabs MACRO address, name local was,is was = offset $ org address is = offset $ if was GT is if2 %OUT ERROR - absolute data overwritten !! moving it: name endif org was endif ENDM jmpfar MACRO address, fixup db 0EAh ; jmpf opcode dw CG:address ; offset of destination fixup dw 0EDCh ; segment of destination ENDM callfar MACRO address, fixup db 09Ah ; callf opcode dw CG:address ; offset of destination fixup dw 0EDCh ; segment of destination ENDM F5KEY equ 3F00h F8KEY equ 4200h SWITCH_F equ 01h IVECT segment at 0000h org 0000h*4 i0off dw ? i0seg dw ? org 0001h*4 i1off dw ? i1seg dw ? org 0003h*4 i3off dw ? i3seg dw ? org 0004h*4 i4off dw ? i4seg dw ? org 0015h*4 i15off dw ? i15seg dw ? org 0019h*4 i19off dw ? i19seg dw ? org 001Eh*4 i1Eptr label dword i1Eoff dw ? i1Eseg dw ? org 002Fh*4 i2Fptr label dword i2Foff dw ? i2Fseg dw ? org 006Ch*4 i6Cptr label dword i6Coff dw ? i6Cseg dw ? IVECT ends CGROUP group CODE, RCODE, ICODE CG equ offset CGROUP CODE segment 'CODE' Assume CS:CGROUP, DS:Nothing, ES:Nothing, SS:Nothing public strat extrn ConsoleTable:word extrn ClockTable:word extrn SerParCommonTable:word extrn DiskTable:near extrn Int13Deblock:near extrn Int13Unsure:near extrn Int2FHandler:near extrn ResumeHandler:near extrn biosinit_end:byte ; End of the BIOS Init Code and Data extrn biosinit:near extrn boot_options:word extrn rcode_fixups:word extrn rcode_seg:word extrn rcode_offset:word extrn rcode_len:word extrn icode_len:word extrn current_dos:word extrn device_root:dword extrn mem_size:word extrn ext_mem_size:word extrn init_buf:byte extrn init_drv:byte extrn init_runit:byte extrn comspec_drv:byte extrn init_flags:word extrn boot_switches:byte include biosmsgs.def ; Include TFT Header File Public A20Enable A20Enable proc near ;======== ; This location is fixed up at run time to be a RET ; If the BIOS is relocated to the HMA then it is fixed up again to be ; CALLF IBMDOS:A20Enable; RET ; Calling this location at run time will ensure that the HMA is mapped ; in so we can access the HMA code. ; A20Enable endp init proc near ; this is at BIOSCODE:0000h ifndef COPYPROT db 1,2,3 ; jump to reusable init space else extrn protect:near ; Jump to Copy protection code jmp protect ; which will return control to endif ; INIT0 on completion init endp compflg label word ifdef COPYPROT dw ' ' ; stops any compression working else dw offset CGROUP:INITDATA ; compresses from INITDATA onwards endif ; this word set to 0 when compressed org 06h db 'COMPAQCompatible' dw offset CGROUP:RCODE ; lets find offset of RCODE MemFixup dw 0 ; and its relocated segment Public cleanup cleanup PROC far ; BIOSINIT will call here later ret cleanup endp ; Local single character buffer for Ctrl-Break handling public serparFlag, serparChar serparFlag db 4 dup (FALSE) ; we haven't got any yet serparChar db 4 dup (?) ; will store one character ; Device driver headers for serial/parallel devices con_drvr dw CG:aux_drvr, 0 ; link to next device driver dw DA_CHARDEV+DA_SPECIAL+DA_ISCOT+DA_ISCIN+DA_IOCTL dw CG:strat, 0 db 'CON ' db 'COLOUR' col_mode db 0,7,0 aux_drvr dw CG:prn_drvr, 0 ; link to next device driver dw DA_CHARDEV dw CG:strat, 0 db 'AUX ' prn_drvr dw CG:clock_drvr, 0 ; link to next device driver dw DA_CHARDEV dw CG:strat, 0 db 'PRN ' clock_drvr dw 0, 0 ; link to next device driver dw DA_CHARDEV+DA_ISCLK dw CG:strat, 0 db 'CLOCK$ ' com1_drvr dw CG:lpt1_drvr, 0 ; link to next device driver dw DA_CHARDEV dw CG:strat, 0 db 'COM1 ' com2_drvr dw CG:com3_drvr, 0 ; link to next device driver dw DA_CHARDEV dw CG:strat, 0 db 'COM2 ' com3_drvr dw CG:com4_drvr, 0 ; link to next device driver dw DA_CHARDEV dw CG:strat, 0 db 'COM3 ' IFDEF EMBEDDED extrn rdisk_drvr:near com4_drvr dw CG:rdisk_drvr, 0 ; link to next device driver ELSE com4_drvr dw -1, -1 ; link to next device driver ENDIF dw DA_CHARDEV dw CG:strat, 0 db 'COM4 ' orgabs 0b4h, i13pointer ; save address at fixed location ; for dirty apps Public i13pointer, i13off_save, i13seg_save i13pointer label dword ; address of ROS Int 13h entry i13off_save dw ? i13seg_save dw ? orgabs 0b8h, req_ptr ; REQ_HDR public req_ptr, req_off, req_seg req_ptr label dword req_off dw 0 ;** fixed location ** req_seg dw 0 ;** fixed location ** strat proc far mov cs:req_off,bx mov cs:req_seg,es ret strat endp lpt1_drvr dw CG:lpt2_drvr, 0 ; link to next device driver dw DA_CHARDEV dw CG:strat, 0 db 'LPT1 ' lpt2_drvr dw CG:lpt3_drvr, 0 ; link to next device driver dw DA_CHARDEV dw CG:strat, 0 db 'LPT2 ' lpt3_drvr dw CG:com2_drvr, 0 ; link to next device driver dw DA_CHARDEV dw CG:strat, 0 db 'LPT3 ' orgabs 100h, vecSave ; save vectors at fixed location ; for dirty apps Public orgInt13 NUM_SAVED_VECS equ 5 vecSave db 10h dw 0,0 db 13h orgInt13 dw 0,0 db 15h dw 0,0 db 19h dw 0,0 db 1Bh dw 0,0 Int19Trap: cld cli ; be sure... push cs pop ds lea si,vecSave mov cx,NUM_SAVED_VECS ; restore this many vectors Int19Trap10: xor ax,ax ; zero AH for lodsb mov es,ax ; ES -> interrupt vectors lodsb ; AX = vector to restore shl ax,1 shl ax,1 ; point at address xchg ax,di ; ES:DI -> location to restore movsw movsw ; restore this vector loop Int19Trap10 ; go and do another cmp word ptr cs:[oldxbda],0 ; has the XBDA been moved? je Int19Trap20 ; no mov es,word ptr cs:[oldxbda] ; yes, move it back mov cx,word ptr cs:[xbdalen] mov ds,word ptr cs:[newxbda] xor si,si xor di,di rep movsw mov ax,40h ; update BIOS data mov ds,ax xor di,di mov ax,es mov 0eh[di],ax mov ax,word ptr cs:[oldmemtop] ; also restore old conventional ; memory top mov 13h[di],ax Int19Trap20: int 19h ; and go to original int 19... Public oldxbda,newxbda,xbdalen,oldmemtop oldxbda dw 0 ; old XBDA segment address newxbda dw 0 ; new XBDA segment address xbdalen dw 0 ; length of XBDA in words oldmemtop dw 0 ; old conventional mem limit orgabs 16ch, devno ; PRN:/AUX: the device number devno db 0,0 ;** fixed location ** CODE ends end init