diff options
Diffstat (limited to 'v4.0/src/DEV/XMA2EMS/PS2_5060.INC')
| -rw-r--r-- | v4.0/src/DEV/XMA2EMS/PS2_5060.INC | 735 |
1 files changed, 735 insertions, 0 deletions
diff --git a/v4.0/src/DEV/XMA2EMS/PS2_5060.INC b/v4.0/src/DEV/XMA2EMS/PS2_5060.INC new file mode 100644 index 0000000..96425f5 --- /dev/null +++ b/v4.0/src/DEV/XMA2EMS/PS2_5060.INC | |||
| @@ -0,0 +1,735 @@ | |||
| 1 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 2 | ;³ Include File: PS2_5060.INC ³ | ||
| 3 | ;³ ³ | ||
| 4 | ;³ Purpose: Initialization code for the Personal Systems/2 ³ | ||
| 5 | ;³ models 50 and 60. ³ | ||
| 6 | ;³ ³ | ||
| 7 | ;³ Returns: INIT_ERR ³ | ||
| 8 | ;³ Flag indicating if an error was detected. ³ | ||
| 9 | ;³ DX = ptr to error message string if error. ³ | ||
| 10 | ;³ ³ | ||
| 11 | ;³ This procedure is called to initialize the XMO and/or XMA/A ³ | ||
| 12 | ;³ card(s) on a PS/2 mod 50 or 60. Any mix of multiple XMA and ³ | ||
| 13 | ;³ XMO cards are supported. The XMA cards will be used in ³ | ||
| 14 | ;³ 'real' mode, meaning the virtual mode ports providing bank ³ | ||
| 15 | ;³ swapping are not used (since this only works on 1 XMA card). ³ | ||
| 16 | ;³ This procedure is not called if WSP's XMA/A device driver ³ | ||
| 17 | ;³ (INDXMAA.SYS) is installed. In this case only the single XMA ³ | ||
| 18 | ;³ card is used for EMS, and it is spoken to in 'virtual' mode. ³ | ||
| 19 | ;³ The procedure searches each adapter slot for the presence of ³ | ||
| 20 | ;³ an XMA or a XMO card by checking the card ID. It checks ³ | ||
| 21 | ;³ the configuration registers on the cards to determine the amount ³ | ||
| 22 | ;³ of memory they contain. ³ | ||
| 23 | ;³ The procedure will then calculate for the /E parameter. This ³ | ||
| 24 | ;³ states how much of the extended memory the user wants for EMS. ³ | ||
| 25 | ;³ Extended memory will come from the top of the address range, ³ | ||
| 26 | ;³ and EMS will come off the bottom (i.e. starting at 1M+384K). ³ | ||
| 27 | ;³ Memory kept as extended has to be marked unusable in the Page ³ | ||
| 28 | ;³ Allocation List. Translate table entries in extended memory ³ | ||
| 29 | ;³ are disabled for memory used for EMS. ³ | ||
| 30 | ;³ Note that the /E parameter is only valid within this ³ | ||
| 31 | ;³ procedure, i.e. for PS/2 mod 50 and 60's. On family 1 machines, ³ | ||
| 32 | ;³ only the XMA 1 card is supported, and it doesn't come up as ³ | ||
| 33 | ;³ extended memory. On mod 50 or 60 with the XMA/A driver, the ³ | ||
| 34 | ;³ driver takes all of the (uppermost) XMA card and resets CMOS. ³ | ||
| 35 | ;³ On the mod 80 with the XMA emulator, this XMA/extended split ³ | ||
| 36 | ;³ must be specified on the Emulator's parm line. ³ | ||
| 37 | ;³ ³ | ||
| 38 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 39 | |||
| 40 | include SYSVAR.INC ;system variables structure ;an007; dms; | ||
| 41 | |||
| 42 | |||
| 43 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 44 | ;³ XMA/A declares ³ | ||
| 45 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 46 | HI6BIT_MASK EQU 00000011b ;Mask for 2 bit bank descriptor | ||
| 47 | LO2BIT_FLIP EQU 00000011b ;Reverses bottom 2 bits in bank des | ||
| 48 | ; gives # of 1/2M in that bank | ||
| 49 | NUM_CONFR_BANKS EQU 3 ;Number of memory banks described | ||
| 50 | ; by the XMA/A config register | ||
| 51 | ; Bank 4 is on the control reg. | ||
| 52 | X_CONF_REG_VAL DB ? ;temporary holder for XMAA's | ||
| 53 | ; config (memory size) register | ||
| 54 | X_CTRL_REG_VAL DB ? ;temporary holder for XMAA's | ||
| 55 | ; control (mem size bank 4) reg. | ||
| 56 | X_BLKS_PER_HALFM DB 128 ;4K blocks per half meg of memory | ||
| 57 | XMAA_NUM_BLOCKS DW ? ;temp for # of 4K blocks on xmaa @RH2 | ||
| 58 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 59 | ;³ Expanded Memory Option (XMO) declares ³ | ||
| 60 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 61 | NUM_CINFO_BANKS EQU 3 ;# of complete memory banks (4-2) | ||
| 62 | ; described by the XMO card info reg | ||
| 63 | ; Bank 1 - hi 1/2 bit - info, lo CC/P | ||
| 64 | H_CARD_INFO_VAL DB ? ;temporary holder for XMO card's | ||
| 65 | ; info (memory size) register | ||
| 66 | H_BLKS_PER_HALFM DB 32 ;16K XMO card blocks per 1/2M of mem | ||
| 67 | HLST_NUM_BLOCKS DW ? ;temp for # of 16K blocks on hlstr @RH3 | ||
| 68 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 69 | ;³ /E option declares ³ | ||
| 70 | ;³ (used to set extended memory) ³ | ||
| 71 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 72 | ems_pgs_parm dw 0 ;temp value for /E parameter | ||
| 73 | e_parm_def equ 0FFFFh ;default...take all for ems | ||
| 74 | MIN_EXTMEM_H EQU (1024+384)/16 ;Translate table pointer for the lowest | ||
| 75 | MIN_EXTMEM_X EQU (1024+384)/4 ; addr extended memory can start at on | ||
| 76 | BASE_MEM EQU 1024 ;Base planer memory ;an007; dms; | ||
| 77 | ; a PS/2 (16K XMO and 4K XMA) | ||
| 78 | PREV_EXT_PGS DW 0 ;Extended memory claimed by previous | ||
| 79 | ; drivers | ||
| 80 | NEEDED_EMS_PGS DW ? ;Pages that will go for EMS use | ||
| 81 | CARDS_PGS DW ? ;Number of pages on card being checked | ||
| 82 | CARD_EXT_S16K DW ? ; and where its extended memory starts | ||
| 83 | ; expressed in 16K blocks | ||
| 84 | |||
| 85 | INIT_MOD_50_60 PROC | ||
| 86 | |||
| 87 | PUSH AX | ||
| 88 | PUSH BX | ||
| 89 | PUSH CX | ||
| 90 | PUSH SI | ||
| 91 | PUSH DI | ||
| 92 | |||
| 93 | MOV INIT_ERR,NO_ERROR ;Initialize error flag @RH4 | ||
| 94 | MOV TOTAL_SYS_PAGES,0 ;Init total number of pages in the @RH2 | ||
| 95 | MOV NUM_MEM_CARDS,0 ; system & # of memory cards found @RH2 | ||
| 96 | XOR DI,DI ;Clear offset into mem card table @RH2 | ||
| 97 | |||
| 98 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 99 | ;³ Search for XMO cards ³ | ||
| 100 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 101 | XOR CX,CX ;Check all system slots starting @RH2 | ||
| 102 | ; at slot 0 RH2 | ||
| 103 | H_SLOT_SCAN: | ||
| 104 | MOV AL,CL ;Enable the specific slot by ORing @RH2 | ||
| 105 | OR AL,SLOT_SETUP ; the slot (bits 0-2) with the @RH2 | ||
| 106 | OUT 96h,AL ; setup flag (bit 3). @RH2 | ||
| 107 | |||
| 108 | MOV DX,CARD_ID_LO ;Read the signature ID of the card @RH2 | ||
| 109 | IN AL,DX ; @RH2 | ||
| 110 | XCHG AL,AH ; @RH2 | ||
| 111 | MOV DX,CARD_ID_HI ; @RH2 | ||
| 112 | IN AL,DX ; @RH2 | ||
| 113 | HLST_CHECK: | ||
| 114 | CMP AX,HLST_CARD_ID ;If it's a XMO card then @RH3 | ||
| 115 | JNE H_NEXT_SLOT ; calculate the amount of memory @RH3 | ||
| 116 | CALL HLST_MEM_ADD ; on the card @RH3 | ||
| 117 | MOV WTT_CARD_SLOT,CL ;Set default slot # and card type @RH5 | ||
| 118 | MOV MEMCARD_MODE,HOLS_REAL ; for single card support @RH5 | ||
| 119 | |||
| 120 | MOV BX,HLST_NUM_BLOCKS ;1 XMO card block = an EMS page | ||
| 121 | |||
| 122 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 123 | ;³ Save info in the memory card table ³ | ||
| 124 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 125 | MOV MEM_CARD_TABLE.CARD_ID[DI],AX ;Save the card ID and @RH5 | ||
| 126 | MOV MEM_CARD_TABLE.CARD_SLOT[DI],CL ; slot # of this card @RH5 | ||
| 127 | MOV AX,TOTAL_SYS_PAGES ;Set # of the 1st EMS @RH5 | ||
| 128 | MOV MEM_CARD_TABLE.START_PG_NUM[DI],AX ; page this card maps @RH5 | ||
| 129 | ADD AX,BX ;Last page mapped = @RH5 | ||
| 130 | DEC AX ; 1st pg + pages on @RH5 | ||
| 131 | MOV MEM_CARD_TABLE.END_PG_NUM[DI],AX ; this card - 1. @RH5 | ||
| 132 | |||
| 133 | ADD TOTAL_SYS_PAGES,BX ;Add card's pgs to tot. @RH5 | ||
| 134 | INC NUM_MEM_CARDS ;Inc # of cards found @RH5 | ||
| 135 | ADD DI,TYPE MEM_CARD_STRUC ;Next entry in card @RH5 | ||
| 136 | ; descriptor table RH5 | ||
| 137 | |||
| 138 | H_NEXT_SLOT: | ||
| 139 | INC CL ;Check next adapter slot @RH2 | ||
| 140 | CMP CL,NUM_OF_SLOTS ;Is it <= system slots? @RH2 | ||
| 141 | JB H_SLOT_SCAN ;Yes..check next slot ;ac000; dms; | ||
| 142 | ;No fall through loop RH2 | ||
| 143 | |||
| 144 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 145 | ;³ Search for XMA/A cards ³ | ||
| 146 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 147 | XOR CX,CX ;Check all slots starting at 0 @RH2 | ||
| 148 | X_SLOT_SCAN: | ||
| 149 | MOV AL,CL ;Enable the specific slot by ORing @RH2 | ||
| 150 | OR AL,SLOT_SETUP ; the slot (bits 0-2) with the @RH2 | ||
| 151 | OUT 96h,AL ; setup flag (bit 3). @RH2 | ||
| 152 | |||
| 153 | MOV DX,CARD_ID_LO ;Read the signature ID of the card @RH2 | ||
| 154 | IN AL,DX ; @RH2 | ||
| 155 | XCHG AL,AH ; @RH2 | ||
| 156 | MOV DX,CARD_ID_HI ; @RH2 | ||
| 157 | IN AL,DX ; @RH2 | ||
| 158 | XMAA_CHECK: | ||
| 159 | CMP AX,XMAA_CARD_ID ;If it's an XMA/A card then @RH2 | ||
| 160 | JNE X_NEXT_SLOT ; calculate the amount of memory @RH2 | ||
| 161 | CALL XMAA_MEM_ADD ; on the card @RH2 | ||
| 162 | MOV WTT_CARD_SLOT,CL ;Set default slot # and card type @RH5 | ||
| 163 | MOV MEMCARD_MODE,XMAA_REAL ; for single card support @RH5 | ||
| 164 | |||
| 165 | MOV BX,XMAA_NUM_BLOCKS ;Divide the # of 4K XMA/A blocks @RH2 | ||
| 166 | SHR BX,1 ; by 4 to get number or 16K EMS @RH2 | ||
| 167 | SHR BX,1 ; pages on this card @RH2 | ||
| 168 | |||
| 169 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 170 | ;³ Save info in the memory card table ³ | ||
| 171 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 172 | MOV MEM_CARD_TABLE.CARD_ID[DI],AX ;Save the card ID and @RH5 | ||
| 173 | MOV MEM_CARD_TABLE.CARD_SLOT[DI],CL ; slot # of this card @RH5 | ||
| 174 | MOV AX,TOTAL_SYS_PAGES ;Set # of the 1st EMS @RH5 | ||
| 175 | MOV MEM_CARD_TABLE.START_PG_NUM[DI],AX ; page this card maps @RH5 | ||
| 176 | ADD AX,BX ;Last page mapped = @RH5 | ||
| 177 | DEC AX ; 1st pg + pages on @RH5 | ||
| 178 | MOV MEM_CARD_TABLE.END_PG_NUM[DI],AX ; this card - 1. @RH5 | ||
| 179 | |||
| 180 | ADD TOTAL_SYS_PAGES,BX ;Add card's pgs to tot. @RH5 | ||
| 181 | INC NUM_MEM_CARDS ;Inc # of cards found @RH5 | ||
| 182 | ADD DI,TYPE MEM_CARD_STRUC ;Next entry in card @RH5 | ||
| 183 | ; descriptor table RH5 | ||
| 184 | |||
| 185 | X_NEXT_SLOT: | ||
| 186 | INC CL ;Check next adapter slot @RH2 | ||
| 187 | CMP CL,NUM_OF_SLOTS ;Is it <= system slots? @RH2 | ||
| 188 | JB X_SLOT_SCAN ;Yes..check next slot ;ac000; dms; | ||
| 189 | ;No fall through loop RH2 | ||
| 190 | |||
| 191 | CMP TOTAL_SYS_PAGES,0 ;If one or more cards are found @RH4 | ||
| 192 | JA CALC_EXTENDED ; then everythang's cool so far @RH4 | ||
| 193 | MOV INIT_ERR,ERROR ;Else no card...set @RH4 | ||
| 194 | MOV DX,OFFSET NOT_FOUND_MSG ; 1st part of error msg @RH4 | ||
| 195 | JMP INIT_50_60_RET ; for no card found @RH4 | ||
| 196 | |||
| 197 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 198 | ;³ Calculate /E parameter - amount of memory for EMS ³ | ||
| 199 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 200 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 201 | ;³ Find ext mem addr of bottom card ³ | ||
| 202 | ;³ in case card memory ever starts at ³ | ||
| 203 | ;³ something other than 1M + 384K ³ | ||
| 204 | ;³ (i.e. if more planar memory is ³ | ||
| 205 | ;³ added or a new unsupported card ³ | ||
| 206 | ;³ comes in below XMO card) ³ | ||
| 207 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 208 | CALC_EXTENDED: | ||
| 209 | push es ;this call kills these regs ;an007; dms; | ||
| 210 | push bx ; ;an007; dms; | ||
| 211 | |||
| 212 | mov ah,52h ;get the sysvars ptr ;an007; dms; | ||
| 213 | int 21h ; to get total ext. memory at boot ;an007; dms; | ||
| 214 | mov ax,word ptr es:[bx].SYSI_Ext_Mem ; ;an007; dms; | ||
| 215 | |||
| 216 | pop bx ;restore regs ;an007; dms; | ||
| 217 | pop es ; ;an007; dms; | ||
| 218 | |||
| 219 | add ax,Base_Mem ; + base memory ;an007; dms; | ||
| 220 | MOV CL,4 ; convert to 16Kb pages ;an007; dms; | ||
| 221 | SHR AX,CL ; ;an007; dms; | ||
| 222 | sub ax,cs:Total_Sys_Pages ;get page where card begins ;an007; dms; | ||
| 223 | |||
| 224 | xor di,di ;init. index value ;an008; dms | ||
| 225 | CMP MEM_CARD_TABLE.CARD_ID[DI],HLST_CARD_ID ;If 1st card holst @RH4 | ||
| 226 | JE FIND_H_1ST_TT ; then get hlst TT @RH4 | ||
| 227 | FIND_X_1ST_TT: ;XMAA is 1st card (lowest ext mem) @RH4 | ||
| 228 | ;;;;; MOV AX,MIN_EXTMEM_X ;Set XMAA TT ptr at 1.384M and @RH4 | ||
| 229 | shl ax,1 ; ;an000; dms; | ||
| 230 | shl ax,1 ; ;an000; dms; | ||
| 231 | FIND_X_1ST_LOOP: ; search for start of ext mem @RH4 | ||
| 232 | CALL X_READ_TT ;Read trans tbl data at this addr @RH4 | ||
| 233 | CMP BX,XMA_TT_INHIBIT ;If not inhibitted then mem here. @RH4 | ||
| 234 | JE FIND_X_1ST_NEXT ;Divide the 4K translate table ptr @RH4 | ||
| 235 | MOV CL,2 ; by 4 to convert it to 16K format @RH4 | ||
| 236 | SHR AX,CL ; AX = start of ext mem (in 16K) @RH4 | ||
| 237 | JMP FIRST_EXT_FOUND ; @RH4 | ||
| 238 | FIND_X_1ST_NEXT: ; @RH4 | ||
| 239 | INC AX ;Else no mem...inc TT ptr and see @RH4 | ||
| 240 | JMP FIND_X_1ST_LOOP ; if ext mem starts at next 4K @RH4 | ||
| 241 | |||
| 242 | FIND_H_1ST_TT: ;XMO is 1st card (lowest ext mem) @RH4 | ||
| 243 | ;;;;; MOV AX,MIN_EXTMEM_H ;Set hlst TT ptr at 1.384M and @RH4 | ||
| 244 | FIND_H_1ST_LOOP: ; search for start of ext mem @RH4 | ||
| 245 | CALL H_READ_TT ;Read trans tbl data at this addr @RH4 | ||
| 246 | CMP BL,H_TT_INHIBIT ;If not inhibitted then mem here. @RH4 | ||
| 247 | JNE FIRST_EXT_FOUND ; found start of card ext mem @RH4 | ||
| 248 | INC AX ;Else no mem...inc TT ptr and see @RH4 | ||
| 249 | JMP FIND_H_1ST_LOOP ; if ext mem starts at next 16K @RH4 | ||
| 250 | FIRST_EXT_FOUND: | ||
| 251 | MOV CARD_EXT_S16K,AX ;Save the start of ext mem ptr @RH4 | ||
| 252 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 253 | ;³ Calc pages for extended memory ³ | ||
| 254 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 255 | MOV AH,88H ;Go to BIOS and find amount of @RH4 | ||
| 256 | INT 15H ; extended memory (assume previous @RH4 | ||
| 257 | MOV CL,4 ; drivers have hooked INT 15h) @RH4 | ||
| 258 | SHR AX,CL ;Get # of 16k pages @RH4 | ||
| 259 | |||
| 260 | MOV BX,CARD_EXT_S16K ;Pages of extended memory used @RH4 | ||
| 261 | ADD BX,TOTAL_SYS_PAGES ; by previous drivers = @RH4 | ||
| 262 | SUB BX,1024/16 ; what we know is the # of ext @RH4 | ||
| 263 | SUB BX,AX ; pages minus what BIOS tells us @RH4 | ||
| 264 | MOV PREV_EXT_PGS,BX ; @RH4 | ||
| 265 | |||
| 266 | CMP EMS_PGS_PARM,E_PARM_DEF ;If no /E parm specified then @RH4 | ||
| 267 | JNE CHECK_E_PARM ; use the remaining pages for EMS @RH4 | ||
| 268 | MOV AX,TOTAL_SYS_PAGES ; (total on cards minus previously @RH4 | ||
| 269 | cmp Prev_Ext_Pgs,ax ;Previous ext pages >= avail on cards? ;an000; dms; | ||
| 270 | jae Default_Mem_Err_Exit ;yes - we have used the whole card ;an000; dms; | ||
| 271 | SUB AX,PREV_EXT_PGS ; used for extended memory) @RH4 | ||
| 272 | MOV NEEDED_EMS_PGS,AX ;Set counter for marking PAL and TT@RH4 | ||
| 273 | JMP SHORT MARK_EXT_IN_PAL | ||
| 274 | |||
| 275 | Default_Mem_Err_Exit: | ||
| 276 | |||
| 277 | mov Init_Err,Error ;flag an error occurred ;an000; dms; | ||
| 278 | lea dx,No_EMS_Memory ;no memory on cards left ;an000; dms; | ||
| 279 | jmp Init_50_60_Ret ;exit routine ;an000; dms; | ||
| 280 | |||
| 281 | CHECK_E_PARM: ;Else test user specified # EMS pgs@RH4 | ||
| 282 | MOV BX,EMS_PGS_PARM ;Set counter for marking Page @RH4 | ||
| 283 | MOV NEEDED_EMS_PGS,BX ; Allocation List and TT entries @RH4 | ||
| 284 | MOV AX,TOTAL_SYS_PAGES ;If the requested EMS pages are @RH4 | ||
| 285 | SUB AX,PREV_EXT_PGS ; more than what's left @RH4 | ||
| 286 | CMP AX,EMS_PGS_PARM ; (total pages minus pages @RH4 | ||
| 287 | JGE MARK_EXT_IN_PAL ; used by other drivers) then set @RH4 | ||
| 288 | MOV INIT_ERR,ERROR ; an error condition flag @RH4 | ||
| 289 | LEA DX,REQ_EMS_ERR_MSG ; Set first part of error message @RH4 | ||
| 290 | JMP INIT_50_60_RET ; @RH4 | ||
| 291 | |||
| 292 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 293 | ;³ Mark PAL for extended memory pages ³ | ||
| 294 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 295 | MARK_EXT_IN_PAL: | ||
| 296 | xor di,di ;start at bottom of PAL to init EXT ;an002; dms; | ||
| 297 | MARK_NEW_IN_PAL: | ||
| 298 | MOV CX,TOTAL_SYS_PAGES ;Loop for the 'new' extended pages @RH4 | ||
| 299 | SUB CX,NEEDED_EMS_PGS ; (left over from /E parm and not @RH4 | ||
| 300 | SUB CX,PREV_EXT_PGS ; reserved by a previous driver) @RH4 | ||
| 301 | MOV RESR_EXT_PGS,CX ; @RH4 | ||
| 302 | CMP CX,0 ; This assumes that others anyone @RH4 | ||
| 303 | JE MARK_PREV_IN_PAL ; using extended memory after us @RH4 | ||
| 304 | MARK_NEW_LP: ; will take it from the top @RH4 | ||
| 305 | MOV PAGE_ALLOC_LIST[DI],RESR_EXT ;Place a 'RE' in the PAL @RH4 | ||
| 306 | ADD DI,TYPE PAGE_ALLOC_LIST ; (Reserved Extended) for @RH4 | ||
| 307 | LOOP MARK_NEW_LP ; these entries @RH4 | ||
| 308 | |||
| 309 | MARK_PREV_IN_PAL: | ||
| 310 | MOV AX,NEEDED_EMS_PGS ;Set offset into Page Alloc List @RH4 | ||
| 311 | add ax,Resr_Ext_Pgs ;get end of area for EMS pages ;an002; dms; | ||
| 312 | MOV DX,TYPE PAGE_ALLOC_LIST ; for the page where extended mem @RH4 | ||
| 313 | MUL DX ; starts. This is done by skipping@RH4 | ||
| 314 | MOV DI,AX ; over the EMS pages on bottom @RH4 | ||
| 315 | MOV CX,PREV_EXT_PGS ;Loop for the previous extended @RH4 | ||
| 316 | CMP CX,0 ; memory pages (if any). This is @RH4 | ||
| 317 | JE DIS_EMS_TT ; ext mem claimed before we load @RH4 | ||
| 318 | MARK_PREV_LP: ; @RH4 | ||
| 319 | MOV PAGE_ALLOC_LIST[DI],PREV_EXT ;Place a 'PE' in the PAL @RH4 | ||
| 320 | ADD DI,TYPE PAGE_ALLOC_LIST ; (Previous Extended) for @RH4 | ||
| 321 | LOOP MARK_PREV_LP ; these entries @RH4 | ||
| 322 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 323 | ;³ Disable translate table entries ³ | ||
| 324 | ;³ in extended memory for memory ³ | ||
| 325 | ;³ used as EMS ³ | ||
| 326 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 327 | |||
| 328 | DIS_EMS_TT: | ||
| 329 | |||
| 330 | mov cx,Resr_Ext_Pgs ;get extended page count ;ac008; dms; | ||
| 331 | ;1 based page count | ||
| 332 | |||
| 333 | xor di,di ;set mem card table ptr ;an002; dms; | ||
| 334 | |||
| 335 | Card_Find_Chk: | ||
| 336 | |||
| 337 | cmp cx,Mem_Card_Table.End_Pg_Num[di];page > ending page on card? ;ac008; dms; | ||
| 338 | ja Card_Find_Loop ;yes - next card please ;an002; dms; | ||
| 339 | add Card_Ext_S16K,cx ;get 1st. avail page ;an008; dms; | ||
| 340 | mov cx,Mem_Card_Table.End_Pg_Num[di];Calc # pages remaining on card ;an002; dms; | ||
| 341 | sub cx,Resr_Ext_Pgs ; ;ac008; dms; | ||
| 342 | inc cx ; ;an002; dms; | ||
| 343 | jmp Calc_Cards_EMS ; ;an002; dms; | ||
| 344 | |||
| 345 | Card_Find_Loop: | ||
| 346 | |||
| 347 | add di,Type Mem_Card_Struc ;next pointer ;an002; dms; | ||
| 348 | jmp Card_Find_Chk ;continue loop ;an002; dms; | ||
| 349 | |||
| 350 | |||
| 351 | CALC_CARDS_EMS: | ||
| 352 | |||
| 353 | MOV CARDS_PGS,CX ; @RH4 | ||
| 354 | |||
| 355 | ;Calc # of pages to inhibit for. @RH4 | ||
| 356 | CMP CX,NEEDED_EMS_PGS ;If the card has less pgs than @RH4 | ||
| 357 | JBE ADJUST_NEEDED_EMS ; # needed for EMS then just loop @RH4 | ||
| 358 | MOV CX,NEEDED_EMS_PGS ; for card. Else loop for needed. @RH4 | ||
| 359 | |||
| 360 | ADJUST_NEEDED_EMS: | ||
| 361 | SUB NEEDED_EMS_PGS,CX ;Remaining EMS pages to inhibit @RH4 | ||
| 362 | ; after this card is taken care of @RH4 | ||
| 363 | |||
| 364 | MOV AL,MEM_CARD_TABLE.CARD_SLOT[DI] ;Activate the slot of @RH4 | ||
| 365 | OR AL,SLOT_SETUP ; the card and set ptr @RH4 | ||
| 366 | OUT 96h,AL ; to where it's ext mem @RH4 | ||
| 367 | MOV AX,CARD_EXT_S16K ; starts @RH4 | ||
| 368 | |||
| 369 | CMP MEM_CARD_TABLE.CARD_ID[DI],HLST_CARD_ID ;Test card type @RH4 | ||
| 370 | JE H_INHIBIT_EMS ; @RH4 | ||
| 371 | X_INHIBIT_EMS: ;Inhibit TT on XMA/A for EMS @RH4 | ||
| 372 | PUSH CX ;Save ctr for # EMS on this card @RH4 | ||
| 373 | MOV CL,2 ;Convert 16K start of EMS ptr to @RH4 | ||
| 374 | SHL AX,CL ; 4K XMA/A translate table format @RH4 | ||
| 375 | POP CX ;Restore # EMS pages counter @RH4 | ||
| 376 | X_INH_EMS_PGS: ;----Loop for all XMA EMS pages----@RH4 | ||
| 377 | PUSH CX ;Save # EMS pages ctr @RH4 | ||
| 378 | MOV CX,BLOCKS_PER_PAGE ;Loop for all XMA blocks in a pg @RH4 | ||
| 379 | X_INH_ONE_PAGE: ;----Loop for one XMA EMS page-----@RH4 | ||
| 380 | CALL X_INH_FOR_EMS ;Inhibit TT entry (AX = 4K ptr) @RH4 | ||
| 381 | INC AX ;Next XMA block @RH4 | ||
| 382 | LOOP X_INH_ONE_PAGE ; @RH4 | ||
| 383 | POP CX ;Restore ctr for # EMS pgs on card @RH4 | ||
| 384 | LOOP X_INH_EMS_PGS ;Loop for # EMS pgs on card @RH4 | ||
| 385 | JMP short next_card_ems ;Now go fix that page alloc table @RH4 | ||
| 386 | |||
| 387 | H_INHIBIT_EMS: ;Inhibit TT on XMO for EMS @RH4 | ||
| 388 | CALL H_INH_FOR_EMS ;Inhibit one TT entry per EMS page @RH4 | ||
| 389 | INC AX ;Next 16K pointer @RH4 | ||
| 390 | LOOP H_INHIBIT_EMS ; and do it again yahoooooo @RH4 | ||
| 391 | |||
| 392 | NEXT_CARD_EMS: | ||
| 393 | CMP NEEDED_EMS_PGS,0 ;If this card had the rest of the @RH4 | ||
| 394 | JE INIT_50_60_RET ; EMS pages then done disabling TT @RH4 | ||
| 395 | ;Else EMS on next card. Set ptr @RH4 | ||
| 396 | MOV AX,CARDS_PGS ; to where next card's ext mem @RH4 | ||
| 397 | ADD CARD_EXT_S16K,AX ; starts (in units of 16K) and save@RH4 | ||
| 398 | |||
| 399 | ADD DI,TYPE MEM_CARD_STRUC ;Next entry in the memory card @RH4 | ||
| 400 | |||
| 401 | mov cx,Mem_Card_Table.End_Pg_Num[di] ;calc pages on ;an002; dms; | ||
| 402 | sub cx,Mem_Card_Table.Start_Pg_Num[di] ;card ;an002; dms; | ||
| 403 | inc cx ; ;an002; dms; | ||
| 404 | |||
| 405 | JMP CALC_CARDS_EMS ; table. @RH4 | ||
| 406 | |||
| 407 | INIT_50_60_RET: | ||
| 408 | |||
| 409 | MOV AX,TOTAL_SYS_PAGES ;Total EMS pages in the system = @RH4 | ||
| 410 | SUB AX,PREV_EXT_PGS ; pages on cards - amount used @RH4 | ||
| 411 | SUB AX,RESR_EXT_PGS ; as extended memory @RH4 | ||
| 412 | MOV TOTAL_SYS_PAGES,AX ;Initialize values for: @RH4 | ||
| 413 | MOV TOTAL_EMS_PAGES,AX ; EMS pages - pages to back planar @RH4 | ||
| 414 | MOV FREE_PAGES,AX ; EMS pages free for applications @RH4 | ||
| 415 | |||
| 416 | MOV AL,0 ;Reset the slot ID @RH5 | ||
| 417 | OUT 96h,AL ; @RH5 | ||
| 418 | |||
| 419 | POP DI | ||
| 420 | POP SI | ||
| 421 | POP CX | ||
| 422 | POP BX | ||
| 423 | POP AX | ||
| 424 | RET | ||
| 425 | INIT_MOD_50_60 ENDP | ||
| 426 | |||
| 427 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 428 | ;³ HLST_MEM_ADD subprocedure ³ | ||
| 429 | ;³ Calculates the amount of memory on the XMO card ³ | ||
| 430 | ;³ on entry: (CL) = card slot # ³ | ||
| 431 | ;³ card is in setup mode ³ | ||
| 432 | ;³ ³ | ||
| 433 | ;³ The following describes how to read memory size, where the 2 bit ³ | ||
| 434 | ;³ pattern indicates SIP size. There are 2 SIPs per bank. ³ | ||
| 435 | ;³ ³ | ||
| 436 | ;³ Reg: Card Info Channel Check, Presence ³ | ||
| 437 | ;³ Port: 102h 105h ³ | ||
| 438 | ;³ SIPS: bank 4 bank 3 bank 2 bank 1 bank 1 ³ | ||
| 439 | ;³ Bit: 7 6 5 4 3 2 1 0 ³ | ||
| 440 | ;³ -----------------------------------------------------------------³ | ||
| 441 | ;³ 1 1 1 1 1 1 1 1 No memory,error ³ | ||
| 442 | ;³ 1 0 1 0 1 0 1 0 256K ³ | ||
| 443 | ;³ 0 1 0 1 0 1 0 1 512K ³ | ||
| 444 | ;³ 0 0 0 0 0 0 0 0 1M ³ | ||
| 445 | ;³ ³ | ||
| 446 | ;³ Note that for bank 0, 102's bit 1 forms the upper bit and ³ | ||
| 447 | ;³ 105's bit 0 forms the lower of the 2 bit presence pattern. ³ | ||
| 448 | ;³ Therefore, if the pattern is '10'B, then the bank has 256K. ³ | ||
| 449 | ;³ ³ | ||
| 450 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 451 | HLST_MEM_ADD PROC | ||
| 452 | PUSH DX ; @RH3 | ||
| 453 | PUSH CX ; @RH3 | ||
| 454 | PUSH AX ; @RH3 | ||
| 455 | |||
| 456 | MOV HLST_NUM_BLOCKS,0 ;Init # of 16K blocks on card @RH3 | ||
| 457 | |||
| 458 | MOV DX,H_CARD_INFO ;Read & store card info reg (102h) @RH3 | ||
| 459 | IN AL,DX ; bits 7-2 describe banks 4-2 @RH3 | ||
| 460 | AND AL,11111110B ; bit 1 upper half of bank 1 descr @RH3 | ||
| 461 | MOV H_CARD_INFO_VAL,AL ; (don't care about sleep bit 0) @RH3 | ||
| 462 | MOV DX,H_CC_PRES ;Read chan. check & presence (105) @RH3 | ||
| 463 | IN AL,DX ; for bit 0 - lower half of bank 1 @RH3 | ||
| 464 | AND AL,00000001B ; Turn off all other bits @RH3 | ||
| 465 | OR AL,H_CARD_INFO_VAL ;Join 2 bits - bank 1 descriptor @RH3 | ||
| 466 | |||
| 467 | XOR AL,LO2BIT_FLIP ;Flip these 2 to get # of 1/2 Megs @RH3 | ||
| 468 | ; in bank 1 of XMO card @RH3 | ||
| 469 | AND AL,HI6BIT_MASK ;Clear other bits @RH3 | ||
| 470 | CMP AL,LO2BIT_FLIP ;Are both bits on (i.e. 1M sips)? @RH3 | ||
| 471 | JNE H_B1_HMEG_OK ;No # of 1/2 M for bank OK (0,1,2)@RH3 | ||
| 472 | INC AL ;Yes # of 1/2 M should be 4 not 3 @RH3 | ||
| 473 | H_B1_HMEG_OK: | ||
| 474 | MUL H_BLKS_PER_HALFM ;Multiply by # of 16k Blocks per @RH3 | ||
| 475 | ; half meg to get bank's blocks @RH3 | ||
| 476 | ADD HLST_NUM_BLOCKS,AX ;Add bank 1 to the total @RH3 | ||
| 477 | |||
| 478 | SHR H_CARD_INFO_VAL,1 ;Shift bank 4-2 descriptors to @RH3 | ||
| 479 | SHR H_CARD_INFO_VAL,1 ; bits 0-5 @RH3 | ||
| 480 | |||
| 481 | MOV CX,NUM_CINFO_BANKS ; Loop for banks accounted for by @RH3 | ||
| 482 | ; the XMO card info register @RH3 | ||
| 483 | HLST_MEM_LOOP: | ||
| 484 | MOV AL,H_CARD_INFO_VAL ;Get 2 bit bank descriptor & flip @RH3 | ||
| 485 | XOR AL,LO2BIT_FLIP ; the 2 bits. Bits now indicate @RH3 | ||
| 486 | ; the # of 1/2 meg in the bank @RH3 | ||
| 487 | AND AL,HI6BIT_MASK ;Ignore other banks @RH3 | ||
| 488 | CMP AL,LO2BIT_FLIP ;Are both bits on (i.e. 1M sips)? @RH3 | ||
| 489 | JNE H_B42_HMEG_OK ;No # of 1/2 M for bank OK (0,1,2)@RH3 | ||
| 490 | INC AL ;Yes # of 1/2 M should be 4 not 3 @RH3 | ||
| 491 | H_B42_HMEG_OK: | ||
| 492 | MUL H_BLKS_PER_HALFM ;Multiply by # of 4k blocks per @RH3 | ||
| 493 | ; half meg to get bank's blocks @RH3 | ||
| 494 | ADD HLST_NUM_BLOCKS,AX ;Add XMO banks 4-2 to total @RH3 | ||
| 495 | SHR H_CARD_INFO_VAL,1 ;Get next bank @RH3 | ||
| 496 | SHR H_CARD_INFO_VAL,1 ; @RH3 | ||
| 497 | LOOP HLST_MEM_LOOP ; @RH3 | ||
| 498 | |||
| 499 | POP AX ; @RH3 | ||
| 500 | POP CX ; @RH3 | ||
| 501 | POP DX ; @RH3 | ||
| 502 | |||
| 503 | RET | ||
| 504 | HLST_MEM_ADD ENDP | ||
| 505 | |||
| 506 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 507 | ;³ XMAA_MEM_ADD subprocedure ³ | ||
| 508 | ;³ Calculates the amount of memory on the XMAA card ³ | ||
| 509 | ;³ on entry: (CL) = card slot # ³ | ||
| 510 | ;³ card is in setup mode ³ | ||
| 511 | ;³ ³ | ||
| 512 | ;³ The following describes how to read memory size, where the 2 bit ³ | ||
| 513 | ;³ pattern indicates SIP size. There are 2 SIPs per bank. ³ | ||
| 514 | ;³ ³ | ||
| 515 | ;³ Reg: Control Reg Config, Channel Check reg ³ | ||
| 516 | ;³ Port: 102h 105h ³ | ||
| 517 | ;³ SIPS: bank 4 bank 3 bank 2 bank 1 ³ | ||
| 518 | ;³ Bit: 7 6 5 4 3 2 1 0 ³ | ||
| 519 | ;³ ------------------------------------------------- ³ | ||
| 520 | ;³ 1 1 1 1 1 1 1 1 No memory or error ³ | ||
| 521 | ;³ 1 0 1 0 1 0 1 0 256K ³ | ||
| 522 | ;³ 0 1 0 1 0 1 0 1 512K ³ | ||
| 523 | ;³ 0 0 0 0 0 0 0 0 1M ³ | ||
| 524 | ;³ ³ | ||
| 525 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 526 | XMAA_MEM_ADD PROC | ||
| 527 | PUSH DX ; @RH2 | ||
| 528 | PUSH CX ; @RH2 | ||
| 529 | PUSH AX ; @RH2 | ||
| 530 | |||
| 531 | ;Insure XMA/A init ROM is disabled @RH2 | ||
| 532 | ;When the high byte of the TT data @RH2 | ||
| 533 | MOV DX,X_CTRL_REG | ||
| 534 | IN AL,DX ; is read or written using port @RH2 | ||
| 535 | MOV X_CTRL_REG_VAL,AL ; SAVE FOR MEM COUNT | ||
| 536 | AND AL,CR_ROMSLEEP_DIS ; 104h (real mode), the upper @RH2 | ||
| 537 | OUT DX,AL ; nibble has info for setting the @RH2 | ||
| 538 | ; initialization ROM addresses. To @RH2 | ||
| 539 | ; insure this causes no problems, @RH2 | ||
| 540 | ; disable XMA/A ROM by clearing @RH2 | ||
| 541 | ; ROM sleep bit in the control reg @RH2 | ||
| 542 | |||
| 543 | MOV XMAA_NUM_BLOCKS,0 ; @RH2 | ||
| 544 | |||
| 545 | MOV AL,X_CTRL_REG_VAL ;Get bits 6&7 of control register @RH2 | ||
| 546 | MOV CL,6 ; to get memory configuration of @RH2 | ||
| 547 | SHR AL,CL ; bank 4 @RH2 | ||
| 548 | XOR AL,LO2BIT_FLIP ;Flip these 2 to get # of 1/2M @RH2 | ||
| 549 | ; in bank 4 of XMA/A card @RH2 | ||
| 550 | AND AL,HI6BIT_MASK ;Clear other bits @RH2 | ||
| 551 | CMP AL,LO2BIT_FLIP ;Are both bits on (i.e. 1M sips)? @RH2 | ||
| 552 | JNE CTRL_HMEG_OK ;No # of 1/2 M for bank OK (0,1,2)@RH2 | ||
| 553 | INC AL ;Yes # of 1/2 M should be 4 not 3 @RH2 | ||
| 554 | CTRL_HMEG_OK: | ||
| 555 | MUL X_BLKS_PER_HALFM ;Multiply by # of 4k blocks per @RH2 | ||
| 556 | ; half meg to get bank's blocks @RH2 | ||
| 557 | ADD XMAA_NUM_BLOCKS,AX | ||
| 558 | |||
| 559 | |||
| 560 | MOV DX,X_CONF_REG ;Read the config, channel check @RH2 | ||
| 561 | IN AL,DX ; register to get mem size of @RH2 | ||
| 562 | MOV X_CONF_REG_VAL,AL ; banks 1-3 @RH2 | ||
| 563 | |||
| 564 | MOV CX,NUM_CONFR_BANKS ; Loop for banks accounted for by @RH2 | ||
| 565 | ; the config register @RH2 | ||
| 566 | XMAA_MEM_LOOP: | ||
| 567 | MOV AL,X_CONF_REG_VAL ;Get 2 bit bank descriptor & flip @RH2 | ||
| 568 | XOR AL,LO2BIT_FLIP ; the 2 bits. Bits now indicate @RH2 | ||
| 569 | ; the # of 1/2 meg in the bank @RH2 | ||
| 570 | AND AL,HI6BIT_MASK ;Ignore other banks @RH2 | ||
| 571 | CMP AL,LO2BIT_FLIP ;Are both bits on (i.e. 1M sips)? @RH2 | ||
| 572 | JNE CONF_HMEG_OK ;No # of 1/2 M for bank OK (0,1,2)@RH2 | ||
| 573 | INC AL ;Yes # of 1/2 M should be 4 not 3 @RH2 | ||
| 574 | CONF_HMEG_OK: | ||
| 575 | MUL X_BLKS_PER_HALFM ;Multiply by # of 4k blocks per @RH2 | ||
| 576 | ; half meg to get bank's blocks @RH2 | ||
| 577 | ADD XMAA_NUM_BLOCKS,AX ; @RH2 | ||
| 578 | SHR X_CONF_REG_VAL,1 ;Get next bank @RH2 | ||
| 579 | SHR X_CONF_REG_VAL,1 ; @RH2 | ||
| 580 | LOOP XMAA_MEM_LOOP ; @RH2 | ||
| 581 | |||
| 582 | POP AX ; @RH2 | ||
| 583 | POP CX ; @RH2 | ||
| 584 | POP DX ; @RH2 | ||
| 585 | |||
| 586 | RET | ||
| 587 | XMAA_MEM_ADD ENDP | ||
| 588 | |||
| 589 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 590 | ;³ H_READ_TT subprocedure ³ | ||
| 591 | ;³ Reads the contents of a translate table entry on a XMO card ³ | ||
| 592 | ;³ on entry: (AX) = Translate table pointer ³ | ||
| 593 | ;³ on exit: (BL) = Data (byte) at that entry ³ | ||
| 594 | ;³ ³ | ||
| 595 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 596 | H_READ_TT PROC | ||
| 597 | PUSH AX ;Save the TT pointer @RH4 | ||
| 598 | MOV DX,H_TTPTR_LO ;Set the low and high bytes of @RH4 | ||
| 599 | OUT DX,AL ; the XMO translate table @RH4 | ||
| 600 | XCHG AL,AH ; pointer, then read the value @RH4 | ||
| 601 | MOV DX,H_TTPTR_HI ; of the data for that entry @RH4 | ||
| 602 | OUT DX,AL ; @RH4 | ||
| 603 | MOV DX,H_TTDATA ; @RH4 | ||
| 604 | IN AL,DX ;Read the data into AL @RH4 | ||
| 605 | MOV BL,AL ; and store it in BL @RH4 | ||
| 606 | POP AX ;Restore TT pointer @RH4 | ||
| 607 | RET ; @RH4 | ||
| 608 | H_READ_TT ENDP | ||
| 609 | |||
| 610 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 611 | ;³ X_READ_TT subprocedure ³ | ||
| 612 | ;³ Reads the contents of a translate table entry on an XMA/A card ³ | ||
| 613 | ;³ on entry: (AX) = Translate table pointer ³ | ||
| 614 | ;³ on exit: (BX) = Data (12 bits) at that entry ³ | ||
| 615 | ;³ ³ | ||
| 616 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 617 | X_READ_TT PROC | ||
| 618 | PUSH AX ;Save the TT pointer @RH4 | ||
| 619 | MOV DX,RM_TTPTR_LO ;Set the low and high bytes of @RH4 | ||
| 620 | OUT DX,AL ; the XMA/A translate table @RH4 | ||
| 621 | XCHG AL,AH ; pointer, then read the value @RH4 | ||
| 622 | MOV DX,RM_TTPTR_HI ; of the data for that entry @RH4 | ||
| 623 | OUT DX,AL ; @RH4 | ||
| 624 | |||
| 625 | MOV DX,RM_TTDATA_HI ;Read 12 bit TT data high byte @RH4 | ||
| 626 | IN AL,DX ; first, then read low byte. @RH4 | ||
| 627 | XCHG AL,AH ; @RH4 | ||
| 628 | MOV DX,RM_TTDATA_LO ; @RH4 | ||
| 629 | IN AL,DX ; @RH4 | ||
| 630 | MOV BX,AX ;Store result in BX @RH4 | ||
| 631 | AND BX,XMA_TT_MASK ;Turn off useless upper 4 bits @RH4 | ||
| 632 | POP AX ;Restore TT pointer @RH4 | ||
| 633 | RET ; @RH4 | ||
| 634 | X_READ_TT ENDP | ||
| 635 | |||
| 636 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 637 | ;³ H_INH_FOR_EMS subprocedure ³ | ||
| 638 | ;³ Inhibits a single translate table entry of extended memory ³ | ||
| 639 | ;³ on a XMO card. This entry (16K) is for use by EMS. ³ | ||
| 640 | ;³ on entry: (AX) = XMO Translate table pointer (# of K / 16) ³ | ||
| 641 | ;³ ³ | ||
| 642 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 643 | H_INH_FOR_EMS PROC | ||
| 644 | PUSH AX ;Save the TT pointer @RH4 | ||
| 645 | MOV DX,H_TTPTR_LO ;Set the low and high bytes of @RH4 | ||
| 646 | OUT DX,AL ; the XMO translate table @RH4 | ||
| 647 | XCHG AL,AH ; pointer, @RH4 | ||
| 648 | MOV DX,H_TTPTR_HI ; @RH4 | ||
| 649 | OUT DX,AL ; @RH4 | ||
| 650 | |||
| 651 | MOV AL,H_TT_INHIBIT ;AL = XMO TT inhibit data @RH4 | ||
| 652 | MOV DX,H_TTDATA ;Inhibit this TT entry so that @RH4 | ||
| 653 | OUT DX,AL ; it is no longer extended memory @RH4 | ||
| 654 | POP AX ;Restore TT pointer @RH4 | ||
| 655 | RET ; @RH4 | ||
| 656 | H_INH_FOR_EMS ENDP | ||
| 657 | |||
| 658 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 659 | ;³ X_INH_FOR_EMS subprocedure ³ | ||
| 660 | ;³ Inhibits a single translate table entry of extended memory ³ | ||
| 661 | ;³ on a XMA/A card. This entry (4K) is for use by EMS. ³ | ||
| 662 | ;³ on entry: (AX) = XMA/A Translate table pointer (# of K / 4) ³ | ||
| 663 | ;³ ³ | ||
| 664 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 665 | X_INH_FOR_EMS PROC | ||
| 666 | PUSH AX ;Save the TT pointer @RH4 | ||
| 667 | MOV DX,RM_TTPTR_LO ;Set the low and high bytes of @RH4 | ||
| 668 | OUT DX,AL ; the XMA/A translate table @RH4 | ||
| 669 | XCHG AL,AH ; pointer, then read the value @RH4 | ||
| 670 | MOV DX,RM_TTPTR_HI ; of the data for that entry @RH4 | ||
| 671 | OUT DX,AL ; @RH4 | ||
| 672 | |||
| 673 | MOV AX,XMA_TT_INHIBIT ;AX = XMA 12 bit TT inhibit data @RH4 | ||
| 674 | MOV DX,RM_TTDATA_LO ;Write 12 bit TT data low byte @RH4 | ||
| 675 | OUT DX,AL ; first, then write high byte. @RH4 | ||
| 676 | XCHG AL,AH ; @RH4 | ||
| 677 | MOV DX,RM_TTDATA_HI ; @RH4 | ||
| 678 | OUT DX,AL ; @RH4 | ||
| 679 | POP AX ;Restore TT pointer @RH4 | ||
| 680 | RET ; @RH4 | ||
| 681 | X_INH_FOR_EMS ENDP | ||
| 682 | |||
| 683 | ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 684 | ;³ ADJUST_CMOS subprocedure ³ | ||
| 685 | ;³ Reset the CMOS value for amount of extended memory. The ³ | ||
| 686 | ;³ memory off the 'top' (upper addresses) is used by EMS. ³ | ||
| 687 | ;³ on entry: ³ | ||
| 688 | ;³ CARD_EXT_S16K = First 16K translate table pointer past the ³ | ||
| 689 | ;³ top of the last card. Example - One 2M card ³ | ||
| 690 | ;³ that started at 1M+384K, AX = 58h + 80H = D8h ³ | ||
| 691 | ;³ ³ | ||
| 692 | ;³ ³ | ||
| 693 | ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 694 | ADJUST_CMOS PROC | ||
| 695 | CMOS_LO EQU 70h ;Port addrs of CMOS controller | ||
| 696 | CMOS_HI EQU 71h | ||
| 697 | |||
| 698 | MOV BX,CARD_EXT_S16K ;Convert to 1st 16K TT ptr past @RH4 | ||
| 699 | SUB BX,ems_pgs_parm ; entries reserved for ext mem @RH4 | ||
| 700 | SUB BX,1024/16 ;Convert to # of 16K above 1M | ||
| 701 | MOV CL,4 ;Multiply by 16 to get # of K | ||
| 702 | SHL BX,CL ; above 1 Megabyte | ||
| 703 | |||
| 704 | MOV AX,8800h ;Get BIOS' current value for # | ||
| 705 | INT 15h ; of K extended (above 1M) | ||
| 706 | |||
| 707 | CMP AX,BX ;If already set below what we think | ||
| 708 | JBE CMOS_RET ; think then don't adjust it | ||
| 709 | |||
| 710 | PUSHF ;Else adjust CMOS...save state of | ||
| 711 | CLI ; interrupts and disable | ||
| 712 | MOV AL,0B5h ;Select NMI off byte 35 | ||
| 713 | OUT CMOS_LO,AL ;Write to CMOS controller | ||
| 714 | JMP $+2 ; delay | ||
| 715 | MOV AL,BL ;Write low data byte to CMOS | ||
| 716 | OUT CMOS_HI,AL ; | ||
| 717 | JMP $+2 ; | ||
| 718 | |||
| 719 | MOV AL,0B6h ;Select NMI off byte 36 | ||
| 720 | OUT CMOS_LO,AL ;Write to CMOS controller | ||
| 721 | JMP $+2 ; delay | ||
| 722 | MOV AL,BH ;Write high data byte to CMOS | ||
| 723 | OUT CMOS_HI,AL ; | ||
| 724 | JMP $+2 ; | ||
| 725 | |||
| 726 | MOV AL,0Fh ;Select NMI on byte 0f | ||
| 727 | OUT CMOS_LO,AL ;Write to CMOS controller | ||
| 728 | JMP $+2 ; delay | ||
| 729 | IN AL,CMOS_HI ;Reset CMOS like BIOS does | ||
| 730 | POPF ;Restore interrupt state | ||
| 731 | CMOS_RET: | ||
| 732 | RET ; @RH4 | ||
| 733 | ADJUST_CMOS ENDP | ||
| 734 | |||
| 735 | \ No newline at end of file | ||