55X8817_PC_Convertable_Technical_Reference_Volume_2_Feb86 55X8817 PC Convertable Technical Reference Volume 2 Feb86
User Manual: 55X8817_PC_Convertable_Technical_Reference_Volume_2_Feb86
Open the PDF directly: View PDF .
Page Count: 275
Download | |
Open PDF In Browser | View PDF |
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , First Edition (February 1986) THE FOLLOWING PARAGRAPH DOES NOT APPLY TO THE UNITED KINGDOM OR ANY COUNTRY WHERE SUCH PROVISIONS ARE INCONSISTENT WITH LOCAL LAW: International Business Machines Corporation provides this manual "as is," without warranty of any kind, either express or implied, including, but not limited to, the particular purpose. IBM may make improvements and changes in the products and the programs described in this manual at any time. This product could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. It is possible that this material may contain reference to, or information about, IBM products (machines and programs), piOgramming, or services that are not announced in your country. Such references or information must not be construed to mean that IBM intends to announce such IBM products, programming, or services in your country. Products are not stocked at the address below. Requests for copies of the product and for technical information about the system should be made to your authorized IBM Personal Computer Dealer. THE FOLLOWING PARAGRAPH APPLIES ONLY TO THE UNITED STATES AND PUERTO RICO: A form for reader's comments is provided at the back of this publication. If the form has been removed, comments may be addressed to IBM Corporation, Department 95H, 11400 Burnet Road, Austin, Texas 78758, U.S.A. IBM may use or distribute whatever information you supply in any way it believes appropriate without incurring any obligation to you. All specifications are subject to change without notice. ©Copyright International Business Machines 1986 Preface The IBM PC Convertible Technical Reference consists of two volumes. Volume 1 describes the hardware design and provides interface information for the IBM PC Convertible. Volume 1 also has information about the basic input/output system (BIOS) and programming support. Volume 2 contains the BIOS listings. The information in these volumes is both descriptive and reference-oriented and is intended for hardware and software designers, programmers, engineers, and other interested persons who need to understand the design and operation of the IBM PC Convertible. These users should be familiar with the use of the IBM PC Convertible and understand the concepts of computer architecture and programming. Volume 1 has five sections: • Section 1, "Introduction" is an overview of the system and the available options. • Section 2, "System Unit" describes each functional part of the base system. This section also contains the description of the interfaces. Programming considerations are supported by command code and register descriptions. • Section 3, "System Options" describes each available option. • Section 4, "System BIOS and Usage" describes the basic input/output system (BIOS) and its use. This section also contains the software interrupt listing, a system memory map, descriptions of vectors with special meanings, and a set oflow-storage maps. In addition, Section 4 describes keyboard encoding and usage. • Section 5, "Compatibility with the IBM Personal Computer Family" describes programming concerns for maintaining compatibility among the IBM PC Convertible system and the other IBM Personal Computers. iii Volume 1 has the following appendixes: • Appendix A, "Characters and Keystrokes" • Appendix B, "Unit Specifications" • Appendix C, "Logic Timing Diagrams" • Appendix D, "Power-On Self Test Error Codes". Volume 2 contains the BIOS listing and is to be used in conjunction with Volume 1. Prerequisite Publications Guide to Operations: for the IBM PC Convertible. Suggested Reading • BASIC for the IBM Personal Computer • Disk Operating System • Hardware Maintenance and Service for the IBM PC Convertible • MACRO Assembler for the IBM Personal Computer. iv Contents Section 1. Power-On Self-Test (POST) ............... 1-1 Power-On Self-Test Sequence .................. 1-2 Modem Presence Test ........................ 1-9 Printer/Communications Presence Test ......... 1-12 Section 2. ROM BIOS Listing ...................... 2-1 ROMMap ................................. 2-4 Common Equates and Data Areas ............... 2-7 Nonmaskable Interrupt Handler (BlONMIH) .... 2-26 Keyboard Services (BIIKYBD) ............... 2-65 Video I/O and Print Screen (BI2VIDEO) ........ 2-77 Diskette Support (B 13DSKT) ................ 2-119 Communications and Printer BIOS (B14COMMO) ........................... 2-143 Time of Day (B15TOD) ..................... 2-153 System Services (B 16SYSV) . . . . . . . . . . . . . . . . . . 2-168 General Subroutines and Tables (B 17TABLE) ... 2-191 Release Date Marker ....................... 2-241 System Model Byte ......................... 2-241 v Notes: vi Section 1. Power-On Self-Test (POST) The IBM PC Convertible uses a set of routines called the power-on self-test (POST) routines. These routines automatically activate system power, perform basic function and device control tests for the major system components, and initialize the system to the ready state. Because the operation of these routines is automatic and cannot be changed by an application programmer, the actual program listings are not included in this manual. However, it may be useful to understand the function of these routines and the initial values they may establish. Figure I-Ion page 1-2 shows the sequence of the steps the power-on routines, the error indicators returned, and the initial values established. Figure 1-2 on page 1-9 and Figure 1-3 on page 1-12 provide additional information on testing for the presence of devices. Power-On Self-Test (POST) 1-1 Power-On Self-Test Sequence Description Error Indication Processor test: Verifies processor operation. System power off. System ROM checksum test: Verifies system ROM. I-long and I-short beep, then system power off. Real-iime clock RAM test: Verifies the clock. If contents have been altered, RAM is cleared and system profile defaults are loaded. l-iong and I-short beep, then system power off. Power source and battery check: Checks for external power. If no external power, checks for good battery. 3-short beeps, then system power off. Base 8K RAM test: Validates first 8K of RAM and clears it to zero. I-long and I-short beep, then system power off. Internal modem power on: Checks for internal modem presence and applies power to it ifpresent. See Figure 1-2 on page 1-9 for additional information. Figure 1-1 (Part 1 of7). Power-on Self-Test Sequence 1-2 Power-On Self-Test (POST) Description Error Indication Video adapter presence test: Checks for attached video adapters by nondestructive writing and reading hex A55A to address hex BOOOO and B8000. Checks for video adapters with valid rom. Checks for LCD by determining if the 'LCD sense' line is set. Video interrupt vectors initialization: Initializes hex 10, I D, I F and 44 video interrupt vectors to system default values. Video ROM validity tests: Checks for video adapter with valid ROM. See Volume I for additional information about adapters with system accessible ROM. Links to ROM if valid. LCD function test: Runs LCD function test if the LCD is present. Error 5001, 5002, or 5003 CRT adapter without ROM presence andfunction tests: Ifa CRT adapter without ROM is present, test vertical and horizontal syncs. Error 0501 Operable display presence test: Checks to ensure that an operable display is present. I-long and 2-short beeps, then system power off. Figure 1-1 (Part 2 of 7). Power-on Self-Test Sequence Power-On Self-Test (POST) 1-3 Description Error Indication Display initialization: Ifnot a resume sequence, initialize the display for POST. Ifthe LCD is present, loads the default font from vectors hex I F and 44. Interrupt controller test: Tests the interrupt controller and initializes it to edge triggered, software end-of-interrupt, and interrupt types 8-15. Error 0 I 0 I with icon, I-long and I-short beep, then waits for power off or Fn/Ctl/Del sequence. System timers tests: Tests the system timers. Timer-O is initialized to 18.2 interrupts per second rate. One of the following: Error 0 I 03 with icon, I-long and I-short beep, then waits for power off or Fn/CtljDel sequence. Error 0 I 02 with icon and Fl prompt; POST continues. DMA controller test: Tests the DMA controller. Error 0105 with icon, I-long and I-short beep, then waits for power off or Fn/CtljDel sequence. Figure 1-1 (Part 3 of 7). Power-on Self-Test Sequence 1-4 Power-On Self-Test (POST) Description Error Indication Keyboard controller test: Tests the keyboard controller. One of the following: Error 0303 or 0304 with icon, I-long and I-short beep, then wai ts for power off or Fn/Ctl/Del sequence. Error 0102 with icon and Fl prompt; POST continues. Interrupt vectors initialization: Initializes interrupt vectors 0 through 32 excluding the video interrupt vectors. Serial/parallel initializations: Initializes the serial and parallel adapter timeout values. Internal modem initialization: Initializes the internal modem. See Volume 1 for additional information about initializing the internal modem. RAM block check: Checks RAM for good contiguous 8K-bytes of RAM. Error 0164 with icon and Fl prompt. Figure 1-1 (Part 4 of 7). Power-on Self-Test Sequence Power-On Self-Test (POST) 1-5 Description Error Indication RAMfunction test: Checks for functional RAM in 64K-byte increments and clears it to zeroes. This test is not performed during either a resume or Ctlj AltjDel sequence. One of the following: When less than 64K-bytes of RAM is functional, error 020 I or 0202 with icon, I-long and I-short beep, then waits for power off or FnjCtljDel sequence. When more than 64K-bytes of RAM is functional, error 020 I or 0 I 02 with icon and FI prompt. POST continues. Diskette drive function test: Tests the operation ofthe diskette drives. One of the following: Error 060 I with icon, I-long and I-short beep, then waits for power off or FnjCtljDel sequence. Error 060 I with icon and FI prompt. Figure 1-1 (Part 50f7). Power-on Self-Test Sequence 1-6 Power-On Self-Test (POST) Description Error Indication Real-time clock test: Tests the update and interrupt functions. Zeros and initializes time and date, and sets alarm to zeros if the clock has not been updated or if power was lost. Error 0163 with icon and Fl prompt. Portable printer interface test: Checks the function of the adapter. Error 510 1 with icon andFI prompt. Printer/communications presence test: Checks to determine what printer and communications features are attached. See Figure 1-3 on page 1-12 for additional information. Internal modem test: Checks the function ofthe internal modem. Error 110 1 or 1102 with icon and Fl prompt. Serial adapter test: Tests the serial adapter portion of the IBM PC Convrtible Serial/Parallel Adapter if it is installed. Error 1101 or 1201 with icon and Fl prompt. Feature adapter ROM presence: External adapters are tested for the presence of ROM. See Volume 1 for additional information about adapters with system accessible ROM. Links to the ROM if valid. Checksum or feature error. Figure 1-1 (Part 6 of 7). Power-on Self-Test Sequence Power-On Self-Test (POST) 1-7 Description Error Indication Set time ofday: Sets time of day data area from real-time clock. Clock icon if clock has not been set by the user. Low battery test: Checks for good battery. Battery icon if battery is low and warning is enabled in the system profile. Complete POST: Ifa system suspend was active and the resume was not cancelled, the system state is restored and the application resumed. Otherwise, the LCD default font is loaded from vectors hex 1F and 44, and the system is booted from drive O. 2-short beeps if any warmng errors occurred. Figure 1-1 (Part 7 of7). Power-on Self-Test Sequence 1-8 Power-On Self-Test (POST) Modem Presence Test Clear RS232_BASE table (hex 400). Clear PRINTER_BASE table (hex 408). Turn off power to internal modem and serial/parallel adapter. Write/read hex AAand55to work register at hex3FF. To Part 2 Figure 1-2 (Part 1 of 3). Internal Modem Presence Test Power-On Self-Test (POST) 1-9 Yes (Other adapter present) Turn on power to internal modem. Set loop counter t05. Delay 100 ms. Write/read hex AA and 55 to work register at hex 3FF. To Part 3 Figure 1-2 (Part 2 of 3). Internal Modem Presence Test 1-10 Power-On Self-Test (POST) Set first entry in RS232_BASE table to hex 3F8. From Part 2 No Set modem installed flag in equipment word. Subtract 1 from loop counter. Set first entry in RS232-BASE table to hex 3F8. Turn off modem power. To Part 2 Return to POST. Figure 1-2 (Part 3 of 3). Internal Modem Presence Test Power-On Self-Test (POST) 1-11 Printer/Communications Presence Test From Part 3 Set pointer to PRINTER_BASE table (hex 408). -- t Printer presence test Printer Table (PRT_TAB) Set pointer to PRT_TAB table. Entry (hex) Port 078 378 3BC 278 Portable Printer Primary Printer Mono Adapter Secondary No No To Part 3 Delay 160 ms. Check portable printer status register (hex 079). To Part 3 __ SPortable printer lpresence test To Part 2 Figure 1-3 (Part 1 of 7). Printer/Communications Presence Test 1-12 Power-OnSelf-Test(POST) From Part 1 Yes (Attached) Yes (Not attached) To Part 3 Send top of forms (ESC 4) command. No (Not attached) Yes (Attached) To Part 3 To Part 3 To Part 2 Figure 1-3 (Part 2 of 7). Printer/Communications Presence Test Power-On Self-Test (POST) 1-13 From Parts 1 and 2 From Part 2 From Parts 1 and 2 No Store address in PRINTER_BASE table. Move PRINTER_BASE table pointer to next entry. Move PRT_TAB table pointer to next entry. No To Part 4 Figure 1-3 (Part 3 of 7). Printer/Communications Presence Test 1-14 Power-On Self-Test (POST) To Part 1 From Part 3 Set pointer to RS232_BASE table (hex 400). - - - - - - - {RS232 presence test No (Internal modem attached) Set serial/parallel adapter to primary. Move RS23LBASE table pointer to next entry. Turn on power to adapter. Write/read hex AA and 55 to work register at hex 2FF. Delay 100 ms. To Part 7 Write/read hex AA and 55 to work register at hex 3FF. - - - - - - - {Test for primary To Part 5 Figure 1-3 (Part 4 of 7). Printer/Communications Presence Test Power-On Self-Test (POST) 1-15 No (Not attached) Set RS232_BASE table entry to hex 3F8. Move RS232_BASE table pointer to next entry. Write/read hex AAand55to work register at hex2FF. - - - - - - - { Test for secondary To Part 6 Figure 1-3 (Part 5 of 7). Printer/Communications Presence Test 1-16 Power-OnSelf-Test(POST) From Part 5 No Set RS232_BASE table entry to hex 2F8. Move RS232_BASE table pointer to next entry. Set equipment word for number of printer and communications ports installed. Figure 1-3 (Part 6 of 7). Printer/Communications Presence Test Power-On Self-Test (POST) 1-17 Yes (Attached) Set RS232_BASE table entry to hex 2F8. Turn on power to adapter at hex 2F8. Move RS23LBASE table pointer to next entry. Delay 100 ms. Set equipment word for number of printer and communications ports installed. Write/read hex AA and 55 to work register at hex 2FF. Yes (serial/ parallel attached) Turn off power to adapter. Delay 100 ms. Figure 1-3 (Part 7 of 7). Printer/Communications Presence Test 1-18 Power-On Self-Test (POST) Section 2. ROM BIOS Listing ROM Map .................................. 2-4 Common Equates and Data Areas ................ 2-7 Common Equates .......................... 2-7 Processor Interrupt Vector Area ............. 2-16 POST and Bootstrap Temporary Stack ........ 2-16 BIOS Data Areas ......................... 2-17 POST Temporary Data Area ................ 2-23 Common Macros ......................... 2-24 Nonmaskable Interrupt Handler (B 10NMIH) ..... 2-26 First Level Interrupt Handler (NMLFLIH) .... 2-26 Diskette Resync (DSKT_RESYNC) .......... 2-29 Keyboard Data NMI (KBNMLDAT A) ....... 2-35 Keyboard Clear NMI (KYBD_CLR) .......... 2-37 Translate Scan Code (KYBD_XLT) .......... 2-38 Real-Time Clock NMI (RTCALARM_NMI) .. 2-44 Low Battery Check (LOW_BAT _CHK) ....... 2-47 Suspend NMI (SUSPEND) ................. 2-51 Resume (RESUME) ....................... 2-55 Keyboard Services (B11KYBD) ................ 2-65 Keyboard Interrupt Hex 16 (KYBD_IO) ....... 2-66 Levell Interrupt Hex 9 (KYBD_INT9) ....... 2-68 Video I/O and Print Screen (B 12VIDEO) ......... 2-77 Print Screen Interrupt Hex 05 (PRT_SCRN) .. 2-116 Diskette Support (B13DSKT) ................. 2-119 Diskette I/O Interrupt Hex 13 (DSKT_IO) .... 2-120 Bootstrap Loader Interrupt Hex 19 (SYS_BOOT) .......................... 2-139 Communications and Printer BIOS (B14COMMO) ............................ 2-143 Communications Interrupt Hex 14 (COMMO_IO) ......................... 2-144 Printer Interrupt Hex 17 (PRT_IO) .......... 2-150 Time of Day (B15TOD) ...................... 2-153 Time of Day Interrupt Hex 1A (TOD_PROC) . 2-154 Timer 0 Interrupt 8 (TMRO_INT8) .......... 2-166 System Services (B 16SYSV) ................... 2-168 ROM BIOS 2-1 System Services Interrupt Hex 15 (SYS_SERVICES) ...................... System Profile Services (SYS_PROF) ........ External Event Services (EXT_EVENT) ...... System Power Off Services (SYS_POWER.. DFF .................... System Status Services (SYS_ST ATUS) ...... Modem Power Services (SYS_MODEM_PWR) .................. POST Interval Services (POST_INTV) ....... Wait Interval Services (WAIT _INTV) ....... Device Busy Services (DEV _BUSY) ......... Interrupt Complete Services (INT_COMPLETE) ..................... General Subroutines and Tables (B 17TABLE) .... Software Reset Routine ................... System Descriptor Table .................. Default System Profile .................... Printer Configuration Table (PR T _TAB) ..... ASCII Conversion (STR....CON) ............ NMI Handler Entry Point Address (NMLINT) ............................ Character Generator Graphics 128-255 (CHAR....GEN_HI) ...................... Convert AX to ASCII (DSP_BYTE) ......... Boot Strap Loader Entry Address (BOOT_STRAP) ....................... Keyboard Noise (KB_NOISE) .............. Communications Baud Rate Table (BAUD_TABLE) ....................... RS-232 1/0 Entry Point (RS232_10) ......... Indicate POST Error (ERR....BEEP) .......... Beep to Speaker (BEEP) ................... Disable All Interrupts (DISABLE_NMI) ...... Enable Global NMls (ENABLE_NMI) ....... Get RTC Register (GET_RTC_REG) ........ Put RTC Register (PUT_RTC_REG) ........ Setup for Battery Savings (BAT_SA V_SETUP) .................... Keyoard 1/0 Entry Point (KEYBOARD_IO) .. Keyboard Reset (KYBD_RESET) ........... Set Data Segment (DDS) .................. 2-2 ROMBIOS 2-169 2-173 2-177 2-181 2-182 2-183 2-185 2-186 2-187 2-190 2-191 2-194 2-197 2-197 2-197 2-198 2-198 2-199 2-203 2-204 2-204 2-205 2-205 2-205 2-206 2-207 2-207 2-208 2-208 2-209 2-210 2-210 2-211 Calculate Absolute Vector Offset (GET_VECTOR@) ..................... Keyboard Support Tables ................. System Setup (SYS_SETUP) ............... Vector Setup (VECTOR-SETUP) ........... Error Message Routine (SYS_CHK) ......... Resume Error Check (RES_ERR-CHK) ...... Diskette I/O Entry (DISKETTE_IO) ......... Icon and Error Message Routine (E_MSG) .... Icon Display Routine (ICON_PR) ........... Diskette Interrupt Entry (DSKT _INT) ....... Diskette Drive Parameters ................. Diskette Timing Parameters (DSKT _BASE) .. Printer I/O Entry (PRINTER-IO) ........... Video Parameters ........................ Video I/O Entry (VIDEO_IO) .............. Video Parameters ........................ Memory Interrupt Hex 12 (MEMORY_SIZE_DET) ................. Equipment Interrupt Hex 11 (EQUIPMENT) . Cassette I/O Entry (No BIOS Support) ....... Character Generator Graphics 0-127 (CHAR-GEN_LO) ..................... Time of Day Entry (TIME_OF_DAY) ....... Timer 0 Interrupt Handler (TIMER-INT) .... BIOS Vector Table (VECTOR-TABLE) ...... Default Interrupt Services (D 11) ............ Hardware Power-on Reset Address .......... Release Date Marker ........................ System Model Byte .......................... 2-211 2-212 2-214 2-215 2-219 2-220 2-221 2-221 2-225 2-229 2-229 2-229 2-230 2-230 2-231 2-231 2-232 2-232 2-233 2-233 2-237 2-237 2-237 2-238 2-240 2-241 2-241 ROMBIOS 2-3 ROM Map Start Stop Length Name FOOOOH FFFFEH FFFFH ROMCODE Address Pub Ii cs by Name FOOD: 4350 FOOD: OC72 FOOD: E229 FOOD: ElE6 FOOD: E729 FOOO:E75F FOOD: E762 FOOD: E6F2 FOOD: F859 FOOD: EFE3 FOOD: E2C6 FOOD: FA6E FOOD: 2030 FOOO:ODEE FOOD:OCCF FOOO:2B61 FOOD: 530A FOOO:53DF FOOO:2473 FOOD: FF23 FOOD: E85C FOOD: E261 FOOD: E79B FOOD: EC59 FOOD: 4C95 FOOD: 18AA FOOD: EFC7 FOOD: E214 FOOD: EF57 FOOD: 4FBO FOOD: 4C2B FOOO:261F FOOD: E6C6 FOOD: 1E9A FOOD: 2304 FOOD: E6E7 FOOD: 22E2 FOOD: FF53 FOOD: E7A3 FOOD: F84D FOOD: E73C FOOD: 5A99 FOOD: EC5C FOOD: El28 FOOD: 5D4F FOOD: 4E6C FOOD: 3809 FOOD: E7AA FOOD: E864 FOOD: ED5F FOOD: 570C FOOD: E8E! FOOD: E91B FOOD: E955 FOOD: E95 F FOOD: E969 FOOD: E976 FOOD: EA87 FOOD: E87E FOOO:OO08 FOOD: E886 ACLDISP_PAGE ADDR_TST BAD_DSKT_I CON BALSALSETUP BAUD_TABLE BEEP BEEP_SUB BOOLSTRAP CASSETTLIO CGIUBL CHAR_GEN_H I CHAR_GEN_LO CHECK_FOR_8250 CHECLINT CLR_STG CMPLADAPLTEST COMMO_IO COM_POWER CRLTEST 011 DDS DEF_SYS_PROF DISABLE_NMI DISKETTLIO DISLRESET DMA_CHECK DSKLBASE DSKLICON DSKLINT DSKLINTE DSKLIO DSKLTST DSP_BYTE DSP _CONFIG DSP_FSETM DSP_HEX DSP_INIT DUMMLRETURN ENABLLNMI EQUIPMENT ERR_BEEP EXLEVENT E-MSG FLICON FILL GELPARM GELRTLNMI GELRTLREG GELVECTOR@ ICON_PR I NITIALI IE_STATUS KID Kll Abs K12 K13 K14 K15 K30 K6 K6L K7 2-4 ROM BIOS Address FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD 0008 0010 0014 ODIE 0020 002C 0043 03DB 0A46 OB40 OBDD OC72 OCCF ODOA 0015 OD5A OD6F ODEE 134C 18AA 1B49 1E9A 1F90 20EE 22E2 2304 2384 2473 2548 261F 2857 2966 29EA 2B1A 2B26 2B4B 2B61 2030 2070 2DCB 3174 3192 3809 38E2 3AC4 3040 3DA4 4110 415A 42AB 4332 4350 4381 439C 43C2 43E8 446B 44A7 44ED 4521 4554 Publics by Value Abs Abs Abs Abs Abs K6L M4 KBFUNL KBPADL MIL POSTMAIN POSLLOOP POSTCNTL ME~TEST ST"-TST MEM_SIIE_CHK ADDILTST CLILSTG ROM_CHECKSUM ROM_SCAN VAll D_ROMCHK ROM_LINK CHECLINT TMILTST DMA_CHECK KYBD_TST DSP _CONFIG LCDBUF_TST LCDCTLTST DSP_INIT DSP_FSETM LCDINIT CRLTEST VIDEO_LINK DSKLTST PTR_COM_PRESENCE MODEM_POWER_ON MODE~CONFIG SEND_C RECLS MODEM_INIT CMPLADAPLTEST CHECLFOR_8250 RS23LTEST MODEM_TEST SEND_COM NMLFLIH GELRTLNMI PULRTLNMI RESUME KYBD_IO KYBD_INT9 VIDEO_IO_1 SELMODE SELCTYPE SELCPOS ACLDISP _PAGE READ_CURSOR SELCOLOR VIDEO_STATE SCROLLUP SCROLL_DOWN READ-ALCURRENT WRITE-ALCURRENT WRITE_LCURRENT READ_DOT FOOO:E88E FOOO:E8C8 FOOO:0014 FOOO: EAC9 FOOO: EADD FOOO:OOIE FOOO:EAAB FOOO: E987 FOOO: E6F5 FOOO: E82E FOOO:3DA4 FOOO:3D40 FOOO: E831 FOOO: IB49 FOOO: IF90 FOOO:20EE FOOO:2384 FOOO: EFFI FOOO: EFFF FOOO: F045 FOOO:0020 FOOO:OOlO FOOO: FOE4 FOOO: FOEC FOOO: FOF4 FOOO: F841 FOOO: E06B FOOO:OBDD FOOO:0A46 FOOO:29EA FOOO: 2B4B FOOO:2966 FOOO: 2DCB FOOO: EFD5 FOOO: 4E3F FOOO:3192 FOOO: E2C3 FOOO: EF62 FOOO: EF5A FOOO: El8F FOOO:03DB FOOO:002C FOOO:0043 FOOO: EFD2 FOOO: FF54 FOOO: 547A FOOO:4B4F FOOO: E26D FOOO: E275 FOOO:2857 F{)00:38E2 FOOO: E7C8 FOOO: FFFO FOOO:44A7 FOOO: 4381 FOOO:4554 FOOO:48C4 FOOO:2B26 FOOO:E05B FOOO: 4FC6 FOOO:3AC4 FOOO: EB70 FOOO:6000 FOOO:ODOA FOOO:OD6F FOOO: E072 FoaO:OD15 FOOO: E739 FOOO:2D70 FOOO: 57BA FOOO: E269 FOOO:4468 FOOO: 43E8 FOOO:4E7B Abs Abs Abs Abs K8 K9 K8FUNL K8FUN_TBL KBNMLTBL KBPADL KBPAD_TBL KILl NT KILNOISE KEYBOARD_IO KYBD_INT9 KYBD_IO KYBD_RESET KYBD_TST LCDBUF_TST LCDCTL_TST LCDINIT LCD_CGA-TBL LCD...MONO_TBL Ml MIL M4 M5 M6 M7 MEMORLSIZLDET MEM...MSG MEM_SIZLCHK MEM....TEST MODEM_CON FIG MODEM_INIT MODEM....POWEILON MODEM_TEST MONO_TBL NELOUTPUT NMLFLIH NMLINT PARMS_TPIl35 PARMS_TPI48 PAILCHK POSTCNTL POSTMAIN POSLLOOP PRINTEILIO PRINT~CREEN PRLIO PRT~CRN PRLTAB PRLTAILEND PTILCOM....PRESENCE PULRTLNMI PULRTLREG P_O_R READ.JILCURRENT READ_CURSOR READ_DOT READ.J.PEN RECV~ RESET RESULTS RESUME RES_ERILCHK ROM_BASIC ROM_CHECKSUM ROM....LINK ROM...MSG ROUCAN RS23LIO RS23LTEST RTCLTST RTLS I Il-SAV E SCROLLDOWN SCROLLUP SEEK FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO FOOO 4565 4840 48C4 4B4F 4C2B 4C95 4E3F 4E6C 4E7B 4FBO 4FC6 51B6 530A 53DF 547A 5527 570C 5739 57BA 5864 58F7 5A99 5D4F 6000 E05B E05B E06B E072 E128 E18F EIBF E214 E229 E257 E261 E269 E26D E275 E275 E2C3 E2C6 E6C6 E6EO E6E7 E6F2 E6F5 E729 E739 E73C E75F E762 E79B E7A3 E7AA E7C8 E7E6 E82E E831 E85C E864 E87E E886 E88E E8C8 E8El E918 E955 E95F E969 E976 E987 E98A EAOC EA87 WRITE_DOT WRITLTTY READ_LPEN PRLSCRN DSKLIO DISILRESET NELOUTPUT GELPARM SEEK DSKLINTE RESULTS SYS_BOOT COMMO_IO COM....POWER PRLIO TOD_PROC INITIALIZE~TATUS SELTOD RTCLTST TMRO_INT8 SYS~ERVICES EXLEVENT FILL ROM....BASIC RESET START MEM...MSG ROM...MSG FLICON PAILCHK SYS_DSKLICON DSKLICON BAD_DSKT_I CON SYS_DESCILTABLE DEF_SYS_PROF RTLSIIl-SAVE PRLTAB PRLTAILEND STILCON NMLINT CHAILGEN_H I DSP_BYTE XLALNIB DSP_HEX BOOLSTRAP KILNOISE BAUD_TABLE RS23LIO ERILBEEP BEEP BEEP_SUB DISABLLNMI ENABLLNMI GELRTLREG PULRTLREG BALSALSETUP KEYBOARD_IO KYBILRESET DDS GELVECTOR@ K6 K7 K8 K9 KI0 Kll K12 KI3 K14 K15 KILl NT SYS_SETUP VECTOILSETUP K30 ROM BIOS 2-5 FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD 2BIA 3174 439C 4332 42AB 415A 5739 E05B OB40 E275 51B6 EB43 E257 ElBF 58F7 E98A FEA5 FE6E 5864 134C 5527 OD5A EAOC FEF3 F065 4110 2548 FOA4 43C2 44ED 4521 4565 4840 E6EO SEND_C SEND_COM SELCOlOR SELCPOS SELCTYPE SET~ODE SELTOD START STG_TST STR_CON SYS_BOOT SYS_CHK SYS_DESCR-TABlE SYS_DSKLICON SYS_SERVICES SYS_SETUP TIMER-INT TIME_OF_DAY TMRO_INT8 TMR_TST TOD_PROC VAll D_ROMCHK VECTOR_SETUP VECTOR-TABLE VIDEO_IO VIDEO_IO_l VIDEO_LINK VIDEO_PARMS VIDEO_STATE WRITLACCURRENT WRI TE_CCURRENT WRITE_DOT WRITLTTY XlALNIB Program entry poi nt at FOOD: E05B 2-6 ROM BIOS FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOO FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD FOOD EAAB EAC9 EADD EB43 EB70 EC59 EC5C ED5F EF57 EF5A EF62 EFC7 EFD2 EFD5 EFE3 EFFl EFFF F045 F065 FOA4 FOE4 FOEC FOF4 F841 F84D F859 FA6E FE6E FEA5 FEF3 FF23 FF53 FF54 FFFO KBPAD_TBl KBFUN_TBl KBNMLTBl SYS_CHK RES_ERR-CHK DISKETTLJO E~SG ICON_PR DSKLINT PARMS_TPI48 PARMS_TPI135 DSKLBASE PRINTER-IO MONO_TBl CGA....TBl lCD_CGA_TBl lCD~ONO_ TBl Ml VIDEO_IO VI DEO_PARMS M5 M6 M7 MEMORY-SIZE_DET EQUIPMENT CASSETTE_IO CHAR_GEN_lO TIME_OF_DAY TIMEILINT VECTOR_TABLE D11 DUMMY _RETURN PRINLSCREEN P_O_R Common Equates and Data Areas TITLE COMMON EQUATES/ DATA AREAS INCLUDE SROMEQUS. INC ; DATE LAST MODIFIED: 09(13(1985 ; ******************************************************* ; GLOBAL EQUATES FOR I/O PORTS ; ******************************************************* Common Equates D MAC 0 N T R 0 L L E R P 0 R T DMA • 0000 o EQU I N T ERR U P T 00; DMA CONTROLLER BASE ADDRESS CON T R 0 L L E R - 20,21H 0020 0020 OOOB OOOA INTAOO EOI READ_ISR READ_IRR EQU EQU EQU EQU 20H 20H OBH OAH INTERRUPT CONTROLLER PORT 1 NON SPECI FIC END OF INTERRUPT READ IN SERV REG AT INTAOO READ INT REQ REG AT INTAOO 0021 INTA01 EQU 21H IRPT CONTROLLER MASK REG SYSTEM TIMERS - 40,42,43H • 0040 • 0042 TIMERO TIMER2 EQU EQU 40H 42H • 0043 0080 • 0030 TIMEILCTL EQU TIMER2JTL EQU TLATCH EQU 43H 80H 30H KEY BOA R D S CAN 0060 EQU NMI • 0061 0061 0080 • 0040 = 0020 • 0008 • 0004 0002 • 0001 CON T R 0 L NMLCNTL KB_CTL CLR_KEYBD DIS_COPROC DIS_IOCHK DISJ.LARM EN_SPKR SPKR_DATA TMRLGATE EQU EQU EQU EQU EQU EQU EQU EQU EQU TIMER 0 COUNTER PORT AD DR TIMER 2 COUNTER PORT AD DR TIMER 0,2 CONTROL PORT ADDR ACCESS TIMER2 CONTROLS LATCH TMR VAL R/W LEAST, 1ST COD E P 0 R T - 60H 60H P 0 RT 61H 61H 80H 40H 20H 08H 04H 02H 01H ; MAIN KEYBOARD SCAN CODE PORT - 61H NMI CONTROL PORT PORT 60H CONTROL REGISTER CLEAR KEYBOARD SIGNAL DISABLE COPROCESSOR NMI DISABLE I/O CHANNEL CHECK DISABLE RTC ALARM NMI ENABLE SPEAKER (NOT AN SPEAKER DATA LINE (NOT AN GATE TIMER 2 (NOT AN NMI NMI) NMI) NMI) ROM BIOS 2-7 - -- -- - - - - - - - - - - -- -- -- -- - - -- -- --- ---- - ---- ;NMI SOURCE = 0062 NMLSRC DSKLNMI IOCHICNMI TIMER2_SN KBCLILNMI SYS_SUSP _NMI RTC.J\LRM_NMI KBDATA_NMI = 0080 = 0040 = 0020 = 0010 = 0008 = 0004 = 0001 REG - 62H EQU EQU EQU EQU EQU EQU EQU EQU NMI SOURCE PORT ADDRESS DISKETTE NMI I/O CHANNEL CHECK NMI TMR 2 SNE (NOT AN NMI SOURCE) KYBD PORT 60 AVAILABLE NMI SYSTEM SUSPEND NMI REAL TIME CLOCK ALARM NMI KEYBOARD DATA READY NMI 62H 80H 40H 20H 10H 08H 04H 01H - -- - -- -- - - - - - - - -- - - - - - -- - - - - - - - - - - - -- - --; SYSTEM CLOCK CONTROL REGISTER = 0072 = 0020 CLOCICCTL GLOBAL_NMI DISABLE_SLEEP CLOCICRUN CLOCK_STOP = 0004 = 0003 = 0000 EQU EQU EQU EQU EQU - 72H 72H 20H 04H 03H o -- - - --- - - ------- - - - - -- -- - - -- ---- - -- - - ;LCD CONTROLLER - INDEX = 0074 LCD_INDX EQU 74H = 0000 LCD_FUNCT LCD_WRAP EQU EQU 00 01 = 0001 SLEEP CLOCK CONTROL REGISTER GLOBAL NMI ENABLE DISABLE SLEEP CLOCK BIT SLEEP CLOCK RUN STATE CLOCK STOP VALUE --- - ---- --- - 74H INDEX REG FOR ACCESING LCDC ; REGS ; LCDC FUNCT CONTROL REGISTER ; LCDC DIAG CONTROL REGISTER -- - --- -- -- ----- ----- -- -- --- -- ---- -- --- -- - - - - - - - - - - - - - -- - - -- - - - -- - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - -;LCD CONTROLLER OATA - 75H = 0075 = 0001 LCD_DATA EQU 75H DATA REG FOR WRITING TO LCDC REGS ON = TWO PANEL LCD OFF = ONE PANEL LCD ON = LCD EMULATING CGA OFF = LCD EMULATING MONO ON = LCD IN NORMAL MODE OFF = LCD IN DIAGNOSTIC MODE ON = LCD ADDR DECODE ENABLED OFF = LCD DISABLED ON = ACCESS LCD FONT STORAGE OFF = ACCESS REGEN BUFFER ON = ENABLE SYNCS OFF = DISABLE SYNCS ON = LCD PANEL POWER ENABLED OFF = LCD PANEL PWR DISABLE ON = TWO PANEL LCD SENSED BY HRDWARE LCD_2PAN EQU OIH = 0002 LCD_CGA EQU 02H = 0004 LCD_NORM EQU 04H = 0008 LCD_ENAB EQU 08H = 0010 LCD_FONT EQU 10H = 0020 SYNCENABLE EQU 20H = 0040 PANEL_ENABLE EQU 40H = 0080 LCD_SENSP EQU 80H - - -- - - - - - - -- - - - - - -- - - - - -- - - - -- - - - - - - -- - - -- -- -- - - - - -= OOll = 0080 ; DISKETTE CONTROL PORT -- - - - - -- - -- - -- - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - --DSKT POWER CONTROL REGISTER DSKLCNTL llH EQU DSKLNMI 80H ENABLE DSKT NMI POWER ON REQ EQU -- -- = 0040 FDCPWR EQU 40H DSKT CONTROLLER POWER ENABLE = 0020 DSKLDEGATE EQU 20H DSKT DRIVE DEGATE FROM CNTLR = 0010 RD_CNTL 10H ; READ CONTROLLER REGISTER EQU ;* THIS BIT OFF ALLOWS READING THE DRIVE TRK POSTN FROM DSKLCNTL REG = 0008 DRO_TRICS EL ; READ DRIVE 0 TRACK POSITION 08H EQU ;* THIS BIT OFF ALLOWS READING THE DRIVE I TRACK POSITION = 0002 2-8 ROM BIOS CNTLSEL EQU 02H ; BIT MUST ALWAYS BE ON FOR ; ANY WRITE TO THIS I/O PORT - -- -- - - - --- ---- - - - - - -- --- -- - - -- - -- -- -- -- - - -- - - - --;PORTABLE PRINTER PORTS = 0078 CPRLDATA EQU 78H PORTABLE PTR XMIT PORT ADDR = 0079 = 0080 = 0008 CPRLSTAT NOLBUSY NOLERROR EQU EQU EQU 79H 80H 08H PORTABLE PTR STAT PORT AD DR NOT BUSY BIT IN STATUS PORT NOT ERROR BIT IN STATUS PORT = 007A CPRLMODE ACK SELECT NO_INIT STROBE EQU EQU EQU EQU EQU 7AH 40H 08H 04H 01H PORTABLE PTR MODE PORT ADDR ACKNOWLEDGE BIT (NOT USED) SLCT BIT IN MD PRT (NOT USED) INITIALIZE BIT IN MODE PORT STRB BIT IN MD PRT (NOT USED) = 0040 = 0008 = 0004 = 0001 ----- ------ - -- - - - - - - - - -- - - - - - -- - - - - - - - - - - - - - - -- -- & F EAT U R E C N T L - 7CH ; KEY BOA R 0 = 007C = 0080 KYBD_CNTL ENJYBD_NMI KYBD-ATTACH SELKYBD_DIAG ACLRS232 ACLMODEM SELRS23LPRIM = 0040 = 0020 = 0004 = 0002 = 0001 7CH 80H 40H 20H 04H 02H 01H EQU EQU EQU EQU EQU EQU EQU KYBD AND FEAT CONTROL ADDR ENABLE KEYBOARD NMI KEYBOARD ATTACHED SENSE ACT KYBD DIAGNOSTI C MODE ACT RS232 FEATURE POWER ACTIVATE MODEM FEATURE POWER SET RS232 FEAT TO PRI ADDR. ------ - -- - - - -- -- - - - -- - -- - - - - - - - - --- - - - - - - -; POW E R = 007F = 0080 = 0040 = 0020 = 0010 = 0008 = 0004 = 0002 = 0001 I N T E R F ACE PWILSTAT LOW_BAT EXLPWR SYS_POR PON-ALRM HDWR_RESET EN_SUS_NMI REQ_POFF EN_PON-ALRM EQU EQU EQU EQU EQU EQU EQU EQU EQU REG - 7 FH 7FH 80H 40H 20H 10H 08H 04H 02H 01H POWER INTERFACE PORT ADDRESS LOW BATTERY STATUS FLAG EXTERNAL POWER SUPPLI ED SYSTEM POR REQSTD (AL T CTL R) POWER ACTIVATED BY RTC ALARM CAUSE POWER-ON-RESET ENABLE SYSTEM SUSPEND NMI REQUEST SYSTEM POWER OFF ENABLE POWER ON BY RTC ALARM ----- --------- ------------------ -- -- - - - - - -- ;DMA = 0083 PAGE REGISTERS DMILPAGEl DMA_PAGE2 DMA_PAGE3 = 0081 = 0082 EQU EQU EQU 83H 81H 82H ; DMA PAGE REGISTER CHANNEL 1 ; DMA PAGE REGISTER CHNL 2 (DSKT) ; DMA PAGE REGISTER CHANNEL 3 ------------------- - -- - - - - - - - - - - - - - - - - - - - -;MANUFACTURING = = = = = 00A1 00A2 00A3 0080 0001 MFG_CHKPT MFG_ERILHI MFG_ERILLO MEM_CTL PORTS EQU EQU EQU EQU EQU MEM_SUB~ODE OA1H OA2H OA3H 80H OIH MFG CHECKPOINT PORT MFG ERROR CODE PORT HIGH MFG ERROR CODE PORT LOW MEMORY DECODE CONTROL PORT BIT SET IN MEMJTL FOR SPECIAL MEM SUBSTITUTE OF LCD DISPLAY RAM FOR MAIN MEM FOR MFG MODE , ---- -------------------------- - -- - -- - - - - - - - -; I I 0 = OOAO = 0080 = 0007 C H K - 8 0 8 7 IONMLCNTL EN_IOCHK INLLEVEL CON T R 0 L - AOH EQU EQU EQU OAOH 80H 07H 1/0 CHAN CHK NMI ENABIDISAB ; ENABLE 8087 AND 10 CHECK NMI ; MASK FOR CURRENT IRPT LVL SNE ROM BIOS 2-9 , ----------------------------------------------------;DISPLAY = 0308 = 03B8 ADAPTER CGA....CNTL MONO_CNTL EQU EQU CONTROL 03D8H 03B8H REGS ; COLOR GRAPHICS CONTROL PORT ; MONO DISPLAY CONTROL PORT -- --- -- - - - - - - - -- - - - - - - - - - - - -- - - -- - -- -- -- - - - - - - - -- - - -;FLOPPY DISKETTE CONTROL REGS DRIVE MOTOR, SELECT CONTROL PORT = 03F2 = 0020 = DOlO = 0008 = 0004 = 0001 = 0000 FLOPPY DISKETTE DRIVE CONTROL *****WRITE ONLY REGISTER***** DRLMOTOR EQU 20H DRIVE I MOTOR ENABLE DRO_MOTOR EQU 10H DRIVE 0 MOTOR ENABLE FDCDMA_ENAB EQU 08H ENABLE FDC DMA AND INTERRUPTS FDCRUN EQU 04H ; DISKETTE CONTROLLER RUN BIT IF THE ABOVE BIT IS OFF THE DISKETTE CONTROLLER IS RESET DRLSELECT ORO_SELECT EQU 03F2H EQU EQU OIH ODH ; DRIVE I SELECT ; DRIVE 0 SELECT DISKETTE CONTROLLER MAIN STATUS REGISTER = 03F4 FDCSTATUS EQU 03F4H = 0080 = 0040 = 0010 REQJ1ASTER DATA_READY FDCBUSY EQU EQU EQU 080H 040H OIOH DSKT CONTROLLER MASTER STATUS *** READ ONLY REGISTER ***** REQUEST FOR MASTER DATA RDY TO BE RD FROM CNTLR CONTROLLER IS BUSY DISKETTE CONTROLLER DATA INPUT jOUTPUT REGISTER 03F5 EQU 03F5H ; DISKETTE CONTROLLER DATA PORT DRIVE MOTOR, SELECT TRACK 0 SENSE PORT = 03F7 DRIVE-SENSE EQU 03F7H = 0080 CHG_LlNE DRO_SEL_SENSE DRLSEL_SENSE DRO_MOLSENSE DRLMOLSENSE TRACKO_SENSE EQU EQU EQU EQU EQU EQU 080H 040H 020H OIOH 008H OOIH = 0040 = 0020 = DOlO = 0008 = 0001 DSKT DRIVE CONTROL LlNE SENSE ***** READ ONLY REGISTER ***** MEDIA CHNG LlNE ACTIVE SENSE DRIVE 0 SELECTED SENSE BACK DRIVE I SELECTED SENSE BACK DRIVE 0 MOTOR ON SENSE BACK DRIVE I MOTOR ON SENSE BACK TRACK 0 IND FOR SLCTD DRIVE COMMANDS SENT TO DISKETTE CONTROLLER BY BIOS = 0008 = 0003 = 0007 = OOOF = 00E6 = 00C5 = 0040 READ_INLSTATUS SPECI FY RECAll BRATE SEEICCMD READ_CMND WRlTEJMND FORMALCMND EQU EQU EQU EQU EQU EQU EQU 08H 03H 07H OFH OE6H OC5H 04DH READ INTERRUPT STATUS COMMAND SPECI FY COMMAND RECAll BRATE DRIVE COMMAND SEEK DRIVE COMMAND READ COMMAND WRITE COMMAND FORMAT COMMAND 46H 4AH 42H SETUP DMA FOR DISKETTE READ SETUP DMA FOR DISKETTE WRITE SETUP DMA FOR NO XFER (VRFY) DMA SETUP COMMANDS FOR DISKETTE = 0046 = 004A = 0042 DMA_READ DMA_WRITE DMA_VERI FY 2-10 ROM BIOS EQU EQU EQU ********************************************************************* GLOBAL EQUATES FOR REAL TIME CLOCK ********************************************************************* RTC REGISTER INDEX PORT = 0070 RTCILPORT EQU 070H REAL TIME CLOCK IX REG PORT OllH REAL TIME ClK DATA REG PORT RTC REGISTER DATA PORT = OOll EQU RTC TIME,DATE, AND ALARM REGISTERS = 0000 = 0001 = 0002 = 0003 = 0004 = 0005 = 0006 = 0007 = 0008 = 0009 RTCTSEC RTCASEC RTCTMIN RTLJ\MIN RTCTHRS RTCAHRS RTCWDAY RTCMOAY RTCMON RTCYEAR EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU o EQU EQU 10 080H TIME SECONDS REG ADDR ALARM SECONDS REG ADDR TIME MINUTES REG ADOR ALARM MINUTES REG ADDR TIME HOURS REG ADDR ALARM HOURS REG AD DR DAY OF WEEK (SUNDAY 1) DAY OF MONTH MONTH YEAR 1 2 3 4 5 6 7 8 9 RTC STATUS REGISTER OOOA 0080 RTCUP_STAT RTCUIP ; CLOCK UPDATE STATUS REG AD DR ; UPDATE IN PROGRESS BIT RTC INTERRUPT AND MODE SET REGISTER = OOOB = 0080 0040 0020 0010 0004 0002 0001 RTCMODE SELClOCK PI E_ENABlE AI E_ENABlE UI E_ENABlE SELBIN SEL24HR SELDAYLIGHT EQU EQU EQU EQU EQU EQU EQU EQU 11 080H 040H 020H OIOH 004H 002H OOIH MODE REG ADDR SET CLOCK BIT PERIODIC INTERRUPT ENABLE ALARM INTERRUPT ENABLE UPDATE ENDED IRPT ENABLE SET BINARY MODE SET 24 HOUR MODE SET DAYLIGHT SAVINGS MODE RTC INTERRUPT STATUS REGISTER = OOOC = 0080 = 0040 0020 = 0010 RTCINLSTAT RTCIRQ PLINT Al_INT UE_INT EQU EQU EQU EQU EQU 12 080H 040H 020H OIOH INTERRUPT STATUS REG AODR INTERRUPT REQUEST SET PERIODIC REQUEST ALARM REQUEST UPDATE ENDED REQUEST RTC CONDITION STATUS REGISTER = 0000 = 0080 RTCCOND_STAT VALID_TIME EQU EQU 13 OBOH RTC CONDITION STATUS RTC HAS NOT lOST POWER RTC DIAG_STATUS FLAGS --- = OOOE = 0080 = 0040 = 0020 = 0010 = 0008 = 0004 = 0002 = 0001 RTCDIAG_STAT RTCTIMLBAD BAD_RTCS I G BAD_STOR_CKSUM lCD...Al LFAlLED lCD_CHANGE RTCJAI lED EQU EQU EQU EQU EQU EQU EQU 14 080H 040H 020H OlOH 08H 04H LCO_NOT...ACTIVE DSKT...ACTIVE EQU EQU 02H OIH DIAG STATUS BYTE IN RTC RAM STANDBY POWER lOST FLAG REAL TIME ClK SIGNATURE BAD BASE 12BK STG CHECKSUM BAD LCD ALT DISPLAY MODE FAilED LCD CONFIGURATION CHANGED REAL TIME ClK DID NOT UPDATE OR VALUES OUT OF LIMITS LCD NOT ACT WHEN SUSPENDED DSKT WAS ACT AT SUSPEND TIME ROM BIOS 2-11 ---- BEGINNING OF RTC CMOS DATA AREA ---REGISTERS FROM HERE TO RTCJlEM....END ARE KEPT CHECKSUMMED = OOOF RTCMEM....START EQU 15 ; START OF RTC REGISTER STACK DISKETTE TYPE INDENTIFIER --- UPPER 4 BITS = 0010 = 0011 = 0000 = 0001 = 0002 = 0003 RTCDSKLCON RTCDSKLCON2 NO_DRIVE TPL48 TPL96 TPL135 EQU EQU EQU EQU EQU EQU 16 17 0 1 2 3 = DRV 0, LOWER = DRV DSKT CONFIG INFO (0 & 1) DSKT CONFIG INFO (2 & 3) 48 TRACK PER INCH DRIVE 96 TRACK PER INCH DRIVE 135 TRACK PER INCH DRIVE SYSTEM EQUIPMENT WORD (COPY OF EQUIPMENLWORD IN DATA SEGMENT) = 0013 = 0014 RTCEQU I P_LO RTCEQU I P_H I EQU EQU 19 20 ; SYSTEM EQUIPMENT FLAG (LOW) ; SYSTEM EQUIPMENT FLAG (HI) - 15-14 - 13 - 12 - 11-9 - 8 - 7-6 - 5-4 - 3-1 - 0 - I I IPL DSKT INSTALLED -- UNUSED INITIAL VIDEO MODE NUMBER OF DISKETTE DRIVES I -- UNUSED -- NUMBER OF COM DEVICES -- JOYSTICK ATTACHED INTERNAL MODEM INSTALLED NUMBER OF PRINTERS ATTACHED SYSTEM MEMORY SIZE = 0015 = 0016 RTCMEMS_LO RTC....MEMS_HI EQU EQU 10 MEMORY SIZE LO BYTE (POST) 10 MEMORY SIZE HI BYTE (POST) 21 22 SYSTEM PROFILE INFORMATION SYS_PROF1 I 15 I 14 I 13-12 I 11-10 I 9 I 8 I 7 - 0 I . -- UNUSED RS232/PARL AVAIL ON 8ATTERY -- MODEM AVAILABLE ON BATTERY -- LCD HIGH INTENSITY MAPPING - INITIAL VIDEO MODE ENABLE LOW BATTERY WARNING SYSTEM WARM START SELECTED = 0017 RTC_SYS_PROFl RESUME_ENABLE LOWBALENABLE MODEM_BATT RS23LBATT EQU EQU EQU EQU EQU 23 80H 40H 02 01 = 0019 RTCSYS_PROF2 RTCLCD_INACT EQU EQU 24 25 = 001B RTCSYS_INACT EQU 27 = 0080 = 0040 = 0002 = 0001 = 0018 2-12 ROM BIOS SYSTEM PROFI LE BYTE 1 SYSTEM RESUME ENABLE FLAG LOW BAT WARNING ENABLE FLAG MODEM AVAILABLE ON BATTERY RS232/PARALLEL AVAILABLE ON BATTERY SYSTEM PROFILE BYTE 2 INACT TIME TO DISPLAY BLANK (2 BYTES) INACT TIME TO SYS POWER OFF (2 BYTES) --- MODEM PROFILE INFORMATION MOD_PROFl I 15-14 I 13 112-10 19-8 I I 7 - 0 I -- UNUSED -- DATA RATE PARITY / FRAMING ANSWER, 1 = AUTO ANSWER o = MANUAL = 001D = 001E RESERVED RTCMOD_PROFl RTCMOD_PROF2 EQU EQU 29 30 ; MODEM SETUP PROFILE BYTE ; MODEM SETUP PROFILE BYTE FEATURE DEVICE CONFIGURATION INFORMATION = 001F = = = = = 0080 0040 0020 0010 0008 RTCFEALCON SERPLL_INST I NTMOD_I NST MODILINST PRLINST CMPLPP_OK EQU EQU EQU EQU EQU EQU 31 80H 40H 20H lOH 08H FEATURE CONFIGURATION REG @ SERIAL PARAL CARD INSTALLED INTERNAL MODEM INSTALLED 1200BPS MODEM INSTALLED SER CARD INSTALLED AS PMRY COMPACT PTR PORT PASSED TEST LCD/CRT ADAPTER CONFIGURATION INFORMATION = 0020 = 0080 = 0010 = 0008 = 0004 = 0002 = 0001 = 0021 RTCDSP_CON DSP _LCD_PRES DSP_VIDEO_ROM DSP_CLCD EQU EQU EQU EQU EQU EQU EQU 32 BOH 10H OBH 04H 02H OIH DISPLAY CONFIGURATION REG @ ON = LCD PANEL IS PRESENT ON = FEAT VIDEO ROM SENSED ON = MONOCHROME ADAPT PRESENT ON = CGA ADAPTER PRESENT ON = LCD CONFIGED AS MONO ADA ON = LCD CONFIGED AS CGA ADA RTCSYS_STAT EQU 33 SYSTEM POWER ON STATUS DSP~ONO DSP_CGA DSP~LCD FOR EQUATES SEE DEFINITION OF PWR_STAT REGISTER 7FH LCD/CRT ADAPTER STATUS INFO = 0022 = 0080 = 0004 = 0002 = 0001 RTCDSP _STAT DIAli-FORCE3US EQU EQU 34 BOH MONO_BAD CGA-BAD LCD_BAD EQU EQU EQU 04H 02H 01H DISPLAY STATUS REGISTER USED TO FORCE RESUME W/O LCD (DSP~LCD & DSP_CLCD = 0) MONO ADAPT PRESENT, BUT BAD CGA PRESENT, BUT BAD LCD WAS CONFIG, BUT BAD LOW BYTE OF BASE STGE CHECKSUM HI BYTE OF BASE STG CHECKSUM BASE 128K STORAGE CHECKSUM = 0023 RTCBME~CKSL 0024 RTCBME~CKSH EQU EQU 35 36 RTC~E~END EQU 36 = = 0024 ; END OF RTC RTC MEMORY GOOD SIGNATURE AREA (MUST BE "RTCG" FOR VALID RTC = 002E RTC31GNATURE EQU 46 46-49 VAL RTC SIGNATURE AREA = 0032 RTCCENTURY EQU 50 RTC CENTURY BYTE SAVE AREA ROM BIOS 2-13 ******************************************************** GLOBAL EQUATES FOR BIOS/POST ******************************************************** SPECIAL KEY EQUATES = = = = 0045 0046 0038 0010 003A 002A 0036 0052 0053 OOOF 0054 0004 0052 003B OOED NUM_KEY SCROLL_KEY AL LKEY CTL_KEY CAPS_KEY LEFLKEY RIGHLKEY INS_KEY DEL_KEY TAB_KEY SYSREQJ1AKE SYSREQ_BREAK FN_KEY FLKEY HIDN_CODE_EO EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU 69 70 56 29 58 42 54 82 83 15 054H OD4H 052H 59 OEDH PCl SCAN CODE FOR NUM LOCK PCl SCAN CODE FOR SCL LK KEY PCl SCAN CODE FOR AL T SFT KEY PCl SCAN CODE FOR CNTL KEY PCl SCAN CODE FOR SHI FT LOCK PCl SCAN CODE FOR LEFT SHI FT PCl SCAN CODE FOR RGHT SHI FT PCl SCAN CODE FOR INSERT KEY PCl SCAN CODE FOR DELETE KEY PCl SCAN CODE FOR TAB KEY PCl SCAN CODE SYS_REQ (MAKE) PCl SCAN CODE SYS_REQ (BRK) NMI SCAN CODE FOR FN KEY PC1 SCAN CODE FOR F1 KEY HIDDEN CODE SEQUENCE 10 ------------ - -- - - - -- - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - -KEYBOARD EQUATES USED IN KEYBOARD SUPPORT TABLES ------------ -- ----------- -- - - - - - - - - - - - - - - - - - - -- - - - - -0000 0001 0002 0003 0004 0005 0006 0007 0009 OOOA OOOB OOOC OOOE OOOF 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001C OOlD 001E 001F 0020 = 007F = = = = CTL + KEYPAD KEYS TO GIVE ASCII CONTROL CODES (EXCEPT NUL) NUL 000 EQU SOH 001 EQU STX 002 EQU ETX 003 EQU EOT 004 EQU 005 ENQ EQU ACK006 006 EQU BEL 007 EQU HT 009 EQU LF 010 EQU VT 011 EQU FF 012 EQU CR 013 EQU SO 014 EQU SI015 015 EQU OLE 016 EQU DCl 017 EQU DC2 018 EQU DC3 019 EQU DC4 020 EQU NAK 021 EQU SYN 022 EQU ETB 023 EQU CAN 024 EQU EM 025 EQU SUB 026 EQU ESC 027 EQU FS 028 EQU GS 029 EQU RS 030 EQU US 031 EQU ENTER EQU 032 DEL 127 EQU 2-14 ROM BIOS KEYPAD BASE PC1 SCAN CODES = 0047 HOMLKEY CUR_UP PGUP KYPD.-MINUS CUR_LFT CUR_RHT KYPD_PLUS END_KEY CUILDN PGDN INS_KEY DEL_KEY = 0048 0049 = 004A = 004B = 0040 = 004E = 004F = 0050 = 0051 = 71 72 EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU 73 74 75 n 78 79 80 81 82 83 CTL + BASE KEYPAD KEYS = oon CTL_HOME CTL_PGUP CTL_CUR_L FT CTL_CUILRHT CTL_END CTL_PGDN = 0084 = 0073 = 0074 = 0075 = 0076 EXTENDED ASCI I CODE EQU EQU EQU EQU EQU EQU 119 132 115 116 117 118 ASCI I CODES = 001B ESC BKSPC TAB ENTER APOSTR SPACE PSEUDO = 0008 = 0009 = 0000 = 0027 = 0020 = 0000 EQU EQU EQU EQU EQU EQU EQU 1BH 08H 09H ODH 27H 20H OOH ; BUILD PSEUDO SCAN CODES ; --iiios -i (a -ROUTi NE -i NT ERRUPT -ASS i GNMENTS ----; = 0005 = 0010 = 0013 = 0014 = 0015 = 0016 = 0017 = 0019 = OOIA -- -- -- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - -PRTSCFN VIDEO_FN DSKLFN RS23LFN SYSSERVJN KEYBDJN PRINTER_FN BOOLFN TOLFN EQU EQU EQU EQU EQU EQU EQU EQU EQU 05 10H 13H 14H ISH 16H 17H 19H 1AH PRINT SCREEN FUNCTION CALL VIDEO I/O DISKETTE COMMUNICATIONS SYSTEM SERVICES KEYBOARD PRINTER SYSTEM BOOT STRAP TIME OF DAY EQUATES FOR ERRORS IN RETURN CODE OF POST ROUTINES = 0020 = 0010 = 0008 = 0004 FATALERROR NONJATALERR POST.-MSG RLDISPATCH NONJ ATAL_NW DISPLALERR EQU EQU EQU EQU EQU EQU 80H 40H 20H 10H 08H 04H FATAL ERROR (POSLSTATUS) NON FATAL ERR (POSLSTATUS) ERR MSG PO I NTED TO BY ES: DX RE-DSPTCH LST RTN AFTER STAT NON FATAL BUT NOT WARMSTART ERROR COMES FROM DSPL Y TEST GENERAL DELAY LOOP COUNTS USING LOOP $ WITH INTERRUPTS DISABLED = 0102 = 006B MS_DELAY DELAL415US EQU EQU 258 107 ; 1 MILLISECOND DELAY COUNT ; 415 USEe DLY COUNT FOR COMMO ROM BIOS 2-15 INCLUDE SROMDATA. INC Processor Interrupt Vector Area 8088 INTERRUPT LOCATIONS 0000 0000 0008 0008 0014 0014 0020 0020 0020 0024 0024 0040 0040 0070 0070 0074 0074 0060 0060 0078 0078 007C 007C 0110 0110 0128 0128 01BO 01BO 0400 0400 0400 0600 0600 7COO 7COO 7COO ABSO SEGMENT AT 0 STG_LOCO LABEL ORG 2*4 NMLPTR LABEL ORG 5*4 INT5_PTR LABEL ORG 8*4 INLADDR LABEL INLPTR LABEL ORG 9*4 INTLPTR LABEL ORG 10H*4 VIDEO_INT LABEL ORG lCH*4 WORD ONECH LABEL ORG lDH*4 PARM-PTR LABEL ORG IBH*4 LABEL BASICPTR ORG 01EH*4 DISK-POINTER LABEL ORG 01FH*4 EXLPTR LABEL ORG 044H*4 LABEL CSELPTR ORG 04AH*4 RTCA_PTR LABEL ORG 06CH*4 RESUME_PTR LABEL ORG 400H DATA--AREA LABEL DATA_WORD LABEL ORG 0600H MFG_TESLRTN LABEL ORG 7COOH LABEL BOOLLOCN ABSO ENDS BYTE WORD WORD PRT SCREEN INTERRUPT VECTOR WORD aWORD WORD KEYBOARD INTERRUPT VECTOR WORD VIDEO I/O INTERRUPT VECTOR USER TIMER VECTOR DWORD POINTER TO VIDEO PARMS WORD ENTRY FOR RESIDENT BASIC DWORD DWORD LOCATION OF POINTER PO I NTER TO EXT ENS I ON DWORD PTR TO LOWER 128 CHAR SET DWORD PTR TO USER RTC ALARM VECTOR DWORD PTR TO PROGRAM RESUME VECTOR BYTE WORD ; ABS LOCATION OF DATA SEGMENT FAR FAR POST and Bootstrap Temporary Stack --- - -- - - - - - - - - - - - - - - - - -- - - - - - -- - -- - - - -- - - - - - --~ ; STACK -- USED DURING INITIALIZATION ONLY 0000 0000 STACK OW 7F [ SEGMENT AT 30H 127 DUP(?) ???? OOFE OOFE TOP _OF_STACK STACK ENDS 2-16 ROM BIOS LABEL WORD BIOS Data Areas -- -- - - -- - - - -- - - - - - - -- - - - - - - - - - - - - - - - - - -; ROM BIOS DATA AREAS 0000 SEGMENT AT 40H DATA 0000 04 [ RS23LBASE DW 4 DUP(?) ADDR RS232 ADA (COM1-COM4) PRINTEILBASE ow 4 DUP(?) AD DR PRINTERS (LPTl-LPT3) ???? 0008 04 [ ???? EQUIPMENT 0010 WORD OW ???? ; INSTALLED HARDWARE I 15-14 I 13 I 12 I 11-9 I 8 I 7-6 I 5-4 I 3-1 I 0 I I I IPL DSKT INSTALLED -- UNUSED INITIAL VIDEO MODE NUMBER OF DISKETTE DRIVES UNUSED NUMBER OF COM DEVICES -- JOYSTICK ATTACHED INTERNAL MODEM INSTALLED NUMBER OF PRINTERS ATTACHED POST 0012 ?? 0080 0040 0020 = 0010 = 0002 = 0001 STATUS DB FATAL_ERROR NON-FATAL_ERR EQU EQU 80H 40H BAD_RTCMEM FEATURE_ERROR EQU EQU EQU EQU 20H 10H 02H 01H MFG~ODE POSLACTlVE M EM0 R Y 0013 ???? FLAG POSLSTATUS S I Z MEMORLSIZE ( 1 K POST ERROR FLAGS AND STATUS (DURING POST) POST DETCD FATAL SYS ERROR POST HAS DETECTED AN ERROR (NON_FATAL) RTC MEMORY BAD - DO NOT USE FEAT DEV FAILED (ROM_SCAN) MANUFACTURING MODE ACTIVE POST IS CURRENTLY ACTIVE B Y T E S ) ; MEMORY SIZE IN K BYTES DW BATTERY CONTROL FLAGS 0015 = 0080 0040 = 0020 = ?? BALSTATUS LOW_BALSIG LOW_BALHOLO LOW_BALPEND DB EQU EQU EQU 80H 40H 20H BATTERY SUPPORT STATUS LOW BATTERY SIGNALLED FLAG LOW BATTERY KEY HOLD STATE LOW BAT PENDING SECOND SENSE ROM BIOS 2-17 B I oS STATUS F LAG 0016 ?? = 0080 BIOS_STATUS DSP_BLANKED DB EQU 80H = 0040 = 0020 = 0010 = 0004 = 0002 F_RESUME KYBD.JICTIVE BOOLF1HIT DCLSUPPORTED FORCUJCL EQU EQU EQU EQU EQU 40H 20H lOH 04H 02H KB_NOISE.JICT EQU 01H = 0001 BIOS STATUS FLAGS DISPLAY HAS BEEN BLANKED (KYBD INACTIVE) FORCE SYSTEM RESUME MODE REQ KEBD HAS HAD A KEY PRESSED Fl KEY HIT IN BOOT ROUTINE DSKT CHANGE LINE SUPPORTED SYS RESUMED - FORCE DISKETTE CHANGE LINE ERROR ON NEXT OP FLAG TO SHOW AUDIO ROUTINE , -- ------------- - -- - -- -- - - - - - - - - - - - - - - - -; KEYBOARD DATA AREAS 0017 LABEL KEY BOA R D 0017 = = = = = = = = ?? 0080 0040 0020 0010 0008 0004 0002 0001 = = = = = = ?? 0080 0040 0020 0010 0008 0004 DB INS_STATE CAPS_STATE NUM_STATE SCROLL_STATE ALT_SHIFT CTLSHIFT LEFLSHI FT RIGHLSHIFT EQU EQU EQU EQU EQU EQU EQU EQU F LAG KB_FLAIi-1 DB INS_SHIFT CAPS_SHIFT SCROLL_SHI FT HOLD_STATE SYS_SHI FT EQU EQU EQU EQU EQU EQU ALT_INPUT DB NU~SHIFT 0019 ?? 001A ???? KEY BOA R 0 KYBD INT 9 AND INT 16 FLAGS AND BFR (CLRD BY KYBD_RESET ROUTINE DURING POST) LAG KBJLAG KEY BOA R 0 0018 r BYTE ;KEYBOARD FLAG STATUS BYTE 1 80H 40H 20H 10H 08H 04H 02H 01H 1 A SCI I BUFFER_HEAD INSERT STATE IS ACTIVE CAPS LOCK STATE TOGGLED NUM LOCK STATE TOGGLED SCROLL LOCK STATE TOGGLED AL TERNATE SHI FT KEY PRESSED CONTROL SHIFT KEY PRESSED LEFT SHI FT KEY PRESSED RIGHT SHIFT KEY PRESSED SECOND BYTE OF KEYBOARD STATUS 80H 40H 20H lOH 08H 04H INSERT KEY IS DEPRESSED CAPS LOCK KEY IS DEPRESSED NUM LOCK KEY IS DEPRESSED SCROLL LOCK KEY IS DEPRESSED SUSPEND KEY HAS BEEN TOGGLED SYS REQUEST KEY IS DEPRESSED STORAGE FOR AL T KEYPAD ENTRY B U F OW E R AND POINTERS ; POINTER TO HEAD OF KBD BUFFER HEAD = TAIL INDICATES THAT THE BUFFER IS EMPTY 001C 001E ???? 10 BUFFEILTAIL OW KB_BUFFER OW 16 DUP (?) ; ROOM FOR 16 ENTRI ES ; POINTER TO TAIL OF KBD BUFFER KLBUFFER_END LABEL WORD KB.JIREALLNG EQU $-KB.JIREA1 ; LNTH OF KEYBOARD AREA ???? 003E = 0027 2-18 ROM BIOS ; LAST BYTE IN KB.JIREALLNG DISKETTE DATA AREAS EEK 003E ?? = 0080 STATUS AND SEEK-STATUS DB INLFLAG EQU MOTOR STATUS AN FLAGS 080H MOTOR 003F ?? " 0080 " 0020 MOTOR_STATUS WRITE-OP MOTOILOK DB EQU EQU 080H 020H 0040 ?? " 0025 MOTOILCOUNT MOTOR_WAIT DB EQU 37 RAT ON DISKETTE 0041 ?? OP TIME_OUT BAD_SEEK BAD_NEC BAD_CRC DMILBOUNDARY BAD_DMA MEDIILCHANGE RECORD_NOLFND WRITE_PROTECT 0080 0040 0020 0010 = 0009 " 0008 " 0006 " 0004 " 0003 = 0002 = 0001 BAD..J\DDR~ARK BAD_CMD 0 SKETTE 07 [ EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU DB DELAY COUNT TIME OUT CNTR FOR DRIVE OFF 2 SECS OF CNTS FOR MOTOR OFF END STATUS RETURN CODE STATUS BYTE 80H 40H 20H 10H 09H 08H 06H 04H 03H 02H 01H CONTROLLER NECSTATUS OFF MOTOR STATUS CURRENT OPERATION IS A WRITE MOTOR ON FOR 500 MSEC BIT 3-0 " DRV 3-0 IS CNTRLY RUNNING DISKETTE_STATUS DB " " " " 0042 DRIVE RECALIBRATION STATUS BIT 3-0 " DRV 3-0 NEEDS RECAL BEFORE NEXT SEEK IF BIT IS " 0 BIT 7 " INTERRUPT OCCURRED ATTACH FAILED TO RESPOND SEEK OPERATION FAILED NEC CONTROLLER HAS FAILED BAD CRC ON DISKETTE READ ATMPT TO DMA CROSS 64K BNDRY DMA OVERRUN ON OPERATION MEDIA CHANGED ON 3.5" DRIVES REQUESTED SECTOR NOT FOUND WRITE ATTEMP ON WRT PROT DSK ADDRESS MARK NOT FOUND BAD CMD PASSED TO DSKT I/O STATUS 7 DUP(?) ; STATUS BYTES FROM CNTLR ?? -- ; --- - - -- - - - - - - - - - -- - - - - - - - - - - - - - - - - - - -; VIDEO DISPLAY DATA AREA -- - -- - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - 0049 ?? CRLMODE DB CURRENT CRT MODE 004A ???? CRLCOLS OW NUMBER OF COLUMNS ON SCREEN 004C ???? CRLLEN OW LENGTH OF REGEN IN BYTES 004E ???? CRLSTART OW CURSOILPOSN OW 0050 08 STARTING ADDR IN REGEN BFR B DUP(?) ; CURSOR EACH OF UP TO 8 PGS ???? 0060 ???? CURSOUODE OW CURRENT CURSOR MODE SETTING 0062 ?? ACTIVE-PAGE DB CURRENT PAGE BEING DISPLAYED 0063 ???? ADDIL6845 OW BASE AD DR FOR ACT DSPL Y CARD 0065 ?? CRT~ODE-SET DB CRNT SETTING OF THE 3X8 REG 0066 ?? CRLPALETTE 08 CRNT PALETTE SETTING COLOR CD ROM BIOS 2-19 THE FOLLOWING FOUR BYTES ARE LOADED IN THE BLANICCTR THEN SYS_OFF_CTR BY THE RTC...ALARM INTERRUPT HANDLER. THE ORDER MUST NOT BE CHANGED AUTO DISPLAY BLANK TIME COUNTER 0067 ???? DSP_BLANICCTR DW TIME DSPLY BLANKED (SECS) AUTO SYSTEM OFF TIME COUNTER 0069 ???? SYS_OFF_CTR DW TIME SYSTEM IS POWERED OFF 006B ?? INTR_FLAG DB FLAG TO SHOW AN INTERRUPT ----- - -- -- - - -- - -- -- - - - - - -- - - - - -- - - - - - - -; TIMER DATA AREA 006C ???? TIMER_LOW DW LOW WORD OF TIMER COUNT 006E ???? TIMEILHIGH DW HIGH WORD OF TIMER COUNT 0070 ?? TIMEILOFL DB = 0012 = 0444 = 0007 SEC-.MALLIMIT MIN_MALLIMIT HRS_MALLIMIT GELRTCTlME COUNTS_SEC COUNTS_MIN COUNTS_HOUR EQU EQU EQU EQU EQU EQU EQU 59H 59H 23H 2 18 1092 7 = 0018 = OOBO COUNTS_DAY COUNTS_DALHI COUNTS_DA LLO EQU EQU EQU 1573040 18H OBOH = 0059 = 0059 = 0023 0 0002 TIMER ROLLED SINCE LAST RD MAX FOR BCD SECONDS MAX FOR BCD MINUTES MAX FOR BCD HOURS TIMER COUNTS PER SECOND TIMER COUNTS PER MINUTE 65543-10000H (65543 TOO LARGE FOR 1 WORD, SO LOW WORD IS USED IN CALCULATIONS) = 1800BOH COUNTS PER DAY HIGH BYTE OF COUNTS PER DAY LOW BYTE OF COUNTS PER DAY ------- - -- - - - - - - - - -- --- - - -- -- - - - - - - - - - -; SYSTEM DATA AREA 0071 ?? = 0080 BIOS_BREAK BREAICH IT DB EQU 80H BREAK KEY FLAGS BREAK KEY HAS BEEN HIT 0072 ???? = 1234 = 5678 = 9ABC = ABCD RESELFLAG SOFLRESET SYS3USPEND MFG_MEM-.MODE LOOP-.MODE DW EQU EQU EQU EQU 1234H 5678H 9ABCH OABCDH SYS RESET TYPE CONTROL FLAG RE- I PL WITHOUT STORAGE CLEAR SYS SUCCESSFULLY SUSPENDED MANUFACTURING MEMORY MODE POST LOOP MODE 0074 02 [ OW 2 DUP(?) RESERVED ???? ; - - ----------- ---------- - --- -- - -- -- -- -- - -- - - - - - - - - - - - -- 03 [ 0078 PRINTER AND RS232 TIME-OUT VARIABLES PRINLTIrLOUT DB 3 DUP(?) ; FOR LPTI-LPT4 RESPECTIVELY EVENLTlM_OUT DB WAIT ON EXT EVNT TIMEOUT CTR RS23LTIM_OUT DB 4 DUP(?) ; FOR COMI-COM4 RESPECTIVELY ?? 0078 007C ?? 04 [ ?? 2-20 ROM BIOS , -- - - - -- -- - - -- - --- -- -- - ---- -- - -- -- -- - ---; 0080 ?17? 0082 ?17? 0084 ADDITIONAL KEYBOARD DATA AREA BUFFEILSTART BUFFEILEND KB_BUFFEILEND BY POST 07 [ DB 7 OW PTRS TO 16 BYTE KBD BUFFER OW INIT SET TO KB_BUFFER AND DUP(?) RESERVED ?? DISKETTE LAST DATA RATE INFORMATION LASLDAT~RATE 008B ?? = 0080 008C RATE_250KBS 02 [ DB EQU 80H 2 DUP(?) OW ALWAYS 80H - 250 KBS RATE 250 KB/SEC DATA RATE VALUE SET BY POST DISKETTE TEST RESERVED ???? DISKETTE DRIVE MEDIA TYPE CODES (MEDIA TYPE BYTE =0 IF NO DRIVE) 17-615141312-01 1 1 1 1 -- MEDIA TYPE CODES (ALWAYS III FOR 720KB MEDIA) RESERVED - ALWAYS 0 -- MEDIA TYPE ESTABLISHED - ALWAYS 1 DOUBLE STEP REQUIRED - NOT SUPPORTED ALWAYS 0 DATA TRANSFER RATE FOR THIS DRIVE - ALWAYS 10 (250 KBS) 0090 ?? 0091 ?? = 0097 0092 ?? MEDIA_TYPLDRO MEDIA_TYPE_DRI MEDI~720KB DB DB EQU 97H DB DISKETTE MEDIA TYPE DRIVE 0 DISKETTE MEDIA TYPE DRIVE 1 MEDIA TYPE FOR 720 KB DSKT RESERVED LOW BATTERY WARNING COUNTER 0093 ?? 0094 ???? 0096 17 DB LOW BATTERY WARNING COUNTER RESERVED KEYBOARD CONTROL FLAG 3 USED BY INTERRUPT 9 KEYBOARD PROCESSING = 0002 0097 ?? KBJLAIL3 LCHC DB DB EQU 02H KEYBOARD TRACKING FLAG 3 (CLEARED BY KYBD_RESET ROUTINE IN POST) LAST CODE HIDDEN CODE FLAG RESERVED ROM BIOS 2-21 - --- --- - -- - - -- -- - - - - - - -- -- - - - - -- - _... -- --EVENT POST/WAIT DATA AREA -- -- --- -- -- - - - - - -- -- - - -- -- - - -- - - - - - - - - -POINTER TO USERS POST FLAG 0098 0098 ???? 009A 009A ???? = 0080 IO_ROM_INIT LABEL USER_FLAG DW 10_ROM_SEG LABEL US ERJLAG_S EG OW EVENLPOSTED EQU I N T E R V A L 009C 009E ???? ???? WA RTCLOW RTCHIGH OOAO ?? 0080 0004 0002 0001 T REDEFINITION OF WORD DURING POST ROM_SCAN OSET ADDR OF USERS WAIT FLAG WORD REDEFINITION OF WORD DURING POST ROM_SCAN SEG ADDR OF USERS WAIT FLAG 080H FLAG SET WHEN WAIT TIME EXP IN USERS FLAG ME OW OW P 0 S T / WA I T S A V E A R EA LOW WORD OF USER WAIT COUNT HIGH WORD OF USER WAIT COUNT F LAG S RTCWAILFLAG POSTED EQU PON-ALRM_PEND ALARM_PEND I NTERVAL_WA IT = = = = T WORD DB 80H EQU EQU EQU 04H 02H 01H WAIT ACTIVE FLAG POST ON INTERVAL OCCURRED POWER ON BY ALARM PENDING USER ALRM I NT 4AH PNDNG SPND INTVL WAIT CURRENTLY ACTIVE KEYBOARD NMI PRE-PROCESSING FUNCTION CONTROL SAVE AREA B4H-CCH 00B4 00B4 ORG OB4H KB-AREA2 LABEL 00B4 ?? = 0080 = 0040 = 0010 = 0008 = 0004 KB_NMLCNTL P60_LOADED FUNCSTATE XLATE_BUSY CLICK-ON KEYPAD_STATE DB EQU EQU EQU EQU EQU 00B5 00B7 00B9 OOBA ???? ???? ?? ?? B_PEND1 B_PEND2 P60_HOLD_BYTE LAST _CL I CK-KEY DW OW DB DB OOBB OOBC ?? ?? KB_NMLHEAD KB_NMLTAIL DB DB KB_NMLBUFFER DB 16 DUP(?) ; ROOM FOR 16 ENTRIES = 0010 KLNMLBLTH EQU $-KB_NMLBUFFER ; LENGTH OF NMI BFR = 0019 KB-AREALLNG EQU $-KB-AREA2 ; LENGTH OF KYBD AREA 2 OOCD DATA OOBD 10 [ BYTE 80H 40H lOH 08H 04H KBD AREA 2 (CLRD KYBD3ESET ROUTINE IN POST) KBD PREPROCESSOR CTRLL FLAGS KEYBOARD PORT 60 IS LD FLAG KEYBOARD FUNCTION KEY STATE KEYBOARD TRANSLATION ACTIVE KEYBOARD CLICKER IS ENABLED KEYBOARD KEYPAD STATE KEYBOARD BRK PENDING FLAGS 1 KEYBOARD BRK PENDING FLAGS 2 PORT 60 SINGLE BYTE QUEUE AREA FOR SCAN CD OF LAST KEY CLICKED PTR TO HEAD OF PREP ROC BFR PTR TO END OF PREPROC BFR ?? 2-22 ROM BIOS ENDS POST Temporary Data Area -- - -- - - ----- -- --- - - -- -- --- - - - - - - -- - - -- - - - - - -- - - - - - - - - - -- -- - - -- ; EXTRA DATA SEGMENT - FOR POST AND PRINT SCREEN STATUS ONLY 0000 0000 ?? = 0001 = OOFF XXDATA SEGMENT STATUS_BYTE PRTSCACTIVE PRTSCERROR AT 50H DB EQU EQU 0001 POSLPTR OW 0003 ?? = 0080 = 0040 = 0020 = 0010 POSTJ1ASK SOFTJ10DE WARMJ10DE COLDJ10DE MF"--TST DB EQU EQU EQU EQU 0004 ?? = 0001 = 0002 = 0003 = 0004 = 0005 = 0006 = 0009 = 0010 = 0012 = 0011 = 0050 = 0051 POSLDEVID SYS_ID EQU EQU KYBD_ID MONO_ID COLOILID DSKLID PPRLID APRLID RS23LID DB LCLID CPRLID 0005 ?? = 0001 = 0002 = 0003 = 0004 = 0.005 = 0006 POSLICON SYSTEM FEATURE SETUP BATTERY PCHECK2 PROMPT 0006 0008 MF"--ERILCODE MF"--CKPT 0009 0009 ???? ???? ?? 10 [ ? 80H 40H 20H 10H 03 04 05 06 09 10H l2H llH EQU EQU EQU EQU EQU EQU EQU EQU 050H EQU 05lH EQU DB 01 EQU EQU 02 03 EQU 04 05 EQU EQU 06 EQU PRINT SCREEN ACTIVE STATUS BIT ON WHEN PRTSC IS ACTIVE PRTSC ERROR - CANCELLED PTR TO CURRENT TEST ROUTINE 01 02 ME~ID MODE~ID 01 OFFH DW DB TEMP DB 16 ASCSTR DB LABEL 17 DUP(?) PWR ON SELF TST ROUTINE MASK SYSTEM SOFT START MODE SYSTEM WARM START MODE SYSTEM COLD START MODE MANUFACTURING TEST MODE DEV ID FOR POST ROUTINE CALLS SYSTEM UNIT 10 MEMORY 10 KEYBOARD 10 MONOCHROME CRT ADAPTER 10 COLOR CRT ADAPTER 10 DISKETTE 10 PARALLEL PRINTER 10 ALT PARALLEL PRINTER ID RS232 PORT 10 MODE~ID LCD DEVICE 10 COMPACT PRINTER PORT ID ICON NUMBER FOR FAILING AREA SYSTEM UN IT I CON SYSTEM FEATURE ICON SYSTEM SETUP BATTERY LOW I CON SYSTEM PARITY CHECK 2 USER PROMPT ICON MANUFACTURING ERROR CODE MANUFACTURING CHECKPOINT LABEL BYTE DUP (?) USED DURING SELF TEST ONLY ?? 0019 0019 11 [ BYTE ASCI I STRING FOR ERROR MSG ?? 002A 07 [ ICON_DIS DB 7 DUP(?) AREA USED FOR EJ1SG ONLY ICONJ1SG DB 7 DUP(?) AREA USED FOR LMSG ONLY ?? 0031 07 [ ?? ROM BIOS 2-23 0038 ?? " 0080 " 0040 " 0008 " 0004 " 0002 " 0001 DSPTEST.Y1ASK VROM_CGA VROM.Y10NO VIDEO_ROM MONO EQU CGA EQU LCD EQU DB EQU EQU EQU 0039 SUSP_DSP _CON DB ?? 003A XXDATA ; ? 80H 40H 08H 04H 02H OIH ENDS VIDEO DISPLAY BUFFER VIDEO_RAM SEGMENT AT OB800H 0000 0000 REGEN REGENW BYTE WORD 4000 [ LABEL LABEL DB 16384 DUP (?) ?? 4000 HLDS RTCDSP _CON VALUE -- ----- ---- -- -- --- - - - - -- -- - -- -- - - - - -- - -- 0000 0000 DISPATCH MASK FOR DSP_TEST VIDEO ROM CGA AVAILABLE VIDEO ROM MONO AVAILABLE DISPATCH VIDEO_LINK MONO AVAILABLE CGA AVAIL! OS PATCH CRLTEST LCD AVAIL! DSPATCH LCD TSTS VIDEO_RAM ENDS INCLUDE SROMMACS .MAC Common Macros IDENT MACRO NAME SNAME ENDM SAVE MACRO PUSH AX PUSH BX PUSH CX PUSH OX PUSH BP PUSH SI PUSH DI PUSH ES PUSH DS ENDM RESTORE MACRO POP DS POP ES POP DI POP SI POP BP POP DX POP CX POP BX POP AX ENDM 2-24 ROM BIOS SNAME,SEQ,REV 16K BYTE DISPLAY BUFFER THE FOLLOWING MACROS MAY BE USED WHEN A CONDITIONAL JUMP OF MORE THAN +/- 128 BYTES IS REQUIRED. THE MACROS ARE NAMED THE SAME WAY AS THE CONDITIONAL JUMP EXCEPT J BECOMES JF. JFA MACRO JLABEL JNA $+5 JMP JLABEL ENDM JFNA MACRO JLABEL JA $+5 JLABEL JMP ENDM JFB MACRO JLABEL JNB $+5 JLABEL JMP ENDM JFNB MACRO JLABEL $+5 JB JMP JLABEL ENDM JFG MACRO JLABEL JNG $+5 JMP JLABEL ENDM JLABEL JFNG MACRO $+5 JG JMP JLABEL ENDM JFL MACRO JLABEL JNL $+5 JMP JLABEL ENDM JLABEL JFNL MACRO JL $+5 JLABEL JMP ENDM JFO MACRO JLABEL $+5 JNO JMP JLABEL ENDM JFNO MACRO JLABEL $+5 JO JMP JLABEL ENDM JFP MACRO JLABEL JNP $+5 JMP JLABEL ENDM JFNP MACRO JLABEL JP $+5 JLABEL JMP ENDM JFS MACRO JLABEL JNS $+5 JMP JLABEL ENDM JFNS MACRO JLABEL JS $+5 JMP JLABEL ENDM JFZ MACRO JLABEL JNZ $+5 JLABEL JMP ENDM JFNZ MACRO JLABEL $+5 JZ JLABEL JMP ENDM END I F NOT ABOVE JUMP AROUND JMP ELSE TAKE A LONG JUMP I F NOT NOT ABOVE JUMP AROUND ELSE TAKE A LONG JUMP I F NOT BELOW JUMP AROUND JMP ELSE TAKE A LONG JUMP I F NOT NOT BELOW JUMP AROUND ELSE TAKE A LONG JUMP I F NOT GREATER JUMP AROUND ELSE TAKE A LONG JUMP I F NOT NOT GTR JUMP AROUND ELSE TAKE A LONG JUMP I F NOT LESS JUMP AROUND JUMP ELSE TAKE A LONG JUMP I F NOT NOT LESS JUMP AROUND ELSE TAKE A LONG JUMP I F NOT OVERFLOW JUMP AROUND ELSE TAKE A LONG JUMP I F NOT NOT OFLOW JMP AROUND ELSE TAKE A LONG JUMP I F NOT PRTY E JMP AROUND JMP ELSE TAKE A LONG JUMP I F PARITY E JMP AROUND JMP ELSE TAKE A LONG JUMP IF NOT SIGN NEG JMP AROUND ELSE TAKE A LONG JUMP I F SIGN NEGATIVE JUMP AROUND ELSE TAKE A LONG JUMP I F NOT ZERO JUMP AROUND JUMP ELSE TAKE A LONG JUMP I F NOT NOT 0 JMP AROUND JMP ELSE TAKE A LONG JUMP ROM BIOS 2-25 Nonmaskable Interrupt Handler (BIONMIH) ; **************************** PUBLICS ;**************************** PUBLIC NMLFLIH PUBLI C PULRTCNMI PUBLIC GELRTCNMI ; **************************** EXTERNALS ;**************************** EXTRN EXTRN EXTRN EXTRN 0000 PAR_CHK: BYTE ICON_PR:NEAR ENABLE_NMI : NEAR DISABLE_NMI :NEAR ROMCODE SEGMENT BYTE PUBLIC ASSUME CS: ROMCODE IDENT BlONMIH,lO,OO First Level Interrupt Handler (NMI_FLIH) ; ********************************************************************** MODULE-NAME: NMLFLIH OATE LAST MODI FI ED : 09/12/85 DESCRIPTIVE-NAME: THIS ROUTINE SUPPORTS THE SIX TYPES OF NMI SOURCES COPYRIGHT: 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: ECOOO FUNCTION: THIS MODULE HANDLES NON-MASKIBLE INTERRUPTS. THE SIX TYPES OF NMI' S ARE: DISKETTE NMI - I/O INSTR. ISSUED WITH CONTROLLER OFF I/O CHANNEL CHECK - I/O DEVICE CHANNEL .ERROR SYSTEM SUSPEND 2 SECONDS BEFORE POWER OFF OCCURS KYBD_DATA KEYBOARD HAS DATA IN PORT 7DH KYBD_CLEAR INT 9 HANDLER ISSUED KYBD CLEAR I/O RTC~LARM REAL TIME CLOCK INTERRUPT MODULE SIZE: 2618 BYTES 2-26 ROM BIOS ENTRY CONDITIONS: PURPOSE OF ENTRY: SERVICE NON-MASKIBLE INTERRUPT INPUT CONDITIONS: NON-MASKIBLE INTERRUPT OCCURRED RESTRICTIONS: NONE INTERNALLY REFERENCED DSKLRESYNC KYBD_XL T CHAN_CHK ROUTINES: KYBD_PREP KYBD_CLR RTCALARM_NMI LOW_BAT_CHK SUSPEND RESUME EXTERNALL Y REFERENCED ROUTI NES: REFER TO EXTRN LIST CHANGE ACTIVITY: NONE ********************************************************************** 0000 REGSAVE STRUC OW 5 DUP(?) 05 [ ???? DXSAVE CXSAVE BXSAVE AXSAVE OFFSAVE SEGSAVE FLGSAVE REGSAVE OOOA OOOC OOOE 0010 0012 0014 0016 0018 REGLSAV STRUC OW 8 DUP(?) 08 [ 0000 OX SAVE AREA ON STACK CX SAVE AREA ON STACK BX SAVE AREA ON STACK AX SAVE AREA ON STACK OFFSET SAVE AREA ON STACK SEGMENT SAVE AREA ON STACK FLAGS SAVE AREA ON STACK OW OW OW OW OW OW OW ENDS 1??? 0010 DOll 0012 AL SAVE AREA ON STACK AH SAVE AREA ON STACK ALSAVE DB AHSAVE DB REGLSAV ENDS ?? 1? = 0200 LFLAG EQU 0200H = OOEC = OOEE IrLINSTR OULINSTR EQU EQU OECH OEEH 0000 0000 0001 0003 0005 0006 0007 0008 0009 OOOA OOOB OOOC 0000 0000 OOOE DOll 0013 0015 0017 0019 ASSUME DS:DATA,ES:NOTHING NMLFLIH PROC FAR PUSH AX ; SAVE REGISTERS MOV AL,DISABLLSLEEP+CLOCICRUN ; DISABLE NMIS OUT CLOCICCTL, AL PUSH BX PUSH CX PUSH OX PUSH BP PUSH SI PUSH 01 PUSH ES PUSH OS NMLREDRIVE: CLEAR DIRECTION CLD MOV AX ,DATA MOV DS,AX SET BP TO STACK PTR MOV BP,SP READ NMI SOURCE FLAGS IN AL,NMLSRC SAVE ALL BUT TIMER SENSE AND AL,NOT TIMERLSN NMIH_OUT JZ 001B OOlD 001F 0021 50 BO 07 E6 72 53 51 52 55 56 57 06 IE FC B8 8E 8B E4 24 74 ---- R 08 EC 62 OF 46 8A E4 DC E6 08 61 08 61 MOV IN OR OUT BL,AL AL,NMLCNTL AL, 0 I S...ALARM NMLCNTL,AL INTERRUPT FLAG IN FLAGS REGISTER OBJECT CODE FOR IN AL,DX INSTR OBJECT CODE FOR OUT DX,AL INSTR BL <--- NMI SOURCE FLAGS DISABLE RTC ALARM· NMI ROM BIOS 2-27 0023 0026 0028 002B 002B 002E 0030 0033 0033 0036 F6 C3 40 74 03 E9 0536 R 0038 003B 003D 0040 0040 0043 0045 0048 0048 004B 004D F6 C3 01 74 03 E9 025F R F6 C3 08 74 03 E9 0797 R F6 C3 80 75 37 F6 C3 10 74 03 E9 02F6 R F6 C3 04 74 03 E9 0551 TEST JZ JMP NMLOO: TEST JZ JMP NMLOI : TEST JNZ BL,IOCHICNMI NMLOO CHAN_CHK CHANN EL CH ECK? BL, SYS_SUSP _NMI NMLOI SUSPEND SYSTEM SUSPEND? TEST JZ JMP NML02: TEST JZ JMP NML03 : TEST JZ JMP BL,KBDATILNMI NML02 KYBD_PREP KEYBOARD DATA READY? BL, KBCLR_NMI NML03 KYBD_CLR KEYBOARD CLEAR? PROCESS KEYBOARD CLEAR BL, RTCJILRfLNMI NMIH_EXIT RTCALARM_NMi EXIT I F NOT ALARM OTHERWISE MUST BE ALARM BL,DSKLNMI DSKT _RESYNC PROCESS CHANNEL CHECK RUN SYSTEM SUSPEND ROUTINE PROCESS DISKETTE NMI GO TO PROCESS DATA KYBD_PREP, KYBD_CLR , DSKLRESYNC, RTCALARM_NMI ROUTINES RETURN HERE 0050 0050 0051 0053 FA BO 07 E6 72 0055 0057 0059 E4 61 24 F7 E6 61 005B 005D 005F 0061 0061 0062 0063 0064 0065 0066 0067 0068 0069 006B 006D 006E 006F E4 62 24 DF 75 AC IF 07 5F 5E 5D 5A 59 5B BO 27 E6 72 58 CF NMIH_EXIT: CLI MOV AL, DI SABLLSLEEP+CLOCICRUN OUT CLOCICCTL ,AL IN AND OUT AL,NMLCNTL AL,NOT OIS...ALARM NMLCNTL ,AL DISABLE NMIS RE-ENABLE ALARM NMI IN AL,NMLSRC READ NMI SOURCE FLAGS AND AL,NOT TlMERLSN SAVE ALL BUT TIMER SENSE JNZ NMLREDRIVE NMIH_OUT: POP RESTORE REGISTERS DS POP ES POP DI POP SI POP BP POP DX POP CX POP BX MOV AL, DI SABLE_SLEEP+CLOCICRUN+GLOBAL_NMI ENABLE NMIS OUT CLOCICCTL,AL POP AX IRET NMLFLIH ENDP INCLUDE DSKTNMI.INC SUBTTL DISKETTE RESYNC DRIVER EXTRN EXTRN EXTRN EXTRN EXTRN 2-28 ROM BIOS NECOUTPUT: NEAR RESUL TS: NEAR DISICRESET:NEAR GELPARM: NEAR GELVECTOR@:NEAR Diskette Resyoc (DSKT_RESYNC) ;*************************************************** MODULE-NAME : DSKLRESYNC DESCRIPTIVE-NAME : DISKETTE RESYNC ROUTINES COPYRIGHT: 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: 0.0 FUNCTION : TO POWER ON ANO RE-SYNCHRONIZE THE STATE OF THE DISKETTE CONTROLLER WITH THE CURRENT STATE OF THE DISKETTE DRIVES MODULE SIZE: 660 BYTES ENTRY CONDITIONS: PURPOSE OF ENTRY: TO POWER UP THE FDC WHEN THE FDC IS POWERED OFF INPUT CONDITIONS: DS POINTING TO ROM DATA AREA, BP POINTING TO STACK RESTRICTIONS: NONE THIS ROUTINE IS INVOKED WHENEVER AN I/O ACCESS IS MADE REGISTERS 3F2,3F4,3F5 WHEN POWER IS OFF TO THE FOC. IF POWERED ON BY THIS ROUTINE AND THE RETURN ADDRESS-1 IS IN AL,DX OR OUT DX,AL INSTRUCTION, THE RETURN ADDRESS RE-EXECUTE THAT INSTRUCTION UPON NMI EXIT. TO THE FOC THE FDC IS POINTING TO AN IS ADJUSTED TO EX IT COND I TI ONS: NORMAL EXIT CONDITIONS: POWER RESTORED TO THE FDC TRACK COUNTER(S) FOR THE FDC AND ARRAY IN SYNC NMI'S ENABLED (PORT 77H) SETUP TO REISSUE THE DISKETTE I/O COMMAND ERROR EXIT CONDITIONS: NONE REGISTERS MODIFIED: AX, BX, CX, DX, ES, AND SI INTERNAL DATA AREAS / TABLES: BIOS DATA AREA AT SEGMENT 40H EXTERNAL l Y REFERENCED ROUTINES: REFER TO EXTRN LIST , EXTERNALL Y REF,RENCED DATA AREAS: REFER TO EXTRN LIST ;************* r;.-,:,*************************************************** ****** DSKT_RESYNC PROC NEAR ASSUME CS: ROMCODE ASSUME DS:DATA,ES:ABSO 006F 006F 0074 0076 007A 81 75 F6 74 7E OA 03F2 14 46 10 04 OE 007C 007E 0080 0082 0084 0086 0088 BO E6 OC E6 24 E6 EB B2 77 40 77 BF 77 C6 CMP JNE TEST JZ DXSAVE[BP] ,DRIVLCNTL DSKLON ALSAVE[BP], FDCRUN DSKLON CHECK FOR DX = RESET PORT JUMP IF NOT RESET BIT ACTIVE IN AL? YES THEN POWER ON CNTLR IF NOT A RESET COMMAND TO 3F2H THEN RESET DISKETTE NMI AND EXIT LEVEL MOV OUT OR OUT AND OUT JMP AL, OSKLNMI +DSKLDEGATE+RD_CNTL +CNTL_SEL DSKLCNTL,AL AL,FDCPWR TOGGLE POWER ON THEN OFF TO DSKLCNTL,AL RESET NMI BUT DO NOT POWER AL. NOT FOCPWR ON CONTROLLER DSKLCNTL,AL NMHLEXIT EXIT LEVEL SAVE DISKETTE MOTOR STATE BUT DISABLE DRIVE SELECTS,DMA, INTERRUPTS ROM BIOS 2-29 008A 008D 008E 0090 0092 0095 0097 0099 0099 009C BA EC 8A 24 F6 74 DC 03F7 DSKLON: DX,DRIVE_SENSE MOV IN AL,DX READ DRIVES MOTOR/SEL LINES MOV BL,AL BL <--- STARTING SENSE AND AL, DR0J.10TOR SAV E DRO MOTOR STATE TEST BL, DRLMOLSENSE WAS DRIVE 1 MOTOR ON? JZ DSKLRS01 NO THEN JUMP OR AL, DR1J.10TOR OTHERWISE TURN ON DRIVE 1 MOTOR DSKLRS01: MOV DX, DRIVE_CNTL SET PORT TO 3F2 OUT DX,AL TURN OFF DMA/lNT LEAVE MOTOR ON D8 10 C3 08 02 20 BA 03F2 EE DISABLE POWER AND ACTIVATE DISKETTE DEGATE MODE 009D 009F BO B2 E6 77 00A1 00A3 OC 40 E6 77 00A5 OOAA OOAC OOAE OOBO 00B2 00B2 F6 74 E4 24 E6 00B5 00B8 OOBA B9 050A E2 FE FA MOV OUT AL, DSKLNMI +DSKLOEGATE+RD_CNTL +CNTL_SEL DSKLCNTL,AL ; SEND TO THE DISKETTE CONTROL REG ENABLE CONTROLLER POWER OR OUT 06 OOAO R 01 06 61 F7 61 E8 076E R AL, FDCPWR DSKLCNTL ,AL ; ENABLE POWER TEST RTCWAILFLAG, INTERVAL_WAIT; CHECK FOR PERIODIC INT JZ DSKLRS01A AL,NMLCNTL IN AND AL,NOT DIS-ALARM ALLOW RTC ALARM INTERRUPTS OUT NMLCNTL,AL DSKLRS01A: CALL NMLCYCLE CYCLE NMI MASK, RESTORE INT FLAGS MOV LOOP CLI CX,5*MS_DELAY DELAY TO WAIT FOR CONTROLLER $ CHECK IF NMI CAUSED BY POWER ON DURING MIDDLE OF CONTROLLER RESET = OOBB OOCO 81 7E OA 03F2 75 13 CMP JNE DXSAVE[BP] ,DRIVE_CNTL DSKLRS02 CHECK FOR OX JUMP I F NOT 00C2 00C5 00C7 8A 46 10 A8 04 75 OC MOV TEST JNZ AL,ALSAVE[BP] AL, FDCRUN DSKLRS02 GET ORIGI NAL AL REG IS FDC RESET OFF? YES THEN NOT A RESET 00C9 OOCB OOCC OOCE DODO 00D2 DC EE E4 24 E6 E9 RESET PORT POWER ON REQUEST IN THE MIDDLE OF THE CONTROLLER RESET 04 OR OUT IN AND OUT JMP 77 DF 77 0207 AL, FDCRUN DX,AL AL, DSKLCNTL AL,NOT DSKLDEGATE DSKLCNTL, AL DSKLRSEXIT SET RESET BACK TO OFF TURN OFF OEGATE EXIT THE NMI TO COMPLETE THE RESET SEQUENCE TAKE OVER AND ACTIVATE DISKETTE INTERRUPT 0005 00D5 0008 0009 OODE ODED 00E2 00E4 AD 50 C6 2B 8E B1 E8 0040 R 06 0040 R FF CO CO 06 0000 E DSKLRS02: MOV AL,MOTOR_COUNT PUSH AX MOV MOTOILCOUNT ,OFFH SUB AX,AX MOV ES,AX MOV CL,6 CALL GELVECTOR@ SAVE CURRENT MOTOR COUNT SAVE ON STACK KEEP MOTOR FROM GO I NG OFF GET INT LEVEL 6 VECTOR LOC SI NOW CONTAINS INTERRUPT VECTOR ADDRESS ; 00E7 OOEA OOEB OOEF OOFO 00F4 00F9 26: 50 26: 50 26: 26: 56 8B 04 8B 44 02 8C 4C 02 C7 04 024C R 2-30 ROM BIOS MOV PUSH MOV PUSH MOV MOV PUSH AX,ES: lSI] GET VECTOR OFFSET AX ; SAVE AX,ES: [SI+2] GET VECTOR SEG AX ; SAVE ES: [SI+2] ,CS ; SET CODE SEGMENT WORD PTR ES: lSI] ,OFFSET DSKLNMIE ; SI ; SAVE VECTOR ADDRESS OOFA OOFC OOFE E4 21 24 BF E6 21 0100 0102 0104 0106 0108 010A OlOC OlOE 0110 0112 BO E6 E4 8A BO E6 E4 8A BO E6 IN AND OUT ~ SETUP AL,INTAOI AL ,OBFH INTAOl,AL ; ENABLE DISKETTE INTERRUPTS TO READ THE TRACK COUNTERS AND DEGATE 01 SKETTES EA 77 77 C8 E2 77 77 E8 F2 77 MOV OUT IN MOV MOV OUT IN MOV MOV OUT AL, DSKLNMI tFDCPWR+DSKT _DEGATE+DRO_TRLSEL +CNTLSEL DSKLCNTL, AL ; READ THE TRACK CNTR FOR DR 0 AL,DSKLCNTL CL,AL ; CL <-- DRIVE 0 POSITION AL, DSKT_NMI +FDCPWR+DSKT_DEGATE+CNTL_SEL DSKLCNTL,AL ; READ THE TRACK COUNTER FOR DR AL,DSKLCNTL CH,AL ; CH <--- DRIVE 1 POSITION AL, DSKLNMI +FDCPWR+DSKT_DEGATE+RD_CNTL +CNTL_SEL DSKT_CNTL, AL RESET THE FOC AND ISSUE SPECIFY COMMAND TO THE FDC CH = DRIVE 1 TRACK POSITION, CL= DRIVE 0, BL = DRIVE_SENSE ON NMI ENTRY 0114 0116 0118 011B 0110 011F 011F 0121 0124 0126 0128 0128 012B 012C 012E 0130 0131 0136 0137 013A 0130 013E 0140 0143 0143 0145 0148 014B 0140 0140 014F 0151 0154 0157 015A 0150 0160 0163 0166 8A 24 F6 74 OC C3 10 C3 08 02 20 OC F6 74 OC 08 C3 20 02 01 BA EE OC EB EE 80 03F2 FB EB BF 57 8B B9 04 00 26 003E R 7F STI CALL WAILINTRPT MOV DI,OFFSET RESYNCOUT2 PUSH 01 MOV DI,CX MOV CX,4 NMLRSETLP: MOV AH ,READ_INLSTATUS CALL NECOUTPUT CALL RESULTS LOOP NMLRSETLP NMLSPECI FY: MOV CX,DI MOV AH, SPECI FY CALL NECOUTPUT MOV BX,1 CALL GELPARM CALL NECOUTPUT MOV BX ,03H CALL GELPARM CALL NECOUTPUT CALL DROP _BUSY 0231 R 01F4 R F9 0004 B4 E8 E8 E2 08 0000 0000 F6 8B B4 E8 BB E8 E8 BB E8 E8 E8 CF 03 0000 0001 0000 0000 0003 0000 E 0000 E 0222 R MOV AL,BL AL , ORO_MOTOR AND TEST BL,DRL.MOLSENSE JZ NMLSELMOT OR AL,DRLMOTOR NMLSELMOT: OR AL, FDCDMILENAB TEST BL,DRLSEL_SENSE NMLSELDR JZ OR AL,DRLSELECT NMLSELDR: MOV OX, DR I VE_CNTL OUT DX,AL OR AL, FDCRUN JMP $ + 2 OUT DX,AL AND SEELSTATUS,NOT INLFLAG SAVE ORO MOTOR STATE WAS DRIVE 1 MOTOR ON? NO THEN JUMP OTHERWISE TURN ON DRIVE 1 MOTOR ENABLE DMA/INTERRUPTS BIT DRIVE 1 ACTIVE ? JUMP I F NOT RESET THE ADAPTER TURN OFF THE RESET TIME DELAY ; RESET THE I NTERRUPT FLAG ALLOW INTERRUPTS CHECK FOR FDC TO GENERATE AN INT ERROR EXIT FOR NECOUTPUT SAVE TRACK COUNTERS READ 4 DRIVES STATUS READ INTERRUPT STATUS COMMAND SEND IT TO THE FDC GET STO AND PCN LOOP UNTI L COMPLETE RESTORE TRACK COUNTERS SPECIFY COMMAND FIRST PARM SENT TO THE FDC SECOND PARM SENT TO THE FOC ISSUE OVERLAPPED RECALS TO DR 0 AND 1 IF INSTALLED NOTE SEE WHAT TO DO WITH SEELSTATUS BIT 7-INTERRUPT RECEIVED 0169 016B 016E 0170 0173 B4 E8 B4 E8 E8 07 0000 E 00 0000 E 0222 R MOV CALL MOV CALL CALL , AH, RECALl BRATE NECOUTPUT AH,OO NECOUTPUT DROP_BUSY RECAL COMMAND FOR THE FDC OUTPUT IT TO THE FDC RECAL DRI VE 0 FI RST OUTPUT IT TO THE FDC CHK FOR FDC BUSY TO DROP FOR OVLP ;SEE IF THERE IS A SECOND DRIVE I F SO RECAL IT 0176 017C F7 06 74 OA ooui R 0040 TEST JZ EQU I P_FLAG, 40H RECAL_DONE ; SEE IF SECOND DRIVE IS INSTALLED ; ONLY DRIVE 0 INSTALLED ROM BIOS 2-31 Ol7E 0180 0183 0185 0188 0188 018B 018D 0190 0193 0196 019C 019E 01A1 01A3 01A6 B4 E8 B4 E8 07 0000 01 0000 MOV AH,RECALIBRATE CALL NECOUTPUT MOV AH,Ol CALL NECOUTPUT RECAL_DONE: E8 0231 CALL WAILINTRPT B4 08 MOV AH,READ_INLSTATUS E8 0000 CALL NECOUTPUT E8 0000 E CALL RESULTS 80 C9 80 OR CL,80H F7 06 0010 R 0040 TEST EQUIP_FLAG,40H 74 OB JZ NMLSEEK E8 0231 R CALL WAILINTRPT B4 08 MOV AH,READ_INLSTATUS E8 0000 CALL NECOUTPUT E8 0000 CALL RESULTS CHK FOR FDC TO GENERATE AN IRPT READ DRIVE STATUS TO THE FOC RECAL STATUS REQUESTED FLAG SEE IF TWO DRIVES INSTALLED CHK FOR FDC TO GENERATE AN IRPT READ DRIVE STATUS TO THE FOC , ;ISSUE OVERLAPPED SEEKS TO DR 0 AND 01A9 01A9 01AC 01AE 0181 01B3 01B6 01B8 018B RECAL COMMAND FOR THE FDC OUTPUT IT TO TH E FDC RECAL DRI VE 1 OUTPUT IT TO THE FDC 80 B4 E8 B4 E8 8A E8 E8 E1 7F OF 0000 00 0000 El 0000 0222 IF INSTALLED NMLSEEK: AND CL,07FH MOV AH, SEEK-CMD CALL NECOUTPUT MOV AH,OO CALL NECOUTPUT MOV AH,CL CALL NECOUTPUT CALL DROP_BUSY , TURN OFF THE RECAL SWITCH SEEK COMMAND FOR THE FDC OUTPUT IT TO THE FDC SEEK DRIVE 0 FIRST OUTPUT IT TO THE FDC DR 0 TRACK TO SEEK TO OUTPUT TO TH E FDC CHK FOR FDC BUSY TO DROP FOR OVLP ;SEE IF THERE IS A SECOND DRIVE IF SO SEEK 01BE 01C4 01C6 01C8 01CB 01CD 01DO 0102 0105 01D5 F7 74 84 E8 B4 E8 8A E8 06 0010 R 0040 OF OF 0000 01 0000 E5 0000 0108 010A 0100 B4 08 E8 0000 E8 0000 E8 0231 TEST EQUI P_FLAG, 40H JZ SEEK-DONE MOV AH,SEEK-CMD CALL NECOUTPUT MOV AH,Ol CALL NECOUTPUT MOV AH,CH CALL NECOUTPUT SEEK-DONE: CALL WAILINTRPT SEE IF SECOND DRIVE IS INSTALLED ONLY DRIVE 0 INSTALLED SEEKL COMMAND FOR THE FDC OUTPUT IT TO THE FOC SEEK DRIVE 1 OUTPUT IT TO THE FDC DR 0 TRACK TO SEEK TO OUTPUT TO THE FDC CHECK FOR FDC TO GENERATE AN IRPT ;GET THE STATUS OF THE SEEK AND THE TRACK VALUE RETURNED FROM THE FDC MOV CALL CALL AH,READ_INLSTATUS NECOUTPUT RESULTS ; READ DRIVE STATUS CMD TO THE FDC ; OUTPUT IT TO THE FDC ; GET STO AND PCN FROM THE FDC ~IF A SECOND DRIVE IS INSTALLED GET ITS RESULTS OlEO 01E6 01E8 01EB OlED 01FO F7 74 E8 B4 E8 E8 06 0010 R 0040 OB 0231 08 0000 0000 TEST JZ CALL MOV CALL CALL EQU I P_FLAG, 40H RESYNCOUTl WAILINTRPT AH,REALINLSTATUS NECOUTPUT RESULTS SEE I F TWO DRIVES CHECK FOR Foe TO GENERATE AN IRPT READ DRIVE STATUS COMMAND TO FDC OUTPUT IT TO THE FDC GET STO AND PCN FROM FDC FOR DR 8 SETUP TO RETURN TO CALLER THE PROPER VALUE IN PORT 77H 01F3 01F3 01F4 01F4 01F6 RESYNCOUTl : POP SI ; DISCARD FOCOUTPUT ERROR ADDRESS RESYNCOUT2 : MOV AL ,DSKLNMI HDCPWR+RD_CNTL +CNTLSEL ; TURN OFF DEGATE OUT DSKLCNTL,AL BO D2 E6 77 01F8 01F9 01FA OlFB 01FF 0200 FA 5E 58 26: 89 44 02 58 26: 89 04 5E RESTORE THE USERS INTERRUPT VECTOR AND MOTOILCOUNT 2-32 ROM BIOS CLI POP POP MOV POP MOV SI AX ES:[SI+2],AX AX ES: [SI] ,AX ; RETRI EVE VECTOR ADDRESS RESTORE VECTOR SEG ADDRESS RESTORE VECTOR OFFSET ADDRESS 0203 0204 58 A2 0040 R POP MOV AX MOTOILCOUNT , AL ; RETRI EVE MOTOR COUNT ADJUST THE STACK POINTER TO RETURN TO USER 0207 0207 0208 020S 020E 0210 0211 0213 0214 0216 0218 021A 021C 021C 021F 021F IE 88 8S 8E 4B 8A IF 3C 74 3C 75 DSKLRSEXIT: PUSH OS MOV BX,OFFSAVE[BP] MOV AX,SEGSAVE[BP] MOV DS,AX DEC BX MOV AL, [BX] POP OS CMP AL,IN_INSTR JE DSKLRHLADJ CMP AL, DULl NSTR JNE RHLEXITNMI DSKLRTN-ADJ: DEC OFFSAVE[BP] RTN_EXITNMI: JMP NMIH_EXIT 5E 12 46 14 08 07 EC 04 EE 03 FF 4E 12 E9 0050 R GET RETURN OFFSET AODR GET RETURN SEGMENT AOOR POINT BACK TO INSTR GET INSTRUCTION BYTE IN AL ,OX INSTRUCTION? YES THEN ADJUST RETURN OUT DX,AL INSTRUCTION? NO TH EN DO NOT ADJUST RTN SETUP TO REISSUE THE I/O FOR USER RETURN TO NMLFLIH ;THIS ROUTINE WILL WAIT FOR THE FOC TO DROP BUSY 0222 0222 0223 0226 0228 0228 0229 022B 0220 022F 022F 0230 0231 DROP_BUSY PROC NEAR PUSH CX 51 BA 03F4 2B C9 MOV OX, FOCSTATUS SUB CX,CX WAILBUSY: IN AL,OX TEST AL, FDCBUSY JZ FOCDONE LOOP WAIT_BUSY FOCDONE: POP CX RET DROP_BUSY ENDP EC A8 10 74 02 E2 F9 59 C3 SAVE REGISTER VALUE POINT TO MASTER STATUS PORT TIMING COUNT FOR LOOP READ THE MASTER PORT TEST FOR BUSY TO DROP FDC NO LONGER I S BUSY RESTORE ORIGINAL VALUE ;THIS ROUTINE WILL WAIT FOR AN INTERRUPT FROM THE FOC 0231 0231 0232 0233 0235 0237 0237 023C 023E 0240 0242 0244 0244 0249 024A 024B 024C 024C 51 53 B3 04 2B C9 F6 75 E2 FE 75 06 003E R 80 06 F7 CB F3 80 26 003E R 7F 5B 59 C3 WAILINTRPT PROC NEAR PUSH CX PUSH BX MOV BL,4 SUB CX,CX WAILINT: TEST SEEICSTATUS,INLFLAG JNZ FOCINTRPT LOOP WAILINT DEC BL JNZ WAILINT FDCINTRPT: AND SEEICSTATUS, NOT INLFLAG POP BX POP CX RET WAILINTRPT ENDP DSKLRESYNC ENDP SAVE BX 2 SECONDS WAIT TIMING COUNT FOR LOOP WAIT FOR AN INTERRUPT FDC GENERATED AN INTERRUPT WAIT ON INTERRUPT ; RESET THE INTERRUPT FLAG RESTORE BX DSKLINTE THIS ROUTINE HANDLES THE DISKETTE INTERRUPT INPUT: OUTPUT: 024C 024C 0240 024E 0251 0253 IE 50 B8 ---- R 8E 08 80 OE 003E R 80 NONE THE INTERRUPT FLAG SET IS SEEICSTATUS DSKLNMIE PUSH PUSH MOV MOV OR PROC FAR OS AX AX,DATA DS,AX SEEICSTATUS, I NLFLAG SET UP DATA SEGMENT ROM BIOS 2-33 0258 025A 025C 025D 025E 025F 80 20 E6 20 58 IF CF MaV OUT POP POP IRET DSKLNMIE AL,EOI INTAOO,AL AX OS END OF INTERRUPT MARKER INTERRUPT CONTROL PORT RECOVER SYSTEM RETURN FROM INTERRUPT ENDP INCLUDE KY8DNMI. INC ; ********************************************************************** MODULE-NAME: KYBDNMI. INC DATE LAST MODIFIED: 09/12/1985 DESCRIPTIVE-NAME: THIS MODULE CONTAINS THE BIOS KYBD NMI INTERRUPT HANDLER AND THE ASSOCIATED KEY SCAN CODE TRANSLATION ROUTINES. COPYRIGHT: 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: FUNCTION: 0.0 KYBD_PREP KYBD_CLR KYBD_XL T MODULE SIZE: KEYBOARD SCAN CODE NMI ROUTINE KEYBOARD CLEAR NMI ROUTINE KEYBOARD SCAN CODE TRANSLATION ROUTINE 816 BYTES ENTRY CONDITIONS: PURPOSE OF ENTRY: TO PROCESS A KEYSTROKE INPUT CONDITIONS: NIA RESTRICTIONS: NIA INTERNALLY REFERENCED ROUTINES: KYBD_XLT SCAN CODE TRANSLATION EXIT CONDITIONS: NORMAL EXIT CONDITIONS: KEYSTROKE PROCESSED ERROR EXIT CONDITIONS: NIA REGISTERS MODIFIED: NONE INTERNAL DATA AREAS I TABLES: NONE EXTERNALLY REFERENCED ROUTINES: REFER TO EXTRN LIST EXTERNALLY REFERENCED DATA AREAS: REFER TO EXTRN LIST CHANGE ACTIVITY: NONE ; ******************************************************************* ; ******************************************************************* ;KEYBOARD EXTERNALS ; ******************************************************************* EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN 2-34 ROM BIOS KBPAD_TBL:WORD KBPADL:ABS KBFUN_TBL: WORD KBFUNL :ABS KBNMLTBL:BYTE KB_NOISE:NEAR Keyboard Data NMI (KBNMI_DATA) ; ******************************************************************* ; LOCAL EQUATES FOR KEYBOARD NMI PROCESSING 007D 0000 004B 0038 0008 ; ******************************************************************* 0080 0057 KBNMLDATA NO_HOLD NMLSLASH_SC P60-AL LSC NMLR-AL LBIT3 EQU EQU EQU EQU EQU 7DH OOH 4BH 038H 08H BREAK-BIT P60_FILSC EQU EQU BOH 057H KEYBOARD NMI SCAN CODE INPUT PORT VAL OF P60_HOLD_BYTE FOR NOT Q' 0 SCAN CODE FOR / MAKE AT NMI LEVEL SCAN CODE FOR AL T AT P60 LEVEL USED TO DENOTE LEFT & RIGHT ALT NMI SC. R-ALT HAS THIS BIT SET. USED TO TST AND SET BRK BIT OF SCs Fll MAKE SC FOR P60 ; ******************************************************************* KYBD_PREP - KEYBOARD SCAN CODE NMI PROCESSING DESCRIPTION: THIS ROUTINE IS JUMPED TO FROM THE FIRST LEVEL NMI INTERRUPT HANDLER WHEN THE INTERRUPT IS THE RESULT OF A KEYSTROKE. A CLICK IS SOUNDED WHEN A KEY SCAN CODE 'MAKE' IS RECEIVED AND THE CLICK STATE IS ON. THE SCAN CODE IS READ THEN TESTS ARE MADE TO SEE IF THE BUFFER IS EMPTY AND PORT 60 IS NOT ACTIVE. I F THESE 2 CONDITIONS ARE MET A CALL IS MADE TO THE XLATE ROUTINE WITH THE KEY SCAN CODE IN AL. ELSE THE SCAN CODE IS BUFFERED IN THE 16 POSITION NMI SCAN CODE BUFFER AT THE BUFFER TAIL. IF PORT 60 IS NOT ACTIVE A CALL IS MADE TO THE XLATE ROUTINE WITH THE KEY SCAN CODE TO BE TRANSLATED AT THE BUFFER HEAD. THE FIRST LEVEL NMI INTERRUPT HANDLER SAVES REGISTERS AND MOVES THE ADDRESS OF "DATA" TO THE OS REGISTER BEFORE IT JUMPS TO THIS ROUTINE. ON EXIT THE FIRST LEVEL INTERRUPT HANDLER RESTORES REGISTERS. INPUT: OUTPUT: DATA IN PORT 7DH OS = DATA (40H) STORE SCAN CODE INTO KB_NMLBUFFER UPDATE KB_NMLHEAD _TAIL SAVE LASLCLICK-KEY INTERNAL ROUTINES: EXTERNAL ROUTINES: KYBD_XLT SPKILON, KLNO I SE, SPKR_RESTORE REGISTERS MODIFIED: N/A INTERRUPTS: LEFT AS ARE KYBD NMI INITIALLY DISABLED, ENABLED BEFORE EXIT NORMAL EXIT: ; ******************************************************************* 025F 025F 0260 JMP NMIH_EXIT NEAR ASSUME ASSUME PUSH POP IE 07 0261 OS: DATA ES: DATA DS ES DATA POINTER TO ES PREPI0: ENABLE DISPLAY I F DISABLED BY KEYBOARD INACTIVITY 0261 0266 F6 06 0016 R 80 74 OF , TEST JZ BIOS_STATUS,DSP_BLANKED ; IS LCD BLANKED? PREP _12 ; RESET BLANKED FLAG AND ENABLE DISPLAY ROM BIOS 2-35 0268 0260 026F 0271 0273 0275 80 BO E6 E4 OC E6 26 0016 R 7F 00 74 75 60 75 AND MOV OUT IN OR OUT BIOS3TATUS,NOT DSP_BLANKED ; RESET FLAG AL,O LCD_INDX,AL AL,LCLDATA ; GET DISPLAY CONTROL REG AL,SYNCENABLE+PANELENABLE ; TURN ON PANEL LCD_DATA,AL SET KEYBOARD ACTIVE FLAG (FOR THIS PERIOD) 0277 0277 027C 80 OE 0016 R 20 80 26 0015 R BF PREP_12: OR AND BIOS3TATUS,KYBD~CTIVE ; INDICATE KEYBOARD IS ACTIVE BALSTATUS,NOT LOW_BAT.JlOLD ; RESET LOW BTRY HOLD FLAG .. ; ..... -- ..... _------ ------ --- --- -- --- -- -- ----- -- ---- -- ---- ------ --- ------ ; A KEYBOARD DATA READY NMI OCCURED. READING THE DATA RESETS THE DATA ; READY NMI REQUEST. ; ... ---------_ ...... -----_ ... -- 0281 E4 7D IN -_ ... -- -- --- -- -- ------- -- -- ---- -- ---- ..... -- --- --- AL,KBNMLDATA ; READ SCAN CODE DETERMINE IF A KEY STROKE CLICK IS REQUIRED FOR THIS KEY. A CLICK IS SOUNDED ON THE MAKE OF ALL KEYS EXCEPT THE MAKES OF KEYS THAT ARE GENERATED BY TYPAMATIC MODE. 0283 0285 A8 80 74 07 0287 028C C6 06 OOBA R 00 EB 23 028E 028E 0292 38 06 OOBA R 74 10 0294 ; A2 OOBA R MOV LASLCLI CK...KEY , AL 0297 029C 029E 02A1 02A4 02A6 02A9 02AC 02AF F6 74 BB B9 8A E8 E8 E8 8A TEST JZ MOV MOV MOV CALL CALL CALL MOV KB_NMLCNTL,CLICK...ON ; IS AUDIO FEEDBACK ENABLED? PREP29 NO, GO TO BUFFER PROCESSING BX,lH ; DURATION OF CLICK CX,20H ; FREQUENCY OF CLICK DL,AL ; SAVE KEYSTROKE SPKR_ON ; FORCE SPEAKER ON KB_NOISE ; OUTPUT KEY STROKE CLICK SPKILRESTORE ; RESTORE SPEAKER STATE AL,DL ; RESTORE AL TEST JZ AL, BREAK...BIT PREP20 ; IS THIS A 'MAKE' SCAN CODE? ; YES, GO TO CLICK PROCESSING ; ALLOW ANY BREAK KEY TO CLEAR LASLCLICK...KEY MOV JMP PREP20: CMP JE LASLCLI CK...KEY , 0 SHORT PREP29 ; YES, CLEAR LASLCLI CK...KEY ; GO TO BUFFER PROCESSING LASLCLI CK...KEY , AL PREP29 ; T-MATIC KEY IF = TO LAST KEY MAKE ; IF TYPAMATIC SKIP CLICK FIRST KEY HIT - NOT TYPAMATIC 06 00B4 R 08 13 0001 0020 DO 0759 R 0000 E 0762 R C2 ; THIS KEY IS NOW LASLCLICK...KEY PROCESS KEY 02B1 02B1 02B5 02B9 02BB 02BE 02CO SA 8A FE 80 72 B1 02C2 02C2 02C4 3A E9 75 12 2E OOBB R OE OOBC R C1 F9 10 02 00 , 02C6 02CB 02DO 0205 C6 C6 C6 EB 06 06 06 OF PREP29 : MOV MOV INC CMP JB MOV CH,KLNMLHEAD CL,KB_NMLTAIL CL CL,KB_NMLBLTH PREP50 CL,O PREP50: CMP JNE CH,CL PREP60 BUFFER HEAD TO CH BUFFER TAIL TO CL.· INCREMENT TAIL POINTER ; IS CL = END OF BUFFER +l ; JUMP I F NOT PAST END OF BUFFER PAST END - SET TO START HAS TAIL REACHED HEAD - OVERFLOW JUMP I F NOT OVERFLOW KEYBOARD NMI BUFFER OVERFLOW OOBB R 00 OOBC R 01 OOBD R FF 90 2-36 ROM BIOS MOV MOV MOV JMP KB_NMLHEAD,O KB_NMLTAIL,l KB_NMLBUFFER,OFFH PREP70 ; BUFFER OVERFLOW - PURGE BUFFER ; POSITION FOR OVERFLOW INDICATOR ; OVERFLOW INDICATOR TO BUFFER HEAD NO OVERFLOW 0208 0208 020A 020E 02E2 B7 8A 88 88 00 IE OOBC R 87 OOBO R OE OOBC R , PREP60: MOV MOV MOV MOV BH,O BL,KILNMLTAIL KB~MLBUFFER[BX] KB~MLTAIL,CL ; CLEAR BH ; MOV ORIGINAL TAIL POINTER TO BL ,AL ; BUFFER SIC AT ORIGINAL TAIL POINTER ; UPDATE TAIL POINTER ; ATTEMPT TO DEQUEUE KEYSTROKE AND TRANSLATE 02E6 02E6 02EB 02ED 02FO F6 75 E8 E9 02F3 02F3 E9 0050 R 06 00B4 R 10 06 0319 R 0050 R 02F6 PREP70: TEST JNZ CALL JMP KB~MLCNTL.XLATE_BUSY PREP90 KYBD_XL T NMIH_EXIT ; IS A XLATION ALREADY IN PROGRESS? JUMP I F ACTIVE XLATE AND WRITE TO PORT 60 EXIT KEYBOARD DATA ROUTINE PREP90: JMP GO TO 1ST LEVEL INTERRUPT HANDLER KYBD_PREP ENDP PROCEDURE END Keyboard Clear NMI (KYBD_CLR) ******************************************************************* KYBD_CLR - KEYBOARD CLEAR NMI PROCESSING DESCRIPTION: THIS ROUTINE IS JUMPED TO FROM THE FIRST LEVEL NMI INTERRUPT HANDLER WHEN THE INTERRUPT IS THE RESULT OF PORT 60 BEING CLEARED. A BUFFER EMPTY TEST IS MADE TO DETERMINE I F THERE ARE MORE KEY SCAN CODES TO BE XLATED. IF THE BUFFER IS NOT EMPTY A CALL IS MADE TO THE XLATE ROUTINE TO PROCESS THE KEY AT THE BUFFER HEAD. THE FIRST LEVEL NMI INTERRUPT HANDLER SAVES REGISTERS AND MOVES THE ADDRESS OF "DATA" TO THE DS REGISTER BEFORE IT JUMPS TO THIS ROUTINE. ON EXIT THE FIRST LEVEL INTERRUPT HANDLER RESTORES REGISTERS. INPUT: OUTPUT: P60JlOLD_BYTE P60_HOLD_BYTE RESET P60_LOADED RESET CLILKEYBD OF PORT 6IH RESET INTERNAL ROUTI NES: EXTERNAL ROUTINES: KYBDJL T NONE REGISTERS MODIFIED: NIA INTERRUPTS: NORMAL EXIT: LEFT AS ARE JMP NMIH_EXIT ******************************************************************* NEAR 02F6 02F6 02F7 IE 07 ASSUME ASSUME PUSH POP DS:DATA ES:DATA DS ES DATA POINTER TO ES ROM BIOS 2-37 THIS NMI IS A RESULT OF INT9 CLEARING THE KEYBOARD INDICATING THAT THE PORT 60 SCAN CODE HAS BEEN READ AND IS READY TO ACCEPT ANOTHER. KEYPAD /, * AND RIGHT -ALT NMI SCAN CODES GENERATE TWO CODES FOR PORT 60. KYBD_XLT SENDS THE FIRST (HIDDEN CODE) DIRECTLY AND QUEUES THE SECOND (P60 SCAN CODE) IN P60_HOLD_BYTE. IF P60_HOLD_BYTE IS HOLDING, IT MUST BE SENT TO P60 AS SOON AS P60 IS EMPTY. 02F8 02FB 02FD 02FF 0301 0306 0308 AO 3C 74 E6 C6 EB 80 00B9 00 09 60 06 00B9 R 00 05 26 00B4 R 7F 030D 030F 0311 E4 61 24 7F E6 61 0313 0316 ; E8 0319 R E9 0050 R MOV CMP JE OUT MOV JMP KCI0 : AL, P60_HOLD_BYTE GET HOLD BYTE AL,NO_HOLD IS A SCAN CODE QUEUED? KClO NO, JUMP. KLDATA,AL ; HELD SCAN CODE TO P60 P6LHOLD_BYTE,NO_HOLD ; RESET HOLD BYTE SHORT KC20 ; LEAVE P60_LOADED SET AND KB_NMLCNTL ,NOT P60_LOADED ; SET OFF PRT 60 ACT RESET CLEAR KEYBOARD NMI SOURCE KC20 : AND OUT IN AL,NMLCNTL AL, NOT CLR_KEYBD NMLCNTL,AL GET NMI CONTROL PORT SET CLEAR KYBD BIT TO 0 CALL TRANSLATE TO SEE IF ANYTHING IN QUEUE AND TRANSLATE IF SO KYBD_XL T NMIH_EXIT CALL JMP XLATE AND WRITE TO PORT 60 GO TO 1ST LEVEL INTERRUPT HANDLER PROCEDURE END 0319 Translate Scan Code (KYBD_XLT) ; ******************************************************************* KYBD_XLT - KEYBOARD SCAN CODE XLATE ROUTINE DESCRIPTION: IF THE SCAN CODE BUFFER IS EMPTY OR PORT 60H IS LOADED AT ENTRY THEN THIS ROUTINE ENABLES KEYBOARD NMI AND EXITS. IF THE BUFFER IS NOT EMPTY THE NEXT ENTRY IN THE SCAN CODE BUFFER IS PROCESSED. THE SCAN CODE IS TRANSLATED TO THE PCl EQUIVALENT AND THE PCl SCAN CODE IS WRITTEN TO PORT 60. HARDWARE WILL GENERATE A SET HARDWARE INTERRUPT 1 REQUEST WHEN PORT 60 IS WRITTEN. I F THE TRANSLATION DOES NOT RESULT IN A PORT 60 LOAD THEN OTHER KEYS IN THE QUEUE ARE PROCESSED I F ANY. INPUT: KB_NMLBUFFER OUTPUT: WRITE TO PORT 60H INTERNAL ROUTINES: EXTERNAL ROUTINES: NUM_STATCFIX NMLCYCLE REGISTERS MODIFIED: N/A INTERRUPTS: I FLAG RESTORED TO PRE-NMI STATE KYBD_NMI ENABLED , NORMAL EX IT: 0319 2~38 RET ; ****************************************************************** NEAR ROM BIOS ASSUME ASSUME OS: DATA ES: DATA SCAN CODE BUFFER PROCESSING 0319 0319 E8 0000 E 031C 0321 F6 06 00B4 R 80 75 00 , ; 0323 0327 032B XL TlO: CALL ; DISABLE ALL INTERRUPTS KB_NMLCNTL, P60_LOADED ; IS PORT 60 CURRENTLY LOADED? XL Tl3 ; YES THEN EXIT THE ROUTINE TEST JNZ PORT 60 IS NOT LOADED SO CHECK QUEUE FOR ANY KEYS 8A IE OOBB R 3A IE OOBC R 75 06 MOV CMP JNE BL, KLNMLHEAD BL,KB_NMLTAIL XL Tl4 ; BUFFER HEAD DISPLACEMENT ; I S BUFFER EMPTY ; YES, GO TO BUFFER EMPTY ENTRY PORT 60 IS NOT LOADED AND NO KEYS IN QUEUE SO FIX NUM_LOCK STATUS AND EXIT 0320 E8 0524 R' CALL RE-ENABLE KEYBOARD NMIS AND EXIT THE ROUTINE 0330 E9 0523 R XLTl3: JMP XL T100 DEQUEUE THE SCAN CODE FROM THE NMI QUEUE 0333 0338 033A 033E 0340 0343 0345 80 B7 8A FE 80 72 B3 OE 00B4 R 10 00 87 OOBD R C3 FB 10 02 00 0347 0347 88 IE OOBB R ; XLTl4: MOV MOV INC CMP JB MOV XLTl5: MOV OR KB_NMLCNTL,XLATLBUSY ; SET KEY XLATE IN PROCESS BH,O ; CLEAR BH - BL IS BUFFER HEAD DISP AL,KB_NMLBUFFER[BXl ; GET SCAN CODE FROM BUFFER BL INCREMENT HEAD POINTER BL,KB_NMLBLTH IS BL = END OF BUFFER +1 XL Tl5 JUMP I F NOT PAST END OF BUFFER BL,O PAST END - SET TO START KB_NMLHEAD,BL UPDATE BUFFER HEAD START OF SCAN CODE TRANSLATION ENABLE NMIS AND RESTORE INTERRUPT STATE TO PRE-NMI CONDITION ------- -------------------------- -- - - - - - -- - - - -- - - - - - -- - - - - - - - -- - --- 034B ; E8 076E R 034E 0350 0352 8A EO 3C FF 75 14 0354 035A 0360 0365 C7 C7 80 E9 0368 0368 036B 036D 036F 0373 0375 0377 0379 ; CHECK IF SC IS FOR A BAS E KEY ONLY XLTl8: 80 E4 80 AND AH , BR EALB IT 8A DO MOV DL,AL 24 7F AND AL,NOT BREALBIT 8D IE 0000 LEA BX, KBNMLTBL 2E: D7 XLAT KBNMLTBL A8 80 TEST AL ,80H 75 03 JNZ XL Tl9 XL T60_1 E9 04DE R JMP CALL NMLCYCLE CYCLE NMI MASK, RESTORE INT FLAGS MOV CMP JNE AH,AL AL,OFFH XL Tl8 AH <=== ORIGINAL NMI SC KEYBOARD OVERRUN ? NO, GO LOOK FOR FUNCTION KEY KEYBOARD OVERRUN DETECTED 06 00B5 R 0000 06 00B7 R 0000 26 00B4 R BF 050C R MOV MOV AND JMP B_PENDl,O ; RESET BREAK PENDING FLAGS B_PEND2,0 ; RESET BREAK PENDING FLAGS KB_NM LCNTL, NOT FUNCSTATE ; CLEAR FUNCTION STATE ; OVERRUN, GO WRITE PORT 60 XL T90 AH <=== BREAK BIT OF NMI SC DL <=== ORIGINAL NMI SC AL <=== NMI SC W/O BREAK BIT SCAN CODE TABLE - NMI TO PCl XLATE NMI SC TO PC! SC BASE KEY ONLY? NO, JUMP AROUND YES, JUMP TO BASE KEY PROCESS IF THIS IS THE FUNCTION KEY, SET/RESET FUNCTION STATE ROM BIOS 2-39 037C 037E 0380 0382 0384 0387 0389 038E 0391 0391 0396 AL,DL AL <=== ORIGINAL NMI SC XLTl9: MOV AND AL, NOT BREAI<-BIT AL <=== NMI SC W/O BREAK BIT AL,FN_KEY CMP FUNCTI ON KEY ? JNE XL T23 NO, GO PROCESS FUNCTION + KEYS TEST AH, BREAI<-BIT FUNCTI ON KEY MAKE ? JZ XLT20 JUMP IF MAKE AND KB_NMLCNTL,NOT FUNCSTATE ; BREAK, CLEAR FUNCTION STATE JMP XLT95 ; GO TO RETURN XLT20: 80 OE 00B4 R 40 OR KB_NMLCNTL,FUNCSTATE ; MAKE, SET FUNCTION STATE E9 051B R JMP XL T95 ; GO TO RETURN ; ... -- --- -- -- ---_ ... ------- --- -- -_ ... ---_ ... ... --_ ... ---- --- --- ---- ----_ ...... ---8A 24 3C 75 F6 74 80 E9 C2 7F 52 15 C4 80 08 26 00B4 R BF 051B R -_ FUNCTION + KEYS PROCESSING IF FUNCTION STATE IS ACTIVE SEARCH THE FUNCTION TABLE FOR A MATCH. I F THERE IS BREAK PENDING AND THIS KEY IS A BREAK KEY SEARCH THE FUNCTION TABLE FOR A MATCH. -_ 0399 0399 039E 03AO 03A5 03A7 03AA 03AC 03AC 03AF 03B2 03B2 03B5 03BA 038C 03BE 03CO 03C3 ; --- -- -_ ... -- -- -_ ...... -- ---- -- --- -- -- --_ ......... -- -- ----- -- -- -- -- -- ... --- -- --XL T23: F6 06 00B4 R 40 TEST KB_NMLCNTL,FUNCSTATE ; FUNCTION KEY STATE ? 75 OC JNZ XLT24 YES, GO SEARCH TABLE B_PEND2,O 83 3E 00B7 R 00 CMP BREAK PENDING? 74 IE JE XL T27 NO, GO CHECK FOR KEYPAD STATE F6 C4 80 TEST AH, BREAI<-BIT YES, TEST FOR BREAK KEY 74 19 JZ XL T27 MAKE KEY - GO CHK KEYPAD STATE XL T24: B9 0001 MOV CX ,OlH INIT KEYS BREAK PENDING FLAG BE 0000 E MOV SI,OFFSET KBFUNL TABLE LENGTH XL T25: 83 EE 02 SUB SI,2 SEARCH FUNCTION TABLE FOR MATCH 2E: 8B 9C 0000 E BX, KBFUN_TBL [SI] MOV BH <=== NMI SC ENTRY BL <=== P60 EXTENDED SC 3A C7 CMP AL,BH CHECK FOR MATCH 74 OA JE XL T28 JMP I F MATCH FOUND 01 E1 SHL ex ,I CX <=== SEARCH KEY BRK PEND FLAG 83 FE 00 CMP SI,O IS SEARCH COMPLETE ? 75 ED JNE XL T25 NO, GO CHECK NEXT ENTRY THIS KEY IS NOT A FUNCTION + KEY. 03C5 03C5 XLT27 : JMP E9 0463 R ; -- XLT40 ; GO TO KEYPAD SEARCH -_ ... -- -_ ...... --_ ...... -_ ... --- -_ ... -- -- -_ ... -_ ............ -- -_ ... -- -_ ......... -_ ... -- -- -- -- ...... ---- A MATCH HAS BEEN FOUND IN THE FUNCTION STATE TABLE. THE TABLE CONTAINS FOUR, FN + CURSOR KEYS; FN + Fl OR F2; AND FOUR, STATE TOGGLE KEYS. THE STATE, CURSOR, AND Fl, F2 KEYS ARE: STATE KEYS CURSOR, Fl, F2 KEYS FN FN FN FN + SCRL LOCK + CAPS LOCK + NUM LOCK + ESC = SPEAKER ON/OFF = CLICKER ON/OFF = KEYPAD ON/OFF = SYS REQ FN + FN + FN FN FN FN Fll Fl2 Fl F2 + + + + = HOME = PGUP = END ~ = PGON THE FUNCTION STATE TABLE MAPS FUNCTION + STATE KEYS TO A BIT. 01H 02H 04H 08H ; --- ... -- 03C8 03C8 03CB 03CD 0301 0303 F6 74 85 75 E9 C4 80 09 OE 00B7 R 03 0406 R THE FUNCTION STATE TABLE MAPS FUNCTION + CURSOR KEYS TO EXTENDED SCAN CODES. = SPEAKER ON/OFF = CLICKER ON/OFF = KEYPAD ON/OFF = SYS REQ -_ ...... -_ ......... -- --_ ... -- -- -_ ......... -- --_ ......... -- -_ XL T28: TEST JZ TEST JWZ JMP 2-40 ROM BIOS AH, BREAI<-BlT XL T28A CX, LPEND2 XL T28A XL T60 IT ALSO MAPS FUNCTION + F1, F2 TO EXTENDED SCAN CODES FOR Fll, F12. ... ----_ ...... -- -- ... ... --_ ...... -_ -_ _- PROCESSING BREAK SC? NO, JMP BREAK PENDING FOR THIS SPECIFIC SC YES, JMP TO RESET NO, PROCESS AS BASE KEY 0306 0306 0309 03DB 03DE 03EO 03E3 03E5 03E9 03EC 03EC 03FO 03F2 03F6 03F9 03FB 03FD 03FF 0401 0404 0404 0407 0409 040E 0411 0411 0415 0418 80 77 80 74 F6 74 31 E9 FB 08 57 FB 08 3B C4 80 OT OE 00B7 051B R 85 75 09 80 75 E4 34 E6 E9 OE 00B7 R 26 OE 00B7 R FB 01 09 61 04 61 051B R 80 75 80 E9 FB 02 08 36 00B4 R 08 051B R 30 1E 00B4 R E8 0524 R E9 051B R XLT28A: IS THIS A STATE CHANGE KEY? CMP BL,08H JUMP TO CUR KEYS I F NOT STATE CHG JA XLT36 SYSTEM REQUEST KEY ? CMP BL,08H YES, GO PROCESSES SYSTEM REQUEST XLT33 JE MAKE KEY? TEST AH, BREAILBIT YES, GO SET BREAK PENDING JZ XLT29 BREAK KEY - RES ET BRK PEND FLAG XOR LPEND2,CX GO TO RETURN JMP XLT95 XL T29: B_PEND2,CX IS BREAK ALREADY PENDING TEST TYPAMATIC INVALID FOR STATE KEY JNZ XLT32 B_PEND2,CX SET KEYS BREAK PENDING FLAG OR SPEAKER STATE KEY ? CMP BL,OlH NO, GO TEST FOR CLICK STATE JNE XLT30 READ SPEAKER CONTROL PORT IN AL,NMLCNTL AL,EN_SPKR TOGGLE ENABLE SPEAKER STATE XOR WRITE SPEAKER CONTROL PORT NMLCNTL,AL OUT JMP XLT95 GO TO RETURN XLT30: CMP BL,02H CLICK STATE KEY? XL T31 ; NO, GO TOGGLE KEYPAD STATE JNE KLNMLCNTL,CLICILON ; TOGGLE CLICK STATE XOR XL T95 GO TO RETURN JMP XLT31 : XOR KLNMLCNTL,BL TOGGLE KEYPAD STATE CALL NUILSTATE_FIX MAKE NUM_STATE RFCT KEYPAD_STATE XL T32: JMP XL T95 GO TO RETURN SYSTEM REQUEST KEY PROCESSING 041B 041B 041E 0420 0424 0426 0429 0429 0420 042F 0432 0432 0434 0437 F6 75 09 BO E9 C4 80 09 OE 00B7 R 54 050C R 31 OE 00B7 R BO 04 E9 050C R 8A C3 80 FB 57 73 15 XL T33: TEST JNZ OR MOV JMP XLT34: XOR MOV JMP AH, BREAILBIT XLT34 B_PEND2,CX AL, SYSREQ_MAKE XLT90 IS THIS A REQUEST KEY MAKE? NO, GO RESET BREAK PENDING FLAG YES, SET KEYS BREAK PENDING FLAG SET AL TO SYSTEM REQUEST MAKE GO WRITE TO PORT 60 B_PEND2,CX AL, SYSREQ_BREAK XLT90 BREAK KEY - RESET BRK PEND FLAG SET AL TO SYSTEM REQUEST BREAK GO WRITE TO PORT 60 IF HERE, MUST BE FN + CURSOR KEY, OR XL T36: MOV AL,BL BL,P60_FlLSC CMP JAE XLT38 FUNCTION + CURSOR KEYS 0439 043C 043E 0442 0444 0447 0447 044B F6 74 31 OC E9 C4 80 09 OE 00B7 R 80 04FB R 09 OE 00B7 R E9 04FB R TEST JZ XOR OR JMP XL T37: OR JMP FUNCTI ON + Fl FUNCTION + F2 044E 044E 0451 0453 0455 0459 045C 045C 0460 F6 74 OA 31 E9 C4 80 09 C4 OE 00B7 R 050C R 09 OE 00B7 E9 050C R XLT38: TEST JZ OR XOR JMP XL T38_1: OR JMP - FN + Fl, F2 , AL <=== PC1 EXTENDED SC FROM TBL ; FN + Fl, F2? ; YES, JUMP HOME, PGUP, END, PGDN AH,BREAILBIT XLT37 B_PEND2,CX AL,BREAILBIT XLT80 CURSOR KEY BREAK ? NO, GO SET BREAK PENDING FLAG BREAK KEY - RESET BREAK PEND FLAG SET BREAK IN PC1 SCAN CODE GO RESET PORT 60 KEYPAD STATE B_PEND2,CX XLT80 SET KEYS BREAK PENDING FLAG GO RESET PORT 60 KEYPAD STATE ( F11) (Fl2) P60-SC: Fll MAKE Fl2 MAKE = 57H = 58H Fll BREAK Fl2 BREAK = D7H = D8H AH, BREAILBIT XL T38_1 AL,AH B_PEND2,CX XLT90 MAKE KEY? YES, JUMP CHANGE TO BREAK SC BREAK KEY - RESET BREAK PEND FLAG WRITE TO P60 B_PEND2,CX XLT90 MAKE KEY - SET BREAK PEND FLAG WRITE TO P60 ROM BIOS 2-41 KEYPAD KEYS PROCESSING DETERMINE I F THE KEYPAD TABLE IS TO BE SEARCHED. THE KEYPAD TABLE SEARCH/NO SEARCH DECISION IS MADE USING THE FOLLOWING RULES: THE SEARCH IS ALWAYS MADE IF THERE ARE ANY BREAK PENDING FLAGS AND THIS KEY IS A BREAK KEY. THE FUNCTION AND KEYPAD STATES ARE MUTUALLY EXCLUSIVE. THE SEARCH IS PERFORMED IF EITHER STATE IS ACTIVE BUT NOT BOTH STATES ACTIVE. 0463 0463 0468 046A 046F 0471 0476 0478 0478 047D 047F 0482 0484 0484 0487 048A 048A 048D 0492 0494 0496 0498 049B F6 74 F6 74 F6 74 06 00B4 R 44 OE 06 00B4 R 40 13 06 00B4 R 04 OC XLT40 : TEST JZ TEST JZ TEST JZ KB_NMLCNTL, FUNCSTATE+KEYPAD_STATE XL T41 ; BOTH OFF - GO TEST BREAK PENDING KB_NMLCNTL, FUNCSTATE ; ONE OR BOTH ARE ON XLT42 ; OFF - ONLY ONE ON - GO SEARCH KB_NMLCNTL,KEYPAD_STATE ; ONE OR BOTH ARE ON XLT42 ; OFF - ONLY ONE ON - GO SEARCH BOTH FUNCSTATE & KEYPAD_STATE ARE OFF OR ON ..•. KEYPAD INACTIVE XL T41: CMP B_PEND1,O BREAK PENDING? JE XLT60 NO, SKIP KEYPAD SEARCH TEST AH,BREAILBIT YES, TEST FOR BREAK KEY JZ XLT60 MAKE KEY - SKI P KEYPAD SEARCH XLT42 : B9 0001 MOV CX,OOOlH CX <=== SEARCH KEY BRK PEND FLAG BE 0000 MOV SI,OFFSET KBPADL TABLE LENGTH XLT44 : 83 EE 02 SUB SEARCH KEYPAD TABLE FOR MATCH SI,2 2E: 8B 9C 0000 MOV BX, KBPAD_TBL [SI] GET TABLE ENTRY 3A C7 CMP AL, BH CHECK FOR MATCH 74 09 JE XL T50 JMP I F MATCH FOUND D1 E1 SHL CX ,I CX <=== SEARCH KEY BRK PEND FLAG 83 FE 00 CMP IS SEARCH COMPLETE ? SI,O 75 ED JNE XLT44 NO, GO CHECK NEXT ENTRY 83 74 F6 74 3E 00B5 R 00 57 C4 80 52 THIS KEY IS NOT A KEYPAD KEY. 049D EB 37 JMP SHORT XL T60 ; GO XLATE NORMAL A MATCH HAS BEEN FOUND IN THE KEYPAD TABLE. SET/RESET THE KEYS BREAK PENDING FLAG THEN WRITE TO PORT 60. SEND HIDDEN CODE FIRST FOR / OR 049F 049F 04A2 04A4 04A8 04AA 04AA 04AE 04BO 04B4 04B6 04B8 04BB 04BD 04CO F6 75 09 EB C4 80 06 OE 00B5 R OA 85 74 31 OA 8A 80 OE 00B5 26 OE 00B5 DC C3 FF 4B 72 05 A2 00B9 BO ED XLT50: TEST AH, BR EAILB IT JNZ XL T52 OR B_PEND1,CX JMP SHORT XL T54 XLT52: TEST CX, B_PEND1 JZ XLT60 XOR B_PEND1, CX XLT54: OR BL ,AH MOV AL,BL CMP BH,NMLSLASH_SC JB XLT56 MOV P60_HOLD_BYTE ,AL MOV AL, HI DN_CODLED *. BREAK KEY? YES, GO RESET BREAK PENDING SET KEYS BREAK PENDING FLAG BREAK PENDING FOR THIS SPECIFIC SC NO, JMP TO PROCESS AS BASE KEY RESET KEYS BREAK PENDING FLAG USE BREAK BIT FROM NMI SC AL <=== PCl EXTENDED SC FROM TBL / OR * ? NO, JUMP OUT QUEUE P60 SC SEND HIDDEN CODE TO P60 THE PORT 60 KEYPAD STATE IS SET OR RESET USING THE FOLLOWING RULES: THIS KEY HAS BEEN TRANSLATED ASSUMING THE KEYPAD STATE IS ACTIVE. A PORT 60 SHIFT STATE TEMPORARILY TOGGLES THE KEYPAD STATE. IF THE PORT 60 SHI FT STATE IS NOT SET THE P60 KEYPAD STATE IS SET AND THE PC1 KEYPAD SCAN CODE IS WRITTEN TO PORT 60. IF THE PORT 60 SHIFT STATE IS SET THE P60 KEYPAD STATE IS RESET (IT WILL REVERT TO THE SET STATE IN THE PORT 60 PROCESSING) AND THE PC1 SCAN CODE IS WRITTEN TO PORT 60. 04C2 04C2 80 OE 0017 R 20 XLT56: OR 2-42 ROM BIOS KB_FLAG,NUtLSTATE ; SET KEYPAD STATE 04C7 04CC 04CE 04D3 F6 74 80 EB 06 0017 R 03 3E 36 0017 R 20 37 90 TEST JZ XOR JMP KB_FLAG,LEFLSHIFT+RIGHLSHIFT ; PORT 60 SHIFT STATE ? XLT90 ; NO, GO WRITE TO PORT 60 KLFLAG,NUM_STATE ; RESET KEYPAD STATE XL T90 ; GO WRITE TO PORT 60 BASE KEYS PROCESSING SCAN CODE IS NOT IN SPECIAL TABLES. XLATE TO PCl SCAN CODES. AFTER TRANSLATION THE CURSOR, INSERT, AND DELETE KEYS ARE DETECTED AND ROUTED TO THE ROUTINE THAT GUARANTEES THE PORT 60 KEYPAD STATE IS INACTIVE. ALL OTHER KEYS ARE WRITTEN TO PORT 60. 04DC 04DE 04DE 04EO 04E2 04E4 ; ; NOT A FN+KEY OR KEYPAD KEY -- GET KEY'S P60 SC XLT60 : AL <=== NMI SC WIO BREAK BIT 8D IE 0000 E LEA BX,KBNMLTBL SCAN CODE TABLE - NMI TO PCl 2E: D7 XLAT KBNMLTBL XLATE NMI SCAN CD TO PCl SCAN CD AL <=== PCl SC FROM TBL 24 7F AND AL, 7 FH CLEAR TYPE BIT XL T60_l: 3C 48 CMP AL,48H CURSOR, INSERT, DELETE 73 17 JAE XLT65 YES, JUMP TO PROCESS THESE KEYS 3C 38 CMP ALT KEY? AL, P60-AL LSC 75 OC JNE XL T62 NO, JUMP AROUND 04E6 04E9 04EB 04ED 04FO F6 74 OA A2 BO 04F2 04F2 04F4 04F7 NOT CURSOR, INSERT, DELETE XL T62: OA C4 OR AL,AH NUM_STATE_FIX E8 0524 R CALL EB 13 JMP SHORT XL T90 04F9 04F9 OA C4 04D6 04D6 04DA AL T KEY C2 08 07 C4 00B9 EO TEST JZ OR MOV MOV DL,NMLUL LBIT3 XLT62 AL,AH P60_HOLD_BYTE ,AL AL,HIDNJODCEO CURSOR, INSERT, OR DELETE KEY XLT65 : OR AL,AH R-ALT KEY? NO, JUMP OUT USE NMI SC BREAK BIT QUEUE P60 AL T SC SEND HIDDEN CODE TO P60 USE NMI SC BREAK BIT MAKE NUM_STATE RLCT KEYPAD_STATE GO WRITE TO PORT 60 ; USE NMI SC BREAK BIT THE CURSOR, FUNCTION+CURSOR, INSERT, AND DELETE KEYS ARE NO LONGER IN THE KEYPAD AREA OF THE KEYBOARD. WHEN THEIR SCAN CODES ARE WRITTEN TO PORT 60, THE PORT 60 KEYPAD STATE MUST BE INACTIVE. A PORT 60 SHIFT STATE TEMPORARILY TOGGLES THE KEYPAD STATE. IF THE PORT 60 SHIFT STATE IS NOT SET THE P60 KEYPAD STATE IS RESET AND THE PCl SCAN CODE IS WRITTEN TO PORT 60. IF THE PORT 60 SHIFT STATE IS SET THE P60 KEYPAD STATE IS SET (IT WILL REVERT TO THE RESET STATE IN THE PORT 60 PROCESSING) AND THE PCl SCAN CODE IS WRITTEN TO PORT 60. 04FB 04FB 0500 0505 0507 80 F6 75 80 OE 0017 R 20 06 0017 R 03 05 36 0017 R 20 XLT80 : OR TEST JNZ XOR KB_FLAG,NUM_STATE ; SET P60 KEYPAD STATE KB_FLAG,LEFLSHIFT+RIGHLSHIFT ; PORT 60 SHIFT STATE ? XLT90 ; YES, GO WRITE TO PORT 60 KB_FLAG,NUM_STATE ; RESET P60 KEYPAD STATE THE PCl SCAN CODE IN AL IS WRITTEN TO PORT 60 050C 050C 050D 0512 0514 0519 05lB 05lB 0520 XL T90: FA 80 E6 80 EB CLI OE 00B4 R 80 60 26 00B4 R EF 08 80 26 0064 R EF E9 0319 R OR OUT AND JMP XLT95 : AND JMP ; DISABLE INTERRUPTS KB_NMLCNTL,P60_LOADED ; SET ON PORT 60 ACTIVE STATUS KLDATA,AL ; WRITE PCl SCAN CODE TO PORT 60 KB_NMLCNTL,NOT XLATE_BUSY RESET BUSY FLAG SHORT XL noo KB_NMLCNTL,NOT XLATE_BUSY ; RESET BUSY FLAG XL no ; REDRIVE XLATE ROUTINE ROM BIOS 2-43 IN QUEUE RETURN TO CALLER 0523 0523 C3 0524 XL noo: RET RETURN KYBD_XL T ENDP PROCEDURE END SUBROUTINE NUM_STATE_FIX THIS ROUTINE MAKES THE NUM_STATE FLAG REFLECT THE KEYPAD_STATE FLAG. INPUT: 0524 0524 0529 052E 0530 0535 0535 0536 80 F6 74 80 26 0017 R OF 06 00B4 R 04 05 OE 0017 R 20 NONE OUTPUT: NUM_STATE SET OR RESET NUM_STATLFIX PROC NEAR AND KB_FLAG,NOT NUM_STATE ; TURN OFF NUM_STATE TEST KB_NMLCNTL,KEYPAD_STATE; IS KEYPAD IN ACTIVE STATE? JZ NSF_RET ; NO, LEAVE NUM_STATE OFF OR KBJLAG,NUM_STATE; YES, TURN NUM_STATE ON NSF_RET: RET C3 NUM_STATE_FIX ENDP THIS ROUTINE IS ACTIVATED WHEN THE NMLFLIH DETECTES AN I/O CHECK IT CAUSES A PARITY CHECK ICON TO BE DISPLAYED ON THE ACTIVE DISPLAY AFTER THE DISPLAY SCREEN IS CLEARED. SUSPEND IS DISABLED AND THE KEYBOARD IS WAITING FOR A FUNCTION CONTROL DELETE KEY SEQUENCE. 0536 0536 0538 053B 0530 053F 0542 0543 0544 0547 0549 054B 0540 0540 054F B4 AO CD 2B BD OE 07 E8 E4 24 E6 00 0049 R 10 02 0000 0000 7F F3 7F E4 70 EB FC CHAN_CHK PROC NEAR INIT AND SET MODE FOR VIDEO MOV AH,O MOV AL, CRLMODE CALL VI DEO_JO PROCEDURE INT lOH SUB DX,DX SET ROW/COLUMN FOR ICON MOV BP ,OFFSET PAR_CHK GET ADDRESS OF PARITY CHECK PUSH CS POP ES ES:BP CONTAIN ICON ADDRESS CALL ICON_PR DISPLAY CHECK ICON IN AL,PWILSTAT ; DISABLE SUSPEND NMI AND AL,NOT EN_SUS_NMI+HDWR_RESET ; OUT PWR_STAT ,AL CHAN_STOP: IN AL,7DH KEEP READING KEYBOARD JMP SHORT CHAN_STOP FOR RESET SEQUENCE 0551 Real-Time Clock NMI (RTC_ALARM_NMI) ; *************************************************************** RTCALARM_NMI -- REAL TIME CLOCK INTERRUPT HANDLER THIS ROUTINE HANDLES THE PERIODIC AND ALARM INTERRUPTS FROM THE NON-VOLATILE TIMER. INPUT FREQUENCY IS 1.024 KHZ OR APPROXIMATELY 1024 INTERRUPTS EVERY SECOND FOR THE PERIODIC INTERRUPT. FOR THE ALARM FUNCTION, AN INTERRUPT WILL OCCUR AT THE DESIGNATED TIME. 2-44 ROM BIOS THE INTERRUPT IS ENABLED ONLY WHEN EVENT OR ALARM FUNCTIONS ARE ACTIVE OR WHEN SYSTEM IS SLEEPING. FOR THE EVENT INTERRUPT, THE HANDLER WILL DECREMENT THE WAIT COUNTER AND WHEN IT EXPIRES WILL TURN ON THE HIGH ORDER BIT OF THE DESIGNATED FLAG. FOR THE ALARM INTERRUPT, THE USER ROUTINE WILL BE INVOKED ON THE NEXT TIMER 0 INTERRUPT THROUGH INT 4AH. ON ENTRY THE BP REGISTER POINTS TO THE LAST STACK POSITION 0551 0551 0553 0556 0558 055A 0550 055F 0560 0562 B4 E8 8A FE E8 22 50 A8 74 RTUILARM_NMI PROC MOV AH, RTCMODE CALL GELRTCNMI MOV BH,AL INC AH CALL GELRTCNMI AND AL, BH PUSH AX TEST AL,PLINT JZ RTCINL9 OB 0747 F8 C4 0747 C7 40 25 NEAR GET INTERRUPT MODE REGISTER SAVE MODE GET INTERRUPT STATUS REGISTER MASK SOURCE WITH ENABLES SAVE INTERRUPT CONDITIONS CHECK FOR PERIODIC INTERRUPT NO - GO AROUND PERIODIC INTERRUPT HAS BEEN RECEIVED 0564 056A 056C 0571 81 73 83 73 2E 00ge R 0300 10 IE 009E R 00 16 0573 0575 0578 057A B4 E8 24 E8 OB 0747 R BF 0750 0570 0582 0586 80 26 OOAO R FE C5 3E 0098 R C6 05 80 0589 0589 058A 058C 58 A8 20 74 05 SUB JNC SBB JAE RTCLOW,0976 RTCINL9 RTCHIGH,O RTC_INL9 DECREMENT ELAPSED TIME COUNT SKIP HIGH BYTE WAIT TELL ROLLS FROM 0 USERS ELAPSED TIME EVENT HAS OCCURRED MOV CALL AND CALL AH,RTCMODE GELRTCNMI AL, NOT PI E_ENABLE PULRTCNMI GET INTERRUPT MODE CONTROL RESET PERIODIC INTERRUPT CLEAR EVENLWAIT ACTIVE FLAG AND SET USERS EVENT COMPLETE FLAG RTCWAILFLAG,NOT INTERVALWAIT ; RESET INT WAIT FLAG DI,DWORD PTR USEILFLAG ; OS: 01 <-- USERSJLAG ADDRESS BYTE PTR [01], POSTED SET US ERS FLAG RTCINL9: POP AX AL ,AL_INT TEST JZ RTCINLI0 , 058E AND LOS MOV RETRIEVE INTERRUPT SOURCE TEST FOR ALARM INTERRUPT NO - GO AROUND RTC ALARM TIME HAS BEEN REACHED - SET BIOS_STATUS FLAG TO ALARM_PEND THIS WILL CAUSE AN INT 4AH TO BE EXECUTED ON THE NEXT TIMERO INTERRUPT 80 OE OOAO R 02 OR RTCWAILFLAG,ALAR~PEND ; SET INT 4AH CALL PENDING CHECK FOR UPDATE IN PROGRESS INTERRUPT (EVERY 1 SECOND) 0593 0593 A8 10 RTCINLI0: TEST AL,UE_INT JFZ RTCINL14 $+5 JNZ JMP RTCINL14 0595 0597 75 03 E9 0647 R 059A E8 064A R CALL LOW_BALCHK 0590 059F E4 7F A8 40 05Al 05A3 74 03 E9 0647 IN TEST JFNZ JZ JMP AL,PWR_STAT AL, EXLPWR RTCINL14 $+5 RTCINL14 ; UPDATE ENDED INTERRUPT? ; JUMP IF NOT ; I F NOT ZERO JUMP AROUND JUMP ; ELSE TAKE A LONG JUMP CHECK AND DISPLAY LOW BATTERY MESSAGE I F NECESSARY GET POWER STATUS ARE WE ON EXTERNAL PWR? JUMP I F SO ; I F NOT NOT ZERO JUMP AROUND JUMP ; ELSE TAKE A LONG JUMP ROM BIOS 2-45 05A6 05AB F6 06 0016 R 20 74 1A 05AD 05B2 05B3 05B4 05B7 05B9 80 IE 07 BF B4 B9 05BC 05BC 05BF 05CO 05C2 05C4 E8 AA FE E2 E9 TEST JZ , BIOS_STATUS,KYBD--ACTIVE ; HAS KEYBOARD BEEN ACTIVE? RTCINL12 ; JUMP I F KEYBOARD NOT ACTIVE ; RELOAD INACTIVITY COUNTS FROM RTC RAM TO SYSTEM RAM , 26 0016 R OF AND PUSH POP MOV MOV MOV 0067 R 19 0004 BIOS_STATUS,NOT KYBD--ACTIVE ; RESET KBD ACTIVE FLAG OS ; SET ES TO DATA ES DI,OFFSET DSP_BLANICCTR AH, RTCLCD_INACT ; START WITH LCD INACTIVITY COUNT CX,4 ; TRANSFER 4 BYTES RTCINL11: CALL GELRTCNMI STOSB INC AH LOOP RTCINL11 JMP RTCINL14 0747 C4 F8 0647 STORE IN COUNTER SAVE AREA GET NEXT BYTE EXIT LEVEL CHECK FOR DISKETTE MOTORS ON AND IF SO THEN RELOAD COUNT 05C7 05C7 05CA 05CB 05CD BA 03F7 EC A8 78 74 07 05CF 0504 80 OE 0016 R 20 EB 71 RTCINL12: MOV DX,DRIVE_SENSE ; CHECK DISKETTE MOTOR STATUS IN AL,DX ; TEST AL, DRO_SELSENSE+DRLSEL_SENSE+DRO_MOT_SENSE +DRLMOT_SENSE JZ RTCINL1L1 ; JUMP IF NOT OR JMP BIOS_STATUS,KYBD--ACTIVE ; CAUSE RELOAD OF COUNTERS SHORT RTCINL14 ; EXIT CHECK DISPLAY BLANK COUNT 0506 0506 05DB 83 3E 0067 R 00 74 06 0500 05El FF OE 0067 74 36 RTCINL1L1: CMP DSP_BLANK_CTR, 0 JE RTCINL13 DEC JZ DSP_BLANK_CTR DSP_BLANK CHECK SYSTEM POWER OFF COUNT 05E3 05E3 05E8 05EA 05EE 05FO 05F5 83 74 FF 74 83 75 3E 0069 R 00 50 OE 0069 46 3E 0069 IE 50 05F7 05FA 05FD 0600 0603 0606 0609 060B 060E 0611 0614 0617 E8 E8 BB B9 E8 B9 E2 BB B9 E8 E8 EB ; 076E R 0759 R 003C 0081 0000 050A FE 0030 00A1 0000 0762 2E RTCINL13: CMP SYS_OFFJTR,O JE RTCINL14 SYS_OFF_CTR DEC JZ DEACLSYSTEM CMP SYS_OFF_CTR,30 JNE RTCINL14 AT THE 30 SECOND MARK? NO THEN EX IT 30 SECONDS TO POWER OFF SO RING ALARM CALL CALL MOV MOV CALL MOV LOOP MOV MOV CALL CALL JMP NMLCYCLE SPKR_ON BX,60 CX,129 KB_NOISE CX,5*MS_DELAY CYCLE NMI AND RESTORE INT FLAGS TURN ON SPEAKER TONE LENGTH (60 MSECS) 1/2 CYCLE FREQUENCY FOR 1KHZ TONE SOUND BEEPER DELAY BETWEEN SOUNDS $ BX,48 CX,161 KB_NOISE SPKR_RESTORE SHORT RTCINL14 TONE LENGTH (60 MSECS) 1/2 CYCLE FREQ FOR 800 HZ TONE SOUND BEEPER RESTORE SPEAKER STATE EXIT LCD/CRT MUST BE BLANKED 0619 0619 061B 0610 061F 0621 BO E6 E4 24 E6 00 74 75 BF 75 DSP _BLANK: MOV OUT IN AND OUT 2-46 ROM BIOS AL,O LCD_INDX,AL AL,LCD_DATA AL, NOT PANEL_ENABLE LCD_DATA,AL TURN OFF PANEL 0623 0626 0629 062B 0620 062F 0634 E8 B9 E2 24 E6 80 EB 076E R 64C8 FE OF 75 OE 0016 R 80 11 CALL MOV LOOP AND OUT OR JMP NMLCYCLE CYCLE NMI , RESTORE INT FLAGS CX,100*MS_DELAY $ AL, NOT SYNCENABLE TURN OFF SYNCS FOR POWER LCD_DATA,AL , BIOS_STATUS,DSP_BLANKED ; SET DISPLAY BLANKED STATUS SHORT RTCINL14 ; EXIT TURN OFF SYSTEM 0636 0636 063B 0630 063F 0641 0643 0645 80 E4 24 OC E6 OC E6 OE 0016 R 40 7F F7 04 7F 02 7F DEACLSYSTEM: OR BIOS_STATUS,F_RESUME ; INDICATE FORCED RESUME MODE IN AL,PWILSTAT GET POWER STAT/CNTL REG AND AL, NOT HDWR_RESET TURN OFF RESET FLAG OR AL, EN_SUS_NMI ENABLE SYSTEM SUSPEND NMI OUT PWILSTAT ,AL OR AL, REQ_POFF REQUEST POWER OFF OUT PWR_STAT ,AL EXIT FROM RTC INTERRUPT 0647 0647 RTCINLI4: JMP NMIH_EXIT E9 0050 R 064A RTCALARM_NMI RETURN TO FIRST LEVEL HANDLER ENDP Low Battery Check (LOW_BAT_CHK) ; ************************************************************************** LOW BATTERY CHECK THIS ROUTINE CHECKS FOR A LOW BATTERY CONDITION AND IF DETECTED WILL ISSUE A WARNING. THE LOW BATTERY WARNING WILL OCCUR AFTER TWO CONSECUTIVE LOW BATTERY SENSES, NO EXTERNAL POWER SUPPLIED AND THE LOW BATTERY WARNING FLAG IS ENABLED IN SYSTEM PROFILE. THE WARNING ISSUED WILL SOUND THREE SHORT BEEPS, FLASH THE SCREEN ON AND OFF AT AN ONE SECOND INTERVAL AND EXECUTE A PAUSE. THE PAUSE WILL HOLD UP ALL MAIN LEVEL PROCESSING AND LOCK OUT NON- I NTERRUPT DR I VEN PROCESS I NG. ONCE TH E USER ACKNOWLEDGES THE WARNING, EITHER BY PRESSING A KEY OR APPLYING EXTERNAL POWER, THE SCREEN FLASHING WILL STOP AND MAIN LEVEL PROCESSING WILL CONTINUE. AT SUCCESSIVE TWO MINUTE INTERVALS, THE LOW BATTERY WARNING WILL BE REISSUED IF THE LOW BATTERY CONDITION STILL EXISTS OR EXTERNAL POWER HAS NOT BEEN APPLIED. IF TWO MINUTES HAVE ELAPSED AND THE WARNING HAS NOT BEEN ACKNOWLEDGED, THE APPLICATION WILL BE SUSPENDED AND THE SYSTEM POWERED OFF. THIS ROUTINE IS CALLED BY THE RTCALAR~NMI ROUTINE EVERY ONE SECOND TO CHECK ON THE BATTERY CONDITION. IF LOW BATTERY IS DETECTED, THIS ROUTINE WILL CALL WAIT ON EXTERNAL EVENT. THIS WILL ALLOW THE SYSTEM TO SLEEP WHILE WAITING FOR A KEY TO BE PRESSED. WHILE WAITING, THE ONE SECOND INTERRUPT CAN OCCUR AGAIN CAUSING THE LOW BATTERY CHECK ROUTINE TO BE CALLED AGAIN. SO THIS ROUTINE IS RECURSIVE. LOW BATTERY CHECK IS DISABLED DURING POST ; ****************************************************************************** 064A 064A F6 06 0012 R 01 064F 0651 0654 0656 0658 065A 065C 065E 0660 74 E9 E4 A8 74 A8 75 B4 E8 03 0746 R 7F 80 lC 40 18 17 0747 LOW_BALCHK PROC NEAR TEST POSLSTATUS, POSLACTIVE ; IS POST CURRENTLY ACTIVE? J FNZ LOWBEND YES, JUMP TO END JZ $+5 IF NOT NOT ZERO JUMP AROUND JUMP JMP LOWBEND ELSE TAKE A LONG JUMP IN AL,PWR_STAT GET POWER INTERFACE TEST AL,LOW_BAT LOW BATTERY SIGNAL ON? JZ LO NO LOW BATTERY SIGNAL - JUMP TO END TEST AL, EXLPWR I S EXTERNAL POWER SUPPLI ED? JNZ LO YES EXTERNAL POWER - JUMP TO END MOV AH,RTCSYS_PROFI CALL GELRTCNMI GET SYSTEM PROFILE ROM BIOS 2-47 0663 0665 0667 066C 066E 0673 0676 A8 74 F6 75 80 E9 40 OF 06 0015 R 20 23 OE 0015 R 20 0746 R 0676 067B 0670 0682 0685 F6 75 80 E9 0685 0687 A8 40 74 08 TEST JZ TEST JNZ OR JMP AL, LOWBALENABLE ; LOW BATTERY MESSAGE WANTED LO ; NO MESSAGE WANTED - JUMP TO END BALSTATUS,LOW_BALPEND ; FIRST LOW BAT SIGNAL? Ll ; NO, ALREADY 2 CONSECUTIVE SIGNALS BALSTATUS,LOW_BALPEND ; YES, SET WAITING FOR 2ND SIG LOWBEND ; EXIT LO: BATTERY NOT LOW OR EXTERNAL POWER IS APPLIED 06 0015 R 80 08 26 0015 R OF 0746 R TEST JNZ AND JMP LO--A : BALSTATUS,LOW_BALSIG ; WAS LOW BTRY ALREADY SIGNALLED LO--A ; YES, JUMP BALSTATUS,NOT LOW_BALPEND ; TURN OFF LOW BTRY PENDING LOWBEND ; JUMP TO EX IT LOW BATTERY HAS BEEN SIGNALLED. IF EXTERNAL PWR APPLIED RESET THE WARNING. TEST JZ AL, EXLPWR Ll ; IS EXTERANL POWER APPLI ED? ; NO, JUMP TO WARNING BATTERY WAS LOW BUT EXTERNAL POWER APPLIED. TURN OFF WAITING FOR KEY AND LOW BATTERY WARNING SIGNALED FLAGS. JUMP TO TURN ON PANEL POWER. 0689 068E 80 26 0015 R IF E9 073C R AND JMP BALSTATUS, NOT LOW_BAT_SI G+LOW_BAT_HOLD+LOW_BAT _PEND; L_PANEL_ON ; ENABLE PANEL BEFORE EXITING BATTERY IS LOW WITH NO EXTERNAL POWER AND WARNING ENABLED Ll: 0691 0691 0696 F6 06 0015 R 80 74 2B 0698 0690 F6 06 0015 R 40 74 OC TEST JZ BALSTATUS,LOW_BALSIG ; LOW BTRY ALREADY SIGNALLED? NO, GO SIGNAL LOW BATTERY L3 LOW BATTERY HAS ALREADY BEEN SIGNALLED TEST JZ BALSTATUS,LOW_BALHOLD ; ARE WE IN HOLD STATE ? L2 ; NO, JUMP AROUND SCREEN TOGGLING TOGGLE SCREEN ON AND OFF WHILE WAITING FOR A KEY TO BE PRESSED(HOLD STATE). 069F 06Al 06A3 06A5 06A7 06A9 BO E6 E4 34 OC E6 00 74 75 40 20 75 MOV OUT IN XOR OR OUT AL,LCD_FUNCT LCD_INDX ,AL AL,LCD_DATA AL, PANEL_ENABLE AL, SYNCENABLE LCD_DATA,AL DECREMENT 2 MINUTE COUNTER. IF COUNTER WARN I NG AGAI N I F KEY HAS BEEN PRESSED. BEEN PRESSED, TURN OFF WAITING FOR KEY FOR KEY LOOP TO BE EXITED AND THEN SET 06AB 06AB FE OE 0093 06AF 06Bl 06B4 06B9 06BB 06CO 74 E9 F6 74 80 E9 ACCESS LCDC CONTROL REGISTER READ LCDC CONTROL REGISTER TOGGLE PANEL ON AND OFF FORCE SYNCS ON ISSUE LCDC CONTROL REG COMMAND GOES TO 0 SIGNAL LOW BATTERY I F COUNTER = 0 AND A KEY HAS NOT FLAG. THIS WILL CAUSE THE WAITING UP THE SYSTEM TO SUSPEND. L2: DEC JFNZ JZ JMP TEST JZ AND JMP 03 0746 R 06 0015 R 40 08 26 0015 R 3F 0746 R LOW_BALCTR COUNT DOWN 2 MINUTE COUNTER LOWBEND NOT 0, SO EXIT I F NOT NOT ZERO JUMP AROUND JUMP $+5 LOWBEND ; ELSE TAKE A LONG JUMP BALSTATUS,LOW_BALHOLD ; HAS KEY BEEN PRESSED? L3 ; YES, SIGNAL WARNING AGAIN BALSTATUS,NOT LOW_BALSIG + LOW_BALHOLD ; NO KEY, LOWBEND ; TURN OFF FLAG AND EXIT SIGNAL LOW BATTERY WARNING CHECK FOR ANY INTERRUPTS IN SERVICE BEFORE SIGNALING LOW BATTERY 06C3 06C3 06C5 06C7 06C9 06C8 L3: BO E6 E4 OA 74 OB 20 20 CO 06 2-48 ROM BIOS MOV OUT IN OR JZ AL,OBH INTAOO,AL AL,INTAOO AL,AL L4 GET INTERRUPT IN SERVICE REG INTERRUPT CONTROLL ER PORT READ INTERRUPT IN SERVICE REG ANY INTERRUPTS IN SERVICE IF ZERO - NONE IN SERVICE 06CD 0601 FE 06 0093 R EB 73 INC JMP LOW_BALCTR SHORT LOWBEND ; NO INTERRUPTS IN SERVICE. ; PROCESS INTERRUPT SIGNAL LOW BATTERY. 0603 0603 L4: 80 OE 0015 R 80 OR BALSTATUS,LOW_BALSIG ; SET LOW BTRY SGNL FLAG ON 0608 E8 076E R CALL NMLCYCLE ; CYCLE NMI AND RESTORE INT FLAGS SOUND THE 3 BEEPS 06DB 06EO 06E3 06E6 06E9 06E9 06EA 06ED C6 B9 E8 BB 06FO 06F2 06F4 06F5 06F7 06FA 06FC 06FE 0700 2B E2 59 E2 E8 E4 24 E6 80 06 009 R 78 0003 0759 R OODF 51 B9 0090 E8 0000 MOV LOW_BALCTR,120 MOV CX,3 CALL SPKR_ON MOV BX,223 LOW_BEEP_LOOP: PUSH CX MOV CX,144 CALL KB_NOISE C9 FE F2 0762 61 F7 61 OE 001 SUB LOOP POP LOOP CALL IN AND OUT OR R 40 SET 2 MINUTE COUNTER 3 BEEPS - LOOP COUNT FORCE SPEAKER ON SHORT BEEP (.25 SECONDS) SAVE LOOP COUNT 1/2 CYCLE FOR 890 HZ TONE SOUND SPEAKER CX,CX $ 250 MS OELAY BETWEEN BEEPS CX RESTORE LOOP COUNT LOW_BEEP _LOOP SPKR_RESTORE RESTORE SPEAKER ENABLE AL,NMLCNTL AL,NOT DISJ.LARM RE-ENABLE ALARM NMI NMLCNTL,AL BALSTATUS,LOW_BALHOLD ; SET BIT FOR WAITING FOR KEY THIS LOOP WAITS FOR A KEY TO BE PRESSED. WHILE WAITING THE SYSTEM SLEEPS. ALSO, WHILE WAITING IN THIS LOOP, THE INTERRUPTS WILL BE PROCESSED. THE UPDATE ENDED INTERRUPT WHICH CALLS THE LOW BATTERY ROUTINE WILL INTERRUPT OUT EVERY SECOND. TO EXIT THIS LOOP, EITHER A KEY IS PRESSED, EXTERNAL POWER IS APPLIED OR THE TWO MINUTE COUNTER GOES TO O. BY APPLYING EXTERNAL POWER (SEE LOJ.) OR BY THE TWO MINUTE COUNTER GOING TO 0 (SEE L2) WILL FORCE OFF THE WAITING FOR KEY FLAG. IF THE TWO MINUTE COUNTER GOES TO 0, THE SYSTEM WILL SET UP TO SUSPENO. 0705 ; LOOP UNTIL KEY PRESSED 0705 0708 070B 070C 0700 0710 B8 BB 1E 07 BF CD 4104 4000 0712 0717 0719 071B 071B 0720 0722 0725 0727 F6 06 0015 R 40 74 02 EB EA 0015 R 15 MOV MOV PUSH POP MOV INT AX,4104H ; FUNCTION 41H, AL=04=RETURN IF ZERO BX, LOW_BALHOLD*100H ; BH=LOW_BALHOLD, BL=O=NO TIME OUT OS ; MAKE ES:DI POINT TO BALSTATUS ES , DI,OFFSET BALSTATUS ; 15H ; SLEEP UNTI L KEY HIT TEST JZ JMP BALSTATUS,LOW_BALHOLD ; BIT IS OFF IF KEY WAS PRESSED L5 KEY PRESSED EXIT LOOP LOW_KB_LOOP KEEP LOOPING CMP JNE MOV SUB OUT LOW_BALCTR,O L6 DX,ORIVE_CNTL AL,AL DX,AL L5: 80 75 BA 2A EE 3E 0093 R 00 12 03F2 CO CTR = 0 FORCE SUSPEND SET UP NO, JUMP ON TURN OFF DISKETTE MOTORS THESE VARIABLES ARE INITIALIZED TO VALUES THAT CAUSES THE SYSTEM TO TURN OFF WHEN RETURNING TO CALLER(RTCJ.LARM_NMI). 0728 072E 0734 0734 0737 073C 073C 073E 0740 0742 C7 06 0067 R 0000 C7 06 0069 R 0001 MOV MOV DSP_BLANK_CTR,O SYS_OFF_CTR,1 CALL AND KEY PRESSED OR CTR=1 DISABLE_NMI ; DISABLE NMI BALSTATUS,NOT LOW_BALPEND ; TURN OFF LOW BAT PEND FLAG L6: E8 0000 E 80 26 0015 R OF BO E6 E4 OC 00 74 75 60 L_PANEL_ON: TURN PANEL ON BEFORE EXITING MOV AL, LCDJUNCT OUT LCD_INDX,AL ACCESS LCDC CONTROL REGISTER IN AL,LCD_DATA ; READ LCDC CONTROL REGISTER OR AL,PANEL_ENABLE+SYNCENABLE ; FORCE PANEL ON ROM BIOS 2-49 0744 0746 0746 0747 E6 75 OUT LCD_DATA,AL LOW BEND : RET LOW_BALCHK ENDP C3 ISSUE LCDC CONTROL REG COMMAND RETURN TO CALLER ; ***************************************************** ; GET RTC REGISTER WHEN ON NMI LEVEL ; INPUT AH= REGISTER # OUTPUT AL = REGISTER DATA 0747 0747 0749 074B 074D 074F 0750 ; ***************************************************** 86 E6 86 E4 C3 GELRTCNMI PROC NEAR XCHG AH,AL OUT RTCR_PORT ,AL XCHG AL ,AH IN AL, RTCD_PORT RET GELRTCNMI ENDP EO 70 C4 71 OUTPUT REGISTER # GET DATA ; ***************************************************** ; PUT RTC REGISTER WHEN ON NMI LEVEL ; INPUT AH= REGISTER #, AL = REGISTER DATA OUTPUT: RTC RAM MODIFIED 0750 0750 0752 0754 0756 0758 0759 ; ***************************************************** 86 E6 86 E6 C3 PULRTCNMI PROC NEAR XCHG AH ,AL OUT RTCR_PORT ,AL XCHG AL ,AH OUT RTCD_PORT, AL RET PULRTCNMI ENDP EO 70 C4 71 ; ********************************** ; FORCE SPEAKER ENABLE ON ; ON EXIT AH HAS OLD SPEAKER CONDITION 0759 0759 075B 075D 075F 0761 0762 ; ********************************** E4 8A OC E6 C3 SPKR_ON PROC NEAR IN AL,NMLCNTL MOV AH,AL OR AL, EN_SPKR OUT NMLCNTL,AL RET SPKR_ON ENDP 61 EO 04 61 FORCE SPEAKER ON ; ********************************** ; RESTORE SPEAKER TO PREVIOUS STATE ; ON INPUT AH HAS OLD SPEAKER CONDITION 0762 0762 0765 0767 0769 076B 076D 076E ; ********************************** 80 E4 24 OA E6 C3 SPKfLRESTORE PROC NEAR AND AH, EN_SPKR IN AL,NMLCNTL AND AL, NOT EN_SPKR OR AL,AH OUT NMLCNTL,AL RET SPKR_RESTORE ENDP E4 04 61 FB C4 61 RESTORE SPEAKER CONTROL ; ******************************************* NMLCYCLE: THIS CODE DISABLES AND RE-ENABLES THE NMI BEFORE RESTORING THE INTERRUPT FLAGS TO THEIR PREVIOUS STATE. , ALL REGISTERS PRESERVED EXCEPT FLAGS 076E 076E 076F 0771 0773 0775 0777 077C 077E 077F 077F 0781 0782 0783 ; ******************************************** 50 BO E6 EB OC F7 74 FB 07 72 00 20 46 16 0200 01 E6 72 58 C3 NMLCYCLE PROC NEAR PUSH AX ; MOV AL, DI SA BL CSL EEP+CLOCICRUN DISABLE GLOBAL NMI OUT CLOCICCTL ,AL JMP $+2 DELAY OR AL, GLOBAL_NMI RE-ENABLE NMI' S TEST FLGSAVE [BP], LFLAG CHECK FOR INTERRUPTS ON JZ NMLCI I F NOT THEN DON'T ENABLE STI ALLOW I NTERRUPTS AFTER NMLCI : OUT CLOCICCTL ,AL ENABLE NMI INSTRUCTION POP AX RET NMLCYCLE ENDP 2-50 ROM BIOS INCLUDE SUSPEND. INC SUBTTL SUSPEND SYSTEM STATE ; ************************************************************************** SUSPEND THIS ROUTINE IS ACTIVATED WHEN THE NMLFLIH DETECTES A SYSTEM SUSPEND NMI. , DATE LAST MODIFIED: 09/12/85 ; ************************************************************************** ; ************************************************************************** ;LOCAL EQUATES ; ************************************************************************** PUBLIC EXTRN EXTRN RESUME COM....POWER: NEAR MODEM_CONFIG:NEAR SUSPEND_COLOR SUSPENDJ10NO INILDISP B9CO BICO 0030 EQU EQU EQU OB9COH OBICOH 30H SUSPEND SAVE AREA IN FONT SAVE FOR WHEN IN MONO INITIAL VIDEO BITS OF EQUIP_FLAG TABLE OF LCD REGISTER ADDRESSES THAT MUST BE SAVED AND RESTORED 0783 0783 078C 010609 OA OB OC 00 OE OF 12 1415 16 17 18 19 lA IB lC 10 = 0014 LCDILTABLE LABEL BYTE DB 1,6,9,OAH,OBH,OCH,ODH,OEH,OFH DB 12H,14H,15H,16H,17H,18H,19H,IAH,IBH,ICH,IDH LCDILLENGTH ASSUME EQU $-LCDIL TABLE OS: DATA Suspend NMI (SUSPEND) 0797 0797 0790 07Al 07A4 07A5 07A7 07A9 07AB 07AD 07AF 07Bl 07B3 C7 8B 83 EC 8A BO E6 E4 8A 24 E6 2A 06 0072 R 0000 16 0063 R C2 04 E8 00 74 75 F8 BF 75 DB SUSPEND PROC NEAR MOV RESELFLAG,O MOV OX ,ADD1L6845 ADD DX,4 IN AL,DX MOV CH,AL AL, LCD_FUNCT MOV OUT LCD_INDX,AL IN AL,LCD_DATA MOV BH,AL AND AL,NOT PANELENABLE LCD_DATA,AL OUT SUB BL, BL CLEAR RESELFLAG OFFSET TO DISPLAY MODE ADDRESS GET CURRENT MODE (LCD ONLY) CH <-- CURRENT DISPLAY MODE SELECT LCD CONTROL REGISTER BH <--- CURRENT LCD CONTROL TURN OFF LCD PANEL BL <--- SUSPEND ERROR FLAGS TEST FOR LCD OPERABLE I. E. CAN BE USED AS ACTIVE OR ALTERNATE DISPLAY 07B5 07B7 07BA 07BC 07BF 07Cl 07C4 07C7 07CA B4 E8 8A F6 75 BA BF F6 75 20 0747 C8 Cl 01 15 03B4 BICO Cl 02 10 MOV CALL MOV TEST JNZ MOV MOV TEST JNZ AH, RTCDSP _CON GELRTCNMI CL,AL CL, DSP_CLCD SUS_OOO OX, MONO_CNTL-4 01 ,SUSPEND_MONO CL, DSPJ1LCD SUS_OOI GET LCD CONFIG FLAG AL, DSPJ10NO+DSP _CGA AL, DSP _MONO+DSP _CGA SUS_002 SAVE ONLY OTHER DISPLAY INFO ARE BOTH DISPLAYS ATTACHED? IS SO THEN CANNOT SUSPEND CL <--- RTCDSP _CON FLAGS TEST LCD STATE JUMP IF LCD IS CGA ASSUME LCD I S MONO 01 <-- SAVE AREA SEGMENT TEST LCD STATE JUMP I F LCD I S MONO LCD NOT ACTIVE OlCC 07CE 0700 24 OC 3C OC 74 33 AND CMP JE ROM BIOS 2-51 0702 0704 A8 04 75 06 TEST JNZ AL,DSP_CGA SUS_OOI ; CGA DISPLAY ONLY? ; IF YES LEAVE LCD AS MONO MONO DISPLAY OR LCD AS CGA SO SET CGA ACCESS 0706 0706 0709 BA 0304 BF B9CO SUS_OOO: MOV MOV DX, CGA_CNTL-4 01 ,SUSPEND_COLOR 01 07DC 07DC 07EO 39 16 0063 R 74 25 SUS_OOI : CMP JE ADDfL6845, OX SUS_003 IS LCD THE ACTIVE DISPLAY? I F SO THEN OKAY 07E2 07E6 07E8 07EB 07EO 8A B4 E8 8B A8 CH <--- MODE SET FOR CRT GET DISPLAY STATUS CALL MOV TEST CH,CRLMODLSET AH,RTCDSP_STAT GELRTCNMI SI,AX AL, DIAG_FORCE_SUS 07EF 74 14 JZ SUS_002 2E 0065 22 0747 R FO 80 MOV MOV <-- SAVE AREA SEGMENT SI LOW <--- RTCDSP_STAT CHECK RTCDSP _STAT FLAGS FOR DIAG RESUME I F NOT THEN SUSPEND ERROR SETUP LCD CONTROLLER FOR ACCESS 07Fl 07F4 F6 C7 08 75 11 07F6 07F8 OlFC 07FE BO 81 74 OC 0800 0800 0802 E6 75 EB 03 90 TEST JNZ BH, LCD_ENAB SUS_003 ; CHECK FOR LCD ENABLED I F SO THEN ALREADY ACCESSED LCD NOT ACTIVE SO SET ACTIVE FOR ACCESS MOV 08 FF BICO 02 02 CMP JE OR SUS_OOlA: OUT JMP AL, LCD_ENAB 01 ,SUSPEND~ONO SUS_OOlA AL,LCD_CGA SET ENABLE CHECK FOR LCD AS MONO JUMP IF SO OTHERWISE SET LCD AS CGA LCD_DATA ,AL SUS_003 WRITE TO LCD CONTROL SET SUSPEND UNSUCCESSFUL DUE TO LCD INACCESSABI L ITY 0805 0805 B3 02 SUS_002: MOV BL ,LCD_NOLACTIVE SET FLAG - FOR LCD INOPERABLE, THIS WILL NOT BECOME AN ERROR CHECK FOR DISKETTE MOTORS OFF 0807 0807 0808 080B 080C 080E 52 BA 03 F7 EC A8 78 74 09 0810 0813 0815 0816 BA 03 F2 2A CO EE 80 CB 01 SUS_003 : PUSH MOV IN TEST JZ OX ; SAVE LCD ADDRESS OX, DRIVE_SENSE ; READ DRIVE STATUS AL,DX AL ,DRO_S EL_SENS E+DRLS EL_S ENS E+DRO_MOLS ENS E+DR l~OT _SENS E SUS_004 DISKETTE MOTORS NOT OFF/TURN THEM OFF AND SET ERROR FLAG MOV SUB OUT OR DX,DRIVE_CNTL AL,AL DX,AL BL,DSKLACTIVE DISKETTE CONTROL SET ERROR FLAG TURN OFF CGA DISPLAY VIDEO 0819 0819 081B 081E 2A CO BA 0308 EE 081 F 0821 0824 0825 FE CO BA 03B8 EE 5A SUS_004: SUB MOV OUT AL,AL OX, CGA_CNTL DX,AL DISABLE VIDEO COLOR TURN OFF MONO DISPLAY VIDEO INC MOV OUT POP AL DX ,MONO_CNTL DX,AL OX DISABLE VIDEO ON MONO RESTORE LCD ADDRESS SAVE REAL TIME CLOCK INTERRUPT MODE AND TURN OFF ALL BUT ALARM INTERRUPTS 2-52 ROM BIOS 0826 0828 082B 84 OB E8 0747 8A FO MOV CALL MOV 082D 082F 0832 0834 24 E8 FE E8 AND CALL INC CALL ; DH <-- RTC INTERRUPT MODE ; DL <-- LOW ORDER LCD ADDRESS AL,NOT PILENABLE+UIE_ENABLE ; DISABLE INTS PULRTCNMI AH ; READ LAST INTERRUPT STATUS ; TO CLEAR IT GELRTCNMI 0837 F6 06 OOAO R 04 74 OD TEST JZ RTCWAILFLAG,PON-.ALRM-PEND ; IS POWER ON PENDING? SUS04A 80 E4 24 OC E6 AND IN AND OR OUT RTCWAILFLAG,NOT PON-.ALRM_PEND ; RESET FLAG AL,PWILSTAT AL, NOT HDWR_RESET ; TURN OFF RESET FLAG AL, EN_PON-.ALRM ; ENABLE POWER ON BY ALARM PWR_STAT, AL 083C 083E 0843 0845 0847 0849 AF 0750 R C4 0747 R 26 OOAO R FB 7F F7 01 7F AH,RTCMODE GELRTCNMI DH,AL CHECK SYSTEM PROFILE FOR RESUME OPTION ENABLE OR FORCED RESUME 084B 084B 0850 0852 0854 0857 0859 F6 75 B4 E8 A8 74 06 0016 R 40 09 17 0747 80 IB SUS04A: TEST JNZ MOV CALL TEST JZ BIOS_STATUS, F_RESUME ; IS A FORCED RESUME REQUESTED? SUS_04B JUMP I F YES AH,RTCSYS_PROFl GET SYSTEM PROFI LE GELRTCNMI AL, RESUMLENABLE SYSTEM TO BE RESUMED? SUS_04D JUMP I F YES SET DIAGNOSTIC FLAGS IN RTC AREA 085B 085B 085D 0860 AH, RTCDIAG_STAT UPDATE DIAGNOSTIC STATUS GELRTCNMI AL, BL SET FLAGS BL, BL ANY ERRORS? SUS_04E ; NO THEN SKIP SAVE CL, DSP _CLCD+DSP --.MLCD ; I F LCD INOPERABLE, THEN RESET SUS_04C ; ERROR FLAG SI, DIAGJORCE_SUS ; CHECK FOR FORCE SUSPEND SUS_04D ; I F NO LCD AND NO FORCE SUSPEND ; THEN DO NOT LOG ANY ERRORS AL,NOT LCD_NOLACTIVE ; RESET LCD NOT ACTIVE FLAG 0866 0869 086B 086F 0871 24 FD 0873 0873 E8 0750 SUS_04C: CALL PULRTCNMI E9 092C R SUS_04D: JMP SUSP _HL T 0862 0864 OE SUS_04B: MOV CALL OR OR JZ TEST JNZ TEST JZ B4 E8 OA OA 74 F6 75 F7 74 0747 C3 DB 13 Cl 03 08 C6 0080 05 0876 0876 AND YES THEN DO NOT SUSPEND CH CONTAINS LCD CONTROL SAVE, BX CONTAINS SUSPEND SEGMENT ADDRESS 0879 0879 087B 0870 8A CF 8E C7 2B FF 087F 0881 0883 E4 75 OC 10 E6 75 SUS_04E: MOV MOV SUB IN OR OUT CL,BH ES, DI DI,DI CL <--- CURRENT LCD CONTROL SET SEGMENT CLEAR DESTINATION OFFSET AL,LCD_DATA AL,LCDJONT LCD_DATA,AL GET LCD CONTROL SET FONT ACCESS FLAG SAVE STACK SEGMENT AND POINTER 0885 0887 0888 088A 8C DO AB 8B C4 AB MOV STOSW MOV STOSW AX,SS SAVE STACK SEGMENT AX,SP SAVE STACK POINTER SAVE REAL TIME CLOCK INTERRUPT MODE 088B 088D 8A C6 AA MOV STOSB AL,DH ; SAVE RTC INTERRUPT MODE SAVE LCD SYSTEM CONTROL,MODE CONTROL, AND PARAMETER REGISTERS ROM BIOS 2-53 088E 0890 0891 0894 0897 8B AB BE B9 B6 0783 R 0014 03 C1 MOV STOSW MOV MOV MOV 0899 0899 089C 089D 089E 089F 08AO 08A1 08A2 2E: 8A 04 46 EE 42 EC AA 4A E2 F5 SUS_005: MOV INC OUT INC IN STOSB DEC LOOP AX,CX ; SAVE LCD MODE CONTROL SI,OFFSET LCDR_TABLE ; SAVE LCD REGISTERS CX, LCDR_LENGTH DH,03 SET HIGH ORDER LCD ADDRESS LOW ORDER ALREADY SET AL,CS: [SI] SI DX,AL DX AL, DX ; GET REGISTER # BUMP PO INTER SET REGISTER # GET DATA PORT SAVE DX SUS_005 CONTINUE SAVE TIMER 0 AND TIMER 2 I NFORMATION 08A4 08A6 08A9 08A9 08AB 08AO 08AE 08BO 08B1 08B3 08B4 08B6 BO 50 B9 0002 E6 E4 AA E4 AA E4 AA BO E2 43 43 40 42 DO F1 MOV MOV SUS_006 : OUT IN STOSB IN STOSB IN STOSB MOV LOOP AL,50H CX ,2 SELECT TIMER 0 AND LSB LOOP NUMBER TIMER_CTL,AL AL, TIMER_CTL GET TIMER 0/2 MODE AL, TIMERO GET TIMER 0 LSB/MSB AL, TIMER2 GET TIMER 2 LSB/MSB AL ,OOOH SUS_006 SELECT TIMER 2 AND MSB SAVE INTERRUPT CONTROLLER STATE 08B8 08BA 08BB 08BD 08BF 08C1 08C2 08C4 08C6 08C8 E4 21 IN STOSB MOV OUT IN STOSB MOV OUT IN STOSB AA BO E6 E4 AA BO E6 E4 04 72 63 44 72 63 AA AL,INTA01 GET INTERRUPT MASK AL,04 CLOCLCTL ,AL AL,63H SELECT INTERRUPT BYTE 0 AL ,44H CLOCLCTL,AL AL,63H SELECT INTERRUPT BYTE 1 SAVE BYTE 0 SAVE BYTE 1 SAVE INTERRUPT 0-32 VECTORS 08C9 08CC 08CE 0801 08D4 B8 8E BE B9 0000 D8 0000 0040 F31 A5 08D6 08D9 08DA BE 0110 A5 A5 MOV MOV MOV MOV REP AX,O DS,AX SI,O CX ,64 MOVSW SET OS SEGMENT 0 SAVE 32 VECTORS SAVE INTERRUPT VECTOR 44H MOV MOVSW MOVSW SI,44H*4 SAVE VECTOR 44H SAVE DATA AREA FROM 0300-053A 08DB 08DE 08E1 B9 OllE BE 0300 F31 A5 08E3 08E5 E4 7C AA 08E6 08E8 E4 AO AA MOV MOV REP CX,llEH SI,0300H MOVSW SET MOVE LENGTH SET SOURCE ADDRESS SAVE KEYBOARD AND FEATURE CONTROL REGISTER IN STOSB AL, KYBD_CNTL SAVE 110 CHANNEL CHECK FLAG 2-54 ROM BIOS IN STOSB AL,IONMLCNTL SAVE NMI AND SPEAKER CONTROL REGISTER 08E9 08EB 08EC 08EE E4 61 AA BO 00 E6 61 IN STOSB MOV OUT AL,NMLCNTL AL,O NMLCNTL ,AL ; DISABLE SPEAKER SAVE COMMUNICAYTIONS CONTROLLER(S) CURRENT STATE 08FO 08F2 B3 01 E8 OB04 08F5 08F7 08FA 08FD 08FD 08FE 0900 0902 0905 0907 090A 090C 090C 0900 090F 2B DB BE 053A B9 7063 MOV CALL BL ,01 ASYNCSUSPEND ; SET SUSPEND PARAMETER FOR ; SAVING ASYNC DEVICES CHECKSUM LOWER 128K OF STORAGE AD 03 E2 B9 8C 80 8E SUB MOV MOV SUS_OlO : LODSW ADD LOOP MOV MOV ADD MOV SUS_Oll : LODSW ADD LOOP 08 FB 8000 08 C4 10 08 AD 03 08 E2 FB BX, BX SI,53AH CX,7D63H BX,AX SUS_OlO CX ,8000H AX,DS AH,10H DS,AX SET ACCUMULATOR STARTING OFFSET CHECKSUM 32K WORDS CHECKSUM NEXT 32K WORDS OFFSET TO NEXT SEGMENT BX,AX SUS_Oll CANNOT USE SYSTEM STACK FROM HERE ON 09ll 0913 0915 0917 BO E6 8A E6 23 70 C3 71 MOV OUT MOV OUT AL, RTCBMEMJKSL RTCR_PORT, AL AL, BL RTCD_PORT ,AL ADDRESS CHECKSUM LOW SAVE AREA OUTPUT ADDRESS 0919 091B 0910 091F BO E6 8A E6 24 70 C7 71 MOV OUT MOV OUT AL, RTCBMEM_CKSH RTCR_PORT, AL AL, BH RTCD_PORT, AL ADDRESS CHECKSUM HI SAVE AREA OUTPUT ADDRESS OUTPUT DATA OUTPUT DATA SET SUSPEND FLAG 0921 0924 On6 onc onc OnE 0930 0932 B8 ---8E 08 C7 06 0072 R 5678 BO 00 E6 72 EB FA ASSUME MOV MOV MOV SUSP_HL T: MOV OUT JMP SUSPEND DS:DATA ; SET OS BACK TO DATA AREA AX, DATA DS,AX RESELFLAG,SYS_SUSPEND ; SET SUSPEND SUCCESSFUL AL, CLOCLSTOP CLOCLCTL, AL SUSP_HL T ENDP ; STOP SYSTEM CLOCKS Resume (RESUME) SUBTTL RESUME SYSTEM STATE **************************************************************** RESUME: SUBROUTINE TO RESTORE SYSTEM FOR APPLICATION RESUME **************************************************************** 0932 0932 0935 0937 E8 0000 E B4 20 E8 0747 R RESUME ASSUME CALL MOV CALL PROC NEAR OS: DATA DISABLE_NMI AH, RTCDSP _CON GELRTCNMI DISABLE ALL INTERRUPTS GET LCD TYPE ROM BIOS 2-55 093A 093D BB BICO BA 03B4 MOV MOV BX, SUSPENDJ10NO DX, MONO_CNTL-4 ; DEFAULT TO LCD AS MONO SET RESUME MODE ACCORDING TO DISPLAY CONFIGURATION 0940 0942 A8 06 75 06 TEST JNZ AL, DSP_MLCD+DSP _CGA RES_DOl I F LCD AS MONO OR CGA I NSTALL ED JMP - RESUME IN MONO MODE 0944 0947 BB B9CO BA 03D4 MOV MOV BX, SUSPEND_COLOR DX, CGA_CNTL-4 LCD MUST BE COLOR 094A 094A 094C 8E DB BE 0007 DS, BX SI,7 GET SAVE AREA SEGMENT RETRIEVE LCD INFO 094F 0951 0953 0955 0959 095B BO E6 BO 81 74 DC 095D 095D E6 75 RES_DOl: MOV MOV ACCESS LCD FONT AREA WHERE SYSTEM SUSPEND SAVE AREA IS LOCATED 00 74 18 FA 03B4 02 02 MOV OUT MOV CMP JE OR RES_OOlA: OUT AL, LCD_FUNCT LCD_INDX,AL ; SELECT LCD REG 0 AL, LCD_ENAB+LCD_FONT ; SET ENABLE WITH FONT ACCESS DX ,MONO_CNTL-4 IS LCD SET IN MONO MODE? RES_OOIA JUMP I F YES AL, LCD_CGA NO, USE LCDC AS CGA LCD_DATA,AL SET LCD MODE FOR RESUME RESTORE LCD CONTROL REGISTERS ; BF 0783 R B9 0014 095F 0962 0965 0965 0968 0969 096A 096B 096C 0960 096E 2E: 8A 05 47 EE 42 AC EE 4A E2 F5 0970 0971 0973 0975 0977 0978 097A 097B 097D 097E 0980 0981 0983 0984 AC 24 8A E6 AC 8A AC 8A AC 8A AC 8A AC 8A MOV MOV RES_002 : MOV INC OUT INC LODSB OUT DEC LOOP DI,OFFSET LCDR_TABLE ; POINT TO LCD REG TABLE CX, LCDR_L ENGTH GET LENGTH OF TABLE AL,CS: [DI] DI DX,AL DX DX,AL DX RES_002 ; GET REGISTER ADDRESS OUTPUT REG NUMBER GET DATA PORT RETRIEVE REGISTER VALUE SET DX BACK TO INDEX PORT RESTORE SYSTEM TIMERS LODSB AND MOV OUT LODSB MOV LODSB MOV LODSB MOV LODSB MOV LODSB MOV 3F EO 43 D8 C8 FO F8 E8 AL,3FH AH,AL TIMERJTL ,AL GET TIMER 0 MODE TURN OFF UPPER TWO BITS AH HAS TIMER 0 MODE WRITE TIMER 0 MODE BL,AL BL HAS TIMER 0 LSB CL,AL CL HAS TIMER 2 LSB DH,AL DH HAS TIMER 2 MODE BH,AL BH HAS TIMER 0 MSB CH,AL CH HAS TIMER 2 MSB WRITE TIMER 0 COUNTER 0986 0989 098C 098E 0991 0993 0995 0997 0999 099B 0990 0990 099F 80 80 74 80 74 8A E6 8A E6 EB E4 30 FC 10 OF FC 20 10 C3 40 C7 40 OA 8A C3 E6 40 AND CMP JE CMP JE MOV OUT MOV OUT JMP RES_003 : MOV OUT 2-56 ROM BIOS AH,30H AH,lOH RES_003 AH,20H RES_004 AL, BL TIMERO,AL AL,BH TIMERO,AL SHORT RES_005 SAVE ONLY READ/WRITE TYPE IS IT LSB ONLY? AL,BL TIMERO,AL WRITE LSB ONLY IS IT MSB ONLY? OUT LSB FI RST THEN MSB 09Al 09A3 09A3 09AS EB 04 8A C7 E6 40 JMP RES_004: MOV OUT SHORT RES_ODS AL,BH TIMERO,AL WRITE MSB ONLY AL,DH AL, 3 FH AL ,80H TIMER_CTL,AL AL ,30H AL,10H RES_006 AL,20H RES_007 AL,CL TIMER2,AL AL,CH TIMER2,AL SHORT RES_008 SET TIMER 2 MODE TURN OFF UPPER TWO BITS SET TIMER 2 AL,CL TIMER2,AL SHORT RES_008 WRITE LSB ONLY AL,CH TIMER2,AL WRITE MSB ONLY RESTORE TIMER 2 09A7 09A7 09A9 09AB 09AD 09AF 09Bl 09B3 09B5 09B7 09B9 09BB 09BD 09BF 09Cl 09C3 09C3 09C5 0ge7 09C9 09C9 09CB 8A 24 DC E6 24 3C 74 3C 74 8A E6 8A E6 EB C6 3F 80 43 30 10 DE 20 10 Cl 42 CS 42 OA 8A Cl E6 42 EB 04 8A C5 E6 42 RES_ODS: MOV AND OR OUT AND CMP JE CMP JE MOV OUT MOV OUT JMP RES_006 : MOV OUT JMP RES_007 : MOV OUT LEAVE ONLY READ/WRITE TYPE IS IT LSB ONLY? IS IT MSB ONLY? OUT LSB FI RST THEN MSB INITIALIZE INTERRUPT CONTROLLER 09CD 09CD 09CE 0900 0901 0903 0904 AC 8A EO AC 8A F8 AC 8A 08 RES_008: LODSB MOV LODSB MOV LODSB MOV AH,AL GET INTERRUPT MASK AH HAS INTERRUPT MASK GET I NTERRUPT BYTE 0 BH,AL GET INTERRUPT BYTE 1 BL,AL BU I LD AND RESTORE ICW 1 0906 0908 09DA 24 08 DC 10 E6 20 09DC 09DE 09EO 8A C7 24 F8 E6 21 AND OR OUT AL ,08H AL,10H INTAOO,AL AND OFF ALL BUT LEVEL/EDGE BIT 4 MUST BE 1 OUTPUT ICWI BUILD AND RESTORE ICW 2 MOV AND OUT AL, BH AL ,OF8H INTA01,AL GET INTERRUPT TYPE ASSIGN ONLY SAVE ICW2 INFO SEND ICW 2 BUILD AND RESTORE ICW 4 09E2 09E4 09E6 09E8 8A DO 24 E6 C3 E8 02 21 MOV SHR AND OUT AL, BL AL,1 AL,02 INTA01,AL GET INTERRUPT BYTE 1 GET AUTO EOI BIT CORRECT SAVE ONLY AUTO EOI BIT SEND ICW 4 RESTORE I NTERRUPT MASK REGI STER 09EA 09EC 8A C4 E6 21 09EE 09Fl 09F3 09F6 09F9 B8 0000 8E CO BF 0000 B9 0040 F3/ AS MOV OUT AL,AH INTA01,AL GET INTERRUPT MASK RESTORE INTERRUPT VECTORS 0 -32 TO RAM MOV MOV MOV MOV REP AX,O ES,AX 01,0 CX,64 MOVSW SET SEGMENT 0 START AT VECTOR 0 RESTORE 32 VECTORS RESTORE VECTOR 44H ROM BIOS 2-57 09FB 09FE 09FF BF 0110 A5 A5 MOV MOVSW MOVSW DI,44H*4 RESTORE VECTOR 44H RESTORE DATA AREA FROM 0300-3FFH WARNING: CANNOT DO ANY STACK OPERATIONS FROM NOW UNTIL SS AND SP RESTORED OAOO OA03 OA06 OA08 OAOB OAOE OAOF BF 0300 B9 0080 F3/ A5 83 C7 12 83 C6 10 AD 8B E8 MOV MOV REP ADD ADD LODSW MOV DI,0300H CX,128 MOVSW DI,18 SI,16 BP ,AX SET DESTINATION 128 WORDS SKIP FROM 400H-410H SOURCE ADDRESSES OLD EQUIP -FLAG AX=PRE SUSPEND EQUIP_FLAG SAVE OLD EQUIP_FLAG RESTORE DATA AREA FROM 0412-053A OAll OA14 B9 0095 F3/ A5 OA16 OA18 OA1B OA1D OAIF OA22 OA25 OA28 OA2B OA2E OA31 8C B8 8E 2B A3 A3 A2 A3 A2 A2 A2 MOV REP CX,149 MOVSW RESTORE 149 WORDS CLEAR KEYBOARD BREAK PENDING FLAGS DB ---D8 CO 00B5 00B7 0018 0072 OOBA 0015 00B9 MOV MOV MOV SUB MOV MOV MOV MOV MOV MOV MOV R R R R R R BX,DS AX,DATA DS,AX AX,AX B_PEND1,AX B_PEND2,AX KB-FLA~l,AL RESELFLAG,AX LASLCLICLKEY,AL BALSTATUS,AL P60_HOLD_BYTE ,AL SAVE RESTORE SEGMENT RESTORE DATA SEGMENT CLEAR CLEAR CLEAR CLEAR CLEAR KEY DEPRESSED BITS RESET FLAG KEY CLICK TRACKING BATTERY STATUS FLAG PORT 60 HOLDING REG CLEAR BIOS STATUS FLAGS , CAUSE TIMEOUT COUNTERS TO BE RELOADED AND A CHECK FOR DISKETTE CHANGE TO BE PERFORMED OA34 OA39 OA3E OMO OM5 OM7 OMB 80 80 8B 80 24 08 8B 26 OE C5 26 30 06 OE OMF OA51 OA53 OA56 OA57 OA59 OA5A OA5C OA5E OA5F OA60 OA61 OA62 8E 8B BE AD 8B AD 8E 8B AC 50 AD 50 8B DB FE 0000 OA64 OA66 OA68 OA6B OA6D OA6F B4 8A E8 FE 8A E8 13 CI 0750 R C4 C5 0750 R 0016 R 04 0016 R 22 0010 R CF 0010 R 0010 R AND OR MOV AND AND OR MOV BIOS_STATUS,DCL_SUPPORTED ; SAVE DCL SUPPORT FLAG BIOS_STATUS, KYBD-ACTI VE+FORCE_DCL AX,BP ; GET OLD EQUIPMENT INFO BYTE PTR EQUIP-FLAG,NOT INILDISP ; CLR NEW VIDEO FLAGS AL,INILDISP ; ONLY SAVE OLD VIDEO FLAGS BYTE PTR EQUIP_FLAG,AL ; MOV OLD VIDEO FLAGS TO EQUI P CX, EQUIP-FLAG ; CX <-- EQUIPMENT WORD RESTORE APPLICATION PROGRAMS STACK POINTER MOV MOV MOV LODSW MOV LODSW MOV MOV LODSB PUSH LODSW PUSH MOV D8 03 EO F7 DS, BX DI,SI SI,O BX,AX SS, BX SP ,AX AX AX SI,DI RESTORE SAVE AREA SEGMENT SAVE CURRENT PLACE GET SS VALUE SAVE IN BX GET SP VALUE RESTORE APPLICATION STACK GET RTC SAVE ON GET LCD SAVE ON RESTORE MODE STACK AND VIDEO CONTROL STACK POINTER RESTORE EQUIP WORD IN RTC RAM FROM SAVED WORD IN REGISTER CX MOV MOV CALL INC MOV CALL AH, RTCEQU I P_LO AL,CL PULRTCNMI AH AL,CH PULRTCNMI RELOAD KEYBOARD NMI CONTROL STATE 2-58 ROM BIOS SAVE IN RTC EQUIPMENT AREA SAVE EQUIPMENT INFO IN RTC OA72 OA73 OA75 DAn OA79 OA7S OA7D AC 24 SA E4 24 OA E6 LODSB AND MOV IN AND OR OUT SO OS 7C 7F C3 7C RETRIEVE FEATURE CONTROL LEAVE ONLY KEYBOARD STATE SAVE IN BL AL,ENJYBD_NMI BL,AL AL, KYBD_CNTL AL, NOT EN_KYBD_NMI AL, BL KYBD_CNTL,AL MASK CURRENT NMI STATE RESTORE KEYBOARD NMI STATE OUTPUT FEATURE CONTROL RESTORE 110 CHANNEL CHECK FLAG OA7F OASO AC E6 AD LODSB OUT 10NMLCNTL,AL RESTORE NMI AND SPEAKER CONTROL REGISTER OAS2 OAS3 AC E6 61 OAS5 OAS7 OAS9 E4 7F AS 40 75 13 OASB OASD OA90 OA92 B4 ES AS 75 LODSB OUT NMLCNTL, AL RESTORE POWER ENABLE TO IN TEST JNZ MODEM AL,PWR_STAT AL,EXLPWR RES_009 GET CURRENT POWER STATUS ON EXTERNAL POWER? JUMP I F ON EXTERNAL POWER CURRENTLY ON BATTERY POWER SO CHECK USER PROFILE FOR MODEM OPTIONS 17 0747 02 OA MOV CALL TEST JNZ AH, RTCSYS_PROFI GELRTCNMI AL,MODEM_BATT RES_009 ; OPERATE COMI ON BATTERY? ; YES THEN JUMP ON BATTERY POWER AND MODEM PROFILE INDICATES NO BATTERY OPERATION OA94 OA96 OA9S OA9B B3 2A ES EB 02 FF 0000 E 09 90 MOV SUB CALL JMP BL,ACLMODEM BH,BH COM_POWER RES_OlD SPECI FY MODEM OFF I NO I CATE POWER OFF REQUEST TURN OFF PRIMARY COM POWER SKI P MODEM _CONFIG MODEM IS POWERED ON SO RESUME CONFIGURATION OA9E OA9E OAAO OAA3 RES_009 : MOV CALL CALL B4 10 ES 0747 R ES 0000 AH, RTCMOD_PROFI GELRTCNMI GET MODEM PROFILE MODE~CONFIG GO SETUP MODEM CONFIGURATION RESTORE COMMUNICATION CONTROLLERS STATE AT POWER OFF TIME OAA6 OAA6 OAAS 2A DB ES 0 B04 R OAAB OAAE OABO OABl OAB3 OAB5 OAB7 BS SE 5S 24 E6 AS 74 RES_OlD : SUB CALL BL,BL ASYNCSUSP END SET RESUME CODE FOR RESTORING OF COMMUNICATION STATE TURN OFF FONT ACCESS AND ENABLE PANEL MOV MOV POP AND OUT TEST JZ ---OS BF 75 OS 04 AX,DATA DS,AX AX AL,NOT PANEL_ENABLE LCD_DATA,AL AL,LCD_ENAB RESOlDA SET DATA SEGMENT ADDRESS RETRIEVE VIDEO FLAGS FORCE PANEL OFF RESTORE LCD CONTROL CHECK FOR LCD ENABLED ONLY ENABLE PANEL I F LCD ENABLED ENABLE PANEL I F LCD WAS ENABLED OAB9 OABB DC 60 E6 75 OR OUT AL,SYNCENABLE+PANELENABLE LCD_DATA,AL ENABLE PANEL RESTORE ACTIVE VIDEO MODE CONTROL REGISTER OABD OABD OACl OAC4 OAC6 SB 16 0063 R S3 C2 04 SA C4 EE RESOIOA: MOV ADD MOV OUT DX,ADDIL6S45 DX,4 AL,AH DX,AL GET RESTORE VIDEO MODE RESTORE VIDEO MODE ROM BIOS 2-59 ENABLE DISKETTE NMI'S OAC7 OAC9 OACB E4 77 OC 80 E6 77 IN OR OUT AL, DSKLCNTL AL,DSKLNMI DSKLCNTL,AL ; ENABLE DISKETTE POWER ON NMI SET REAL TIME CLOCK ALARM FLAG I F POWERED ON BY ALARM OACD OACF OAD2 OAD4 OAD5 OAD8 B4 E8 8A 58 F6 74 21 0747 F8 DADA OADF 80 OE OOAO R 02 24 DF C7 10 07 OAEl MOV CALL MOV POP TEST JZ AH,RTCSYS_STAT GELRTCNMI BH,AL AX BH, PON-ALRM RES_Oll OR AND RTCWAILFLAG,ALARM_PEND ; SET ALARM PENDING AL, NOT AIE_ENABLE TURN OFF ALARM I F POWERED ON BY IT GET SYSTEM STATUS BH <-- SYS_STATUS RETRI EVE RTC MODE POWERED ON BY ALARM? RES_Oll : RESTORE REAL TIi·iE CLOCK I NTERRUPT MODE OAEl OAE3 B4 OB E8 0750 R MOV CALL AH, RTC.MODE PULRTCNMI ENABLE PRINTER PORTS OAE6 OAE9 OAEB OAEC OAEF OAFO OAF3 BA BO EE 80 EE BA EE 027A DC OAF4 OAF6 OAF8 OAFA E4 OC 24 E6 7F 04 F7 7F MOV MOV OUT ADD OUT MOV OUT C6 01 03BE DX,27AH AL ,OCH DX,AL DH,l DX,AL DX,03BEH DX,AL START WITH SECONDARY DO PRIMARY DO MONO PRINTER PORT ENABLE SYSTEM SUSPEND NMI IN OR AND OUT AL,PWILSTAT AL, EN_SUS_NMI AL, NOT HDWR_RESET PWR_STAT ,AL ENABLE SUSPEND NMI RESET FLAG ISSUE RESUME VECTOR CALL OAFC OAFC E8 0000 E RES_012 : CALL ENABLE_NMI ENABLE NMI' S ISSUE RESUME VECTOR CALL OAFF CD 6C OB01 OB04 E9 0050 R INT JMP RESUME SUBTTL 2-60 ROM BIOS 6CH NMIH_EXIT ENDP ASYNC SAVE/RESTORE ALLOW OP /SYS TO CORRECT REAL TIME INFORMATION EX IT TO USERS PROGRAM ASYNCSUSPEND THIS SAVES OR RESTORES THE REGISTERS OF THE 8250 ASYNC CHIP. USED IN SUSPEND AND RESUME. ES:DI MUST BE SET TO FIRST BYTE ON ENTRY FOR SUSPEND, DS:SI MUST BE SET UP TO FIRST BYTE FOR RESUME. SI OR DI IS INCREASED BY 14 ON EXIT. THE DATA STATUS BYTE AND THE 8250 REGISTERS FOR THE ASYNC PORT ARE STORED IN RAM AS FOLLOWS: BYTE 1 - DATA STATUS (OAAH = GOOD) BYTE 2 - 8250 LINE CONTROL REG BYTE 3 - 8250 MODEM CONTROL REG BYTE 4 - 8250 SCRATCH REG BYTE 5 - 8250 INTERRUPT CTL REG BYTE 6 - 8250 DIVISOR LATCH (MSB) BYTE 7 - 8250 DIVISOR LATCH (LSB) THE MODEM 8250 REGISTERS AND DATA STATUS BYTE ARE STORED IN THE SAME FORMAT IN THE NEXT 7 BYTES. INPUT BL=O : RESTORES REGISTERS (RESUME) BL=l : SAVE REGISTERS (SUSPEND) DIRECTION FLAG=O DS:SI = BEGINNING OF DATA AREA FOR RESUME. ES:DI = BEGINNING OF DATA AREA FOR SUSPEND REGI STERS USED BX DESTROYED 14 ADDED TO SI (RESUME) OR DI (SUSPEND). LOCAL EQUATES = OOAA GOOD_DATA OB04 OB04 OB05 ASYNCSUSPEND 50 52 , PUSH PUSH EQU OAAH PROC NEAR AX DX THIS MEANS THAT THE FOLLOWING 6 8YTES ARE VALID SUSPEND DATA ; SAVE REGISTERS USED ;-----GET RTCFEALCON AND KY8D_CNTL TO SEE WHO IS INSTALLED OB06 OB08 OBOB OBOD OBlO OB11 OB13 B4 E8 8A BA EC 86 50 IF 0747 R EO 007C 0814 0817 081A 081C BA F6 74 81 02F8 C4 01 04 C2 0100 OB20 0822 0824 A8 80 75 02 2B CO SV1: JNZ SUB TEST AL, SERPLLI NST SV2 AX,AX TEST FOR SER/PAR INSTALLED YES, GO TO NEXT TEST NO, FORCE TO FAIL NEXT TEST OB26 OB29 OB28 F6 C4 04 74 02 BO AA SV2: JZ MOV TEST AH, ACLRS232 SV3 AL,GOOD_DATA TEST FOR ASYNC POWER ON NO, AL=O TO INDICATE BAD YES, SET AL TO INDICATE GOOD 082D ;-----DO THE SUSPEND OR RESUME ; E8 OB47 R SV3: CALL ASLRES3US C4 , MOV CALL MOV MOV IN XCHG PUSH AH, RTCFEA LCON GELRTCNMI AH,AL DX, KY8D_CNTL AL,DX AL,AH AX GET ASYNC INSTALLATION INFO FROM REAL TIME CLOCK RAM SAVE FEATURE REGISTER ADDRESS THE POWER CONTROL REG AND READ IT EXCHANGE BYTES SAVE FOR LATER (REST~ODEM) ;-----GET ADDRESS OF ASYNC PORT, EVEN IF NOT PRESENT MOV TEST JZ ADD DX,2F8H AH, SET_RS23LPRIM SV1 DX,lOOH ADDRESS OF SECONDARY PORT TEST FOR ASYNC BEING PRIMARY SKIP IF NOT CHANGE TO PRIMARY ADDRESS I F SO ;-----IS ASYNC INSTALLED AND ON? ; , RESUME OR SUSPEND ASYNC ;-----IS MODEM INSTALLED AND ON? 0830 OB30 OB31 REST~ODEM: 58 A8 40 POP TEST AX AL, I NTMOD_I NST RETRIEVE FEATURE AND KYBD REGS TEST FOR INTERNAL MODEM ROM BIOS 2-61 OB33 OB35 75 02 2B CO OB37 OB3A OB3C F6 C4 02 74 02 BO AA OB3E BA 03F8 OB41 E8 OB47 OB44 OB45 OB46 5A 58 C3 JNZ SUB SV4: JZ MOV SV4 AX,AX YES, DO NEXT TEST NO, FORCE FAILURE OF NEXT TEST TEST AH, ACLMODEM SV5 AL,GOOD_DATA TEST FOR MODEM POWER ON NO, LEAVE AL=O YES, SET AL=GOOD_DATA ;-----GET ADDRESS OF MODEM EVEN IF NOT THERE SV5: MOV DX,3F8H ; ADDRESS MODEM PORT ;-----CALL SUSPEND/RESUME CALL RESUME OR SUSPEND MODEM ; -----FINISHED POP POP RET OB47 OX AX RESTORE REGISTERS ASYNCSUSPEND ENDP -- ---------- -------- --------- -- -- - - - - --- - -- - - - - - - - - - - - - - - -- - - - -- - - -- ;ASLRES_SUS INPUT AL=O I F PORT I S NOT POWERED ON. AL=GOOD_DATA BYTE IF PORT IS WORKING. BL=O IF RESUME, BL!=O IF SUSPEND. DX=PORT BASE ADDRESS REGISTERS USED AL,DX -------- ----- ---------- -- - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - -ASLRES_SUS OB47 OB47 OB49 THIS PROCEDURE SAVES OR RESTORES THE ASYNC PORTS REGISTERS. 02 DB 74 2B ADD JZ PROC BL, BL ASLRESUME NEAR ARE WE RESUMING OR SUSPENDING? RESUMING ; -----SUSPEND COMMAND OB4B OB4B OB4C OB4E AA 22 CO 74 22 ASLSUSPEND: STOSB AND AL,AL JZ AS1 OB50 OB51 OB52 OB53 OB54 42 42 42 EC AA INC INC INC IN STOSB OX OX OX AL,DX ADDRESS THE LI NE CTL REG (XF9) (XFA) (XFB) READ FROM 8250 AND STORE IN DATA AREA OB55 OB57 24 7F EE AND OUT AL, 7 FH DX,AL ASSURE THAT DLAB BIT IS ZERO OB58 OB59 OB5A 42 EC AA INC IN STOSB OX AL,DX ADDRESS MODEM CONTROL REG (XFC) READ STORE IN DATA AREA OB5B OB5C OB5D OB5E OB5F 42 42 42 EC AA INC INC INC IN STOSB OX OX OX AL,DX ADDRESS SCRATCH REG OB60 OB63 OB64 83 EA 06 EC AA SUB IN STOSB DX,6 AL, OX ADDRESS INTR ENABLE REG READ FROM 8250 STORE IN RAM OB65 OB66 OB67 OB69 42 42 BO 80 EE INC INC MOV OUT OX OX AL ,80H DX,AL (XFA) ADDRESS LINE CTL REG AGAIN (XFB) SET DLAB BIT TO 1 TO READ BAUD 2-62 ROM BIOS ; STORE FI RST BYTE (GOOD OR BAD) ; IS PORT WORKING? ; NO, DO NOT STORE REGISTERS YES, STORE ALL REGISTERS (XFD) (XFE) (XFF) READ FROM 8250 STORE IN RAM (XF9) OB6A OB6B OB6C OB6D OB6E OB6F OB70 OBll OB72 OB75 4A 4A EC AA 4A EC AA C3 83 C7 06 C3 DEC OX DEC OX IN AL,DX STOSB DEC OX IN AL,DX STOSB RET ASI : ADD 01,6 RET ADDRESS BAUD MSB READ FROM 8250 SAVE ADDRESS OTHER BAUD BYTE READ FROM 8250 SAVE EXIT SKIP OVER DATA AREA EXIT (XFA) (XF9) (XF8) ; -----RESUME COMMAND OB76 OB76 OB78 OB7A OB7B OB7D 22 74 AC 3C 75 OB7F OB80 AC 50 LODSB PUSH AX IS PORT OPERATING? NO, DO NOT RESTORE YES, LOOK AT STORED DATA IS IT GOOD? NO, DO NOT RESTORE YES, SO RESTORE 8250 GET LINE CONTROL REG FROM RAM STORE ON STACK OB81 OB82 OB83 OB84 OB86 42 42 42 2A CO EE INC INC INC SUB OUT OX OX OX AL,AL DX,AL (XF9) (XFA) ADDRESS LINE CTL REG (XFB) SET DLAB BIT 0 TO ALLOW NORMAL ADDRESS I NG OB87 OB88 OB89 42 AC EE INC LODSB OUT OX DX,AL ADDRESS MODEM CONTROL REG (X FC) GET FROM RAM AND RESTORE 8250 OB8A OB8B OB8C OB8D OB8E 42 42 42 AC EE INC INC INC LODSB OUT DX,AL OB8F OB92 OB93 83 EA 07 EC EC SUB IN IN DX,7 AL,DX AL,DX ADDRESS DATA REG GET ANY TRASH CHRS OB94 OB95 OB96 42 AC EE INC LODSB OUT OX DX,AL ADDRESS I NTR CTL REG (XF9) GET FROM RAM AND WRITE TO 8250 OB97 OB98 OB99 OB9B 42 42 BO 80 EE INC INC MOV OUT OX OX AL ,80H DX,AL (XFA) ADDR LINE CONTROL REG(XFB) SET DLAB BIT = 1 IN 8250 OB9C OB9D OB9E OB9F OBAO OBAI OBA2 4A 4A AC EE 4A AC EE DEC DEC LODSB OUT DEC LODSB OUT OX OX DX,AL (XFA) (XF9) GET BAUD MSB FROM RAM AND INTO 8250 ADDR BAUD LSB (XF8) GET FROM RAM AND INTO 8250 OBA3 OBA4 OBA5 OBA6 OBA7 42 42 42 58 EE INC INC INC POP OUT OX OX OX AX DX,AL (XF9) (XFA) ADORE LINE CONTROL AGAIN (XFB) PULL OFF STACK AND PUT IN 8250 OBA8 C3 RET OBA9 46 83 C6 06 C3 oBAA OBAD CO 2F AA 2B ASLRESUME: AND AL,AL JZ AS2 LODSB AL,GOOD_DATA CMP JNE AS3 AS2: AS3: RET OX OX OX ADDRESS SCRATCH REG GET FROM RAM AND WRITE TO 8250 DX,AL OX INC ADD SI SI,6 (XFO) (XFE) (XFF) (XF8) CORRECT ADDRESS COUNT ROM BIOS 2-63 OBAE OBAE ENDP ROMCODE END 2-64 ROM BIOS ENDS Keyboard Services (BIIKYBD) TITLE BllKYBD BIOS KEYBOARD ROUTINES ROMCODE SEGMENT BYTE PUBLIC IDENT BllKYBD,Il,OO 0000 ; ********************************************************************** MODULE-NAME : BllKYBD DATE LAST MODI FI ED: 9/16/85 DESCRIPTIVE-NAME: THIS MODULE CONTAINS THE BIOS INTERRUPT 9 KEYBOARD HANDLER AND THE ASSOCIATED INTERRUPT 16 KEYBOARD SERVICE ROUTINES. COPYRIGHT 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: 0.0 KYBD_INT9 - INTERRUPT 9 KEYBOARD HANDLER (HARDWARE INT 1) ROUTINE TO READ SCAN CODES FROM PORT 60H AND CONVERT THEM TO ASCII CODES AND QUEUE IN THE BIOS KEYBOARD BUFFER. FUNCTION: KYBD_IO - KEYBOARD I/O ROUTINES TO ACCESS THE ASCI I KEYBOARD BUFFER. (INT 16H) MODULE SIZE: 945 BYTES EXTERNALLY REFERENCED ROUTINES: REFER TO EXTRN LIST EXTERNALLY REFERENCED DATA AREAS: REFER TO EXTRN LIST CHANGE ACTIVITY: NONE ; ********************************************************************** ; ***************************************************************** ;* PUBLICS ; ***************************************************************** PUBLIC PUBLIC KYBD_IO KYBD_INT9 ; ***************************************************************** ;* EXT ERN A L REF ERE N C E S ; ***************************************************************** ROUTINES EXTRN EXTRN EXTRN DCS: NEAR START: NEAR KB_NOISE:NEAR EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN K6: BYTE K6L:ABS K7: BYTE K8: BYTE K9: BYTE KI0:BYTE TABLES ROM BIOS 2-65 EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN Kll K12 K13 K14 K15 K30 BYTE BYTE BYTE BYTE BYTE BYTE P60_SLASH_SC P60...ASTRICSC F1LMAKE_SC FlLMAKE_SC F1LBASE...ASCI I EQU EQU EQU EQU EQU LOCAL EQUATES 0035 0037 0057 0058 0085 P60 P60 Fll F12 Fll 35H 37H 057H 058H D85H MAKE SC FOR BASE / MAKE SC FOR BASE * MAKE SC AT NMI & P60 LEVEL MAKE SC AT NMI & P60 LEVEL EXTENDED ASCI I (BASE) Keyboard Interrupt Hex 16 (KYBD_IO) ; **** I NT 16H *********************************************************** ROUTINE NAME: KYBD_IO (INT 16H) FUNCTION: PROVIDE ACCESS TO THE ASCII KEYBOARD BUFFER AND CLICKER. INPUT CONDITIONS: (AH)=O PROCESS SYSTEM REQUEST KEY IF THE KEY IS ACTIVE ELSE READ THE NEXT ASCI I CHARACTER STRUCK FROM THE KEYBOARD RETURN THE RESULT IN (AL), SCAN CODE IN (AH) (AH)=l PROCESS SYSTEM REQUEST KEY IF THE KEY IS ACTIVE ELSE RESET THE Z FLAG TO INDICATE IF AN ASCII CHARACTER IS AVAILABLE TO BE READ. (ZF) =1 -- NO CODE AVA I LABLE (ZF) =0 -- CODE IS AVAILABLE IF ZF = 0, THE NEXT CHARACTER IN THE BUFFER TO BE READ IS IN AX, AND THE ENTRY REMAINS IN THE BUFFER (AH)=2 RETURN THE CURRENT SHIFT STATUS IN AL REGISTER THE BIT SETTINGS FOR THIS CODE ARE INDICATED IN THE THE EQUATES FOR KBJLAG (AH) =4 TURN ON/OFF KEYBOARD CLICK STATE BY THE VALUE IN AL AS FOLLOWS: TURN OFF KEYBOARD CLICK. TURN ON KEYBOARD CLICK. AL IS RANGE CHECKED. THE STATE IS UNALTERED IF AL <> 1,0. (AL)=O (AL)=l NOTE: FUNCTION CALLS OTHER THAN THE ABOVE RESULT IN NO OPERATION EXIT CONDITIONS: FUNCTIONS 0, 2, 4 FUNCTION 1 REGISTERS MODIFIED: INTERRUPTS: IRET BACK TO CALLER RET 2 BACK TO CALLER AX, Z FLAG FOR FUNCTIONS 2 AND 4, I FLAG IS LEFT AS IS FOR FUNCTION 0, INTERRUPTS ARE FORCED OFF (CLI) AND FORCED 0 (STI) BEFORE DOING IRET FOR FUNCTION 1, INTERRUPTS ARE FORCED OFF (CLI) AND FORCED 0 (STI) BEFORE DOING RET 2 INTERNALLY REFERENCED ROUTINES: ; EXTERNALLY REFERENCED ROUTINES: PTR-INC DDS, INT 15H ; ************************************************************************ 2-66 ROM BIOS 0000 0000 0001 0002 0005 0007 0009 OOOB 0000 OOOF 0011 0014 0016 IE 53 E8 OA 74 FE 74 FE 74 80 74 EB ASSUME cs: ROMCODE, CS : DATA KYBD_IO PROC FAR PUSH OS PUSH BX CALL DDS OR AH,AH JZ Kl DEC AH JZ K2 DEC AH JZ K3 SUB AH,2 JZ K4 JMP KYBD_END 0000 E E4 10 CC 2B CC 3B EC 02 39 49 90 ; SAVE CURRENT OS ; SAVE BX TEMPORARI LY ; ; ; ; AH=O ASCILREAD AH=1 ASCI LSTATUS AH=2 SHI FLSTATUS ,AH=4 CLICI<-STATE EXIT ; ; ----- READ THE KEY TO FIGURE OUT WHAT TO DO 0019 0019 OOlA OOlE 0022 Kl: FA 8B IE OOIA R 3B IE OOlC R 75 08 CLI MOV CMP JNE BX, BUFFEILHEAD BX, BUFFER_TAIL KLA ; ASCI I READ INTERRUPTS OFF GET POINTER TO HEAD OF BUFFER CHECK FOR HEAD = TAIL JUMP IF SOMETHING IN BUFFER ISSUE KEYBOARD BUSY WAIT 0024 0027 0029 B8 9002 CD 15 FB 002A EB ED MOV INT STI CALL KEYBOARD BUSY HANDLER AX,09002H ISH INTERRUPTS ON BIOS INT ISH WILL RETURN HERE WHEN HEAD JMP Kl <> TAIL ; LOOP BACK TO WAIT FOR BFR NOT EMPTY DATA IN KEYBOARD BUFFER 002C 002C 002E 0031 0035 8B E8 89 EB 07 03A4 R IE OOlA R 2A 90 KLA: MOV CALL MOV JMP AX, [BX] PTILINC BUFFEILHEAD, BX KYBD_END ; ; ; ; GET SCAN CODE AND ASCI I CODE MOVE POINTER TO NEXT POSITION STORE VALUE IN VARIABLE RETURN ;----- ASCII STATUS 0038 0038 0039 0030 0041 0043 0044 0045 0046 K2: FA 8B 3B 8B FB 5B IF CA CLI MOV CMP MOV STI POP POP RET IE OOlA R IE OOlC R 07 0002 , BX, BUFFER_HEAD BX, BUFFEILTAIL AX, [BX] BX OS 2 I NTERRUPTS OFF GET HEAD POINTER I F EQUAL (Z=l) THEN NOTHING THERE RE-ENABLE INTERRUPTS RECOVER REGISTER ; RECOVER SEGMENT ; THROW AWAY FLAGS ;----- SHIFT STATUS 0049 0049 004C K3: AO 0017 R EB 13 90 MOV JMP , AL,KB_FLAG KYBD_END GET THE SHI FT STATUS FLAGS RETURN ;----- CLICK STATE 004F 004F 0051 0053 0058 0058 005A 005C 0061 0061 K4: OA CO 75 05 80 26 00B4 R F7 OR JNZ AND AL,AL ; TURN OFF KEYBOARD CLICK? ; JUMP FOR RANGE CHECK K5 KB_NMLCNTL, NOT CLI CI<-ON ; TURN OFF CLI CK CMP JNE OR AL,l ; RANGE CHECK KYBD_END ; NOT I N RANGE, RETURN KB_NMLCNTL,CLICI<-ON ; TURN ON KEYBOARD CLICK K5: 3C 01 75 05 80 OE 00B4 R 08 5B KYBD_END: POP BX ; RECOVER REGISTER ROM BIOS 2-67 0062 0063 IF CF POP IRET RECOVER REGISTERS RETURN TO CAllER DS KYBD_IO ENDP 0064 Level 1 Interrupt Hex 9 (KYBD_INT9) ** I NT 9 ************************************************************* ROUTINE-NAME: KYBD_INT9 FUNCTION: THIS ROUTINE IS ACTIVATED BY A INTERRUPT 9 (HARDWARE INT 1) IT READS PORT 60 AND PROCESSES THAT SCAN CODE BY EITHER SETTING/ RESETTING ITS FLAG OR TRANSLATING THE SCAN CODE INTO AN EXTENDED ASCII CODE AND PLACING IT IN THE ASCII BUFFER. THIS INTERRUPT SERVICE ROUTINE TRIGGERS THE KYBD_ClR NMI. THE NMI DOES NOT GO INTO EFFECT UNTIL A NON-SPECIFIC EO! !S DONE NEAR THE EXIT OF THIS ROUTINE. ENTRY CONDITIONS: PURPOSE OF ENTRY: PROCESS THE SCAN CODE IN PORT 60H INPUT CONDITIONS: cs: ROMCODE SEGMENT RESTRI CTIONS: EXIT CONDITIONS: NORMAL EXIT CONDITIONS: ASCII BFR HAS 2 BYTE EXTENDED ASCII CODE ERROR EXIT CONDITIONS: N/A REGISTERS MODIFIED: NONE INTERRUPTS: FORCED ON UPON ENTRY (STI) INTERNAll Y REFERENCED ROUTINES: PTR_I NC EXTERNAllY REFERENCED ROUTINES: DDS, INT 5H, KB_NOISE, INT 15H, INT IBH, ********************************************************************** 0064 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 0071 0073 0074 0076 0078 007A 007C 007E FB 50 53 51 52 56 57 IE 06 FC E8 E4 50 E4 8A OC E6 86 E6 0080 58 0000 60 61 EO 80 61 EO 61 KYBD_INT9 PROC FAR STI PUSH AX PUSH BX PUSH CX PUSH DX PUSH 51 PUSH DI PUSH DS PUSH ES ClD CAll DDS Al,KB_DATA IN PUSH AX AL, KB_CTL IN MOV AH,Al OR Al,80H KB_CTL,Al OUT XCHG AH,Al KB_CTl,Al OUT POP AX AllOW FURTHER INTERRUPTS FORWARD DIRECTION READ I N THE CHARACTER SAVE IT GET THE CONTROL PORT SAVE VALUE RESET BIT FOR KEYBOARD GET BACK ORIGINAL CONTROL KB HAS BEEN RESET NOTE: THIS WIll GENERATE A KB_ClR NMI UPON INT9 EOI. RECOVER SCAN CODE ALLOW OPERATING SYSTEM INTERCEPT (INT 15 FUNCTION 4FH) (AH = 4FH , Al = SCAN CODE) 0081 B4 4F 2-68 ROM BIOS MOV AH,4FH 0083 0084 0086 F9 CD 15 73 60 0088 8A EO STC INT JNC PRE SET CARRY FOR INTERCEPT CHECK MOV KEYPAD /, * 008A 008F 0091 0096 0099 0098 009E OOAO OOAO 00A5 00A7 OOAA OOAF F6 74 80 80 74 80 75 06 21 36 FC 05 FC 12 009 R 02 F6 75 E9 80 E9 06 0018 R 08 03 0320 R 26 0018 R F7 0396 R 00B2 00B4 00B6 OOBB 3C 75 80 E9 EO 08 OE 0096 R 02 0396 R OOBE OOCO 00C2 3C FF 75 03 E9 0386 R 0096 R 02 35 37 AH,AL MAKES KB_FLAL3, LCHC TEST HAS AN EOH 8EEN PROCESSED? K9_1 JZ NO, JUMP XOR KB_FLAL3, LCHC YES, RESET FLAG CMP AH, P60_SLASH_SC KEYPAD / KEY? JE K6_1 YES, JUMP CMP AH, P60J.STRICSC KEYPAD * KEY? K9_1 JNE NO, JUMP K6_1: TEST KLFLAL1,HOLD_STATE ; IN HOLD STATE? K6_5 ; YES,AROUND JNZ JMP K55 ; NO,JUMP LEAVING /, * AS IS K6_5: AND KLFLAG_1,NOT HOLD_STATE; RST HLD ST, DISCARD KEY JMP KY8DLEXIT ; EXIT INT9 ROUTINE , ----- -------------- - --; HIDDEN CODE - EOH CMP KL1: JNE OR JMP - AL,HIDN_CODE_EO ; IS P60 SC A HIDDEN CODE? K1O_1 NO, JUMP KBJLAG_3,LCHC ; SET FLAG KYBD9_EXIT ; EXIT ROUTINE , -------- - -- - - - - -- - - - - - -; OVERRUN SC - K10_1: JNZ JMP FFH CMP AL ,OFFH K14_S1 K62 00E4 00E4 00E6 00E8 00E8 ; IS THIS AN OVERRUN CHAR ; NO, TEST FOR SYS REQ KEY ; BUFFERJULL_BEEP , -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - -- - - - - - - -; SYSTEM REQUEST MAKE/BREAK 00C5 00C5 00C7 00C9 OOCE 0000 0005 0007 0009 0009 OODB 0000 00E2 IF NO CARRY THEN VECTOR INTERCEPT ELSE PROCESS KEY HERE: SAVE SCAN CODE IN AH ALSO 3C 75 F6 75 80 BO EB 54 10 06 0018 R 04 18 OE 0018 R 04 00 OB 3C 75 80 BO 04 OE 26 0018 R FB 01 B4 85 CD 15 E9 0396 K14_S1 : CMP JNE TEST JNZ OR MOV JMP K14_S2 : CMP JNE AND MOV (INT 15H AL,SYSREQ~AKE K14_S2 KB_FLAL1, SYS_SHI FT K14_S4 KB_FLAG_1, SYS_SHI FT AL,OO SHORT K14_S3 FUNCTION 85H) SYSTEM REQUEST KEY MAKE NO, GO LOOK FOR BREAK ALREADY DEPRESSED? IF SO THEN THROW AWAY MAKE SET SYS REQ DEPRESSED FLAG SET MAKE FLAG GO DO THE INT 15H AL,SYSREQ_BREAK SYSTEM REQUEST KEY BREAK? K16 ; NO, GO TEST FOR SHIFT KEYS KB_FLAG_1,NOT SYS_SHIFT ; RESET SYS REQ DEPRESSED FLAG AL,Ol SET REQUEST BREAK FLAG K14_S3 : MOV INT K14_S4 : JMP AH,85H 15H SET SYSTEM REQUEST NOTI FI CAT! ON KYBD9_EXIT EXIT TEST FOR SHI FT KEYS OOEB OOEB OOED OOEE OOEF 00F2 00F5 00F7 00F9 OOFB 24 7F OE 07 BF 0000 B9 0000 F2/ AE 8A C4 74 03 E9 0187 K16: AND PUSH POP MOV MOV REPNE MOV JE JMP OOFE 0102 81 EF 000 E K17: 2E: 8A A5 0000 E MOV AL,07FH CS ES DI,OFFSET K6 CX,OFFSET K6L SCASB AL,AH K17 K24_0 TESLSHIFT TURN OFF THE BREAK BIT ESTABLISH ADDRESS OF SHIFT TABLE SHI FT KEY TABLE LENGTH LOOK THROUGH THE TABLE FOR A MATCH RECOVER SCAN CODE JUMP I F MATCH FOUND IF NO MATCH, THEN SHIFT NOT FOUND SHI FT KEY FOUND SUB DI,OFFSET K6+1 AH,cs:K7[DI] ADJUST PTR TO SCAN CODE MTCH ; GET MASK INTO AH ROM BIOS 2-69 0107 0109 A8 80 75 54 010B OlOE 80 FC 10 73 OA TEST AL ,80H ; TEST FOR BREAK KEY JNZ K23 ; BREAICSHI FLFOUND ; ------ - -- - - - - - - - - ---- - - - - - - - - - - - - -- - - - --; SHI FT MAKE FOUND, DETERMINE SET OR TOGGLE - --- CMP JAE AH, SCROLLSHI FT K18 ; IF SCRL SFT OR ABOVE, TOGGLE KEY PLAIN SHIFT KEY, SET SHIFT ON 0110 0114 08 26 0017 R E9 0396 R ~----0117 OllA OllA OllF 0121 0123 F6 75 3C 75 06 0017 R 04 F6 52 22 0125 012A 012C 0131 0133 0138 F6 75 F6 75 F6 74 06 0017 R 08 EB 06 0017 R 20 OD 06 0017 R 03 OD 013A 013A 013D 0140 0140 0145 0147 0147 014B 014D 0151 0155 0157 0159 015C E9 01C5 R OR JMP K25_JMP: JMP K25 K18: KBJLAG, CTL_SH 1FT TEST K25_JMP JNZ AL, INS_KEY CMP JNE K22 JUMP TO K25 FOR JNZ' s BELOW SHI FT - TOGGLE CHECK CTL SHI FT STATE JUMP IF CTL STATE CHECK FOR INSERT KEY JUMP I F NOT I NSERT KEY [[[[ INSERT KEY HIT llll KB_FLAG, AL LSHIFT CHECK FOR ALTERNATE SHI FT TEST K25_JMP ; JUMP IF ALTERNATE SHIFT JNZ KBJLAG, NUM_STATE ; CHECK FOR BASE STATE K19 : TEST JNZ K21 ; JUMP IF NUM LOCK IS ON TEST KLFLAG, LEFLSHIFT+ RIGHLSHIFT JZ K22 JUMP I F BASE STATE F6 06 0017 R 03 74 F3 84 75 08 30 3C 75 B8 E9 K22: TEST JNZ OR XOR CMP JNE MOV JMP 26 0018 R 37 26 0018 R 26 0017 R 52 2B 5200 0334 R ; TURN ON SHI FT BIT ; INTERRUPLRETURN TOGGLED SHIFT KEY, TEST FOR 1ST MAKE OR NOT K20: MOV JMP K21 : TEST JZ B8 5230 E9 0334 R KLFLAG,AH KYBD9_EXIT NUMERIC ZERO, NOT INSERT KEY PUT OUT AN ASCI I ZERO BUFFERJI LL ; MIGHT BE NUMERIC KLFLAG, LEFLSHIFTt RIGHLSHIFT JUMP NUMERIC, NOT INSERT K20 AX, 5230H K57 AH, KB_FLAG_l KYBD9_EXITl KLFLAG_l,AH KLFLAG,AH AL, INS_KEY KYBDLEXITl AX, I NS_KEY*256 K57 SHFT TOGGLE KEY HIT; PROCESS IS KEY ALREADY DEPRESSED JUMP I F KEY ALREADY DEPRESSED IND THAT THE KEY IS DEPRESSED TOGGLE THE SHIFT STATE TEST 1ST MAKE OF INSERT KEY JUMP IF NOT INSERT KEY SET CODE INTO AH, 0 INTO AL PUT INTO OUTPUT BUFFER --- - -- - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - -- - - - - - -- ; SH I FT BREAK FOUND 015F 015F 0162 0164 0166 016A 016C 016E 0171 0173 0177 0179 017B ------------- - -- - - - - - - - - - - - - - - - -- - - - - -- - - - - - -K23: CMP JAE NOT AND CMP JNE AH, SCROLL_SH I FT K24 AH KLFLAG,AH AL ,AL LKEY+80H KYBDLEXITl BREAK-SH I FT - FOUND IS THIS A TOGGLE KEY YES, HANDLE BREAK TOGGLE INVERT MASK TURN OFF SHI FT BIT IS THIS ALT SHIFT RELEASE GO TO EOI EXIT 80 73 F6 20 3C 75 FC 10 lA D4 26 0017 R B8 16 AO B4 88 3C 74 E9 ; ALLSHIFT RELEASED, PROCESS ALT + KEYPAD (0-9) IF PENDING ; --------- ---------- - -- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - -' - - - -0019 R MOV AL,AL LINPUT 00 MOV AH,O BUILD PSEUDO SC 26 0019 MOV AL LINPUT ,AH CLEAR ALT_INPUT 00 CMP AL,O WAS ALT_INPUT HOLDING? 09 JE KYBDLEXITI NO, EOI EXIT 033D R JMP K58 YES, T, SO PUT IN BUFFER - -- - -- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - -- - - - - - -- - - - - - - - - - - - - - - -- - SHI FT BREAK IS A STATE KEY - TOGGLE FLAG 017E 017E 0180 F6 D4 20 26 0018 R , K24: NOT AND ; LINK TO KEYBOARD EXIT FOR SHORT JUMPS 2-70 ROM BIOS BREAK-TOGGLE INVERT MASK INDICATE STATE EXITED 0184 0184 KYBD9_EXITl: JMP KY BDLEX IT E9 0396 R I NTERRUPLRETURN ; ----- TEST FOR Fll OR Fl2 MAKE 0187 0187 0189 018B 0180 018F 0191 0193 0193 0198 019A 019F 01A2 01A2 01A7 01A9 OIAC OlBl 01B3 01B6 OIBB OlBD OICO OICO 01C2 01C5 01C5 01C7 01C9 OICB 0100 0102 0104 0106 OIDB K24_0: AH HAS BASE Fll EXT ASCII MOV AH, FlLBASL.ASCI I CMP AL,FlLMAKE3C F1l MAKE? K24_l YES, JUMP JE AH HAS BASE F12 EXT ASCI I INC AH AL, FlLMAKE_SC CMP F12 MAKE? JNE K25 NO, JUMP ; -- -- ----- - -- - ---- -- - -- -- -- -- ------ - - ---- -- - -- -- - -- -- -- - -- -- --- - -- -; F1l / F12 FOUND CHECK FOR ALT+, CTL+, SHIFT+ F1l/F12 B4 3C 74 FE 3C 75 85 57 06 C4 58 32 F6 74 80 E9 06 0018 R 08 08 26 0018 R F7 0396 R K24_l: TEST JZ AND JMP K24_5: TEST F6 06 0017 R OF 74 80 F6 75 80 F6 75 80 17 C4 06 00 EC 06 03 EC 01E8 01E8 OlEO OIEF 01F1 K25: MOV CMP JAE 8A EO 3C 80 73 B9 F6 74 3C 74 80 E9 AH,AL AL,80H KYBDLEXITl TEST JZ CMP JE AND JMP 06 0018 R 08 OC 45 AE 26 0018 R F7 0396 R F6 06 0017 R 08 75 03 EB 60 90 F6 74 3C 75 06 00 53 09 CLEAR AL TO MAKE AX EXTNDED SC GO BUFFER Fll/F12 EXT ASCI I NO-SHI FT -FOUND RESTORE AH AFTER Fll/ F12 TEST 8REAK SC? ; YES, EOI EXIT ; ««««< ; < NO BREAK ; ««««< )»»>> » »»») CODES PAST HERE KBJLAG....l,HOLD_STATE ; ARE WE IN HOLD STATE K28 ; BRANCH AROUND TEST I F NOT AL,NUM-KEY ; CAN' T END HOLD ON NUtLLOCK KYBDLEXITl KB_FLAG_l,NOT HOLD3TATE ; TURN OFF HOLD STATE BIT KYBDLEXIT HOLD STATE, TEST FOR SPECIAL CHARS K28: TEST JNZ JMP KB_FLAG,AL LSHI FT K29 K38 ; ; ; ; NO-HOLD-STATE ARE WE IN ALTERNATE SHI FT JUMP IF ALTERNATE SH 1FT JUMP I F NOT ALTERNATE ; - -- ----- --- -- --- -- -- --- ---- --- -- ---- -- --- - - - -- -- -- -- -- - -TEST -RESET K29: KB_FLAG,CTL_SHI FT ARE WE IN CONTROL SHI FT ALSO 0017 R 04 TEST NO_RESET K3l JZ AL,DEL_KEY SHI FT STATE THERE, TEST KEY CMP NO_RESET JNE K3l , 01F3 01F9 KB_FLAG ,ALLSHI FT +CTL_SHI FT +LEFLSHI FT +RIGHT_SH I FT ANY SHIFT STATES? K24_7 NO, AROUND WITH BASE Fll/Fl2 AH,6 AH HAS ALT+F1l/F12 EXT ASCII KB_FLAG, AL LSH I FT ALT SHIFT CASE? K24_7 YES, JUMP AH,2 AH HAS CTL +Fll/F12 EXT ASCII KB-FLAG, CTL_SHI FT CTL SH I FT CAS E? K24_7 YES, JUMP AH HAS SHIFT+Fll/F12 EXT ASCII AH,2 JZ ADD TEST JNZ SUB 02 0017 R 04 TEST JNZ 02 SUB K24_7 : 2A CO SUB AL,AL E9 0364 R JMP K6l , - -- - -- --- -- -- ---- -- -- -- --; TEST FOR HOLD STATE 06 0017 R 08 NOT IN OlOE OlOE 01E3 01E5 KB_FLAG_l,HOLD_STATE ; HOLD STATE? K24_5 ; NO, AROUND KB_FLAG_l,NOT HOLD_STATE; YES, ENTERED KEY ONLY KYBDLEXIT ; RESETS HOLD STATE ClL-ALT -DEL C7 06 0072 R 1234 E9 0000 E MOV JMP ENTERED, DO I/O CLEANUP FOR SOFT START RESELFLAG, l234H START ; SET FLAG FOR RESET FUNCTION ; JUMP TO POWER ON DIAGNOSTICS ROM BIOS 2-71 01FC 01FC 01FE 0200 0202 3C 75 80 E9 K31 : CMP JNE MOV JMP 39 05 20 0334 R NO-RESET TEST FOR SPACE KEY NOT THERE SET SPACE CHAR BUFFERJILL AL,57 K32 AL, t , K57 LOOK FOR KEY PAD ENTRY 0205 0205 0208 0208 0200 020F 0213 0216 0218 021A 021C 021F K32 : MOV MOV REPNE JNE SUB MOV MOV MUL ADD MOV JMP 8F 0000 E 89 OOOA F2/ AE 75 13 81 EF 0001 AO 0019 R B4 OA F6 E4 03 C7 A2 0019 E9 0396 --- ALT + (KEYPAD 0-9) MAKE -- DI,OFFSET K30 CX,10 SCASB K33 DI,OFFSET K30+1 AL, AL LI NPUT AH,10 AH AX,DI AL LINPUT ,AL KYBDLEXIT LOOK FOR SUPERSHI FT ENTRY 0222 0222 0227 022A 022C 022E 0230 C6 06 0019 R 00 89 001A F2/ AE 75 05 BO 00 E9 0334 R K33 : MOV MOV REPNE JNE MOV JMP AL LINPUT,O CX,26 SCASB K34 AL,O K57 CHECK FOR TOP ROW KEYS 0233 0233 0235 0237 0239 023B 023E 0240 3C 72 3C 73 80 80 E9 K34: CMP JB CMP JAE ADO MOV JMP 02 DC OE 08 C4 76 00 0334 0254 0254 0259 K35 : CMP JAE K36: JMP K37: CMP JAE MOV JMP 3C 3B 73 03 E9 0396 R 3C 73 BB E9 47 F9 0000 037C F6 06 0017 R 04 74 65 K38: TEST JZ ADD IN THE LATEST ENTRY STORE IT AWAY THROW AWAY THAT KEYSTROKE -- AL T + A-Z TYPEWRITER MAKE NO-ALT -KEYPAD ZERO PREVIOUS ENTRY IN INPUT 01, ES ALREADY POINTING LOOK FOR MATCH IN ALPHABET NOT FOUND, FN KEY OR OTHER ASCI I CODE OF ZERO PUT IT IN THE BUFFER -- ALT + PCl (1-9,-,=) MAKE - AL,2 K35 AL,14 K35 AH,118 AL,O K57 KEY I N TOP ROW? NO, JMP NO, JMP BUILD PSEUDO SC BUFFER_FILL CHECK FOR Fl - FlO 0243 0243 0245 0247 0247 024A 024A 024C 024E 0251 ALT -KEY-PAD ALT -INPUT-TABLE LOOK FOR ENTRY US I NG KEYPAD LOOK FOR MATCH NO--AL LKEYPAD 01 NOW HAS ENTRY VALUE GET THE CURRENT BYTE MUL TIPLY BY 10 --- ALT + (Fl - FlO) MAKE --- AL, FLKEY K37 SC POTENTIAL FUNCTION KEY? YES, JMP NO. THIS KEY NOT SUPPORTED IN ALT_SHIFT. EOI RETURN. AL,ll K36 BX,OFFSET K13 K63 SC IN FI-FlO REGION? NO, JMP TO EXIT ALT+(Fl-FIO) EXT ASCII TABLE GO XLATE & BUILD PSEUDO SC ««< »»> ««>> KBJLAG, CTL_SHI FT K44 IN CTL_SHIFT? NO, JMP ------------------- - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- ; IN 025B 0250 3C 46 75 18 025F 0263 0267 026B 0270 0272 8B 89 89 C6 CD 2B CTL_SHIFT CMP JNE STATE W/O ALLSHIFT AL, SCROLL_KEY K39 CTL+BREAK ENTERED IE IE IE 06 lB CO 0080 001A 001C OOll R R R R 80 2-72 ROM BIOS MOV MOV MOV MOV INT SUB - ; TEST FOR BREAK ; NO- BREAK CLEAN UP & DO INT IBH - CTL + BREAK MAKE BX,8UFFER_START BUFFER_HEAD,BX BUFFER_TAIL, BX BIOS_BREAK,80H lBH AX,AX RESET BUFFER TO EMPTY TURN ON BIOS_BREAK BIT BREAK INTERRUPT VECTOR PUT OUT DUMMY CHARACTER 0274 0277 0277 0279 E9 0334 R JMP K39: CMP JNE 3C 45 75 2E 027B 0280 0282 80 OE 0018 R 08 BO 20 E6 20 OR MOV OUT 0292 0292 0295 0298 0299 029A 029D 029F 02M 02A6 02A9 B8 BB IE 07 BF CD F6 75 E9 - BUFFEILFI LL NO-BREAK LOOK FOR PAUSE KEY NO-PAUSE EOI & SLEEP UNTIL UNPAUSE - CTL + NUM_LOCK MAKE KB_FLAG_1,HOLD_STATE ; TURN ON THE HOLD FLAG AL,EOI ; EOI TO ALLOW MORE KEYSTROKES 020H,AL DURING PAUSE INTERVAL, TURN CRT BACK ON , 80 74 BA AO EE AL,NUMJEY K41 PAUSE ENTERED , 0284 0289 028B 028E 0291 K57 3E 0049 R 07 07 03D8 0065 R CMP JE MOV MOV OUT CRT-HODE,7 K40 DX ,03D8H AL, CRLMODE_SET DX,AL CURRENTLY USING MONO? YES, JMP TO SLEEP PORT FOR COLOR CARD GET CURRENT MODE VAULE SET THE CRT MODE ON ISSUE SYS SERVICES INT, WAIT ON EXTERNAL EVENT FUNCTION (WAIT UNTIL HOLD_STATE BIT OF KB_FLAG_1 IS RESET) K40: 4104 MOV AX, 4104H FUNCTION 41H, AL=04=RETURN IF 0 0800 MOV BX,HOLD_STATE*100H BH=HOLD_STATE, BL=O=NO TIME OUT PUSH DS MAKE ES:DI POINT TO KB_FLAIL1 POP ES 0018 R MOV DI,OFFSET KBJLAG_1 15 INT 15H ; SLEEP UNTI L OUT OF HOLD 06 0018 R 08 TEST KB_FLAG_1,HOLD_STATE; DID INT 15H RESET HOLD_STATE? EC JNZ K40 ; NO, KEEP LOOPING 039B R JMP KYBD9_RET ; YES, GO TO NON_EO I EXIT K41: ;----- TEST FOR PRINT SWITCH TOGGLE CMD 02A9 02AB 02AD 02BO 3C 75 B8 E9 37 06 7200 0334 R CMP JNE MOV JMP AL, P60--ASTRLSC K42 AX ,114*256 K57 CHECK FOR TYPEWRITER KEYS 02B3 02B3 02B6 02B8 K42: MOV CMP JB BB 0000 3C 3B 72 76 BX,OFFSET K8 AL, FLKEY K56 [[[ CTL + */PRTSC MAKE ]]] * KEY HIT? NO, JMP YES, BUILD TOGGLE_PRLSW PSEUDO SC BUFFER_FILL [[[ CTL + TYPEWRITER KEY MAKE 1]] BX <=== CTL + TYPEWRITER KEYS TABLE SC BELOW TYPEWRITER REGION? YES, GO TRANSLATE TO ASCII CODE KEY IS IN FN OR KEYPAD REGION [[[ CTL + (F1-F10) ]]] [[[ CTL + PAGE/CURSOR KEY]]] 02BA 02BA 02BD K43: MOV JMP BB 0000 E E9 037C R BX,OFFSET K9 K63 CTL FN & CTL PAGE/CUR TBLS GO XLATE & BUILD PSEUDO SC <<<<< ««< NOT IN CTL_SHI FT ««< NOR AL LSHI FT >>>>> »»> »»> CHECK IF KEY IN KEYPAD REGION (1-9,.,-,+) 02CO 02CO 02C2 02C4 02C9 3C 73 F6 74 47 2C 06 0017 R 03 5A IN K44: CMP JAE TEST JZ SHIFT STATE AL,71 ; KEY IN KEYPAD REGION? K48 ; YES, JMP KB_FLAG,LEFLSHIFT+RIGHLSHIFT ; IN SHIFT STATE? K54 ; NO, JMP ,BUT KEY IS NOT IN KEYPAD REGION CHECK FOR BACK TAB 02CB 02CD 02CF 02D2 3C 75 B8 EB OF 05 OFOO 60 CMP JNE MOV JMP AL, TAB_KEY K45 AX, TAB_KEY*256 SHORT K57 [[[[ SHIFT + TAB ]]] TAB KEY? NO ,JMP BUILD BACK_TAB PSEUDO SC BUFFER_FILL ROM BIOS 2-73 CHECK FOR PRINT SCREEN 0204 0204 0206 0208 02DA 02DC 02DE 3C 75 BO E6 CD E9 K45: CMP JNE 37 09 20 20 05 039B R - EOI THEN INT 5H Al, P60--ASTRLSC K46 Al, EOI INTAOO,Al 5H KYBDLRET MOV OUT INT JMP 3C 72 BB E9 K46: CMP JB 3B 06 0000 E 037C R Al, FLKEY K47 BX,OFFSET K12 K63 MOV JMP KEY IS IN TYPEWRITER REGION 02EB 02EB 02EE PRINT SCREEN KEY? NO, JMP EOI TO AllOW MORE INTERRUPTS ISSUE PRINT SCREEN INTERRUPT GO TO NON_EO I EX IT [[[ SHIFT + (Fl-FlO) ]]] CHECK FOR FUNCTION KEY 02El 02El 02E3 02E5 02E8 - SHIFT + */PRTSC Fl - FlO KEY? NO, JMP BX SHIFT F1-FlO EXT ASCII TBl GO XLATE & BUilD PSEUDO SC [[[ SHIFT + TYPEWRITER KEY]]] K47 : BB 0000 EB 40 MOV BX,OFFSET Kll SHORT K56 JMP ; BX=UPPERCASE ASCI I CODE TBl ; GO TRANSLATE TO ASCI I CODE -- - -- - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -; KEYPAD KEY: NOT IN AlT OR CTl SHIFT:DETERMINE IF KEYPAD OR PG/CUR ----------- - -- - - - - - - - - -- - - - - - - - - - - -- - - - - -- - - - - - - - - - - - - - - - - - -- - - - - - -- 02FO 02FO 02F5 02F7 02FC F6 75 F6 75 06 0017 R 20 20 06 0017 R 03 20 K48: TEST JNZ TEST JNZ KBJlAG,NUM_STATE ; IN NUM_STATE? K52 ; YES, JMP KBJlAG, lEFLSHI FT +RIGHLSHI FT ; NUM_STATE? K53 ; YES, GO PROCESS BASE CASE KEYPAD (PAGE/CURSOR) KEY -PAGE/CURSOR, DEL, -, + --02FE 02FE 0300 0302 0304 0306 0308 030B 0300 0300 0310 0312 0312 0315 3C 74 3C 74 2C BB EB K49 : CMP JE CMP JE SUB 4A OB 4E OC 47 0000 71 MOV JMP K50: MOV B8 4A2D EB 22 JMP K51 : MOV B8 4E2B EB 10 JMP IN NUM_STATE 0317 0317 031C F6 06 0017 R 03 75 EO 031E 031E 0320 0323 2C 46 BB 0000 EB OB K52 : TEST JNZ K53: SUB MOV JMP Al,KYPDJ1INUS K50 Al, KYPD_PlUS K51 Al,71 BX,OFFSET K15 SHORT K64 AX,74*256+'SHORT K57 , AX, 78*256+' +' SHORT K57 - KEYPAD MINUS KEY? YES, JMP KEYPAD PLUS KEY? YES, JMP ADUST SC FOR TABLE OFFSET BX=KEYPAD AREA BASE CASE TBl GO TRANSLATE & BUilD PSEUDO SC BlD EXT ASCI I CODE FOR MINUS BUFFEILFIll BlD EXT ASCI I CODE FOR PLUS BUFFEILFIll CHECK IF TEMPORARilY SHIFTED OUT KB_FlAG, lEFT _SHI FT +RI GHT_SHI FT K49 Al,70 BX ,OFFSET K14 SHORT K56 ; NOT NUM STATE? ; YES, JMP TO BASE ; KEYPAD XlAT [[[ KEYPAD 0-9, ., -, + ]]] ADJUST SC FOR TABLE OFFSET BX=KEYPAD KEYS' ASCI I CODES GO XLATE & BUilD ASCII CODE ------------------------------------------------------- ; NOT IN ANY SHI FT STATE ; KEYPAD REGION HAS BEEN PROCESSED (SC 69 & UP) CHECK FOR F1-F10 0325 0325 0327 0329 032B 3C 72 BO EB 3B 04 00 37 K54: CMP JB MOV JMP Al,FLKEY K55 Al,O SHORT K61 - [[[ BASE Fl - FlO ]]] FUNCTI ON KEY? NO, JMP SCAN CODE IN AH ALREADY BUFFER_Fill KEY MUST BE FROM TYPEWRITER REGION -- BASE TYPEWRITER KEY --- 2-74 ROM BIOS 0320 0320 K55: MOV SS 0000 ; T RAN S L ATE 0330 0330 0332 K56 : DEC XLAT FE C8 2E: 07 ; 8X=SASE CASE ASCI I TSL 8X,OFFSET K10 SC TO EXTENDTEO ASCII CODE AL cs: Kll BUFFER ; ADJUST SC FOR TABLE OFFSET ; TRANSLATE FROM TABLE IN BX PUT CHARACTER INTO BUFFER 0334 0334 0336 0338 0338 3C 74 80 74 K57 : CMP JE CMP JE FF IF FC FF 1A AL ,-1 K59 AH, -1 K59 IGNORE CODE XLATED FROM TABLE? YES, GO TO EOI EXIT IGNORE PSEUDO SCAN? YES, GO TO EOI EXIT CHECK FOR CAPS_STATE 0330 0330 0342 F6 06 0017 R 40 74 20 ; K58: TEST JZ KB_FLAG,CAPS_STATE; ARE WE IN CAPS LOCK STATE K61 ; SKIP IF NOT ;----- DETERMINE WHICH WAY TO CONVERT 0344 0349 F6 06 0017 R 03 74 OF 034B 0340 034F 0351 0353 0355 0357 0357 3C 72 3C 77 04 EB TEST JZ CMP JB CMP JA ADD JMP K59: JMP EB 3D 90 3C 72 3C 77 2C 61 06 7A 02 20 K60: CMP JB CMP JA SUB »»» »»» IN SHI FT STATE? ; NO, JMP ALPHABETI C CHARS ONLY AL, I AI ALPHABETIC CHAR? NO, JMP K61 AL, 'Z' K61 AL, I a ,_, AI SHORT K61 NO, JMP YES, CONVERT TO LOWER CASE. GO BUFFER KYBDLEXIT CONVERT LOWER CASE TO UPPER 035A 035A 035C 035E 0360 0362 IN CAPS_STATE KB_FLAG, LEFT _SHI FT +RI GHT_SH I FT K60 CONVERT UPPER CASE TO LOWER 41 15 5A 11 20 00 ««« ««« INTERRUPT_RETURN ALPHABETI C CHARS ONLY AL, I a I K61 AL, I z I K61 AL, 'a'-'A' ALPHABETIC CHAR? NO, JMP NO, JMP YES, CONVERT TO UPPER CASE , ---- ------------- - -- - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - -; BUFFER EXTENDED ASCI I CODE I F NOT FULL 0364 0364 0368 036A 0360 0371 0373 0375 0379 -- ------------------------ -- - - - - - - - - - - - - - - - - - - - - -- -- 8B 8B E8 3B 74 89 89 EB IE 001C R F3 03A4 R IE 001A R 13 04 IE 001C R 1B 90 K61 : MOV MOV CALL CMP JE MOV MOV JMP BX,BUFFER_TAIL SI, BX PTR_INC BX, BUFFER_HEAD K62 [SI],AX BUFFER_TAIL,BX KYBD9_EXIT GET BUFFER TAIL POINTER SI <=== TAIL PTR ADVANCE THE TAIL HAS BUFFER WRAPPED AROUND? YES, GO GIVE BUFFER_FULL_BEEP NO, BUFFER THE CODE UPDATE TAIL PTR GO TO EOI EXIT TRANSLATE F1-FlO SCAN CODES TO AN EXTENDED ASCII CODE (FOR SHIFT, ALT, & CTL STATES) 037C 037C 037E 037E 2E: 07 0380 0382 0384 8A EO BO 00 EB AE 2C 3B K63: SUB K64: XLAT MOV MOV JMP AL, FLKEY cs :K9 AH,AL AL,O K57 - ; ADJUST SC FOR TABLE OFFSET XLAT FROM TABLE IN BX (K9,K12,K13) BUILD EXTENDED ASCII CODE GO BUFFER ROM BIOS 2-75 BUFFER IS FULL, SOUND THE BEEPER 0386 0386 0388 038A 038D 0390 0393 BO E6 BB B9 E8 EB 20 20 0053 0081 0000 E 06 90 K62 : MOV OUT MOV MOV CALL JMP AL, EO! INTAOO,AL BX,083 CX,081H KB_NOISE KYBD9_RET , - - -- - - -- - - - - - -- - - - -- - - - - - -- END OF INTERRUPT COMMAND SEND CMD TO INT CONTROL PORT NO. CYCLES FOR 83 MSEC TONE 1/2 CYCLE FOR 1KHZ TONE RETURN WITHOUT EOI ; ISSUE EOI & RETURN ----- - -- - - - - -- - - - - - -- -- - - -- 0396 0396 0397 0399 KYBD9_EXIT : CLI MOV AL,EOI OUT INTAOO,AL FA BO 20 E6 20 TURN OFF INTERRUPTS ISSUE EOI RETURN WITH EOI ALREADY ISSUED 039B 039B 039C 039D 039E 039F 03AO 03Al 03A2 03A3 03A4 KYBD9_RET: POP ES POP DS POP DI POP SI POP DX POP CX POP BX POP AX IRET KYBD_INT9 ENDP 07 IF 5F 5E 5A 59 5B 58 CF RESTORE REGS ; RETURN: I RPTS SET BACK AS WERE ; ********************************************************************** ROUTINE-NAME: FUNCTION: PTR_INC INCREMENT THE KEYBOARD BUFFER POINTER AND WRAP THE BUFFER I F NECESSARY. ENTRY CONDITIONS: DS= DATA SEGMENT BX= POINTER TO INCREMENT EXIT CONDITIONS: BX INCREMENTED BY 2 AND I F BUFFER_END EXCEECE BX IS SET TO BUFFER_START. REGISTERS MODIFIED: BX 03A4 03A4 03A5 03A6 03AA 03AC 03BO 03BO 03B1 03B1 ; ********************************************************************** 43 43 3B IE 0082 75 04 8B IE 0080 C3 PTR_INC PROC NEAR INC BX INC BX CMP BX, BUFFER-END PTR_Ol JNE MOV BX, BUFFER-START PTR_01 : RET PTR-INC ENDP ROM CODE ENDS END 2-76 ROM BIOS MOV E TO NEXT WORD IN LIST AT END OF BUFFER? NO, CONTI NU E YES, RESET TO BUFFER BEGINNING Video I/O and Print Screen (B12VIDEO) ROMCOOE SEGMENT BYTE PUBLIC ASSUME CS: ROMCODE IDENT BI2VIDEO,12,00 0000 ; ******************************************************************** MODULE-NAME: B12VIDEO DATE LAST MODI FlED: 09(12(85 DESCRIPTIVE-NAME: VIDEO_IO AND PRINT SCREEN BIOS COPYRIGHT: 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: 0.0 FUNCTION: VIDEO_IO HANDLES ALL BIOS VIDEO REQUESTS HANDLES THE PRINT SCREEN FUNCTION PRINLSCREEN MODULE SIZE: 2829 BYTES ENTRY CONDITIONS: REFER TO ROUTINE PROLOGUES EXIT CONDITIONS: REFER TO ROUTINE PROLOGUES ROUTINES IN MODULE: VIDEO_IO PRINLSCREEN INTERNAL DATA AREAS INT 10H DISPLAY INTERFACE ROUTINES INT 5H PRINT SCREEN INTERRUPT HANDLER TABLES: MLl, REGS_PUSHD, VI EXTERNALLY REFERENCED ROUTINES: REFER TO EXTRN LIST EXTERNALLY REFERENCED DATA AREAS: DATA SEG, XXDATA SEG, VIDEO RAM , CHANGE ACTIVITY: NONE ; ******************************************************************** ; ***************************************************************** ;* EXT ERN A L REF ERE N C E S ; ***************************************************************** ROUTINES EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN DDS: NEAR BEEP:NEAR KB_NOISE:NEAR GELRTLREG: NEAR PULRTLREG:NEAR LCDINIT:NEAR EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN CHAILGEN_LO: BYTE CHAR_GEN_HI: BYTE M4 :ABS M5:WORD M6:BYTE M7: BYTE TABLES ROM BIOS 2-77 MONO_TBL: WORD CGA_TBL: WORD EXTRN EXTRN EXTRN EXTRN LCD~ONO_TBL: WORD LCD_CGA_TBL: WORD ***************************************************************** PUBLICS DECLARATION ***************************************************************** PUBLIC PUBLI C PUBLIC PUBLIC PUBLIC PUBLI C PUBLIC PUBLIC PUBLIC PUBLIC PUBLI C PUBLIC PUBLIC VIDEO_IO_l PRLSCRN SELMODE SELCTYPE SELCPOS READ_CURSOR READ_LPEN ACLDISP_PAGE SCROLLUP SCROLL_DOWN READ_ALCURRENT WRITUILCURRENT WRITE_LCURRENT PUBLIC SET_COLOR PUBLIC WRITE_DOT PUBLIC READ_DOT PUBLIC WRITE_TTY SUBTTL VIDEO BIOS - INT lOH ; ******************************************************************** ROUTINE-NAME: FUNCTION: VIDEO_JO THIS ROUTINE HANDLES THE VIDEO BIOS REQUESTS - INT lOH ENTRY CONDITIONS: PURPOSE OF ENTRY: SEE INT 10H DESCRIPTION INPUT CONDITIONS: SEE INT 10H DESCRIPTION RESTRICTIONS: NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: SEE INT 10 DESCRIPTION ERROR EXIT CONDITIONS: NO ERROR REPORTING INTERFACE IS DEFINED REGISTERS MODIFIED: ALL REGISTERS EXCEPT AX ARE SAVED UNLESS THEY ARE USED TO RETURN INFO AS DEFINE IN THE INT 10H DESCRIPTION RETURN TYPE: IRET (ALL FLAGS RESTORED) INTERRUPTS: ENABLED OUR I NG PROCESSI NG INTERNALLY REFERENCED ROUTINES: ACLOISP _PAGE, LCD_REQUEST, PHYS_DSP _DESCR_REQ, PRLSCREEN, READ-ALCURRENT, READ_CURSOR, READ_DOT, READ_LPEN, SCROLL_UP, SCROLL_DOWN, SELCOLOR, SELCPOS, SELCTYPE, SELMODE, VIDEO_STATE, WRITE-ALCURRENT, WRITE_LCURRENT, WRITE_DOT, WRITE_STRI NG, WRITE_TTY EXTERNALL Y REFERENCED ROUTI NES: DDS, BEEP, KB_NOISE, GET _RTLREG, PULRTLREG, LCDINIT ; ********************************************************************* 2-78 ROM BIOS - - - I NT lOH - - -- - - -- -- - - -- - - - - - - -- - - - - - - - - - - -- -- - - - - - - - - -- - - - - - - - - - -VIDEO_IO THESE ROUTINES PROVIDE THE CRT INTERFACE THE FOLLOWI NG FUNCTIONS ARE PROV I OED: (AH) =OOH SET MODE (AL) CONTAINS MODE VALUE TYPE RES/DIM DISPLAY MAX PAGES (AL)=O (AL) =1 (AL)=2 (AL) =3 (AL)=4 (AL) =5 (AL) =6 (AL) =7 NOTE: ALPHA ALPHA ALPHA ALPHA GRAPHICS GRAPHICS GRAPHICS ALPHA 40X25 40X25 80X25 80X25 320X200 32DX200 640X200 80X25 COLOR - BW** 8 COLOR 8 COLOR - BW** 4 COLOR 4 COLOR 1 COLOR - BW 1 COLOR - BW 1 MONOCHROME 1/4 NOTES * DEFAULT * INTERNAL IF HIGH BIT OF AL IS SET, THE REGEN BUFFER IS NOT CLEARED. FOR MONOCHROME, CRT MODE WILL INTERNALLY DEFAULT TO 7. FOR MONO ON LCD THE MAXIMUM PAGES ALLOWED IS 4, OTHERWISE THE MAXIMUM PAGES ALLOWED IS 1. FOR COLOR, AL=(7-255) WILL DEFAULT TO MODE 3 BW MODES OPERATE SAME AS COLOR MODES, BUT COLOR BURST IS NOT ENABLED (AH)=OlH SET CURSOR TYPE (CH) = BITS 4-0 = START LINE FOR CURSOR ** HARDWARE WILL ALWAYS CAUSE BLINK ** SETTING BIT 5 OR 6 WILL CAUSE ERRATIC ** BLINKING OR NO CURSOR AT ALL (CL) BITS 4-0 = END LINE FOR CURSOR (AH)=02H SET CURSOR POSITION (BH) = PAGE NUMBER (MUST BE 0 FOR GRAPHICS MODES) (DH,DL) = ROW,COLUMN (0,0) IS UPPER LEFT ROW = (0 - 24), COL = (0 - (CRT COLUMNS-i)) CRT COLUMNS IS EITHER 80 OR 40 (AH)=03H READ CURSOR POSITION (BH) = PAGE NUMBER (MUST BE 0 FOR GRAPHICS MODES) ON EXIT: (DH,DL) = ROW,COLUMN OF CURRENT CURSOR (CH,CL) = CURSOR MODE CURRENTLY SET (AH)=04H READ LIGHT PEN POSITION ON EXIT: (AH) = 0 -- LIGHT PEN SWITCH NOT DOWN/NOT TRIGGERED (AH) = 1 -- VALID LIGHT PEN VALUE IN REGISTERS (DH,DL) = ROW,COLUMN OF CHARACTER LP POSN (CH) = RASTER LINE (0-199) (BX) = PIXEL COLUMN (0-319,639) (AH)=05H SELECT ACTIVE DISPLAY PAGE(VALID ONLY FOR ALPHA MODES) (AL)=NEW PAGE VALUE VALID PAGE VALUES: ALSO, SEE AH=OOH FOR PAGE INFO MODES 0 & 1 - (0 - 7) MODES 2 & 3 - (0 - 3) MODE 7 0 MODE 7 & LCD CONFIGURED AS MONO - (0 - 3) (AH)=06H SCROLL ACTIVE PAGE UP (AL) = NUMBER OF LINES, INPUT LINES BLANKED AT BOTTOM OF WINDOW AL = 0 MEANS BLANK ENTIRE WINDOW (CH,CL) = ROW,COLUMN OF UPPER LEFT CORNER OF SCROLL (DH,DL) = ROW,COLUMN OF LOWER RIGHT CORNER OF SCROLL (BH) = ATTRIBUTE TO BE USED ON BLANK LINE ROM BIOS 2-79 (AH) =07H SCROLL ACTIVE PAGE DOWN (AL) = NUMBER OF LINES, INPUT LINES BLANKED AT TOP OF WINDOW AL = 0 MEANS BLANK ENTI RE WI NDOW (CH,CL) = ROW,COLUMN OF UPPER LEFT CORNER OF SCROLL (DH,DL) = ROW,COLUMN OF LOWER RIGHT CORNER OF SCROLL (BH) = ATTRIBUTE TO BE USED ON BLANK LINE CHARACTER HANDLI NG ROUTI NES (AH) =08H READ ATTRI BUTE/CHARACTER AT CURRENT CURSOR POSITION (BH) = DISPLAY PAGE (FOR ALPHA MODES ONLY) ON EXIT: (AL) = CHAR READ (AH) = ATTRIBUTE OF CHAR READ (ALPHA MODES ONLY (AH)=09H WRITE ATTRIBUTE/CHARACTER AT CURRENT CURSOR POSITION (BH) = DISPLAY PAGE (FOR ALPHA MODES ONLY) (CX) = COUNT OF CHARACTERS TO WRITE (AL) = CHAR TO WRITE (BL) = ATTRIBUTE OF CHARACTER (ALPHA)/COLOR OF CHAR (GRAPHICS) SEE NOTE ON WRITE DOT FOR BIT 7 OF BL = l. (AH) =OAH WRITE CHARACTER ONLY AT CURRENT CURSOR POSITION **** NOT VALID FOR MEDIUM RESOLUTION GRAPHICS **** (BH) = DISPLAY PAGE (FOR ALPHA MODES ONLY) (CX) = COUNT OF CHARACTERS TO WRITE (AL) = CHAR TO WRITE FOR READ/WRITE CHARACTER INTERFACE WHILE IN GRAPHICS MODE, THE CHARACTERS ARE FORMED FROM A CHARACTER GENERATOR IMAGE MAINTAINED IN THE SYSTEM ROM. FOR WRITE CHARACTER INTERFACE IN GRAPHICS MODE, THE REPLICATION FACTOR CONTAINED IN (CX) ON ENTRY WILL PRODUCE VALID RESULTS ONLY FOR CHARACTERS CONTAI NED ON THE SAME ROW. CONTINUATION TO SUCCEEDING LINES WILL NOT PRODUCE CORRECTL Y. GRAPH I CS INTERFACE (AH)=OBH SET COLOR PALETTE (BH) = PALETTE COLOR ID BEING SET (0-127) (BL) = COLOR VALUE TO BE USED WITH THAT COLOR ID NOTE: FOR THE CURRENT COLOR CARD, THIS ENTRY POINT HAS MEANING ONLY FOR 320X200 GRAPHICS. COLOR ID = 0 SELECTS THE BACKGND COLOR (0-15) COLOR ID = 1 SELECTS THE PALETTE TO BE USED: o = GREEN(1)/RED(2)/YELLOW(3) 1 = CYAN(I)/MAGENTA(2)/WHITE(3) IN 40X25 OR 80X25 ALPHA MODES, THE VALUE SET FOR PALETTE COLOR 0 INDICATES THE BORDER COLOR TO BE USED (VALUES 0-31, WHERE 16-31 SELECT THE HIGH INTENSITY BACKGROUND SET. (AH)=OCH WRITE DOT (DX) = ROW NUMBER (CX) COLUMN NUMBER (AL) = COLOR VALUE IF BIT 7 OF AL = 1, THEN THE COLOR VALUE IS EXCLUSIVE OR' D WITH THE CURRENT CONTENTS OF THE DOT (AH)=ODH READ DOT (DX) = ROW NUMBER (CX) = COLUMN NUMBER ON EXIT: (AL) = THE DOT READ 2-80 ROM BIOS ASCI I TELETYPE ROUTINE FOR OUTPUT (AH)=OEH WRITE TELETYPE TO ACTIVE PAGE (AL) = CHAR TO WRITE (BL) = FOREGROUND COLOR I N GRAPH I CS MODE NOTE --SCREEN WIDTH IS CTRLLED BY PREVIOUS MODE SET (AH)=OFH CURRENT VIDEO STATE RETURNS THE CURRENT VIDEO STATE ON EXIT: (AL) = MODE CURRENTLY SET ( SEE AH=O FOR EXPL (AH) = NUMBER OF CHARACTER COLUMNS ON SCREEN (BH) = CURRENT ACTIVE DISPLAY PAGE (AH)=lOH (AH) =llH (AH)=12H RESERVED - NO OPERATION RESERVED - NO OPERATION RESERVED - NO OPERATION (AH)=13H WRITE STRING (ES:BP) = POINTER TO STRING TO BE WRITTEN (CX) = LENGTH OF CHARACER STRING TO WRITTEN IF CX = 0 NO OPERATION (OX) = CURSOR POSITION FOR STRING TO BE WRITTEN (BH) = PAGE NUMBER (AL) 0 WRITE CHARACTER STRING BL - ATTRIBUTE STRING IS {CHAR,CHAR, ... ,CHAR} CURSOR NOT MOV ED (AL) = 1 WRITE CHARACTER STRING AND MOVE CURSOR BL - ATTRI BUTE STRING IS {CHAR,CHAR, ... ,CHAR} CURSOR IS MOVED (AL) = 2 WRITE CHARACTER AND ATTRI BUTE STRING STRING IS {CHAR,ATTR,CHAR,ATTR.. ,CHAR,ATTR} CURSOR IS NOT MOVED (AL) = 3 WRITE CHARACTER AND ATTR STRING AND MOVE CURSO STRING IS {CHAR,ATTR,CHAR,ATTR.. ,CHAR,ATTR} CURSOR IS MOVED (AL) = 4 - 255 NO OP ERA TI ON NOTE: CARRIAGE RETURN, LINE FEED, BACKSPACE, AND BELL ARE TREATED AS COMMANDS RATHER THAN PRINTABLE CHARACTERS. ROM BIOS 2-81 (AH) =14H LCD REQUEST LOAD LCD CHARACTER FONT / SET LCD HIGH INTENSITY SUBSTITUTE (AL) = 0 (ES) (01) (CX) - LOAD USER SPECIFIED FONT SEGMENT ADDRESS OF USER CHARACTER TABLE OFFSET TO FIRST CHARACTER TO BE STORED NUMBER OF CHARACTERS TO STORE (1 - 256) VALUE CHECKED (DL) - CHAR OFFSET INTO RAM FONT STORAGE (BH) - NUMBER OF BYTES PER CHARACTER (1 - 255) VALUE CHECKED (BL) - 0 = LOAD MAIN FONT (BLOCK 0) 1 = LOAD ALTERNATE FONT (BLOCK 1) 2 - 255 = NO OPERATION (AL) = 1 - LOAD SYSTEM ROM DEFAULT FONT (BL) - 0 = LOAD MAIN FONT (BLOCK 0) 1 = LOAD ALTERNATE FONT (BLOCK 1) 2 - 255 = NO OPERATION (AL) = 2 -SET MAPPING OF LCD HIGH INTENSITY ATTRIBUTE (BL) - INTENSIFY MAPPING INPUT REGISTER o = IGNORE HIGH INTENSITY ATTRIBUTE 1 = MAP HIGH INTENSITY TO UNDERSCORE 2 = MAP HIGH INTENSITY TO REVERSE IMAGE 3 = MAP INTENSITY TO SELECT ALTERNATE FONT 4 - 255 = NO OPERATION (AL) = 3 - 255 NO OPERATION (AH) =15H PHYS I CAL 01 SPLAY DESCRI PTI ON PARAMETER REQUEST RETURNS THE ADDRESS OF A 7 WORD TABLE WHICH CONTAINS THE DESCRIPTION PARAMETERS OF THE CURRENT DISPLAY. IT ALSO RETURNS THE MONITOR NUMBER OF THE ALT DISPLAY ON EXIT: (ES: 01) = POINTS TO A 7 WORD PARAMETER TABLE AX = MONITOR NUMBER OF ALT DISPLAY. IF THERE IS NO ALTERNATE DISPLAY OR THE ALT DISPLAY IS INOPERATIVE THEN AX = O. THE 7 WORD TABLE CONTAINS THE FOLLOWING INFOMATION: WORD I NFORMATION 1 MONITOR MODEL NUMBER (5140,5153,5151) NUMBER OF VERTICAL PELS / METER 2 3 NUMBER OF HORIZONTAL PELS / METER 4 TOTAL NUMBER OF VERTICAL PELS 5 TOTAL NUMBER OF HORIZONTAL PELS 6 HORIZONTAL PEL SPACING IN MICROMETERS (CENTER TO CENTER) VERTICAL PEL SPACING IN MICROMETERS (CENTER TO CENTER) DISPLAY TYPES AND TABLES WORD MONOCHROME CGA LCD AS CGA LCD AS MONO 5140 08El 0987 00C8 0280 01BB 019A 5140 HEX 0 0 0 0 0 0 ----------------------- ------------- - -- - - -- - - - -- -- - - - - -1 2 3 4 5 6 7 5151 HEX 0 0 0 0 0 0 5153 0498 OA15 00C8 0280 0352 0184 HEX HEX HEX HEX HEX HEX HEX HEX HEX HEX HEX HEX HEX HEX ; ***************************************************************** ;* S TAR T 0 F COD E ; ***************************************************************** ASSUME 2-82 ROM BIOS CS: ROMCODE, OS: DATA, ES: VIDEO_RAM 0000 0000 0069 0002 OlBA 0004 0241 0006 0290 0008 0703 OOOA 026C OOOC 02F7 OOOE 037A 0010 03B6 0012 03FC 0014 0430 0016 02AB 0018 0474 OOlA 0463 001C 074F 001E 0201 0020 016F 0022 016F 0024 016F 0026 0879 0028 0927 002A 09E6 = 002C 0000 0002 0004 0006 0008 OOOA OOOC OOOE 0010 0012 0014 0016 0018 002C 002C 0020 002E 002F 0030 0031 0032 0033 0034 0035 0036 0037 0039 003B 0030 003F 0042 0044 0045 0048 0048 004B 004E 0052 0056 0059 005B 0050 0050 005F 0060 R R R R R R R R R R R R R R R R R R R R R R 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 MLI OW OW OW OW OW OW OW OW OW OW OW OW OW OW OW OW OW OW OW OW OW OW M1L_1 TBL OF RTNS WITHIN VIDEO I/O LABEL WORD OFFSET SELMODE OFFSET SELCTYPE OFFSET SELCPOS OFFSET READ_CURSOR OFFSET REAO_LPEN OFFSET ACLOISP_PAGE OFFSET SCROLL_UP OFFSET SCROLL_DOWN OFFSET REAO-ACCURRENT OFFSET WRITUCCURRENT OFFSET WRITE_CCURRENT OFFSET SELCOLOR OFFSET WRITLOOT OFFSET READ_DOT OFFSET WRITLTTY OFFSET VIDEO_STATE OFFSET VIDEO_RETURN OFFSET VIDEO_RETURN OFFSET VIDEO_RETURN OFFSET WRITLSTRING OFFSET LCD_REQUEST OFFSET PHYS_OSP_DESCR-REQ $-ML1 EQU REGS_PUSHO TEMPBP OW BP _POS OW DLPOS OW SLPOS OW BLPOS OW CLPOS OW OLPOS OW DS_POS OW ES_POS OW IP_POS OW CS_POS OW FL_POS OW REGS_PUSHO STRUC 0 0 0 0 0 a 0 0 0 a 0 0 ENDS 06 IE 52 51 53 56 57 55 VIOEO_IO_1 PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH FB FC 50 8A 32 01 8B 3D 72 58 E9 STI CLO PUSH MOV XOR SAL MOV CMP JB POP JMP AX AL,AH AH,AH AX,l SI,AX AX ,M1L_1 M2 AX VIDEO_RETURN CALL MOV MOV AND CMP JNE MOV DDS AX ,OB800H 01, EQUIP-FLAG 01,30H 01,30H M3 AH,OBOH MOV POP MOV ES,AX AX AH,CRLMODE C4 E4 EO FO 002C 04 016F R PROC ES OS OX CX BX SI DI BP NEAR SAVE REGISTERS SAVE AX VALUE GET I NTO LOW BYTE ZERO TO HIGH BYTE *2 FOR TABLE LOOKUP PUT INTO SI FOR BRANCH TEST FOR WITHIN RANGE BRANCH AROUND BRANCH THROW AWAY THE PARAMETER DO NOTHING IF NOT IN RANGE M2: E8 B8 8B 81 83 75 B4 0000 E B800 3E 0010 R E7 0030 FF 30 02 BO SEGMENT FOR CGA CARD GET EQUIPMENT SETTING ISOLATE CRT SWITCHES IS SETTING FOR MONO CARD? SEGMENT FOR MONO CARD M3: 8E CO 58 8A 26 0049 R SET PTR TT VIDEO RAM AREAS RECOVER VALUE GET CURRENT MODE INTO AH ROM BIOS 2-83 0064 0069 2E: FF A4 0000 R JMP VIDEO_IO~1 WORD PTR CS: [SI+OFFSET MLIJ ENDP SELMODE THIS ROUTINE INITIALIZES THE ATTACHMENT TO THE SELECTED MODE. THE SCREEN IS BLANKED. IF CGA, THE ONLY VALID MODES ALLOWED ARE 0-6. ALL OTHER MODES ARE DEFAULTED TO MODE 3. IF MONO, MODE IS DEFAULTED TO 7. INPUT (AL) = MODE SELECTED (DS) = DATA SEGMENT (ES) = REGEN BUFFER SEGMENT (DJ) = VIDEO SWITCHES FROM EQUIPMENT FLAG OUTPUT CURRENT DISPLAY INITIALIZED TO SELECTED MODE INTERRUPTS DISABLED DURING THE INITIALIZATION OF THE 6845 REGISTERS -------- - -- - - ---------- ------ - -- - - - - - - -- - -- - - - - - - - - - - - -0069 0069 006A 006C 006F 0071 0074 0076 0078 007A 007C 50 24 BA B3 83 74 3C 72 BO EB SETJ10DE PUSH AND MOV MOV CMP JE CMP JB MOV JMP 7F 0304 00 FF 30 08 07 OA 03 06 PROC AX AL, 7 FH DX,03D4H BL ,0 DI,30H M8 AL,7 M8A AL,3 SHORT M8A NEAR SAVE CLEAR REGEN BIT TURN OFF CLEAR REGEN BIT ADDRESS OF CGA CARD MODE SET FOR CGA CARD IS MONO CARD INSTALLED YES, JUMP TO MONO SET IS MODE 7 OR GREATER FOR CGA CARD THEN DEFAULT TO MODE 3 (80 x 25 COLOR) MONOCHROME OPERATION SELECTED 007E 007E 0080 0082 0084 0084 0087 0089 008C 0090 0091 0092 0093 0096 0098 M8: E8 8A A2 89 IE 50 52 83 8A EE 0099 009A 0090 5A B8 ---8E 08 009F 00A3 00A4 00A7 OOAA OOAC OOAE OOBI 00B3 00B5 00B8 OOBA C5 58 B9 80 72 03 80 72 03 80 72 03 BO 07 B2 B4 FE C3 0178 R EO 0049 R 16 0063 C2 04 C3 MOV MOV INC M8A: CALL MOV MOV MOV PUSH PUSH PUSH ADD MOV OUT IE 0074 R 0000 E FC 02 10 09 FC 04 09 09 FC 07 02 09 2-84 ROM BIOS AL,7 DL,OB4H BL INDICATE MONO CARD MODE ADDRESS OF MONO CARD (3B4) MODE SET FOR MONO CARD LCD_MOVE AH,AL CRLMODE,AL ADDL6845, OX OS AX OX DX,4 AL,BL OX ,AL CK FOR LCD ADA CHANGE REQ SAVE MODE IN AH SAVE IN GLOBAL VARIABLE SAVE ADDRESS OF BASE SAVE POINTER TO DATA SEGMENT SAVE MODE SAVE OUTPUT PORT VALUE POINT TO CONTROL REGISTER GET MODE SET FOR CARD RESET VIDEO AND CHANGE CONFIG IF REQD BACK TO BASE REGISTER SET UP FOR ABSO SEGMENT ESTABLI SH VECTOR TBL ADDR POP MOV MOV OX AX ,ABSO DS,AX ASSUME OS: ABSO LOS POP MOV CMP JC ADD CMP JC ADD CMP JC ADD BX, PARM_PTR AX CX, OFFSET M4 AH,2 M9 BX, CX AH,4 M9 BX ,CX AH,7 M9 BX, CX GET POINTER TO VIDEO PARMS RECOVER PARMS LENGTH OF EACH ROW OF TABLE DETERMINE WHICH ONE TO USE MODE IS 0 OR 1 MOVE TO NEXT ROW OF INIT TBL MODE IS 2 OR 3 MOVE TO GRAPHICS ROW OF TBL MODE IS 4,5, OR 6 MOVE TO MONO CARD ROW OF TBL BX POINTS TO CORRECT ROW OF INITIALIZATION TABLE OOBC OOBC OOBD M9: 50 32 E4 PUSH XOR AX AH,AH OULINIT SAVE MODE IN AH AH WILL SERVE AS REGISTER LOOP THROUGH TABLE, OUTPUTTTING REG ADDR, THEN VALUE FROM TABLE OOBF OOCO 00C1 00C1 00C3 00C4 00C5 00C7 00C9 OOCA OOCB OOCC OOCE OOCF OODO PUSHF CLI MIa: MOV OUT INC INC MOV OUT INC DEC LOOP POPF POP POP ASSUME 9C FA 8A EE 42 FE 8A EE 43 4A E2 9D 58 IF C4 C4 07 F3 AL,AH DX,AL OX AH AL, [BX] DX,AL BX DX MIa AX DS DS:DATA SAVE CURRENT FLAGS INHIBIT INTERRUPTS INIT LOOP GET 6845 REGISTER NUMBER POINT TO DATA PORT NEXT REGISTER VALUE GET TABLE VALUE OUT TO CHIP NEXT IN TABLE BACK TO POINTER REGISTER DO THE WHOLE TABLE RESTORE FLAGS GET MODE BACK REC+VER SEGMENT VALUE FILL REGEN AREA WITH BLANKS 00D1 00D3 00D7 OODC 0000 OODF ODE1 00E4 00E7 ODE9 OOEC OOEE OOFO 00F2 00F2 ODF4 00F7 00F9 OOFB OOFD OOFD 0100 0100 33 89 C6 59 DO 72 B9 80 72 80 74 33 EB FF 3E 004E R 06 0062 R 00 El 21 2000 FC 04 14 FC 07 04 CO OE B4 E8 A8 75 B5 20 0000 02 02 08 XOR MOV MOV POP SHL JC MOV CMP JC CMP JE XOR JMP DI,DI CRLSTART, DI ACTIVE_PAGE,O CX CL,l Ml3A CX,8192 AH,4 M12 AH,7 M11 AX,AX SHORT Ml3 Ml1: AH, RTCDSP _CON GELRTCREG AL, DSP~LCD M12 CH,08H MOV CALL TEST JNZ MOV M12: MOV M13: REP B8 0720 F3/ AB AX,' '+7*256 STOSW SET UP POINTER FOR REGEN START ADDR SAVED IN GLOBAL SET PAGE VALUE RESTORE CLEAR REGEN BIT LOOK, DON'T CLR REGEN REQ I F ON - DON'T CLEAR REGEN NUMBER OF WORDS IN CGA CARD TEST FOR GRAPHICS NO_GRAPH I CS_I NIT TEST FOR MONO CARD MONO_CARD_I NIT FILL FOR GRAPHICS MODE CLEAR_BUFFER MONO_CARD_I NIT GET DISPLAY CONFIGURATION IS LCD CONFIGURED AS MONO YES, CLEAR ENTIRE BUFFER BUFFER SIZE ON MONO CARD NO_GRAPH I CS_I NIT FILL CHAR FOR ALPHA CLEAR_BUFFER FILL REGEN BFR WITH BLANKS ENABLE VIDEO AND CORRECT PORT SETTING o lO2 OlO5 OlO7 0109 AO 32 8B 8B 0049 R E4 FO 16 0063 R OlOD 0110 0115 0116 83 C2 04 2E: 8A 84 0000 EE A2 0065 R Ml3A: XOR MOV MOV ADD MOV OUT MOV MOV AL, CRLMODE AH,AH SI,AX DX, ADDR_6845 DX,4 AL,CS: [SI+OFFSET M7] DX,AL CRLMODE_SET ,AL GET THE MODE INTO AX REGISTER TBL POINTER, INDEXED BY MODE PREPARE TO OUTPUT TO VIDEO ENABLE PORT SET VIDEO ENABLE PORT SAVE THAT VALUE DETERMINE NUMBER OF COLUMNS, BOTH FOR ENTIRE DISPLAY ; ----- AND THE NUMBER TO BE USED FOR TTY INTERFACE 0119 011E 0120 2E: 8A 84 0000 32 E4 A3 004A R MOV XOR MOV AL,CS: [SI + OFFSET M6] AH,AH CRLCOLS,AX ; NO. OF COLS IN THIS SCREEN SET CRT LENGTH 0123 0127 81 E6 OOOE 2E: 8B 8C 0000 E AND MOV SI,OEH ; WORD OFFSET IN CLR LEN TABLE CX, CS: lSI + OFFSET M5] ; LENGTH TO CLEAR ROM BIOS 2-85 012C OBI 0133 0135 0138 OI3A 013C 80 75 B4 E8 A8 74 B9 3E 0049 R 07 OC 20 0000 02 03 1000 013F 89 OE 004C R CRT~ODE, 7 M13C AH, RTCDSP _CON GELRTCREG AL, DSP _MLCD MI3C CX ,4096 CMP JNE MOV CALL TEST JZ MOV MI3C: MOV CRLLEN,CX MONO MODE GET DISPLAY CONFIGURATION LCD CONFIGURED AS MONO SET PG LEN TO 4096 TO ALLOW MUL TI PG KEYS WHEN LCD MONO SAVE LENGTH OF CRT SET CURSOR POSITIONS 0143 0146 0149 014A 014B 0140 B9 0008 BF 0050 R IE 07 33 CO F3/ AB 014F 42 BO 30 MOV MOV PUSH POP XOR REP CX ,8 ; CLEAR ALL CURSOR POSITIONS DI,OFFSET CURSOR_POSN OS ESTABLISH SEGMENT ES ADDRESSING AX,AX STOSW FILL WITH ZEROES SET UP OVERSCAN REGISTER 0150 0152 0157 0159 015B 015B 015C 80 3E 0049 R 06 75 02 BO 3F 015F 0162 0167 0169 016C B9 80 75 B9 EB EE A2 0066 R INC OX AL,30H MOV MI4 AL, 3 FH SET OVERSCAN PORT TO DEFAULT VALUE OF 30H FOR ALL MODES EXCEPT 640X200 SEE I F MODE IS 640X200 BW I F NOT 640X200, GO TO REGULAR I F IT IS 640X200, PUT IN 3FH OX ,AL CRLPALETTE,AL SEND CORRECT VAL TO 309 PORT SAVE THE VAL FOR FUTURE USE CRT~oDE,6 CMP JNZ MoV MI4 : OUT MOV SET CURSOR TYPE TO DEFAULT VALUES. 0607 3E 0049 R 07 03 OBOC 4C 90 MOV CMP JNE MOV MI4A: CX,0607H CRT~ODE,7 JMP MI4A CX,OBOCH SELCTYPE CURSOR MODE FOR MODES 0-6 IS IT MODE 7 NO, JUMP ON CURSOR MODE MONO (MODE 7) SET CURoSR TYPE NORMAL RETURN FROM ALL VIDEO RETURNS 016F 016F 0170 0171 0172 0173 0174 0175 0176 0177 0178 50 5F 5E 5B 59 5A IF 07 CF VIDEO_RETURN: POP BP POP OJ POP SI POP BX POP CX POP OX POP OS POP ES JRET SELMODE 2-86 ROM BIOS ALL DONE ENDP LCD-MOVE THIS ROUTINE CHECKS FOR MONOCHROME TO CGA OR VICE VERSA CHANGE REQUESTED FOR THE LCD DISPLAY. IF LCD IS THE ONLY DISPLAY, A CHANGE IS ALLOWED AND A CALL TO LCD_INIT IS MADE TO SET THE CONTROL REGISTERS BEFORE CONTINUING WITH THE MODE SET. INPUT AL HAS MODE SET VALUE OUTPUT IF LCD IS NOT THE ONLY DISPLAY THEN A RETURN IS MADE WITH NO CHANGES. IF THE LCD IS THE ONLY DISPLAY AND A CGA TO MONO OR MONO TO CGA CHANGE IS REQUESTED, THE DISPLAY CONFIG BYTE (RTCDSP_CON) IS UPDATED TO REFLECT THE CHANGE. AND, A CALL TO LCD_INIT IS MADE TO UPDATE THE LCD CONTROL REGISTERS FOR THE NEW LCD MODE. A RETURN IS THEN MADE TO FINISH THE SET MODE. IF NO MONO TO CGA OR CGA TO MONO CHANGE IS REQUESTED - NO ACTION IS TAKEN. REGISTERS MODIFIED: SI INTERRUPTS: LCD_MOVE PUSH PUSH PUSH PUSHF MOV CLI MOV CALL CMP JE 0178 0178 0179 017A 017B 017C 017E 017F 0181 0184 0187 50 53 52 9C 8A FA B4 E8 80 74 0189 3C 82 CMP 018B 0180 018F 0192 0194 75 BO BA B3 EB JNE MOV MOV MOV JMP 08 20 0000 E FB 07 OE DISABLED DURING PROCESSING PROC NEAR AX BX OX BL,AL AH, RTCDSP _CON GELRTCREG BL,7 LCD_MOl SAVE FLAGS SAVE NEW MODE REQUEST DISABLE INTERRUPTS GET DISPLAY CONFIGURATION DATA RETURNED IN AL MONOCHROME MODE REQUESTED? CGA MODE BEING REQUESTED 28 81 03B8 01 OC 90 AL,DSP_MLCD+DSP_LCD_PRES; IS LCD PRES & CONFIGURED ; MONO & NO OTHER ADA PRESENT LCD_M03 ; JUMP I F CAN'T EFFECT CHANGE AL,DSP_CLCD+DSP_LCD_PRES; SET LCD TO CGA MODE OX, MONO_CNTL GET MONO CONTROL ADDRESS BL ,01 ; DISABLE VIDEO FOR MONOCHROME LCD_M02 ; GO CHANGE CONFIGURATION MONOCHROME MODE IS BEING REQUESTED 0197 0197 3C 81 0199 019B 0190 01AO 75 BO BA 2A 1A 82 0308 DB LCD_MOl: CMP JNE MOV MOV SUB AL,DSP_CLCD+DSP_LCD_PRES; IS LCD PRES & CONFIGURED ; CGA & NO OTHER ADA PRESENT LCD_M03 ; NO THEN EXIT AL,DSP-MLCD+DSP_LCD_PRES; SET CONFIG LCD MONO MODE OX, CGA_CNTL ; MODE CTRL FOR PRESENT STATE BL, BL ; DISABLE VIDEO FOR CGA LCD ADAPTER CHANGE CAN BE MADE 01A2 01A2 01A5 01A7 01A8 01AB 01AD OlAF 01B1 01B3 E8 8A EE E8 BO E6 E4 OC E6 01B5 01B5 01B6 0187 01B8 90 5A 58 58 0000 C3 0000 E 00 74 75 40 75 LCD-M02 : CALL MOV OUT CALL MOV OUT IN OR OUT PULRTCREG AL, BL DX,AL LCDINIT AL, LCD_FUNCT LCD_I NDX, AL AL,LCD_DATA AL, PANEL_ENABLE LCD_DATA,AL LCD-M03 : POPF POP POP POP OX 8X AX UPDATE DISPLAY CONFIGURATION DISABLE VIDEO IN CRNT STATE SET UP LCD AL = 0 PORT 74 GET LCDC REGS TURN ON PANEL POWER RESTORE INTERRUPT FLAGS RESTORE REGISTERS ROM BIOS 2-87 01 B9 01BA C3 RET LCD~OVE ENDP SELCTYPE THIS ROUTINE SETS THE CURSOR VALUE. SPECIAL HANDLING OCCURS FOR THE LCD CURSOR. IF THE LCD IS THE CURRENT DISPLAY THE FOLLOWING FOR THE DISPLAY NO CURSOR MODE (BIT 5 = 1 & BIT CH REGISTER) IS CONVERTED TO THE LCD CONTROLLER CURSOR MODE (CX=0808H). ALSO, THE BLINKING MODE AND BIT 6 OF THE CH REGISTER) ARE TURNED OFF. OCCURS: 6 = 0 OF THE DISPLAY NO BITS (BIT 5 I F LCD CONFIGURED AS MONO IS THE CURRENT DISPLAY THEN THE LCDC REGISTERS FOR LCD CURSOR START AND LCD CURSOR END ARE REGISTERS 23 AND 24 RESPECTIVELY. AND THE CURSOR VALUES ARE RESCALED TO FIT IN AN 8x8 CHARACTER BOX. THIS IS BECAUSE THE MONO CHARACTER BOX IS 9x14 BUT THE LCD HAS AN 8x8 CHARACTER BOX. INPUT (ex) HAS CURSOR VALUE eH-START LINE, CL-STOP LINE (OS) = DATA SEGMENT OUTPUT PHYSICAL CURSOR SET 01BA SELCTYPE MOV MOV CALL MOV CMP JE PROC CURSOR~OD E, NEAR 01BA 01BE 01CO 01C3 01C5 01CB 89 B4 E8 B4 81 74 OE 0060 20 0000 E OA 3E 0063 R 0304 33 CX AH, RTCDSP _CON GELRTCREG AH,10 ADDR_6845,03D4H SEL2 01CD 01CF OlD1 OlD3 0106 0108 OlDB 0100 A8 74 B4 F6 75 F6 75 80 02 45 17 C5 40 05 C5 20 36 E5 9F OlEO 01E3 01E5 01E8 01 EA 01EB 01EE 01FO 01F3 80 77 80 77 50 BB 8A E8 8A WHEN THE LCD AS MONO IS CURRENT MODE THE CURS IS RESCALED TO FIT IN A 8x8 CHARACTER BOX. THE CURSOR WILL ONLY BE RESCALED IF CURS START (CH) AND CURSOR END (CL) VALUES ARE 8ETWEEN VALUES 0 - 13. FD 00 CMP CH,13 INVALID CURSOR START VALUE? 31 JA SELC YES, PROCESS AS IS. F9 00 CMP CL, 13 I NVALI 0 CURSOR END VALUE? 2C JA SELC YES, PROCESS AS IS PUSH AX SAVE LCDC CURSOR START REG 080E MOV BX,080EH BH - MULT, BL - DIV FACTOR C5 MOV AL,CH RESCALE CURSOR START 021C R CALL SELRESCALE E8 MOV CH,AL NEW CUROSR START 01F5 01F7 01FA 01FC 01FD 8A E8 8A 58 EB SAVE CURSOR VAL IN DATA AREA GET LCD CONFIGURATION FROM RTC. CURSOR START REGISTER ARE WE IN CGA MODE JUMP TO CGA MODE TEST ; MONO IS CURRENT MODE AL, DSP _MLCD SELC MOV AH,OllH TEST CH,40H JNZ SELl TEST CH ,20H JNZ SEL4 SELl: AND eH, 09 FH TEST JZ C1 021C R C8 MOV CALL MOV POP JMP 17 90 AL,CL SELRESCALE CL,AL AX SELC IS LCD AS MONO CRNT DISPLAY? NO, JUMP ON IT I S MONO MNTR LCDC CUR ST REG AS MONO IS BIT 6 ON YES , JUMP ON IS BIT 5 ON (NO CURSOR) YES, JUMP TO RST TO LCDC VAL TURN OFF BLINK (BIT 5 & 6) RESCALE CURSOR END NEW CUROSR START RESTORE LCDC CUSR START REG CALL TO OUTPUT ex REG CGA IS CURRENT MODE. 0200 0200 0202 0204 0207 A8 74 F6 74 01 12 C5 40 05 SEL2: TEST JZ TEST JZ 2-88 ROM BIOS AL,DSP_CLCD SELC CH,40H SEL3 IS LCD AS CGA CURRENT DSPL Y? NO, ITS CGA MONITOR- AS IS IS BIT 6 ON NO, JUMP ON 0209 020C 020E 020E 0211 0213 0216 0216 0219 021C 021C 021E 0220 0223 0225 0227 80 E5 9F EB 08 AND CH,09FH JMP SHORT SELC SEL3: TEST CH,20H JZ SELC SEL4: MOV CX,080SH SELC: CALL M16 JMP VIDEO_RETURN F6 C5 20 74 03 B9 0808 E8 0228 R E9 016F R F6 F6 SO 72 FE C3 E7 F3 FC 07 02 CO TURN OFF BLINK (BIT 5 & 6) IS BIT 5 ON (DSPLY NO CUSR) NO, JUMP ON LCDC VAL FOR DSPL Y NO CURSOR OUTPUT CX REG THE RESCALING FORMULA IS (( X * 8) / 14.) + ROUND UP. X IS EITHER CH REGISTER OR CL REGISTER, 8 IS FOR THE LCD CHAR BOX HEIGHT(8 x 8), AND 14 IS FOR THE MONO CHARACTER SOX HEIGHT(9 x 14). ROUND UP IS 1 IF THE REMAINDER IS GREATER THAN 6. AND, RND UP IS 0 IF REMNDR IS < THAN 7. ON ENTRANCE AL WILL CONTAIN X, BH = SAND BL = 14. SELRESCALE: MUL SH MUL T SY LCD CHAR BX LEN S OIV BL DIV BY MONO CHAR BX LEN 14 CMP AH,7 AH = RMNDR , AL = QUOT! ENT JS SELRI INC AL ADD 1 TO QUOTI ENT FOR RND UP SELRl: RET RETURN TO CALLER TH I S ROUT! NE OUTPUTS TH E CX REGISTER TO THE REGS NAMED IN AH 0228 0228 0229 022A 022E 0230 0231 0232 0234 0235 0236 0238 023A 023B 023C 023E 023F 0240 0241 9C FA SB 8A EE 42 SA EE 4A 8A FE EE 42 8A EE 9D C3 M16: PUSHF CLI MOV MOV OUT INC MOV OUT DEC MOV INC OUT INC MOV OUT POPF RET SELCTYPE 16 0063 C4 C5 C4 CO Cl OX ,ADDR_6845 AL,AH DX,AL DX AL,CH DX,AL OX AL,AH AL OX ,AL OX AL,CL DX,AL SAVE CURRENT FLAGS INHIBIT INTERRUPTS ADDRESS REGISTER GET VALUE REGISTER SET DATA REGISTER DATA POINT TO OTHER DATA REGISTER SET FOR SECOND REGISTER SECOND DATA VALUE RESTORE FLAGS ALL DONE ENDP SELCPOS THIS ROUTINE SETS THE CURRENT CURSOR POSITION TO THE NEW X-Y VALUES PASSED INPUT OX - ROW,COLUMN OF NEW CURSOR BH - DISPLAY PAGE OF CURSOR *** BH = 0 FOR GRAPH I CS OS - DATA SEGMENT OUTPUT CURSOR IS SET AT 6845 I F DISPLAY PAGE IS CURRENT DISPLAY 0241 0241 0243 0245 0247 0249 024D 0251 0253 0255 0258 0258 025B 8A 32 01 SB 89 38 75 SB ES CF ED El Fl 94 0050 R 3E 0062 R 05 C2 025B R E9 016F R SET_CPOS MOV XOR SAL MOV MOV CMP JNZ MOV CALL M17 : JMP SELCPOS PROC NEAR CL, BH CH,CH ; ESTABLISH LOOP COUNT CX,l ; WORD OFFSET SI,CX ; USE INDEX REGISTER [SI+OFFSET CURSOR_POSN],DX ; SAVE THE POINTER ACTIVE_PAGE, BH MI7 SELCPOS_RETURN AX,DX GET ROW/COLUMN TO AX M18 CURSOILSET SELCPOS_RETURN VIDEO_RETURN ENDP ROM BIOS 2-89 SET CURSOR POSITION, AX HAS ROW/COLUMN FOR CURSOR 025B 025B 025E 0260 0264 0266 0268 026B 026C MI8 E8 8B 03 01 B4 E8 C3 02E6 R C8 OE 004E R F9 OE 0228 R CALL MOV ADD SAR MOV CALL RET MI8 PROC NEAR POSITION CX,AX CX,CRLSTART CX, I AH,14 MI6 FIND LOCATION IN REGEN BFR ADD START ADDR FOR THIS PAGE DIVIDE BY 2 FOR CHAR COUNT REGISTER NUMBER FOR CURSOR OUTPUT THE VALUE TO THE 6845 ENDP ACLDI SP_PAGE THIS ROUTINE SETS THE ACTIVE DISPLAY PAGE, ALLOWING THE FULL USE OF THE RAM SET ASIDE FOR THE VIDEO ATTACHMENT. **** VALID ONLY FOR ALPHA MODES **** INPUT AL HAS THE NEW ACTIVE DISPLAY PAGE (0-7) FOR MODES 0&1, (0-3) FOR MODES 2&3, AND (0) FOR MODE 7 WHEN MONOCHROME MONITOR (0-3) FOR MODE 7 WHEN THE LCD IS CONFIGURED AS MONO (OS) = DATA SEGMENT OUTPUT THE 6845 IS RESET TO DISPLAY THAT PAGE 026C 026C 026F 0273 0274 0275 0277 027A 027C 027E 0280 0283 0284 0286 028A 0280 0290 A2 8B 98 50 F7 A3 0062 R OE 004C R 8B 01 B4 E8 5B 01 8B E8 E9 C8 F9 OC 0228 R El 004E R ACLDISP_PAGE PROC NEAR ACTIVE_PAGE,AL MOV MOV CX,CRLLEN CBW PUSH AX MUL CX MOV CRLSTART ,AX SAVE ACTIVE PAGE VALUE GET SAVED LEN OF REGEN BFR CONVERT AL TO WORD SAVE PAGE VALUE DISPLAY PAGE TIMES REGEN LEN SAVE START ADDRESS FOR LATER REQUIREMENTS START ADDRESS TO CX DIVIDE BY 2 FOR 6845 6845 REGISTER FOR START ADDR MOV CX,AX SAR CX, I MOV AH,12 CALL MI6 POP BX RECOVER PAGE VALUE SAL BX, I ; *2 FOR WORD OFFSET MOV AX, [BX + OFFSET CURSOR_POSN- ; GET CURSOR FOR PAGE CALL MI8 ; SET THE CURSOR POSITION VIDEO_RETURN JMP ACLDISP_PAGE ENDP E3 87 0050 025B R 016F R READ_CURSOR THIS ROUTINE READS THE CURRENT CURSOR VALUE FROM THE 6845, AND SENDS IT BACK TO THE CALLER INPUT BH - PAGE OF CURSOR, MUST BE 0 FOR GRAPHICS OS - DATA SEGMENT OUTPUT OX - ROW, COLUMN OF THE CURRENT CURSOR POSITION CX - CURRENT CURSOR MODE 0290 0290 0292 0294 0296 029A 029E 029F 02AI 02A4 02A7 02A8 02AB 8A 32 01 8B 8B 55 8B 89 89 50 E9 OF FF E3 97 0050 R OE 0060 R EC 56 OC 4E OA 0l6F R READ_CURSOR PROC NEAR MOV BL,BH XOR BH,BH SAL BX, I ; WORD OFFSET MOV OX, [BX+OFFSET CURSOILPOSN] MOV CX, CURSOILMODE PUSH BP MOV BP ,SP GET PTR TO STACK SAVE AREA MOV [BP] . DLPOS, OX SETUP RETURN VALUES IN STACK MOV [BP] . CLPOS, CX SAVE AREA POP BP JMP VIDEO_RETURN READ_CURSOR ENDP 2-90 ROM BIOS SET COLOR THIS ROUTINE WILL ESTABLISH BACKGND COLOR, THE OVERSCAN COLOR, AND THE FOREGROUND COLOR SET FOR MEDIUM RESOLUTION GRAPHICS INPUT (BH) HAS COLOR 10 IF BH=O, THE BACKGROUND COLOR VALUE IS SET FROM THE LOW BITS OF BL (0-31) IF BH=I, THE PALETTE SELECTION IS MADE BASED ON THE LOW BIT OF BL: O=GREEN, RED; YELLOW FOR COLORS 1,2,3 I=BLUE, CYAN, MAGENTA FOR COLORS 1,2,3 (BL) HAS THE COLOR VALUE TO BE USED (OS) - DATA SEGMENT OUTPUT THE COLOR SELECTION IS UPDATED 02AB 02AB 02AF 02B2 02B5 02B7 8B 83 AO OA 75 SELCOLOR MOV ADD MOV OR JNZ 16 0063 C2 05 0066 R FF OE NEAR PROC OX, ADDR_6845 DX,5 AL, CRLPALETTE BH, BH M20 I/O PORT FOR PALETTE OVERSCAN PORT GET THE CURRENT PALETTE VAL IS THIS COLOR O? OUTPUT COLOR 1 HANDLE COLOR 0 BY SETTING THE BACKGROUND COLOR 02B9 02BB 02BE 02CO 02CO 02Cl 02C4 24 EO 80 E3 IF OA C3 AND AND OR M19 : OUT MOV JMP EE A2 0066 R E9 016F R AL,OEOH BL,OIFH AL, BL DX,AL CRLPALETTE,AL VIDEO_RETURN TURN OFF LOW 5 BITS OF CRNT TURN OFF H 3 BITS INPUT VAL PUT VALUE INTO REGISTER OUTPUT THE PALETTE SEND COLOR TO 309 PORT SAVE THE COLOR VALUE HANDLE COLOR 1 BY SELECTING THE PALETTE TO BE USED 02C7 02C7 02C9 02CB 02CD 02CF 0201 24 DO 73 OC EB M20: AND SHR JNC OR JMP SELCOLOR OF EB F3 20 EF AL ,ODFH BL,1 M19 AL ,20H M19 ENDP TURN OFF PALETTE SELECT BIT TEST THE LOW ORDER BIT OF BL ALREADY DONE TURN ON PALETTE SELECT BIT GO DO IT VIDEO STATE RETURNS THE CURRENT VIDEO STATE INFORMATION INPUT OS = DATA SEGMENT OUTPUT AH = NUMBER OF COLUMNS ON THE SCREEN AL = CURRENT VIDEO MODE BH = CURRENT ACTIVE PAGE 0201 0201 0205 0208 02DC 0200 020F 02E2 02E3 02E6 8A AO 8A 55 8B 89 50 E9 26 004A R 0049 R 3E 0062 EC 5E 08 016F R VIDEO_STATE PROC NEAR MOV AH, BYTE PTR CRLCOLS ; GET NUMBER OF COLUMNS MOV AL, CRLMODE CURRENT MODE MOV BH,ACTIVE_PAGE GET CURRENT ACTIVE PAGE PUSH BP MOV BP, SP GET PTR TO STACK SAVE AREA MOV [BP] .BLPOS,BX SETUP RETURN VALUES IN STACK POP BP JMP VIDEO_RETURN VIDEO_STATE ENDP ROM BIOS 2-91 POSITION THIS SERVICE ROUTINE CALCULATES THE REGEN BUFFER ADDRESS OF A CHARACTER IN THE ALPHA MODE INPUT AX = AX = OFFSET ROW, COLUMN POSITION OUTPUT 02E6 02E6 02E7 02E9 02EB 02EF 02F1 02F3 02F5 02F6 02F7 53 8B 8A F6 32 03 01 5B C3 POSITION PUSH MOV MOV MUL XOR ADD SAL POP RET POSITION 08 C4 26 004A FF C3 EO OF CHAR POSITION IN REGEN BUFFER PROC NEAR BX BX,AX AL,AH BYTE PTR CRLCOLS BH,BH AX,BX AX,l BX SAVE REGISTER ROWS TO AL DETERMI NE BYTES TO ROW ADD IN COLUMN VALUE 2 FOR ATTRI BUTE BYTES * ENDP SCROLL UP THIS ROUTINE MOVES A BLOCK OF CHARACTERS UP ON THE SCREEN INPUT (AL) = NUMBER OF ROWS TO SCROLL (CX) = ROW/COLUMN OF UPPER LEFT CORNER (OX) = ROW/COLUMN OF LOWER RIGHT CORNER (BH) = ATTRIBUTE TO BE USED ON BLANKED LINE (AH) = CURRENT CRT MODE (OS) = DATA SEGMENT (ES) = REGEN BUFFER SEGMENT OUTPUT NONE -- THE REGEN BUFFER IS MODIFIED 02F7 02F7 02F9 02FC 02FE 0301 0303 0306 0306 0307 0309 030C 030E 0310 0312 0314 0314 0317 0319 031B 0310 031F 031F 0320 0322 0322 0325 0327 0329 0328 032B 032E 0333 0335 0338 033B 033C 8A 80 72 80 74 E9 08 FC 04 08 FC 07 03 04DA R 53 8B E8 74 03 8A 2A C1 0343 31 FO E6 E3 E8 03 03 FE 75 036A R F5 FD CC F5 58 BO 20 E8 03 FE 75 0373 FD CB F7 E8 80 74 AO BA EE 0000 E 3E 0049 R 07 07 0065 R 0308 ASSUME SCROLL_UP MOV CMP JC CMP JE JMP N1 : PUSH MOV CALL JZ ADD MOV SUB N2: CALL ADD ADD DEC JNZ N3: POP MOV N4: CALL ADD DEC JNZ N5 : CALL CMP JE MOV MOV OUT N6: 2-92 ROM BIOS CS: ROMCODE, OS: DATA, ES: DATA PROC NEAR BL,AL SAVE LINE COUNT IN BL AH,4 TEST FOR GRAPH I CS MODE N1 HANDLE SEPARATELY AH,7 TEST FOR MONO CARD N1 GRAPH I CS_UP UP_CONTINUE 8X SAVE FILL ATTRIBUTE IN BH AX,CX UPPER LEFT POSITION SCROLLPOSITION DO SETUP FOR SCROLL N7 BLANICFI ELD SI,AX FROM ADDRESS AH,DH # ROWS I N BLOCK AH, BL # ROWS TO BE MOVED ROW_LOOP NlO MOVE ONE ROW SI,BP 01, BP POINT TO NEXT LINE IN BLOCK AH COUNT OF LINES TO MOVE N2 ROW_LOOP CLEAILENTRY AX RECOVER ATTRIBUTE IN AH , AL, ' FILL WITH BLANKS CLEAILLOOP Nll CLEAR THE ROW 01, BP POINT TO NEXT LINE BL COUNTER OF LINES TO SCROLL N4 CLEAR_LOOP SCROLLEND DDS CRLMODE,7 IS THIS THE MONO CARD N6 IF SO, SKIP THE MODE RESET AL,CRLMODE_SET GET VALUE OF THE MODE SET OX ,03D8H ALWAYS SET CGA CARD PORT DX,AL VIDEO_RELHERE 033C 033F 033F 0341 0343 JMP E9 016F R VIDEO_RETURN BlANLFIElD GET ROW COUNT GO CLEAR THAT AREA N7: MOV JMP SCROll_UP BA DE EB DC Bl,DH N3 ENDP HANDLE COMMON SCROll SET UP HERE 0343 0343 0346 034A 034C 034E 0350 0352 0354 0356 035A 035C 035E 0362 0364 0365 0366 0369 036A E8 03 8B 8B 2B FE FE 32 8B 03 8A F6 03 06 IF 80 C3 02E6 R 06 004E R F8 FO 01 C6 C2 ED 2E 004A R ED C3 26 004A R CO FB 00 SCROll_POS ITI ON PROC NEAR CAll POSITION ADD AX, CRLSTART MOV DI,AX MOV SI,AX SUB DX,CX INC DH INC Dl XOR CH,CH MOV BP ,CRLCOlS BP, BP ADD MOV Al, Bl BYTE PTR CRLCOlS MUl ADD AX,AX PUSH ES POP OS CMP Bl,O RET SCROll_POS IT I ON ENDP CONVERT TO REGEN POINTER OFFSET OF ACTIVE PAGE TO ADDRESS FOR SCROll FROM ADDRESS FOR SCROll OX = #ROWS, #COlS IN BLOCK INCREMENT FOR 0 ORIGIN SET HIGH BYTE OF CNT TO ZERO GET NO. OF COlS IN DISPLAY TIMES 2 FOR ATTRI BUTE BYTE GET LINE COUNT FIND OFFSET TO FROM ADDRESS *2 FOR ATTRIBUTE BYTE ESTAB ADDSSNG TO REGEN BFR FOR BOTH POINTERS a SCROll MEANS BLANK FI ElD RETURN WITH FLAGS SET ;----- MOVE_ROW 036A 036A 036C 0360 036E 0370 0371 0372 0373 NI0 8A CA 56 57 F3/ A5 5F 5E C3 MOV PUSH PUSH REP POP POP RET PROC NEAR Cl,Dl SI 01 MOVSW 01 SI GET # OF COlS TO MOVE SAVE START ADDRESS MOVE THAT LINE ON SCREEN RECOVER ADDRESSES ENDP NI0 ; ----- CLEAR_ROW 0373 0373 0375 0376 0378 0379 037A Nll 8A CA 57 F3/ AB 5F C3 MOV PUSH REP POP RET Nll PROC NEAR Cl,Dl 01 STOSW 01 GET # COLUMNS TO CLEAR STORE THE FIll CHARACTER ENDP SCROll_DOWN THIS ROUTINE MOVES THE CHARACTERS WITHIN A DEFINED BLOCK DOWN ON THE SCREEN, FILLING THE TOP LINES WITH A DEFINED CHARACTER INPUT (Al) = NUMBER OF LINES TO SCROll (CX) = UPPER lEFT CORNER OF REGION (OX) = lOWER RIGHT CORNER OF REGION (BH) = FIll CHARACTER (AH) = CURRENT CRT MODE (OS) = DATA SEGMENT (ES) = REGEN SEGMENT OUTPUT NONE -- SCREEN IS SCROllED 037A 037A FD SCROll_DOWN STD PROC NEAR ; DIRECTION FOR SCROll DOWN ROM BIOS 2-93 037B 0370 0380 0382 0385 0387 038A 038A 038B 0380 0390 0392 0394 0396 0398 0398 039B 0390 039F 03Al 03A3 03A3 03A4 03A6 03A6 03A9 03A8 03AD 03AF 03B2 03B2 03B4 03B6 8A 80 72 80 74 E9 08 FC 04 08 FC 07 03 0533 R 53 8B E8 74 2B 8A 2A C2 0343 R 20 FO E6 E3 E8 2B 2B FE 75 036A R F5 FD CC F5 58 BO 20 E8 2B FE 75 E9 0373 R FD CB F7 032B R 8A DE EB ED MaV BL,AL CMP AH,4 JC N12 CMP AH,7 JE N12 JMP GRAPH I CS_DOWN N12 : PUSH BX MOV AX, OX CALL SCROLL_POS ITI ON JZ N16 SUB SI,AX MOV AH,DH SUB AH,BL N13 : CALL NI0 SUB SI, BP SUB 01, BP DEC AH JNZ N13 N14: POP AX MOV AL, ' N15 : CALL NIl SUB 01, BP DEC BL JNZ N15 JMP N5 N16 : MOV BL,DH JMP N14 SCROLL_DOWN ENDP LI NE COUNT TO BL TEST FOR GRAPHICS TEST FOR MONO CARD CONTI NU E_DOWN SAVE ATTRIBUTE IN BH LOWER RIGHT CORNER GET REGEN LOCATION SI IS FROM ADDRESS GET TOTAL # ROWS COUNT TO MOVE IN SCROLL MOVE ONE ROW RECOVER ATTRI BUTE IN AH CLEAR ONE ROW GO TO NEXT ROW SCROLL_END --------------- ---------------- -- - - - - - - - - - - - - - - - - - - - - - -- READ--'lLCURRENT THIS ROUTINE READS THE ATTRIBUTE AND CHARACTER AT THE CURRErn CURSOR POSITION AND RETURNS THEM TO THE CALLER INPUT (BH) = DISPLAY PAGE ( ALPHA MODES ONLY (AH) = CURRENT CRT MODE (OS) = DATA SEGMENT ( ES) = REGEN SEGMENT OUTPUT (AL) = CHAR READ (AH) = ATTRI BUTE READ INTERRUPTS: DISABLED DURING THE READ ------------ ----------- - -- - - - - -- - ------------------ - -- -- 03B6 03B6 03B9 03BB 03BE 03CO 03C3 03C3 03C6 80 72 80 74 E9 FC 04 08 FC 07 03 066F R E8 03EO R 8B F3 ASSUME CS: ROMCODE, OS: DATA, ES: DATA READ--'lLCURRENT PROC NEAR CMP AH,4 IS THIS GRAPHICS JC PI CMP AH,7 IS THIS MONO CARD JE PI JMP GRAPH I CS_READ PI: READ--'lLCONTI NUE FIND_POSITION CALL MOV SI, BX ESTABLISH ADDRESSING IN SI ;----- WAIT FOR HORIZONTAL RETRACE 03C8 03CC 03CF 0300 0301 0301 0302 0304 0306 0307 0307 8B 16 0063 83 C2 06 06 IF MaV ADD PUSH POP OX ,ADDR_6845 DX,6 ES OS IN TEST JNZ CLI AL,DX AL,HORLRETRACE P2 IN AL,DX P2 : EC A8 01 75 FB FA P3: EC 2-94 ROM BIOS GET BASE ADDRESS POINT AT STATUS PORT GET SEGMENT FOR QUICK ACCESS WAIT FOR RETRACE LOW GET STATUS IS HORZ RETRACE LOW WAIT UNTIL IT IS NO MORE INTERRUPTS WAIT FOR RETRACE HIGH GET STATUS 0308 03DA 03DC 0300 03EO 03EO 03EO 03E2 03E4 03E6 03E8 03EC 03EE 03FO 03FO 03F4 03F6 03F6 03F9 03FB 03FC A8 01 74 FB AD E9 016F R 8A 32 8B 01 8B 33 E3 TEST AL, HORLRETRACE JZ P3 LODSW VIDEO_RETURN JMP READ....ACCURRENT ENDP CF ED F1 E6 84 0050 R DB 06 03 1E 004C R E2 FA E8 02E6 03 08 C3 IS IT HIGH WAIT UNTIL IT IS GET THE CHAR/ATTR FIND_POSITION PROC NEAR CL, BH DISPLAY PAGE TO CX MOV XOR CH, CH MOV SI,CX MOVE TO SI FOR INDEX SAL SI,I ; * 2 FOR WORD OFFSET MOV AX, [SI+ OFFSET CURSOR_POSN- ; GET ROW/COL OF PAGE XOR BX, BX SET START ADDRESS TO ZERO NO_PAGE JCXZ P5 PAGE_LOOP P4: LENGTH OF BUFFER ADD BX,CRLLEN LOOP P4 NO_PAGE P5: CALL POSITION DETERMINE LOCATION IN REGEN ADD BX ,AX ADD TO START OF REGEN RET FI ND_POS IT ION ENDP WRITE....ACCURRENT THIS ROUTINE WRITES THE ATTRIBUTE AND CHARACTER AT THE CURRENT CURSOR POSITION INPUT (AL) = CHAR TO WRITE (BH) = DISPLAY PAGE (BL) = ATTRIBUTE OF CHAR TO WRITE (CX) = COUNT OF CHARACTERS TO WRITE (AH) = CURRENT CRT MODE (OS) DATA SEGMENT (ES) REGEN SEGMENT OUTPUT NONE INTERRUPTS: DISABLED DURING THE WRITE 03FC 03FC 03FF 0401 0404 0406 0409 0409 040B 040C 0400 0410 0412 0413 0414 80 72 80 74 E9 FC 04 08 FC 07 03 05BD R 8A E3 50 51 E8 03EO R 8B FB 59 5B WRlTE....ACCURRENT PROC CMP AH,4 P6 JC CMP AH,7 P6 JE JMP GRAPHICS_WRITE P6: MOV AH, BL PUSH AX PUSH CX FIND_POSITION CALL MOV 01, BX POP CX POP BX P7 : NEAR IS TH I S GRAPH I CS IS THIS MONO CARD WRITE....ACCONTINUE GET ATTRI BUTE TO AH SAVE CHAR/ATTRIBUTE SAVE WRITE COUNT ADDRESS TO 01 REGISTER WRITE COUNT CHARACTER/ ATTR IN BX REG WRITE_LOOP ;----- WAIT FOR HORIZONTAL RETRACE 0414 0418 041B 041C 041C 0410 041F 0421 0422 0422 0423 0425 0427 0429 042A 8B 16 0063 R 83 C2 06 9C MOV ADD PUSHF OX ,ADDR_6845 DX,6 GET BASE ADDRESS POINT AT STATUS PORT SAVE CURRENT FLAGS IN TEST JNZ CLI AL,DX AL, HORLRETRACE P8 GET STATUS IS IT LOW WAIT UNTIL IT IS NO MORE INTERRUPTS IN TEST JZ MOV STOSW POPF AL,DX AL, HORLRETRACE P9 AX,BX GET STATUS IS IT HIGH WAIT UNTIL IT IS RECOVER THE CHAR/ATTR PUT TH E CHAR/ ATTR INTERRUPTS BACK ON - I F P8: EC A8 01 75 FB FA P9: EC A8 01 74 FB 8B C3 AB 90 em ROM BIOS 2-95 042B 0420 0430 E2 E7 E9 016F R LOOP P7 JMP VIDEO_RETURN WRITE-AC_CURRENT ENDP AS MANY TIMES AS REQUESTED WRITE_CCURRENT NOT VALID FOR MEDIUM RESOLUTION GRAPHICS ** THIS ROUTINE WRITES THE CHARACTER AT THE CURRENT CURSOR POSITION, ATTRIBUTE UNCHANGED INPUT (BH) = DISPLAY PAGE (CX) = COUNT OF CHARACTERS TO WRITE (AL) = CHAR TO WRITE (AH) CURRENT CRT MODE (OS) = DATA SEGMENT (ES) = REGEN SEGMENT OUTPUT NONE ** INTERRUPTS: DISABLED DURING THE WRITE 0430 0430 0433 0435 0438 043A 0430 0430 043E 043F 0442 0444 0445 0446 80 72 80 74 E9 FC 04 08 FC 07 03 05BD R 50 51 E8 03EO 8B FB 59 5B WRITE_CCURRENT PROC NEAR CMP AH,4 JC PI0 CMP AH,7 JE PI0 GRAPHICS_WRITE JMP PI0 : PUSH AX PUSH CX CALL FIND_POSITION MOV 01, BX POP CX POP BX Pll: IS THIS GRAPHICS IS THIS MONO CARD SAVE CHAR ON STACK SAVE WRITE COUNT ADDRESS TO 01 WRITE COUNT BL HAS CHAR TO WR I TE WRITE_LOOP ; ----- WAIT FOR HORIZONTAL RETRACE 0446 044A 0440 044E 044E 044F 0451 0453 0454 0454 0455 0457 0459 045B 045C 0450 045E 0460 0463 8B 16 0063 83 C2 06 9C EC A8 01 75 FB FA EC A8 74 8A AA 90 47 E2 E9 01 FB C3 E6 016F R MOV OX ,ADDR_6845 ADD DX,6 PUSHF P12 : IN AL,DX TEST AL,HORLRETRACE JNZ P12 CLI P13 : IN AL,DX TEST AL,HORLRETRACE P13 JZ MOV AL, BL STOSB POPF INC 01 LOOP Pll VIDEO_RETURN JMP WRITE_CCURRENT ENDP 2-96 ROM BIOS GET BASE ADDRESS POINT AT STATUS PORT SAVE CURRENT FLAGS GET STATUS IS IT LOW WAIT UNTIL IT IS NO MORE INTERRUPTS GET STATUS IS IT HIGH WAIT UNTI L IT IS RECOVER CHAR WRITE CHAR I NTERRUPTS BACK ON - I F ON BUMP POINTER PAST ATTRIBUTE AS MANY TIMES AS REQUESTED READ DOT ENTRY -- -- WRITE DOT THESE ROUTINES WILL WRITE A DOT, OR READ THE DOT AT THE INDICATED LOCATION ox = ROW (0-199) (THE ACTUAL VAL DEPENDS ON THE MODE) COLUMN ( 0-639) ( THE VALUES ARE NOT RANGE CHECKED) OOT VALUE TO WRITE (1,2 OR 4 BITS OEPENOING ON MODE, REQ'D FOR WRITE DOT ONLY, RIGHT JUlTIFIED) BIT 7 OF AL=l INDICATES XOR THE VAL INTO LOCATION OS DATA SEGMENT ES REG EN SEGM ENT CX AL EXIT AL = DOT VALUE READ, RIGHT JUSTIFIED, READ ONLY -- - -- - - - - - - - - - -- - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - -- - - - -- - - - - - -- - - -0463 0463 0466 0469 046B 0460 046F 0471 0474 0474 0474 0475 0476 0479 047B 0470 0480 0481 0484 0486 0488 048A 048C 048C 048F 0490 0493 0493 0495 0497 E8 0497 R 26: 8A 04 22 C4 02 EO BA CE 02 CO E9 016F R 50 50 E8 0497 02 E8 22 C4 26: 8A DC 58 F6 C3 80 75 00 F6 04 22 CC OA C1 26: 88 04 58 E9 016F R 32 C1 EB F5 ASSUME READ_DOT CALL MOV AND SHL MOV ROL JMP READ_DOT CS: ROMCODE, OS: DATA, ES: DATA PROC NEAR R3 ; FIND BYTE POSITION OF DOT AL,ES:-SIGET THE BYTE MASK OFF OTHER BITS IN BYTE AL,AH LEFT JUSTI FY THE VALUE AL, CL GET NUMBER OF BITS IN RESULT CL,DH AL,CL RIGHT JUSTIFY THE RESULT VIDEO_RETURN RETURN FROM VIDEO 10 ENDP WRITE_DOT PUSH PUSH CALL SHR AND MOV POP TEST JNZ NOT AND OR R1 : MOV POP JMP R2: XOR JMP WRITE_DOT PROC AX AX R3 AL, CL AL,AH CL,ES:-SIBX BL ,80H R2 AH CL,AH AL,CL ES:-SI-,AL AX VIDEO_RETURN AL,CL R1 NEAR SAVE DOT VALUE TWICE FIND BYTE POSITION OF DOT SHIFT TO SET UP OUT BITS ; STRI P OFF THE OTHER BITS GET THE CURRENT BYTE RECOVER XOR FLAG IS IT ON YES, XOR THE DOT SET THE MASK TO REMOVE THE INDICATED BITS OR IN THE NEW VALUE OF BITS ; FINISH_DOT RESTORE THE BYTE IN MEMORY RETURN FROM VIDEO 10 XOR_DOT EXCLUSIVE OR THE DOTS FINISH UP THE WRITING ENDP R3 PROCEDURE THIS SUBROUTINE DETERMINES THE REGEN BYTE LOCATION OF THE INDICATED ROW COLUMN VALUE IN GRAPHICS MODE. ENTRY -DX = ROW VALUE (0-199) CX = COLUMN VALUE (0-639) EXIT -SI OFFSET INTO REGEN BUFFER FOR BYTE OF INTEREST AH = MASK TO STRIP OFF THE BITS OF INTEREST CL BITS TO SHIFT TO RIGHT JUSTIFY THE MASK IN AH DH = # BITS IN RESULT 0 0 0497 0497 0498 53 50 R3 PROC PUSH PUSH NEAR BX AX ; SAVE BX DURING OPERATION ; SAVE AL DURING OPERATION DETERMINE 1ST BYTE IN INDICATED ROW BY MULTIPLY ROW VALUE BY 40 LOW BIT OF ROW DETERMINES EVEN/ODD, 80 BYTES/ROW 0499 0498 049C 049F BO 28 52 80 E2 FE F6 E2 MOV PUSH AND MUL AL,40 OX DL,OFEH DL SAVE ROW VALUE STRIP OFF ODD/EVEN BIT AX HAS ADDRESS OF 1ST BYTE ROM BIOS 2-97 04Al 04A2 04A5 04A7 04AA 04AA 04AC 04AD 5A F6 C2 01 74 03 05 2000 POP TEST JZ ADD OX DL,1 R4 AX,2000H MaV POP MOV SI,AX AX DX,CX OF INDICATED ROW RECOVER IT TEST FOR EVEN/ODD JUMP I F EVEN ROW OFFSET TO LOC OF ODD ROWS EVEN_ROW MOVE PO I NTER TO SI RECOVER AL VALUE COLUMN VALUE TO OX R4: 8B FO 58 8B 01 DETERMI NE GRAPH I CS MODE CURRENTLY I N EFFECT SET UP THE REGISTERS ACCORDING TO THE MODE CH = MASK FOR LOW OF COLUMN ADDRESS ( 7/3 FOR HIGH/MED RES) CL = # OF ADDRESS BITS IN COLUMN VALUE ( 3/2 FOR H/M) BL = MASK TO SELECT BITS FROM POINTED BYTE (80H/COH FOR H/M) BH = NUMBER OF VALID BITS IN POINTED BYTE ( 1/2 FOR H/M) 04AF 04B2 04B5 04BA 04BC 04BF BB 89 80 72 BB B9 02CO 0302 3E 0049 R 06 06 0180 0703 MOV MOV CMP JC MOV MOV BX,2COH CX,302H CRLMODE,6 R5 BX,180H CX,703H SET PARMS FOR MED RES HANDLE IF MED ARES SET PARMS FOR HIGH RES DETERMINE BIT OFFSET IN BYTE FROM COLUMN MASK 04C2 04C2 R5 : 22 EA AND CH,DL ; AD DR OF PEL IN BYTE TO CH DETERMINE BYTE OFFSET FOR THIS LOCATION IN COLUMN 04C4 04C6 04C8 03 EA 03 F2 8A F7 SHR ADD MOV OX ,CL SI,DX DH, BH SH I FT BY CORRECT AMOUNT INCREMENT THE POINTER GET # BITS IN RESULT TO DH 04CA 04CC 04CC 2A C9 SUB CL ,CL ZERO INTO STORAGE LOCATION DO C8 ROR AL,l 04CE 0400 0402 02 CD FE CF 75 F8 ADD DEC JNZ CL, CH BH R6 0404 0406 0408 0409 04DA 8A E3 02 EC 5B C3 LEFT JUSTI FY THE VALUE IN AL (FOR WRITE) ADD IN THE BIT OFFSET VALUE LOOP CONTROL ON EX IT, CL HAS SH I FT COUNT TO RESTORE BITS GET MASK TO AH MOVE MASK TO CORRECT LOCAT RECOVER REG RETURN WITH SET UP MULTIPLY BH (VALID BITS IN BYTE) BY CH (BIT OFFSET) R6: MOV SHR POP RET R3 ENDP AH,BL AH,CL BX GRAPHICS UP THIS ROUTINE SCROLLS UP THE INFORMATION ON THE CRT ENTRY CH, CL = UPPER LEFT CORNER OF REGION TO SCROLL DH,DL = LOWER RIGHT CORNER OF REGION TO SCROLL BOTH OF THE ABOVE ARE IN CHARACTER POSITIONS BH = FILL VALUE FOR BLANKED LINES AL = # LINES TO SCROLL (AL=O MEANS BLANK THE ENTIRE FIELD) OS = DATA SEGMENT ES = REGEN SEGMENT EXIT NOTHING, THE SCREEN IS SCROLLED 04DA 04DA 04DC 8A 08 8B Cl GRAPHICS_UP PROC MOV BL,AL MaV AX,CX NEAR ; SAVE LINE COUNT IN BL ; GET UPPER LEFT POS IN AX REG USE CHARACTER SUBROUTINE FOR POSITIONING 2-98 ROM BIOS ;----- ADDRESS RETURNED IS MULTIPLIED BY 2 FROM CORRECT VALUE 04DE 04El EB 073C R 8B F8 CALL MOV GRAPH_POSN DI,AX ; SAVE RESULT AS DEST ADDRESS DETERMINE SIZE OF WINDOW 04E3 04E5 04E9 2B 01 81 C2 0101 DO E6 SUB ADD SAL OX ,CX DX,101H DH,l 04EB DO E6 SAL DH,l 04ED 04F2 80 3E 0049 R 06 73 04 04F4 04F6 DO E2 01 E7 ADJUST VALUES MUL TIPL Y # ROWS BY 4 SINCE 8 VERT DOTS/CHAR AND EVEN/ODD ROWS DETERMINE CRT MODE CMP JNC CRLMODE,6 R7 TEST FOR MEDIUM RES FIND_SOURCE MEDIUM RES UP SAL SAL ; # COL * 2 SINCE 2 BYTES/CHAR ; OFFSET *2 SINCE 2 BYTES/CHAR DL,l 01,1 DETERMINE THE SOURCE ADDRESS IN THE BUFFER 04F8 04F8 04F9 04FA 04FC 04FE 0500 0502 0504 0506 0508 050A 050C 050E R7: 06 IF 2A DO DO 74 8A B4 F6 8B 03 8A 2A PUSH POP SUB SAL SAL JZ MOV MOV MUL MOV ADD MOV SUB ED E3 E3 20 C3 50 E4 F7 FO E6 E3 FIND_SOURCE GET SEG BOTH POINTING REGEN ES OS CH,CH BL,l BL,l Rll AL, BL AH,80 AH SI,DI SI,AX AH,DH AH,BL ZERO TO HIGH OF COUNT REG MUL TI PL Y NO. OF LI NES BY 4 IF ZERO, BLANK ENTIRE FIELD GET NUMBER OF LINES IN AL 80 BYTES/ROW DETERMINE OFFSET TO SOURCE SET UP SOURCE ADD IN OFFSET TO IT NUMBER OF ROWS IN FIELD DETERMINE NUMBER TO MOVE LOOP THROUGH, MOVING ONE ROW AT A TIME, BOTH EVEN & ODD FIELDS 0510 0510 0513 0517 051B 0510 R8: E8 81 81 FE 75 0593 R EE IFBO EF IFBO CC Fl CALL SUB SUB DEC JNZ R17 SI,2000H-80 DI,2000H-80 AH R8 ROW_LOOP MOVE ONE ROW MOVE TO NEXT ROW NUMBER OF ROWS TO MOVE CONTINUE TILL ALL MOVED FILL IN THE VACATED LINE(S) 051F 051F 0521 0521 0524 0528 052A 052C 052F 052F 0531 0533 8A C7 E8 81 FE 75 E9 05AC R EF IFBO CB F5 016F R 8A DE EB EC R9: MOV RlO: CALL SUB DEC JNZ JMP Rll: MOV CLEAR-ENTRY ATTRIBUTE TO FILL WITH AL, BH R18 DI,2000H-80 BL RIO VIDEO_RETURN BL,DH JMP R9 GRAPHICS_UP CLEAR THAT ROW POINT TO NEXT LINE NUMBER OF LI NES TO FILL CLEAR_LOOP EVERYTHING DONE BLANK_FI ELD SET BLANK COUNT TO EVERYTHING IN FIELD CLEAR THE FI ELD ENDP ROM BIOS 2-99 GRAPHICS DOWN THIS ROUTINE SCROLLS DOWN THE INFORMATION ON THE CRT ENTRY CH,CL = UPPER LEFT CORNER OF REGION TO SCROLL DH,DL = LOWER RIGHT CORNER OF REGION TO SCROLL BOTH OF THE ABOVE ARE IN CHARACTER POSITIONS BH = FILL VALUE FOR BLANKED LINES AL = # LINES TO SCROLL (AL=O MEANS BLANK THE ENTIRE FI ELD) OS = DATA SEGMENT ES = REGEN SEGMENT EXIT NOTHING, THE SCREEN IS SCROLLED 0533 0533 0534 0536 GRAPH I CS_DOWN PROC STD MOV BL,AL MOV AX,DX FD 8A 08 8B C2 NEAR ; SET DIRECTION ; SAVE LINE COUNT IN BL ; GET LOWER RIGHT POS INTO AX ;----- USE CHARACTER SUBROUTINE FOR POSITIONING ;----- ADDRESS RETURNED IS MULTIPLIED BY 2 FROM CORRECT VALUE 0538 053B onc E8 8B F8 R CALL MOV GRAPH_POSN DI,AX ; SAVE RESULT AS DEST AD DR DETERMINE SIZE OF WINDOW 0530 053F 0543 2B 01 81 C2 OlD1 DO E6 0545 DO E6 SUB ADD SAL OX, CX DX,101H DH,l SAL DH,l ADJUST VALUES MUL TIPLY # ROWS BY 4 SINCE 8 VERT DOTS/CHAR AND EVEN/ODD ROWS DETERMINE CRT MODE 0547 054C 80 3£ 0049 R 06 73 05 054E DO E2 SAL DL,l 0550 0552 01 E7 47 SAL INC 01,1 01 CMP JNC CRLMODE,6 R12 TEST FOR MEDIUM RES FIND_SOURCE_DOWN ;----- MEDIUM RES DOWN # COLUMNS * 2, SINCE 2 BYTES/CHAR (OFFS,ET OK) OFFSET *2 SINCE 2 BYTES/CHAR PO I NT TO LAST BYT E DETERMINE THE SOURCE ADDRESS IN THE BUFFER 0553 0553 0554 05.55 0557 055B 0550 055F 0561 0563 0565 0567 0569 056B 0560 06 IF 2A 81 DO DO 74 8A B4 F6 8B 2B 8A 2A ED C7 OOFO E3 E3 2E C3 50 E4 F7 FO E6 E3 R12 : PUSH POP SUB ADD SAL SAL JZ MOV MOV MUL MOV SUB MOV SUB ES OS CH,CH 01,240 BL,l BL,l R16 AL,BL AH,80 AH SI,DI SI,AX AH,DH AH,BL FIND_SOURCLDOWN BOTH SEGMENTS TO REGEN ZERO TO HIGH OF COUNT REG POINT TO LAST ROW OF PIXELS MUL TIPLY NO. OF LINES BY 4 IF ZERO, BLANK ENTIRE FIELD GET NUMBER OF LINES IN AL 80 BYT ES / ROW DETERMINE OFFSET TO SOURCE SET UP SOURCE SUBTRACT THE OFFSET NUMBER OF ROWS IN FIELD DETERMINE NUMBER TO MOVE LOOP THROUGH, MOVING ONE ROW AT A TIME, BOTH EVEN & ODD FI ELDS 056F 056F 0572 0576 057A 057C E8 81 81 FE 75 0593 R EE 2050 EF 2050 CC F1 R13 : CALL SUB SUB DEC JNZ R17 SI,2000H+80 DI,2000H+80 AH R13 FILL IN THE VACATED LINE(S) 2-100 ROM BIOS ROW_LOOP _DOWN MOVE ONE ROW MOV E TO NEXT ROW NUMBER OF ROWS TO MOVE CONTINUE TILL ALL MOVED 057E 057E 0580 0580 0583 0587 0589 058B 058C 058F 058F 0591 0593 8A C7 E8 81 FE 75 FC E9 05AC R EF 2050 CB F5 016F R 8A DE EB EB R14: MOV R15: CALL SUB DEC JNZ CLD JMP R16 : MOV AL, BH R18 DI ,2000H+80 BL R15 VIDEO_RETURN BL,DH JMP R14 GRAPH I CS_DOWN CLEAR_ENTRLDOWN ATTRIBUTE TO FILL WITH CLEAR_LOOP_DOWN CLEAR A ROW POINT TO NEXT LINE NUMBER OF LINES TO FILL CLEAR_LOOP_DOWN RESET THE DIRECTION FLAG EVERYTHING DONE BLANILFI ELD_DOWN SET BLANK COUNT TO EVERYTHNG IN FIELD CLEAR THE FI ELD ENDP ROUTINE TO MOVE ONE ROW OF I NFORMA TI ON 0593 0593 0595 0596 0597 0599 059A 059B 059F 05A3 05A4 05A5 05A7 05A9 05AA 05AB 05AC R17 8A CA 56 57 F3/ A4 5F 5E 81 C6 2000 81 C7 2000 56 57 8A CA F3/ A4 5F 5E C3 MOV PUSH PUSH REP POP POP ADD ADD PUSH PUSH MOV REP POP POP RET R17 PROC NEAR CL, DL SI DI MOVSB DI SI SI,2000H DI,2000H SI DI CL,DL MOVSB DI SI NUMBER OF BYTES IN THE ROW SA VE PO INTERS MOVE THE EVEN FI ELD POINT TO THE ODD FIELD SAVE THE POINTERS COUNT BACK MOVE THE ODD FI ELD POINTERS BACK RETURN TO CALLER ENDP CLEAR A SINGLE ROW 05AC 05AC 05AE 05AF 05Bl 0582 05B6 05B7 05B9 05BB 05BC 05BD RIB MOV PUSH REP POP ADD PUSH MOV REP POP RET 8A CA 57 F3/ AA 5F 81 C7 2000 57 8A CA F3/ AA 5F C3 R18 PROC NEAR CL, DL DI STOSB DI DI,2000H DI CL, DL STOSB DI NUMBER OF BYTES IN FI ELD SAVE POINTER STORE THE NEW VALUE POINTER BACK POINT TO ODD FIELD FILL THE ODD FILELD RETURN TO CALLER ENDP GRAPHICS WRITE THIS ROUTINE WRITES THE ASCI I CHARACTER TO THE CURRENT POSITION ON THE SCREEN. ENTRY AL = CHARACTER TO WRITE BL = COLOR ATTRIBUTE TO BE USED FOR FOREGROUND COLOR IF BIT 7 IS SET, THE CHAR IS XOR'D INTO THE REGEN BUFFER (0 IS USED FOR THE BACKGROUND COLOR) CX = NUMBER OF CHARS TO WRITE OS = DATA SEGMENT ES = REGEN SEGMENT EXIT NOTHING IS RETURNED FOR THIS ROUTINE, THE IMAGES USED TO FORM CHARS ARE CONTAINED IN ROM. ROM BIOS 2-101 05BD 05BD 05BF B4 00 50 05CO 05C3 E8 0739 8B F8 ASSUME CS: ROMCODE, OS: DATA, ES: DATA GRAPH I CS_WR ITE PROC NEAR MOV AH,O ; ZERO TO HIGH OF CODE POINT PUSH AX ; SAVE CODE POINT VALUE DETERMINE POSITION IN REGEN BUFFER TO PUT CODE POINTS CALL MOV S26 DI,AX ; FIND LOC IN REGEN BUFFER ; REGEN POINTER IN 01 DETERMINE REGION TO GET CODE POINTS FROM 05C5 05C6 05C7 05C9 58 IE 2B F6 8E DE 05CB 05CD 05CF 0503 0506 0508 05DC 3C 73 C5 EB 2C C5 8C 05DE 05DF IF 52 80 07 36 0110 07 90 80 36 007C DA POP AX PUSH OS SUB SI,SI MOV OS ,SI ASSUME OS :ABSO CMP AL,80H JAE SO LOS SI,CSELPTR JMP SI SO: SUB AL,80H LOS SI, EXLPTR SI : MOV DX,DS ASSUME DS:DATA POP OS PUSH OX ; RECOVER CODE POINT IF IT IS IN SECOND HALF JUMP IT'S IN FIRST HALF ZERO ORIGIN FOR SECOND HALF GET POINTER TO 2ND HALF SAVE THE SEGMENT OF THE TBL RECOVER DATA SEGMENT SAVE TABLE SEGMENT ON STACK DETERMINE GRAPHICS MODE IN OPERATION 05EO 05EO 05E2 05E4 05E6 05E8 05ED 05EE S2: 01 01 01 03 80 IF 72 EO EO EO FO 3E 0049 R 06 SAL SAL SAL ADD CMP POP JC 2C AX,1 AX,1 AX,1 SI,AX CRLMODE,6 OS S7 DETERMINE-MODE MUL TI PL Y CODE PO I NT VALUE BY 8 SI HAS OFFSET OF CODES RECOVER TBL POINTER SEGMENT TEST FOR MEDIUM RESOLUTION HIGH RESOLUTI ON MODE 05FO 05FO 05F! 05F2 05F4 05F4 05F5 05F8 05FA 05FB 05FC 05FC 0601 0604 0606 0608 0609 060A 060B 0600 0610 0610 0613 0614 0615 061A S3 : 57 56 B6 04 PUSH PUSH MOV 01 SI DH,4 HIGH_CHAR SAVE REGEN POINTER SAVE CODE POINTER NUMBER OF TIMES THROUGH LOOP S4: AC F6 C3 80 75 16 AA AC LODSB TE5T JNZ STOSB LOD5B BL,80H 56 GET BYTE FROM CODE POINTS SHOULD WE USE THE FUNCTION TO PUT CHAR IN STORE IN REGEN BUFFER 55: 26: 88 85 IFFF 83 C7 4F FE CE 75 EC 5E 5F 47 E2 E3 E9 016F R MOV ADD DEC JNZ POP POP INC LOOP JMP ES: [DI+2000H-l] ,AL ; STORE IN SECOND HALF 01,79 MOVE TO NEXT ROW IN REGEN DH DONE WITH LOOP 54 51 01 RECOVER REGEN POINTER 01 POINT TO NEXT CHAR POSITION S3 MORE CHARS TO WRITE VIDEO_RETURN XOR STOSB LODSB XOR JMP AL,ES:[DI] 56: 26: 32 05 AA AC 26: 32 85 IFFF EB EO EXCLUSIVE OR WITH CURRENT 5TORE THE CODE POINT AGAI N FOR ODD FI ELD AL,ES: [DI+2000H-l] S5 BACK TO MAINSTREAM ;----- MEDIUM RESOLUTION WRITE 061C 061C 061E 0620 57 : 8A 03 01 E7 E8 06F7 2-102 ROM BIOS MOV 5AL CALL DL,BL 01,1 S19 MED_RES_WRITE SAVE HIGH COLOR BIT OFF5ET*2 SINCE 2 BYTE5/CHAR EXPAND BL TO FULL WORD 0623 0623 0624 0625 0627 0627 0628 062B 062D 0630 0632 0635 0639 0639 063C 0640 0641 0644 0646 0649 064B 0650 0655 0655 065A 065F 0662 0664 0666 0667 0668 0669 066A 066C 066F MED_CHAR SAVE REGEN POINTER SAVE THE CODE POINTER NUMBER OF LOOPS S8: 57 56 B6 04 PUSH PUSH MOV DI SI DH,4 LODSB CALL AND S21 AX,BX S9: AC E8 070C R 23 C3 F6 C2 80 74 07 26: 32 25 26: 32 45 01 26: 88 25 26: 88 45 01 AC E8 070C R 23 C3 F6 C2 80 74 OA 26: 32 A5 2000 26: 32 85 2001 26 : 88 A5 2000 26: 88 85 2001 83 C7 50 FE CE 75 Cl 5E 5F 47 47 E2 B7 E9 016F R GET CODE POI NT DOUBLE UP ALL THE BITS CONVERT THEM TO FOREGROUND COLOR ( 0 BACK ) IS THIS XOR FUNCTION NO, STORE IT IN AS IT IS ; DO FUNCTION WITH HALF AND WITH OTHER HALF TEST DL,80H JZ S10 XOR AH,ES:[DIJ XOR AL,ES: [DI+IJ SlO: ES:-DI-,AH STORE FI RST BYTE MOV MOV ES: [DI+IJ ,AL STORE SECOND BYTE LODSB GET CODE POINT CALL S21 AND AX,BX CONVERT TO COLOR TEST DL,80H AGAIN, IS THIS XOR FUNCTION JZ Sl1 ; NO, JUST STORE THE VALUES AH, ES: -DI +2000HFUNCTION WITH FIRST HALF XOR AL, ES: -D I +2001HAND WITH SECOND HALF XOR Sl1: MOV ES: [D I +2000HJ , AH ES: -DI +2000H+ 1-, AL MOV PUT I N 2ND BU FR PART ADD DI,80 POINT TO NEXT LOCATION DEC DH JNZ S9 KEEP GOING POP SI RECOVER CODE PONTER POP 01 RECOVER REGEN POINTER DI POINT TO NEXT CHAR POSITION INC INC DI LOOP S8 MORE TO WRITE JMP VIDEO_RETURN GRAPHICS_WRITE ENDP GRAPH I CS READ THIS ROUTINE READS THE ASCII CHARACTER AT THE CURRENT CURSOR POSITION ON THE SCREEN BY MATCHING THE DOTS ON THE SCREEN TO THE CHARACTER GENERATOR CODE POINTS ENTRY ( 0 IS ASSUMED AS THE BACKGROUND COLOR DS DATA SEGMENT ES REGEN SEGMENT EXIT AL CHARACTER READ AT THAT POSITION (0 RETURNED IF NONE FOUND) 0 0 0 FOR THIS ROUTINE, THE IMAGES USED TO FORM CHARS ARE CONTAINED IN ROM. 066F 066F 0672 0674 E8 0739 R 8B FO 83 EC 08 0677 8B EC GRAPH I CS_READ PROC CALL S26 MOV SI,AX SUB SP,8 MOV BP ,SP NEAR CONVERTED TO OFFSET IN REGEN SAVE IN SI ALLOCATE SPACE TO SAVE THE READ CODE POINT POINTER TO SAVE AREA DETERMINE GRAPHICS MODES 0679 067E 067F 0680 80 3 E 0049 R 06 06 IF 72 lA CMP PUSH POP JC CRLMODE,6 ES DS S13 POINT TO REGEN SEGMENT MEDIUM RESOLUTION HIGH RESOLUTION READ GET VALUES FROM REGEN BUFFER AND CONVERT TO CODE POINT 0682 0684 0684 B6 04 8A 04 MOV S12: MOV DH,4 NUMBER OF PASSES AL, [SIJ GET FIRST BYTE ROM BIOS 2-103 06F4 06F7 E9 016F R VIDEO_RETURN JMP GRAPHICS_READ ENDP ALL DONE -------- - -- - - - - - -- - - - - - -- -- - - -- - - - -- - - - - - - - - - -- - - -- -- --EXPAND_MED_COLOR - S19 THIS ROUTINE EXPANDS THE LOW 2 BITS IN BL TO FILL THE ENTIRE BX REGISTER ENTRY BL = COLOR TO BE US ED ( LOW 2 BITS ) EXIT BX = COLOR TO BE USED ( 8 REPLICATIONS OF THE 2 COLOR BITS ) 06F7 06F7 06FA 06FC 06FD 0700 0700 0702 0704 0706 0708 070A 070B 070C ------- ----- - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - -- - - - - - -- - -S19 80 E3 03 8A C3 51 B9 0003 DO DO OA E2 8A 59 C3 EO EO 08 F8 FB PROC NEAR AND BL,3 MOV AL,BL PUSH CX MOV CX,3 S20: SAL AL,1 SAL AL,1 OR BL,AL LOOP S20 MOV BH, BL POP CX RET 519 ENDP EXPAND_BYTE 070C 070C 0700 0710 0710 0712 0714 0716 0718 071A 071B 071C ISOLATE THE COLOR BITS COPY TO AL SAVE REGISTER NUMBER OF TIMES TO DO THIS LEFT SHI FT BY 2 ANOTHER COLOR VERS ION INTO BL FI LL ALL OF BL FILL UPPER PORTION REGISTER BACK ALL DONE - 521 THIS ROUTINE TAKES THE BYTE IN AL AND DOUBLES ALL OF THE BITS, TURNING THE 8 BITS INTO 16 BITS. THE RESULT IS LEFT IN AX PROC NEAR PUSH OX MOV DX ,8000H DBLBIT4: SHR AL,1 RCR DX,1 SAR DX,1 JNB DBLBIT4 MOV AX,DX POP DX RET 521 ENDP 521 52 BA 8000 DO 01 01 73 8B 5A e3 E8 DA FA F8 C2 SAVE REGISTER BIT TO TERMINATE LOOP LOW ORDER BIT TO CARRY FLAG FROM CARRY TO HIGH OF RESULT DBL HIGH ORDER BIT -SIGN EXT TERM WHEN BIT SHIFTED OUT PUT RESULT I NTO AX RESTORE REGISTER RETURN MED_READ_BYTE - S23 THIS ROUTINE WILL TAKE 2 BYTES FROM THE REGEN BUFFER, COMPARE AGAINST THE CURRENT FOREGROUND COLOR, AND PLACE THE CORRESPONDING ON/OFF BIT PATTERN INTO THE CURRENT POSITION IN THE SAVE AREA ENTRY SI,DS = POINTER TO REGEN AREA OF INTEREST BX = EXPANDED FOREGROUND COLOR BP = POINTER TO SAVE AREA EXIT BP IS INCREMENT AFTER SAVE D71C 071C 071E 0721 0724 0726 0726 0728 0729 072B 072C 072E 0730 0732 0734 PROC NEAR MOV AH, [SIJ MOV AL, [SI+IJ MOV CX,OCOOOH MOV DL,O S24 : TEST AX, ex CLC JZ S25 STC S25 : RCL DL,1 SHR eX,1 eX,1 SHR JNC 524 MOV [BPJ ,DL 523 8A 8A B9 B2 24 44 01 COOO 00 85 F8 74 F9 DO 01 01 73 88 Cl 01 02 E9 E9 F2 56 00 2-104 ROM BIOS GET FI RST BYTE GET SECOND BYTE 2 BIT MASK TO TEST ENTRIES RESULT REGISTER IS THIS SECTION BACKGROUND? CLEAR CARRY I F ZERO, IT IS BACKGROUND WASN'T, SO SET CARRY MOVE THAT BIT INTO RESULT MOVE MASK RIGHT BY 2 BITS AGAI N [F MASK NOT FALL OUT STORE RESULT IN SAVE AREA 0686 0689 068A 068E 0691 0692 0695 0697 0699 88 45 8A 88 45 83 FE 75 EB 46 00 84 2000 46 00 C6 50 CE EB 17 90 MOV INC MOV MOV INC ADD DEC JNZ JMP [BP],AL BP AL, [S I +2000H] [BP],AL BP SI,80 DH S12 S15 SAVE IN STORAGE AREA NEXT LOCATION GET LOWER REGION BYTE ADJUST AND STORE POINTER INTO REGEN LOOP CONTROL DO IT SOME MORE GO MATCH SAVED CODE POINTS ;----- MEDIUM RESOLUTION READ 069C 069C 069E 06AO D6AO E8 07lC R 06A3 06A7 06AA 06AE 06BO 81 E8 81 FE 75 01 E6 B6 04 C6 2000 07lC R EE 1FBO CE EE S13 : SAL MOV S14 : CALL ADD CALL SUB DEC JNZ ,. MED_RES_READ 51,1 DH,4 OFFSET*2 SINCE 2 BYTES/CHAR NUMBER OF PASSES 523 GET PAIR BYTES FROM REGEN INTO SINGLE SAVE GO TO LOWER REGION GET THIS PAIR INTO SAVE ADJUST PTR BACK INTO UPPER SI,2000H S23 SI, 2000H-80 DH S14 KEEP GOING UNTIL ALL 8 DONE SAVE AREA HAS CHARACTER IN IT, MATCH IT 06B2 06B2 06B4 06B6 06BB 06BE 06CO 06C1 06C3 06C3 06C4 06C5 06C8 06C8 06C9 06CA 06CD 06CF 0600 0601 0603 0605 0608 0609 ; FIND_CHAR S15 : SUB MOV ASSUME 26: C4 3E 0110 R LES ASSUME 83 ED 08 SUB 01,01 ES,DI ES: ABSO DI,CSELPTR ES: NOTHING BP ,8 8B F5 FC BO 00 AL,O ENSURE 01 RECTI ON CURRENT CD PT BEING MATCHED SS OS DX,128 ESTAB ADDRESSING TO STACK FOR THE STRING COMPARE NUMBER TO TEST AGAINST SI 01 CX,8 CMPSB 01 SI S18 AL 01,8 OX S17 SAVE SAVE AREA POINTER SAVE CODE POINTER NUMBER OF BYTES TO MATCH COMPARE THE 8 BYTES RECOVER THE POINTERS 2B FF 8E C7 16 IF BA 0080 56 57 B9 0008 F3/ A6 5F 5E 74 IE FE CO 83 C7 08 4A 75 ED MOV CLD MOV S16: PUSH POP MOV S17 : PUSH PUSH MOV REPE POP POP JZ INC ADD DEC JNZ ESTABLI SH ADDRESS I NG ADJUST POINTER TO BEGINNING OF SAVE AREA SI, BP I F ZERO FLAG SET, MATCH NO MATCH, MOVE ON TO NEXT NEXT CODE POINT LOOP CONTROL DO ALL OF THEM CHAR NOT MATCHED, MIGHT BE IN USER SUPPLI ED SECOND HALF 06DB 0600 06DF 06El 3C 74 2B 8E 00 12 CO 08 06E3 06E7 06E9 06EB 06ED 06EF C4 8C OB 74 BO EB 3E 007C CO C7 04 80 02 CMP JE SUB MOV ASSUME LES MOV OR JZ MOV JMP ASSUME AL,O S18 AX,AX DS,AX OS :ABSO DI,EXLPTR AX, ES AX,DI S18 AL,128 S16 DS:DATA AL <> 0 I F 1ST HALF SCANNED IF" 0, IF ALL SCANNED ESTAB ADDRESSING TO VECTOR GET POINTER SEE I F POINTER REALLY EXISTS IF ALL 0, THEN DOESN'T EXIST NO SENSE LOOKING ORIGIN FOR SECOND HALF GO BACK AND TRY FOR IT CHARACTER IS FOUND ( AL"O IF NOT FOUND ) 06F1 06Fl 83 C4 08 S18: ADD SP ,8 ; READJUST, THROW AWAY SAVE ROM BIOS 2-105 0737 0738 0739 45 C3 INC RET S23 BP ; ADJUST PO INTER ; ALL DONE ENDP V4_POSITION - S26 THIS ROUTINE TAKES THE CURSOR POSITION CONTAINED IN THE MEMORY LOCATION, AND CONVERTS IT INTO AN OFFSET INTO THE REGEN BUFFER, ASSUMING ONE BYTE/CHAR. FOR MEDIUM RESOLUTION GRAPHICS, THE NUMBER MUST BE DOUBLED. ENTRY NO REGISTERS, MEMORY LOCATION CURSOR_POSN I S USED EXIT AX CONTAINS OFFSET INTO REGEN BUFFER 0739 0739 073C 073C 0730 073F 0741 0745 0747 0749 074B 0740 074E 074F Al 0050 R 53 8B 8A F6 01 01 2A 03 5B C3 08 C4 26 004A R EO EO FF C3 S26 PROC NEAR MOV AX, CURSOR_POSN GRAPH_POSN LABEL NEAR PUSH BX MOV BX,AX MOV AL,AH MUL BYTE PTR CRLCOLS SHL AX,1 SHL AX,1 SUB BH, BH ADD AX,BX POP BX RET S26 ENDP GET CURRENT CURSOR SAVE REGISTER SAVE COPY OF CURRENT CURSOR GET ROWS TO AL MULTIPLY BY BYTES/COLUMN MTPLY * 4 SINCE 4 ROWS/BYTE ISOLATE COLUMN VALUE DETERMINE OFFSET RECOVER POINTER ALL DONE THIS INTERFACE PROVIDES A TELETYPE LIKE INTERF TO VIDEO CARD. THE INPUT CHARACTER IS WRITTEN TO CURRENT CURSOR POSITION, AND THE CURSOR IS MOVED TO NEXT POSITION. IF CURSOR LEAVES THE LAST COLUMN OF THE FIELD, COLUMN IS SET TO ZERO, AND THE ROW VALUE IS INCREMENTED. IF ROW VALUE LEAVES THE FIELD, CURSOR IS PLACED ON LAST ROW, FIRST COLUMN, AND ENTIRE SCREEN IS SCROLLED UP ONE LINE. WHEN THE SCREEN IS SCROLLED UP, THE ATTRIBUTE FOR FILLING NEW BLANKED LINE IS READ FROM THE CURSOR POSITION ON PREVIOUS LINE BEFORE SCROLL, IN CHARACTER MODE. IN GRAPHICS MODE, THE 0 COLOR IS USED. FOR BKSP, THE CURSOR COLUMN POSITION I S DECREMENTED BY 1. I F THE CURSOR COLUMN ISO AND A BKSP OCCURS CURSOR COLUMN REMAINS O. IT DOES NOT BACKSPACE TO THE PREVIOUS LINE. ENTRY (AL) = CHARACTER TO BE WRITTEN NOTE: BACK SPACE, CR, BELL AND LINE FEED ARE HANDLED AS COMMANDS RATHER THAN AS DISPLAYABLE GRAPHICS (BL) = FOREGROUND COLOR FOR CHAR WRITE IF CURRENTLY I N A GRAPHICS MODE (OS) = DATA SEGMENT EXIT ALL REGI STERS SAVED 074F 074F 0750 0751 0753 0757 0759 50 50 B4 03 8A 3E 0062 CD 10 58 075A 075C 075E 0760 0762 3C 74 3C 74 3C ASSUME WRITE_TTY PUSH PUSH MOV MOV INT POP CS: ROMCODE, OS: DATA PROC NEAR AX AX AH, GELCURSOILINFO BH,ACTIVE_PAGE VIDEO_FN AX SAVE REGISTERS SAVE CHAR TO WRITE READ CURRENT CURSOR POSITION SET CURRENT ACTIVE PAGE I NT 10H RECOVER CHAR OX NOW HAS THE CURRENT CURSOR POSITION 08 52 00 57 OA 2-106 ROM BIOS CMP JE CMP JE CMP AL,8 U8 AL ,DOH U9 AL,OAH IS IT A BACKSPACE BACICSPACE IS IT CARRIAGE RETURN CAR_RET IS IT A LINE FEED 0764 0766 0768 74 57 3C 07 74 5A JE CMP JE UlO AL,07H Ull LINE_FEED IS IT A BELL BELL ; ----- WRITE THE CHAR TO THE SCREEN 076A 076C 076F B4 OA B9 0001 CD 10 0771 0773 0777 0779 077B 077E FE 3A 75 B2 80 75 MOV MOV INT AH,WRITE_CHAILONLY CX,l VIDEO_FN WRITE CHAR ONLY TO ACTIVE PG ONLY ONE CHARACTER INT 10H POSITION THE CURSOR FOR NEXT CHAR C2 16 004A R 33 00 FE 18 2A INC CMP JNZ MOV CMP JNZ DL DL, BYTE PTR CRLCOLS ; TEST FOR COLUMN OVERFLOW U7 SELCURSOR DL,O COLUMN FOR CURSOR DH,24 U6 SELCURSOR_INC SCROLL REQUIRED 0780 0780 0782 U1: B4 02 CD 10 MOV INT AH,SELCURSOR_POS VIDEO_FN ; SET THE CURSOR DETERMINE VALUE TO FILL WITH DURING SCROLL 0784 0787 0789 078B 0780 078F 0791 0791 0793 0795 0797 0797 079A 079C 079E 07A2 07M 07M 07A6 07A6 07A7 07AA 07AA 07AC 07AC 07AE AO 3C 72 3C B7 75 0049 04 06 07 00 06 MOV CMP JC CMP MOV JNE U2: B4 08 CD 10 8A FC MOV INT MOV U3 : B8 2B B6 8A FE 0601 C9 18 16 004A R CA MOV SUB MOV MOV DEC U4: CD 10 INT U5 : 58 E9 016F R POP JMP U6: FE C6 INC U7: B4 02 EB F4 MOV JMP AL,cn...MODE AL,4 U2 AL,7 BH,O U3 GET THE CURRENT MODE READ-CURSOR FI LL WITH BACKGROUND SCROLL-UP READ-CURSOR AH, READ.J\ TLCHAR READ CHAR/ATTR AT CURSOR VIDEO_FN I NT 10H BH,AH STORE IN BH ; SCROLL-UP AX,SCROLL_WINDOW_UP*256+01H ; SCROLL UP ONE LINE CX, CX ; UPPER LEFT CORNER DH,24 ; LOWER RIGHT ROW DL,BYTE PTR CRLCOLS ; LOWER RIGHT COLUMN DL VI DEO-CALL-RETURN VIDEO_FN PROCESS VIDEO FUNCTION TTY-RETURN AX RESTORE THE CHARACTER VIDEO_RETURN RETURN TO CALLER SET-CURSOR-INC DH NEXT ROW SET -CURSOR AH, SELCURSOR_POS SET CURSOR POSITION U4 ESTABLISH THE NEW CURSOR BACK SPACE FOUND BACK SPACE DOES NOT BACK SPACE TO PREVIOUS LINE I F AT BEG OF LINE 07BO 07BO 07B3 07B5 07B7 U8: 80 74 FE EB FA 00 F7 CA F3 CMP JE DEC JMP DL,O U7 DL U7 ALREADY AT BEGINNING OF LINE SELCURSOR NO -- JUST MOVE IT BACK SELCURSOR CARRIAGE RETURN FOUND 07B9 07B9 07BB U9 : B2 00 EB EF MOV JMP DL,O U7 MOVE TO FI RST COLUMN SELCURSOR LINE FEED FOUND 07BD 07BD 80 FE 18 U10: CMP DH,24 BOTTOM OF SCREEN ROM BIOS 2-107 07CO 07C2 75 ES EB BC JNE JMP U6 UI YES, SCROLL THE SCREEN NO, JUST SET THE CURSOR BL ,2 BEEP U5 SET UP COUNT FOR BEEP SOUND THE POD BELL TTLRETURN BELL FOUND 07C4 07C4 07C6 07C9 07CB Ull: MOV CALL JMP WRITE_TTY B3 02 ES 0000 E EB DB ENDP LIGHT PEN THIS ROUTINE TESTS THE LIGHT PEN SWITCH AND THE LIGHT PEN TRIGGER. IF BOTH ARE SET, THE LOCATION OF THE LIGHT PEN IS DETERMINED. OTHERWISE, A RETURN WITH NO INFORMATION IS MADE. ON ENTRY (OS) = DATA (AH) =0 SEGMENT ON EXIT IF NO LIGHT PEN INFORMATION IS AVAILABLE aX,ex,ox ARE DESTROYED (AH) = 1 IF LIGHT PEN IS AVAILABLE (DH,DL) = ROW,COLUMN OF CURRENT LIGHT PEN POSITION (CH) = RASTER POSITION (BX) = BEST GUESS AT PIXEL HORIZONTAL POSITION 07CB 07CB 0703 ASSUME CS:ROMCODE,DS:DATA ;----- SUBTRACLTABLE VI LABEL BYTE 03 03 05 05 03 03 DB 3,3,5,5,3,3,3,4 03 04 PROC NEAR ;----- WAIT FOR LIGHT PEN TO BE DEPRESSED 0703 0705 0709 07DC 0700 07DF B4 SB 83 EC AS 75 00 16 0063 C2 06 07E! 07E3 07E5 AS 02 75 03 E9 OS69 R 04 7E MOV MOV ADD IN TEST JNZ AH,O OX, ADDR_6S45 DX,6 AL,DX AL, LIGHLPEN_SWITCH V6 SET NO LIGHT PEN RETURN CODE GET BASE ADDRESS OF 6S45 POINT TO STATUS REGISTER GET STATUS REGISTER TEST LI GHT PEN SWITCH NOT SET, RETURN . NOW TEST FOR LIGHT PEN TRIGGER TEST JNZ JMP AL ,2 V7A V7 TEST LIGHT PEN TRIGGER RETURN WIO RESETTING TRIGGER TRIGGER HAS BEEN SET, READ THE VALUE IN 07E8 07ES B4 10 07EA 07EE 07FO 07Fl 07F2 07F3 07F5 07F6 07F8 07FA 07FB OlFC 07FD 8B SA EE 42 EC 8A 4A FE SA EE 42 EC SA V7A: MOV AH,16 ; LIGHT PEN REGISTERS ON 6845 INPUT REGS POINTED TO BY AH, AND CONVERT TO ROW COLUMN IN OX 16 0063 C4 E8 C4 C4 E5 MOV MOV OUT INC IN MOV DEC INC MOV OUT INC IN MOV DX,ADDR_6S45 AL,AH OX ,AL DX AL,DX CH,AL OX AH AL,AH DX,AL OX AL,DX AH,CH ADDRESS REGISTER FOR 6845 REGISTER TO READ SET IT UP DATA REGISTER GET THE VALUE SAVE IN CX ADDRESS REGISTER SECOND DATA REGISTER POINT TO DATA REGISTER GET SECOND DATA VALUE AX HAS INPUT VALUE ; ----- AX HAS THE VALUE READ IN FROM THE 6S45 2-108 ROM BIOS 07FF 0803 0805 080A 080C 0810 0812 0814 0816 MOV SUB MOV SUB MOV SHR SUB JNS SUB 8A 1E 0049 R 2A FF 2E: 8A 9F 07CB R 2B C3 8B 1E 004E R 01 EB 2B C3 79 02 2B CO BL,CRLMODE BH,BH BL,CS:V1[BX] AX,BX BX,CRLSTART BX,l AX, BX V2 AX,AX MODE VALUE TO BX DETERMINE AMOUNT TO SUBTRACT TAKE IT AWAY IF POSITIVE, DETERMINE MODE <0 PLAYS AS 0 DETERMINE MODE OF OPERATION 0818 0818 081A 081F 0821 0826 V2 : B1 80 72 80 74 MOV CMP JB CMP JE 03 3E 0049 R 04 2A 3E 0049 R 07 23 CL,3 CRLMODE,4 V4 CRLMODE,7 V4 DETERMINEjlODE SET *8 SHIFT COUNT DETERMINE IF GRAPHICS OR ALPHA ALPHA_PEN ALPHA_PEN GRAPHICS MODE 0828 082A MOV DIV B2 28 F6 F2 DL,40 DL DIVISOR FOR GRAPHICS DETERMINE ROW(AL) AND COLUMN(AH) AL RANGE 0-99, AH RANGE 0-39 DETERMINE GRAPHIC ROW POSITION 082C 082E 0830 0832 0834 0839 083B 0830 083F 083F 8A 02 8A 2A 80 75 B1 DO E8 ED DC FF 3E 0049 R 06 04 04 E4 MOV ADD MOV SUB CMP JNE MOV SAL CH,AL CH,CH BL,AH BH, BH CRLMODE,6 V3 CL,4 AH,l SHL BX,CL V3: 03 E3 SAVE ROW VALUE IN CH *2 FOR EVEN/ODD FI ELD COLUMN VALU E TO BX MUL TI PL Y BY 8 FOR MEDIUM RES DETERMINE MEDIUM OR HIGH RES NOLH I GH_RES SHI FT VALUE FOR HIGH RES COL VAL TIMES 2 FOR HIGH RES NOLHIGH_RES MULTIPLY *16 FOR HIGH RES DETERMINE ALPHA CHAR POSITION 0841 0843 0845 0847 0849 8A 8A DO DO EB 04 FO EE EE 12 MOV MOV SHR SHR JMP DL,AH DH,AL DH,l DH,l SHORT V5 COLUMN VALUE FOR RETURN ROW VALUE DIVIDE BY 4 FOR VALUE IN 0-24 RANGE LIGHT_PEN_RETURN_SET ;----- ALPHA MODE ON LIGHT PEN 084B 084B 084F 0851 0853 0855 0857 0859 085B 0850 0850 085F 085F 0860 0864 0867 0868 0869 0869 086A 086C 086F 0872 0875 0876 0879 V4: F6 8A 8A 02 8A 8A 32 03 36 004A R FO 04 EO E8 DC FF E3 DIV MOV MOV SAL MOV MOV XOR SAL BYTE PTR CRLCOLS DH,AL DL,AH AL,CL CH,AL BL,AH BH, BH BX,CL MOV AH,l PUSH MOV ADD OUT POP OX OX ,ADDR_6845 DX,7 DX,AL OX V5: B4 01 V6: 52 8B 16 0063 83 C2 07 EE 5A V7: 55 8B 89 89 89 50 E9 EC 5E 08 4E OA 56 DC 016F R PUSH MOV MOV MOV MOV POP JMP READ_LPEN BP BP ,SP [BP] • BX-POS, BX [BP] • CX-POS, CX [BP] . DX-POS, OX BP VIDEO_RETURN ENDP ALPHA_PEN DETERMINE ROW,COLUMN VALUE ROWS TO DH COLS TO DL MUL TI PL Y ROWS * 8 GET RASTER VAL TO RETURN REG COLUMN VALUE TO BX LI GHT_PEN_RETURN_SET INDICATE EVERTHING SET LIGHT _PEN_RETURN SAVE RETURN VALUE (IN CASE) GET BASE ADDRESS POINT TO RESET PARM ADDR, NOT DATA, IS IMPORTANT RECOVER VALUE RETURN_NO_RESET GET PTR TO STACK SAVE AREA SETUP RETURN VALUES IN STACK SAVE AREA ROM BIOS 2-109 WRITE_STRING THIS ROUTINE WRITES A STRING OF CHARACTERS TO THE CRT. INPUT (AL) ~ WRITE STRING COMMAND 0 - 3 (BH) DISPLAY PAGE (Bl) ~ ATTRIBUTE OF CHAR TO WRITE IF AL ~~ 0 OR AL ~~ 1 (CX) ~ COUNT OF CHARACTERS TO WRITE, IF CX~O THEN RETURN (OX) ~ CURSOR POSITION FOR STRING TO BE WRITTEN ROW ~ (0-24), COL ~ (0- (CRT COLUMNS-I)) CRT COLUMN SIZE IS EITHER 80 OR 40 (ES) ~ STRING SEGMENT (BP) ~ STRING OFFSET (OS) ~ DATA SEGMENT OUTPUT N/A 0879 0879 087A 087C 087F 0880 0882 0884 0887 0889 088B 088E 088F 0891 0893 0895 0899 089A 55 8B 8E 50 3C 72 E9 OB 75 E9 53 8A 32 01 8B 5B 56 089B 089C 089E 08AO 50 B4 02 CD 10 58 08A1 08A1 08A2 08A3 08M 51 53 50 06 08A5 08A7 08AB 86 EO 26: 8A 46 00 45 08AC 08AE 08BO 08B2 08B4 08B6 08B8 08BA 08BC 3C 74 3C 74 3C 74 3C 75 EC 46 10 04 03 0924 R C9 03 0924 R OF FF E3 B7 0050 WRITE_STRING PROC NEAR PUSH BP MOV BP, SP MOV ES, [BP] . ES_POS RECOVER STRING SEG ADDRESS POP BP TEST FOR INVAL STRING OPTION CMP Al,04 IF OPTION INVAL THEN RETURN JB WO JMP DONE TEST FOR 0 LENGTH STRING WO: OR CX,CX JNZ WI JMP IF 0 LENGTH STRING, RETURN DONE SAVE PAGE AND POSSIBLE ATTR WI: PUSH BX GET CURRENT CURSOR POSITION MOV BL, BH XOR BH, BH SAL BX ,I MOV SI, [BX+OFFSET CURSOR_POSN] RESTORE BX POP BX SAVE CURRENT CURSOR POSITION PUSH SI PUSH MOV INT POP AX AH, SELCURSOR_POS VIDEO_FN AX SAVE WRITE STRING OPTION SET NEW CURSOR POSITION RESTORE WRITE STRING OPTION WRITE_CHAR: PUSH CX PUSH BX PUSH AX PUSH ES XCHG MOV INC AH,AL AL,ES: [BP] BP PUT WRT STRING OPTION IN AH GET CHAR FROM INPUT STRING BUMP POINTER TO CHARACTER ; ----- TEST FOR SPECIAL CHARACTER'S 08 OC OD 08 OA 04 07 1C CMP JE CMP JE CMP JE CMP JNE DO_TTY: 2-110 ROM BIOS AL,8 DO_TTY AL ,ODH DO_TTY AL ,OAH DO_TTY AL ,07H GELATTRI BUTE IS IT A BACKSPACE BACK-SPACE IS IT CARRIAGE RETURN CAR_RET IS IT A LINE FEED LINE_FEED IS IT A BELL I F NOT THEN DO WRITE CHAR ----- WRITLTTY IS CALLED TO PROCESS THE SPECIAL CHAR. WRITE_TTY WRTS TO THE CURRENT ACTIVE PAGE DEFINED BY GLOBAL VAR ACTIVE_PAGE. WRITLSTRING WRITES TO THE PAGE DEFINED BY USER IN BH REGISTER. THE ACTIVE_PAGE VARIABLE MAY NOT BE SAME PG AS DEFINED BY USER IN BH REGISTER. THE ACTIVE_PAGE VAR MUST BE TEMP SET TO BH REGISTER BEFORE CALLING WRITE_TTY. AND, BOTH ACTIVE-PAGE AND BH REGISTER MUST BE RESTORED AFTER. 08BC 08CO 08C2 08C4 08C8 08CA 08CC 08CE 08D2 0803 08D4 08D5 08D6 86 B4 CD 86 8A 32 01 8B 07 58 5B 59 EB 3E 0062 R OE 10 3E 0062 R DF FF E3 97 0050 R 08D8 08D8 08DB 08DE 08EO 08E4 B9 0001 80 FC 02 72 05 26: 8A 5E 00 45 GELATTRIBUTE: MOV CX ,I CMP AH,2 JB GOLIT MOV BL,ES: [BP] INC BP 08E5 08E5 08E7 08E9 08EA 08EB 08EC B4 09 CD 10 07 58 5B 59 GOLIT: MOV INT POP POP POP POP 08 ED 08EF FE C2 3A 16 004A R INC CMP 08F3 08F5 08F7 08F9 08FC 72 1A FE C6 2A D2 80 FE 19 72ll JB INC SUB CMP JB 37 XCHG MOV INT XCHG MOV XOR SAL MOV POP POP POP POP JMP ACTIVE_PAGE,BH TEMPORARILY EXCHANGE VALUES AH, WRITE_TEL ETYPE WRITE TTY CHAR TO THE ACT PG VIDEOJN INT 10H ACTIVE_PAGE, BH RESOTRE VALUES BL, BH GET CURRENT CURSOR POSITION BH, BH ; INTO THE OX REGISTER BX ,I DX, [BX+OFFSET CURSOILPOSN] ES AX ; RESTORE REGISTERS BX CX SHORT ROWS_SET AH, WR ITE_ATLCHAR VIDEO_FN ES AX BX CX SET CHAR WRITE AMOUNT TO ONE IS ATTRIBUTE IN THE STRING I F NOT THEN JUMP ELSE GET IT BUMP STRING POINTER WRITE CHAR AND ATTRI BUTE RESTORE REGISTERS DL ; INCREMENT COLUMN COUNTER DL, BYTE PTR CRLCOLS ;. I F COLS ARE I N RANGE FOR THIS MODE THEN COLUMNS_SET GOTO COLS SET BUMP ROW COUNTER BY ONE DH SET COLUMN COUNTER TO ZERO DL,DL I F ROWS ARE < 25 THEN DH,25 GOTO ROWS_SET ROWS_SET WRITLTTY IS CALLED TO PROCESS SCROLL LINE CMD. WRITE_TTY WRITES TO THE CURRENT ACTIVE PAGE DEFINED BY GLOBAL VARIABLE ACTIVE_PAGE. WRITE_STRING WRITES TO THE PAGE DEFINED BY USER IN BH REGISTER. THE ACTIVE_PAGE VARIABLE MAY NOT BE THE SAME PAGE DEFINED BY USER IN BH REGISTER. ACTIVE_PAGE VARIABLE MUST BE TEMPORARILY SET TO BH REGISTER BEFORE CALLING WRITLTTY. AND, BOTH ACTIVE-PAGE AND BH REGISTER MUST BE RESTORED AFTER. 08FE 08FF 0903 0906 0908 090C 090E 090F 090F 090F 0910 0912 0914 0915 50 86 B8 CD 86 FE 58 0917 0918 09lA 091C 5A 3C 01 74 08 3C 03 3E 0062 OEOA 10 3E 0062 CE 50 B4 02 CD 10 58 E2 8A AX SAVE WRITE STRING PARM REGS PUSH ACTIVE_PAGE,BH ; TEMPORARILY EXCHANGE VALUES XCHG MOV AX,WRITE_TELETYPE*256+0AH ; SCROLL 1 LINE VIDEO_FN FEED COMMAND TO WRITE TTY FN INT ACTIVE_PAGE, BH XCHG RESTORE TO ORIG VALUES DEC DH RESET ROW COUNTER TO 24 POP AX RESTORE REG'S ROWS_SET: COLUMNS_SET: PUSH AX SAVE WRITE STRING OPTION MOV AH, SELCURSOR_POS SET NEW CURSOR POSITION VIDEO_FN INT AND RESTORES VIDEO PAGE POP AX WRITE_CHAR LOOP DO IT UNTIL CX = ZERO POP CMP JE CMP DX AL,l DONE AL,3 RESTORE OLD CURSOR COORDIN I F CURSOR WAS TO BE MOVED WE'RE DONE ROM BIOS 2-111 091E 0920 0922 0924 0924 74 04 B4 02 CD 10 JE MOV INT DONE: JMP E9 016F R DONE AH ,S ELCURSOR_POS VIDEO_FN ELSE RESTORE OLD CURSOR POS VIDEO_RETURN RETURN TO CALLER 0927 ENDP LCD_REQUEST THESE ROUTINES PERFORM FUNCTIONS SPECIFIC TO THE LCD CONTROLLER. INPUT AL - LCD REQUEST NUMBER o " LOAD USER SPECI FI ED FONT 1 " LOAD SYSTEM ROM DEFAULT FONT 2 " SET LCD HIGH INTENSITY ATTRIBUTE MAPPING 3 - 255 " NO OPERATION (OS) " DATA SEGMENT ADDITIONAL INPUTS ARE REQUIRED FOR EACH REQUEST LCD MUST BE PRESENT. IF NOT, NO OPERATION IS PERFORMED OUTPUT LCD SPECIFIC FUNCTION WILL BE PERFORMED IF A LCD IS PRESENT 0927 0927 0928 092A 0920 092F 50 B4 20 E8 0000 A8 03 58 75 03 E9 016F R PUSH MOV CALL TEST POP JFZ JNZ JMP PROC NEAR AX AH, RTCDSP _CON GELRTCREG ; AL, DSP_CLCD+DSP ~LCD AX VIDEO_RETURN $+5 VIDEO_RETURN 0930 0932 0935 0937 3C 00 75 5A CMP JNE AL,O DEFONT SAVE LCD_REQUEST GET DISPLAY CONFIGURATION RESTORE LCD REQUEST LCD IS NOT AVAILABLE - EXIT I F NOT ZERO JUMP AROUND JUMP ELSE TAKE A LONG JUMP I F LOAD USER FONT REQUEST LOAD_USERJONT THIS ROUTINE ACCESSES THE LCD FONT STORAGE AND ALTERS ONE OR MORE CHARACTERS, ALLOWING THE USER TO CAUSE DIFFERENT CHARACTERS TO BE DISPLAYED IN ALPHA/NUMERIC MODE INPUT ES:DI - POINT TO CHARACTER FONT IN USER TABLE WHERE LOADING IS TO START FROM CX - NUMBER OF CHARACTERS TO STORE (1-256) VALUE CHECKED DL - CHAR OFFSET INTO RAM FONT AREA BH - NUMBER OF BYTES PER CHARACTER (1-255) VALUE CHECKED BL - 0 " LOAD MAIN FONT (BLOCK 0) 1 " LOAD ALTERNATE FONT (BLOCK 1) 2-255 " NO OPERATION OUTPUT THE USER SPECI FI ED FONT IS LOADED ALTERED CHARACTERS WILL DISPLAY DIFFERENTLY IN A/N MODE INTERRUPTS: DISABLED DURING THE LOADING OF THE FONT 0939 093B B4 20 E8 0000 MOV CALL AH, RTCDSP _CON GELRTCREG 093E 0940 0943 0945 A8 B8 75 B8 TEST MOV JNZ MOV AL,DSP_CLCD AX,CGA_RAM LCDI AX ,MONO_RAM USE CGA REGEN ADDRESS IS LCD CONFIGURED AS CGA ? NO, USE MONO REGEN ADDRESS 0948 0948 8E CO LCD 1 : MOV ES,AX LCD REGEN ADDR IS FONT SEG " DEST SEG FOR FONT MOVE 094A 094C 094E OA FF 74 43 8A C7 OR JZ MOV BH, BH LCD3 AL,BH IS # OF BYTES PER CHAR> 0 NO, IT IS 0 THEN END BYTES PER CHARACTER TIMES 01 B800 03 BOOO 2-112 ROM BIOS ; GET DISPLAY CONFIGURATION 0950 0952 F6 E2 8B F8 0954 0957 0959 095C 095E 0962 0962 0963 0965 0968 096B 80 74 80 75 81 096C 096E 0970 0974 OB 74 81 77 C9 21 F9 0100 1B 0976 0978 097A 097C 8A 2A F7 8B C7 E4 El C8 097E 097E 0980 0982 0984 0986 0988 098A 098C 098E 0990 0991 0991 0993 0993 0995 9C FA BO 00 E6 74 E4 75 OC 10 E6 75 F3/ A4 24 EF E6 75 90 FB 00 09 FB 01 33 C7 1000 55 8B EC 8E 5E 10 8B 76 04 5D EB 50 3C 01 75 1D MUL MOV DL DI,AX CHARACTER OFFSET EQUALS DESTINATION INDEX BL,O LCD2 BL,l LCD3 DI,1000H REQUEST TO LOAD MAIN FONT YES, JUMP TO LOAD REQUEST TO LOAD ALT FONT NO, JUMP TO END YES ADJ DEST. IX AL T FONT BP BP, SP DS, [BP] . ES_POS SI, [BP] • DLPOS BP RECOVER ES & DI VAL FROM STK SOURCE SEGMENT FOR FONT MOVE SET UP SOURCE IX FOR MOVE OR JZ CMP JA CX, CX LCD3 CX,256 LCD3 IS # OF CHARS TO STORE> 0 NO, IT IS 0 THEN EXIT MAX CHARS ALLOWED IS 256 IF> 256 THEN EXIT MOV SUB MUL MOV AL, BH AH,AH CX CX,AX NUMBER OF CHARS TO STORE NUMBER OF BYTES TO STORE CMP JE CMP JNE ADD LCD2: PUSH MOV MOV MOV POP PUSHF CLI MOV AL, LCDJUNCT OUT LCD_I NDX, AL IN AL,LCD_DATA OR AL, LCD_FONT LCD_DATA,AL OUT REP MOVSB AND AL,OFFH-LCD_FONT LCD_DATA,AL OUT POPF LCD3 : JMP SHORT LCDXIT DE FONT : CMP AL,l JNE INTENS BYTES PER CHARACTER TIMES = ACCESS LCD FN CONTROL REG ACCESS DISPLAY FONT STORAGE MOVE THE FONT RETURN FROM FONT TO REGEN END LOAD USER SPECI FI ED FONT I F LOAD DEFAULT FONT REQUEST --- -- ------ ----- ---- --- - -- -- - --------- ---- ------- --------------- LOAD_DEFAUL LFONT THIS ROUTINE CAUSES THE LCD FONT STORAGE TO BE REINITIALIZED WITH THE SYSTEM ROM DEFAULT FONT INPUT BL - o = LOAD MAIN FONT (BLOCK 0) 1 = LOAD ALTERNATE FONT (BLOCK 1) 2 - 255 = NO OPERATION OUTPUT DEFAULT CHARACTERS WILL BE DISPLAYED IN A/N MODE ----------------- --- - -- - -- - - - - - ---- ---- ---------- --------------0997 0998 0999 099C 099E 09A1 09A4 09A6 09A8 09AB 09AE 09BO 09B2 09B4 09B4 09B6 OE 07 B9 B7 B8 BF B2 CD B8 BF B2 CD EB 0080 08 1400 0000 00 10 1400 0000 80 10 2F 3C 02 75 2B PUSH POP MOV MOV MOV MOV MOV INT MOV MOV MOV INT JMP INTENS: CMP JNE CS ; PREPARE TO ISSUE LOAD ES ; USER FONT = DEFLT BIOS FONT CX,128 ; NO. OF CHARS TO WRITE = 128 BH,8 ; 8 BYTES PER CHAR AX,256*LCD_REQ+LOAD_USER ; SETUP LD USR FONT REQ DI,OFFSET CHAR_GEN_LO ; LOAD LOWER 128 CHARS ; CHAR OFFSET IN FONT STORAGE DL,O VIDEO_FN ; IRPT TO VIDEO I/O TO LD FONT AX,256*LCD_REQ+LOAD_USER ; SETUP LD USER FONT REQ DI,OFFSET CHAR_GEN_HI ; LOAD UPPER 128 CHARACTERS CHAR OFFSET IN FONT STORAGE DL,128 VIDEO_FN IRPT TO VIDEO I/O TO LD FONT SHORT LCDX IT AL ,2 LCDXIT SET HIGH INTEN MAP REQUEST ROM BIOS 2-113 SET_H I GH_I NTENSITY _MAPP ING THIS ROUTINE MAPS THE LCD HIGH INTENSITY ATTRIBUTE. THIS ROUTINE ACCESSES THE LCD INTENSIFY REGISTER AND CAUSES CHARACTERS WITH THE INTENSI FI ED ATTRI BUTE TO BE DISPLAYED 01 FFERENTL Y INPUT BL - INTENSIFY MAPPING INPUT REGISTER o = IGNORE HIGH INTENSITY ATTRIBUTE 1 = MAP INTENSITY TO UNDERSCORE 2 = MAP INTENSITY TO REVERSE IMAGE 3 = MAP INTENSITY TO SELECT ALTERNATE FONT 4 - 255 = NO OPERATION OUTPUT INTENSIFIED CHARACTERS WILL DISPLAY DIFFERENTLY INTERRUPTS: DISABLED DURING PROCESSING 09B8 09B3 09BD 09CO 09C2 09C5 09C7 09C9 09CB 09CB 09CC 09CD 09CF 0900 0902 0905 0907 0909 09DC 09DE 09EO 09E1 09E2 09E3 80 73 BA B4 E8 A8 74 B2 9C FA BO EE BO F6 74 OC F6 74 OC 42 EE 90 FB 04 26 03B4 20 0000 01 02 04 CMP BL ,04H JAE LCDXIT MOV DX,3B4H AH, RTCDSP _CON MOV CALL GELRTCREG TEST AL,DSP_CLCD JZ LCD4 MOV DL ,OD4H LCD4 : PUSHF CLI MOV AL,14H OUT DX,AL MOV AL,77H TEST BL,02H JZ LCD5 OR AL ,80H LCD5: TEST BL,OIH JZ LCD6 OR AL,8 LCD6 : INC DX OUT DX,AL POPF 14 77 C3 02 02 80 C3 01 02 08 ; E9 016F R 09E6 LCDXIT: JMP VIDEO_RETURN LCD_REQUEST ENDP ; ONLY OPERATION 0 - 3 ALLOWED ; ALL OTHERS EX IT GET LCD CTRL PORT ADDRESSES IF EMULATING MONO = 3B4 IF EMULATING COLOR = 304 REQUEST TO WRT TO REG 20 FOREGND RGB ON, BKGND RGB ON SET UP H ORDER BIT OF INTEN SET UP L ORDER BIT OF INTEN WRT INTENSI FY DATA TO REG 20 PHYS_DSP._DESCR_REQ THIS ROUTINE RETURNS THE ADDRESS OF A 7 WORD TABLE CONTAINING THE PHYSICAL DISPLAY DESCRIPTION PARAMETERS OF CURRENT DISPLAY. IT ALSO RETURNS THE MONITOR NUMBER OF AL TERNATE OPERATIONAL DISPLAY. THE TABLE CONTAINS THE FOLLOWING: WORD 1 2 3 4 5 6 INFORMATION MONITOR MODEL NUMBER (5140,5153,5151) NUMBER OF VERTICAL PELS I METER NUMBER OF HORIZONTAL PELS I METER TOTAL NUMBER OF VERTICAL PELS TOTAL NUMBER OF HORIZONTAL PELS HORIZONTAL PEL SPACING IN MICROMETERS (CENTER TO CENTER) VERTICAL PEL SPACING IN MICROMETERS (CENTER TO CENTER) INPUT NONE OUTPUT ES:DI AX 09E6 2-114 ROM BIOS POINTER TO DISPLAY DESCRIPTION TABLE CONTAINS THE MONITOR NUMBER OF THE ALTERNATE OPERATIONAL DISPLAY. IF THERE IS NO ALTERNATE DISPLAY OR ITS INOPERABLE, AX = 0 09E6 09E8 09EB 09ED 09EE 09EF 09F5 B4 E8 8A OE 07 81 75 FIGURED OUT WHAT DISPLAY IS CURRENTLY ACTIVE MOV AH, RTCDSP_CON GET DISPLAY CONFIGURATION CAll GELRTCREG SAVE DISPLAY CON FIG MOV Bl,Al PUSH CS ES = CS POP ES 3E 0063 R 0304 CMP ADD1L6845, 03D4H IS CGA CURRENT MODE? JNE PHYS_MONO NO, JUMP TO MONO TEST 14 20 0000 08 COLOR IS CURRENT MODE. SEE IF COLOR DISPLAY OR LCD CONFIG AS COLOR IS THE CURRENT DISPLAY. SET ES:DI TO POINT TO TBl OF CRNT DSPlY. ALSO TURN OFF CURRENT DISPLAY BIT IN THE DISPLAY CONFIG BYTE. 09F7 09F9 09FB 09FE OAOI OA03 OA03 OA06 OA09 A8 74 BF 80 EB 01 08 0000 E E3 7E lA BF 0000 E 80 E3 FB EB 12 TEST JZ MOV AND JMP PHYS_CGAl: MOV AND JMP Al,DSP_ClCD ; IS LCD CONFIGURED AS CGA? PHYS_CGAI ; NO, JUMP TO COLOR DISPLAY DI,OFFSET lCD_CGILTBl ; SET ADDR TO LCD AS CGA TBl Bl,NOT DSP_ClCD+DSP_lCD_PRES ; TURN OFF LCD BITS YES, JUMP TO TEST AlT DSPlY SHORT PHY~-.Al T CURRENT DSPlY IS COLOR DSPlY DI,OFFSET CGILTBl SET ADDRESS TO CGA TABLE Bl, NOT DSP_CGA TURN OFF CURRENT DISPLAY BIT SHORT PHYS-.Al T YES, JUMP TO TEST ALT DSPl Y MONO IS CURRENT MODE. SEE IF MONOCHROME DSPlY OR LCD CONFIG AS MONO IS CURRENT DISPLAY. SET ES:DI TO POINT TO TABLE OF CURRENT DISPLAY. ALSO TURN OFF CURRENT DISPLAY BIT IN THE DISPLAY CONFIG BYTE. OAOB OAOB OAOD OAOF OAl2 OAl5 OAl7 OAl7 OAIA OAID OAlD OAIF OA21 OA24 OA26 OA2A OA2C OA2C OA2E OA31 OA34 OA36 OA38 OA3A OA3E OA40 0A40 OA43 0A45 0A47 0A49 OA4D OA4F OA4F OA51 OA51 OA52 OA54 OA57 OA5A A8 74 BF 80 EB 02 08 0000 E E3 70 06 BF 0000 E 80 E3 F7 PHYS.Jo10NO: TEST Al,DSP.Jo1lCD ; IS LCD CONFIGURED AS MONO? JZ PHYS.Jo10NOl ; NO, JUMP TO COLOR DISPLAY MOV DI,OFFSET lCD.Jo10NO_TBl ; DEFAULT TO LCD MONO TABLE AND Bl,NOT DSP_MlCD+DSP_lCD_PRES ; TURN OFF LCD BITS JMP SHORT PHYS-.Al T YES, JUMP TO TEST ALT DSPlY PHYS_MONOl: ; CURRENT DSPl Y MONO MONITOR MOV DI,OFFSET MONO_TBl ; NO, CURRENT DSPlY MONO MNTR AND Bl,NOT DSP.Jo10NO ; TURN OFF CURRENT DISPLAY BIT TEST FOR THE ALTERNATE DISPLAY AND SET AX TO THE MONITOR NUMBER OF Al TERNATE DISPLAY. Bl SHOULD CONTAIN THE ALTERNATE DISPLAY CONFIG. IF THERE IS NO ALTERNATE DISPLAY OR THE ALTERNATE IS INOPERATIVE THE MONITOR NUMBER IS O. PHYS-.Al T: ; TEST FOR ALTERNATE DISPLAY 84 DB TEST Bl, Bl ; ANY ALTERNATE DSPS PRESENT? 74 2E JZ PHYS-.Al LNONE ; NO, JUMP TO SET MNTR # TO 0 F6 C3 03 TEST Bl,DSP_ClCD+DSP.Jo1lCD ; IS AlT MONITOR THE LCD 74 06 JZ PHYS-.Al Tl NO, JUMP TO CHECK OTHER DSPlY 2E: Al 0000 MOV AX ,lCDJGILTBl [OJ YES, SET LCD MONITOR # EB 25 JMP SHORT PHYS_END JUMP TO EXIT PHYS-.Al Tl: TEST FOR THE COLOR DISPLAY B4 22 AH, RTCDSP _STAT MOV GET THE DISPLAY STATUS E8 0000 E CAll GELRTCREG F6 C3 04 Bl ,DSP_CGA TEST IS ALT DSP COLOR MONITOR? 74 OA JZ JUMP TO TEST MONO MON ITOR PHYS-.Al T2 A8 02 Al, CGA_BAD TEST IS THE CGA BAD? 75 15 JNZ PHYS-.Al LNONE YES, SET FOR NO ALTERNATE 2E: Al 0000 MOV AX , CGA_TBl [0] NO, SET CGA MONITOR # SHORT PHYS_END EB 11 JMP JUMP TO EXIT PHYS-.Al T2: TEST FOR MONOCHROME MON ITOR F6 C3 08 Bl, DSP_MONO IS AlT DSPAY MONO MONITOR? TEST 74 OA PHYS-.Al T_NONE JUMP NO Al T DISPLAY JZ A8 04 TEST Al, MONO_BAD IS THE MONOCHROME BAD? 75 06 PHYS-.Al T_NONE YES, SET FOR NO ALTERNATE JNZ 2E: Al 0000 MOV AX ,MONO_TBl [0] NO, SET MONOCHROME MONITOR # SHORT PHYS_END EB 02 JMP JUMP TO EXIT PHYS-.Al T_NONE: Al T NOT THERE OR INOPERATIVE 2B CO SET MON ITOR # TO 0 SUB AX,AX PHYS_END: 55 PUSH BP 8B EC MOV BP ,SP GET PTR TO STACK SAVE AREA 8C 46 10 MOV [BP] • ES_POS, ES SET UP RETURN VAL IN STACK 89 7E 04 MOV [BP] .DLPOS,DI 5D POP BP ROM BIOS 2-115 OA5B OA5E E9 016F R JMP VIDEO_RETURN PHYS_DSP _DESCR_REQ ENDP Print Screen Interrupt Hex 05 (PRT_SCRN) SUBTTL PRINT SCREEN BIOS INT 05H HANDLER ; ********************************************************************* ROUTINE-NAME: FUNCTION: PRLSCRN THIS ROUTINE PRINTS THE SCREEN ENTRY CONDITIONS: PURPOSE OF ENTRY: PRINT SCREEN INPUT CONDITIONS: NONE RESTRICTIONS: ONLY ONE PRINT SCREEN REQUEST AT A TIME EXIT CONDITIONS: NORMAL EXIT CONDITIONS: STATUS_BYTE (50:0) " 0 THE SCREEN IS PRINTED OR IF CTRc BREAK IS PRESSED THE PRINT IS TERMINATED. ERROR EXIT CONDITIONS: STATUS_BYTE (50:0) "OFFH (PRINTER ERROR) THE PRINT IS TERMINATED. STATUS_BYTE (50:0) "01 (PRINT SCREEN IN PROG.) PRINT SCREEN IS ALREADY IN PROGRESS AND ANOTHER PRINT SCREEN IS REQUESTED THE LATEST PRINT SCREEN REQUEST IS IGNORED. REGISTERS MODIFIED: ALL SAVED RETURN TYPE: IRET (ALL FLAGS RESTORED) INTERRUPTS: ENABL ED OUR I NG PROCESSI NG INTERNALLY REFERENCED ROUTINES: CRLF EXTERNALLY REFERENCED ROUTINES: INT 10H (VIDEOJN) INT 17H (PRINTER_FN) ; ****************************************************************************** I NT 5H - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - -- - - -- - - - -THIS LOGIC WILL BE INVOKED BY INTERRUPT 05H TO PRINT THE SCREEN. CURSOR POSITION AT THE TIME THIS ROUTINE IS INVOKED WILL BE SAVED AND RESTORED UPON COMPLETION. THE ROUTINE IS INTENDED TO RUN WITH INTERRUPTS ENABLED. I F A SUBSEQUENT 'PRINT SCREEN' KEY IS DEPRESSED DURING THE TIME THIS ROUTINE IS PRINTING IT WILL BE IGNORED. IF THE CONTROL BREAK KEYS ARE PRESSED DURING THE PRINTING, THE PRINT SCREEN REQUEST IS TERMINATED. ERRORS ENCOUNTERED DURING PRINT (RETURN BY INT 17H) CAN BE OUT OF PAPER, I/O ERROR AND TIME OUT. STATUS BYTE IS UPDATED ON EACH CALL TO PRINT SCREEN. ADDRESS 50:0 CONTAINS THE STATUS OF THE PRINT SCREEN: 50: 0 EITHER PRINT SCREEN HAS NOT BEEN CALLED OR UPON RETURN FROM A CALL THIS INDICATES A SUCCESSFUL OPERATION. PRINT SCREEN IS IN PROGRESS ERROR ENCOUNTERED DURING PRINTING "0 "1 "255 ASSUME OA5E OA5E OA5F FB 06 PRLSCRN STI PUSH 2-116 ROM BIOS CS: ROMCODE, OS: DATA, ES: XXDATA PROC ES FAR MUST RUN WITH INTERRUPTS ENABLED MUST USE 50:0 FOR DATA AREA OA60 OA61 OA62 OA63 OA64 OA65 OA68 OA6A IE 50 53 51 52 B8 ---8E CO 26: 80 3E 0000 R 01 OA70 OA72 OA75 OA7B OA7E OA80 75 03 E9 OB07 R 26: C6 06 0000 R 01 B8 ---- R 8E 08 83 3E 0008 R 00 OA85 OA87 OA8A OA8C 75 EB B4 CD 03 6F 90 OF 10 ;- PUSH PUSH PUSH PUSH PUSH MOV MOV CMP JFZ JNZ JMP MOV MOV MOV CMP JFZ JNZ JMP MOV INT MUST USE 40:0 FOR DATA AREA OS AX BX FOR CURSOR LIMITS CX CURRENT CURSOR POSITION OX AX,XXDATA HEX 50 ES,AX STATUS_BYTE,PRTSLJlCTIVE; PRINT IN PROGRESS? ; YES, JUMP TO END EXIT ; I F NOT ZERO JUMP AROUND JUMP $+5 ; ELSE TAKE A LONG JUMP EXIT STATUS_BYTE,PRTSLJlCTIVE; SHOW PRNT IN PROGRESS HEX 40 AX,DATA DS,AX IS PRINTER ATTACHED? PRI NTER_BASE [OJ, 0 NO, ERROR EX IT ERR20 I F NOT ZERO JUMP AROUND JUMP $+5 ELSE TAKE A LONG JUMP ERR20 AH ,GELVIDEO_STATE REQUEST CURRENT SCREEN MODE [ALJ = MODE, VIDEO_FN ON RETURN [AHJ=NUMBER COLUMNS/LINE, ------- ----- -- - - - - - - -- - - - - - -- - - - - - -- -- - - - - - - - - - - - -- - - - - -- - - -- -- AT THIS POINT WE KNOW THE COLUMNS/LINE ARE IN [AXJ AND THE PAGE IF APPLICABLE IS IN -BH-. THE STACK HAS DS,AX,BX,CX,DX PUSHED. -AL- HAS VIDEO MODE OA8E OA90 OA92 OA95 8A B5 E8 F6 OA98 OA9A OA9B OA9D OA9F OAAO OAAI CC 19 OBOE R C4 29 MOV MOV CALL TEST CL,AH CH,25 CRLF AH,29H 75 5E 51 B4 03 CD 10 JNZ PUSH MOV INT ERR20 CX AH,GELCURSOR_INFO VIDEO_FN 59 52 33 02 POP PUSH XOR CX OX DX,DX USE OF -CX- REGISTER TO CONTROL ROW & COLUMNS CR LF ROUTINE TEST FOR PRINTER ERRORS OUT OF PAPER, I/O & TIME OUT JUMP I F ERROR DETECTED SAVE SCREEN BOUNDS WILL NOW READ THE CURSOR. ON RETURN: CX=CRNT CRSR MODE, OX = ROW, COL OF CRNT CURSOR RECALL SCREEN BOUNDS SAVE CURRENT CURSOR POSITION WILL SET CURSOR POS TO -0,0- THE LOOP FROM PRII0 TO THE INSTRUCTION PRIOR TO PRI20 IS THE LOOP TO READ EACH CURSOR POSITION FROM THE SCREEN AND PRINT. OAA3 OAA3 OAA8 OAAA OAAF OABI OABI OAB3 OAB5 OAB7 OAB9 OABB OABD OABF OABF OACO OAC2 OAC4 OAC6 OAC7 OACA OACC OACE OADO OAD2 OAD4 OAD6 OAD7 F6 74 80 EB 06 0071 R 80 07 26 0071 R 7F 35 B4 CD B4 CD OA 75 BO 02 10 08 10 CO 02 20 52 33 32 CD 5A F6 75 FE 3A 75 32 8A 52 E8 02 E4 17 C4 29 27 C2 CA 01 02 E2 OBOE R PRIlO: TEST JZ AND JMP PRI 12: MOV INT MOV INT OR JNZ MOV PRIl5 : PUSH XOR XOR INT POP TEST JNZ INC CMP JNE XOR MOV PUSH CALL BIOS_BREAK, BREAK-HIT ; HAS BREAK KEY BEEN PRESSED? ; NO KEY, JUMP AROUND PRIl2 BIOS_BREAK,NOT BREAK-HIT; YES, TURN 8REAK KEY OFF ; JUMP TO END SHORT PRI20 AH, SELCURSOR_POS VIDEOJN AH, READ--.ATLCHAR VIDEO_FN AL,AL PRIl5 AL,' , TO SHOW CURSOR SET REQUEST NEW CURSOR POSITION TO INDICATE READ CHARACTER CHARACTER NOW IN [ALJ SEE IF VALID CHAR JUMP IF VALID CHAR MAKE A BLANK OX DX,DX AH,AH PRINTERJN OX AH, 29H SAVE CURSOR POSITION INDICATE PRINTER 1 TO SHOW PRINT CHAR IN -ALPRINT THE CHARACTER RECALL CURSOR POSITION TEST FOR PRINTER ERRORS OUT OT PAPER, I/O & TIME OUT JUMP I F ERROR DETECTED ADVANCE TO NEXT COLUMN SEE IF AT END OF LINE I F NOT PROCEED BACK TO COLUMN 0 [AHJ =0 SAVE NEW CURSOR POSITION LINE FEED CARRIAGE RETURN ERRI0 DL CL,DL PRII0 DL,DL AH,DL OX CRLF ROM BIOS 2-117 OADA OADB 5A F6 C4 29 OADE OAEO OAE2 OAE4 OAE6 OAE6 OAE7 OAE9 OAES 00 OAF1 OAF3 OAF3 OAF4 OAF6 OAF8 OAF8 OAFB OAFE OB01 FF OB07 OB07 OB08 OB09 OBOA OBOB OBOC OBOD OBOE 75 FE 3A 75 13 C6 EE BD 5A B4 02 CD 10 26: C6 06 0000 EB 14 5A B4 02 CD 10 BB 0053 B9 0081 E8 0000 E 26: C6 06 0000 POP TEST JNZ INC CMP JNE PR120: POP MOV INT MOV JMP ERR10 : POP MOV INT ERR20 : MOV MOV CALL MOV EXIT: POP POP POP POP POP POP IRET PRLSCRN 5A 59 5B 58 IF 07 CF DX AH,29H ERR10 DH CH,DH PRI10 RECALL CURSOR POSITION TEST FOR PRI NTER ERRORS OUT OF PAPER, I/O & TIME OUT JUMP I F ERROR DETECTED ADVANCE TO NEXT LINE FINISHED? I F NOT CONTINUE DX AH, SELCURSOR_POS VIDEO_FN STATUS_BYTE,O RECALL CURSOR POSITION TO SHOW CURSOR SET REQUEST CURSOR POSITION RESTORED INDICATE FINISHED SHORT EXIT EXIT THE ROUTINE DX AH, SELCURSOR_POS VIDEO-FN GET CURSOR POSITION TO REQUEST CURSOR SET CURSOR POSITION RESTORED BX,083 NO. CYCLES FOR 83MSEC TONE CX,081H 1/2 CYCLE FOR 1KHZ TONE KB_NOISE ; SOUND BEEP FOR ERROR STATUS_BYTE,PRTSCERROR ; INDICATE ERROR DX CX BX AX DS ES ; RESTORE ALL REGISTERS USED ENDP CARRIAGE RETURN, LINE FEED SUBROUTINE OBOE OBOE OBlO 33 D2 32 E4 OB12 OB14 OB16 BO OA CD 17 F6 C4 29 OB19 OB1B OBlO OB1F OB21 OB22 OB22 75 32 BO CD C3 06 E4 OD 17 CRLF XOR XOR MOV INT TEST PROC NEAR DX,DX AH,AH AL,12Q PRINTEfLFN AH,29H JNZ CRLFl XOR AH,AH MOV AL,15Q INT PRINTER-FN CRLFl : RET CRLF ENDP ROMCODE ENDS END 2-118 ROM BIOS PRINTER 0 WILL NOW SEND INITIAL LF ,CR TO PRINTER LF SEND THE LINE FEED TEST FOR PRINTER ERRORS OUT OF PAPER, I/O & TIME OUT EX IT I F ERROR NOW FOR TH E CR CR SEND THE CARRIAGE RETURN Diskette Support (B13DSKT) ********************************************************************** PUBLICS ********************************************************************** PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC EXTERNAL DSKLIO SEEK DSKLINTE SYS_BOOT DISK-RESET NECOUTPUT RESUL TS SEEK GELPARM REFERENCES ********************************************************************** EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN 0000 DDS: NEAR DSKLBASE: BYTE GELRTCREG: NEAR PULRTCREG: NEAR PARMS_TPI48: BYTE PARMS_TP 1135: BYTE DSP_FSETM: NEAR DSP _I NIT: NEAR ICON_PR:NEAR EXLEVENT: NEAR FLI CON: BYTE SYS_DSKLI CON: BYTE DSKT_I CON: BYTE BAD_DSKLI CON: BYTE RES_ERR-CHK: NEAR POSLLOOP: NEAR ROMCODE SEGMENT BYTE PUBLIC ROM BIOS 2-119 ********************************************************************** MODULE-NAME : B13DSKT DATE LAST MODI FI ED: 09/12/85 DESCRIPTIVE-NAME: BIOS DISKETTE SERVICE ROUTINES COPYRIGHT: 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: 0.0 FUNCTION: THIS MODULE PROVIDES INPUT/ OUTPUT SERVICE FUNCTIONS TO THE FLOPPY DISKETTE CONTROLLER / DISKETTE DRIVES AND ASSOCIATE HARDWARE. MODULE SIZE: 1761 BYTES INPUT PARAMETERS: SEE LIST PROVIDED FOR EACH FUNCTION CALL BELOW OUTPUT PARAMETERS: SEE LIST PROVIDED FOR EACH FUNCTION CALL BELOW ROUTINES IN MODULE: DSKLIO - COMMON ENTRY FOR ALL OTHER ROUTINES FOR DISKETTE SERVICES SYS_BOOT - ENTRY FOR LOADING THE DISKETTE BOOT PROGRAM INTERNAL DATA AREAS / TABLES: BIOS DATA AREA AT SEGMENT 40H EXTERNALL Y REFERENCED ROUTINES: REFER TO EXTRN LIST EXTERNALL Y REFERENCED DATA AREAS: REFER TO EXTRN LIST CHANGE ACTI VITY: ********************************************************************** Diskette I/O Interrupt Hex 13 (DSKT_IO) - - I NT 13H - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - -- - - -- -DISKETTE I/O - DSKLIO INPUT: (AH)"O RESET DISKETTE SYSTEM HARD RESET TO NEC, PREPARE COMMAND, SET RECAL REQUIRED ON ALL DRIVES (AH)"1 READ THE STATUS OF THE SYSTEM INTO (AL) DISKETTE_STATUS FROM LAST OPERATION IS USED (AH)=2 READ THE DESIRED SECTORS INTO MEMORY (AH)=3 WRITE THE DESIRED SECTORS FROM MEMORY (AH)"4 VERIFY THE DESIRED SECTORS 2-120 ROM BIOS (AH)=5 FORMAT THE DESIRED TRACK FOR THE FORMAT OPERATION, BUFFER POINTER (ES,BX) MUST POINT TO COLLECTION OF DESIRED AD DR FIELDS FOR THE TRACK. EACH FIELD IS COMPOSED OF 4 BYTES, (C,H,R,N), WHERE C = TRACK NUMBER, H=HEAD NUMBER, R = SECTOR NUMBER, N= NUMBER OF BYTES PER SECTOR (00=128, 01=256, 02=512, 03=1024). THERE MUST BE ONE ENTRY FOR EVERY SECTOR ON THE TRACK. THIS INFORMATION IS USED TO FIND THE REQUESTED SECTOR DURING READ/WRITE ACCESS. REGISTERS FOR READ/WRITE/VERIFY /FORMAT INPUT: (DL) - DRIVE NUMBER (0-3 ALLOWED, VALUE CHECKED) (DH) - HEAD NUMBER (0-1 ALLOWED, NOT VALUE CHECKED) (CH) - TRACK NUMBER (0-4F, NOT VALUE CHECKED) (CL) - SECTOR NO. (NOT VALUE CHKD, NOT USED FOR FORMAT) (AL) - NO. OF SECTORS ( NOT VALUE CHKD, NOT USED FOR FMT) (ES:BX) - ADDRESS OF BUFFER ( NOT REQUIRED FOR VERIFY TI DATA VARIABLE -- DISK-POINTER DOUBLE WORD POINTER TO CURRENT SET OF DSKT PARAMETERS OUTPUT: AH = STATUS OF OPERATION GOOD RETURN OOH TIME_OUT 80H BAD_SEEK 40H BAD_NEe 20H BAD_CRC 10H DMA_BOUNDARY 09H BAD_DMA 08H MEDIA-CHANGE 06H RECORD_NOLFND 04H WRITE_PROTECT 03H BAD~DDR_MARK 02H BAD_CMD 01H NO ERROR DETECTED ATTACHMENT FAILED TO RESPOND SEEK OPERATION FAILED NEC CONTROLLER HAS FAILED BAD CRC ON DISKETTE READ ATMPT TO DMA CROSS 64K BNDRY DMA OVERRUN ON OPERATION MEDIA HAS BEEN CHANGED REQUESTED SECTOR NOT FOUND WRT ATMPTD ON WRT PROT DISK ADDRESS MARK NOT FOUND BAD CMD PASSED TO DSKT I/O AL = NUMBER OF SECTORS ACTUALLY TRANSFERRED OS, BX,DX,CX PRESERVED CY = 0 CY = 1 SUCCESSFUL OPERATION (AH=O ON RETURN) FAILED OPERATION (AH HAS ERROR CODE) ************ ERROR RETRY PROCEDURE ************* NOTE: I F AN ERROR IS REPORTED BY THE DISKETTE CODE, THE APPROPRIATE ACTION IS TO RESET THE DISKETTE, THEN RETRY THE OPERATION. MEDIA CHANGE ERRORS NEED NOT BE RETRIED. ROM BIOS 2-121 (AH)'8 READ DRIVE PARAMETERS DL • DRIVE NUMBER (0-3) OUTPUT PARAMETERS: IF DRIVE INSTALLED: ES:DI • POINTER TO DR1VE PARAMETERS TABLE CH • MAXIMUM TRACK NUMBER / SIDE (LOWER 8 BITS) CL (BITS 7-6) • TWO MOST SIGNIFICANT BITS OF 10 BIT TRACK NUMBER CL (bits 5-0) • MAXIMUM 512 BYTE SECTOR NUMBER (6 BITS) PER TRACK DH • MAXIMUM HEAD NUMBER DL • NUMBER OF DISKETTE DRIVES INSTALLED ON SYSTEM (1 - 2) AX • 0 BH • 0 BL • DRIVE TYPE (1 - 360K 40 TRACK DRIVE) (2 - 1.2 Meg 80 TRACK DRIVE) (3 - 720K 80 TRACK DRIVE) DISKETTE_STATUS IS CLEARED, CARRY FLAG IS RESET. IF DRIVE NOT INSTALLED: ES ,AX, BX, CX, DH, 01 • 0 DL • NUMBER OF DISKETTE DRIVES INSTALLED DISKETTE_STATUS' 0 CARRY FLAG IS RESET. (AH) • 15H CHECK FOR CHANGE LINE SUPPORT (READ DASD) DL • DRIVE NUMBER (0-3) OUTPUT PARAMETERS: AH • 00 - NO DRIVE PRESENT 01 - DSKT DRV WITH NO CHANGE LINE SUPPORT INSTALLED 02 - DSKT DRV WITH CHANGE LINE SUPPORT INSTALLED 03 - FIXED DISK DISKETTE_STATUS' 0, CARRY FLAG CLEAR (AH)'16H READ DISKETTE CHANGE LINE STATUS DL • DRIVE NUMBER (0-3) OUTPUT PARAMETERS: IF DRIVE INSTALLED: • OOH06H- DISK CHANGE LINE NOT ACTIVE CARRY FLAG IS CLEARED DISK CHANGE LINE ACTIVE CARRY FLAG IS SET DISKETTE HEAD STEPPED TO TRACK 1 THEN 0 TO RESET CHANGE LINE 80H- DISK CHANGE LINE ACTIVE AND CANNOT BE RESET (NO DISKETTE IN DRIVE) - CARRY FLAG IS SET IF DRIVE NOT INSTALLED: DISKETTE_STATUS' TIMEOUT (80H) CARRY FLAG IS CLEARED IF DRIVE DOES NOT SUPPORT CHANGE LINE: DISKETTLSTATUS • MEDIA CHANGE (06) CARRY FLAG IS CLEARED (AH)'17H SET DASD TYPE FOR FORMAT DL • DRIVE NUMBER (0-3) AL • FORMAT TYPE 00 • NOT USED 01 • DISKETTE 320/360K IN 360K DRIVE 02 • DISKETTE 360K IN 1. 2MEG DRIVE 03 • DISKETTE 1.2MEG IN 1.2MEG DRIVE 04 • DISKETTE 720K IN 720K DRIVE OUTPUT PARAMETERS: AH'DISKETTE_STATUS' 0 NO FUNCTION PERFORMED 2-122 ROM BIOS CARRY FLAG CLEAR (AH) = ALL OTHER VALUES OUTPUT: AH=DISKETTLSTATUS = 01 (BAD COMMAND) CARRY FLAG SET ASSUME CS: ROMCODE, OS: DATA STRUCTURE DEFINING SAVE AREA ON STACK REGSAVE OX SAVE BPSAVE DISAVE SISAVE DSSAVE CXSAVE BXSAVE AXSAVE REGSAVE 0000 0002 0004 0006 0008 OOOA OOOC OOOE 0010 0000 0001 0002 STRUC OW OW OW OW OW OW OW OW ENDS REGHSAV STRUC DLSAVE DB DHSAVE DB DB ?? ?? 08 - OX BP 01 SI OS CX BX AX ? 8 DUP(?) SAVE SAVE SAVE SAVE SAVE SAVE SAVE SAVE AREA AREA AREA AREA AREA AREA AREA AREA ON ON ON ON ON ON ON ON STACK STACK STACK STACK STACK STACK STACK STACK DL SAVE AREA ON STACK DH SAVE AREA ON STACK ?? 243 OOOA OOOB OOOC 0000 OOOE OOOF 0010 ?? ?? ?? ?? ?? ?? CLSAVE CHSAVE BLSAVE BHSAVE ALSAVE AHSAVE REGHSAV 0000 0000 0002 0004 0006 0008 OOOA OOOC OOOE 0010 0082 00F6 OOFD 0139 010F 0122 007C 007C 0494 0012 0014 0016 04E3 R 050B R 0580 R 0018 0018 FB 0019 001A 001B 001C 0010 001E 001F 0020 0021 0023 0026 0028 50 53 51 1E 56 57 55 52 8B E8 2A 8A 002A 0020 002F 0032 0034 0037 80 76 80 72 80 72 R R R R R R R R R DB DB DB DB DB DB ENDS DSKLTABLE OW OW OW OW OW OW OW OW OW OW OW OW CL CH BL BH AL AH LABEL WORD OFFSET DISICRESET OFFSET DISICSTATUS OFFSET DISICREAD OFFSET DISICWRITE OFFSET DISICVERF OFFSET DISICFORMAT OFFSET DSKLINLCMD OFFSET DSKLINLCMD OFFSET DSKLRDPARM OFFSET DSKLRDDASD OFFSET DSKLCHANGE OFFSET DSKLSETDASD DSKLIO PROC STI SAVE SAVE SAVE SAVE SAVE SAVE AREA AREA AREA AREA AREA AREA AH=O AH=l AH=2 AH=3 AH=4 AH=5 AH=6 AH=7 AH=8 AH=9 THRU AH=15 AH=16 AH=17 ON ON ON ON ON ON STACK STACK STACK STACK STACK STACK DISK RESET COMMAND -DISK STATUS COMMAND -DISK READ COMMAND DISK WRITE COMMAND -DISK VERIFY COMMAND -DISK FORMAT COMMAND -INVALID COMMAND -INVALID COMMAND -READ DISKETTE DRIVE PARMS -12 AND <17 ARE ALSO INVALID DETERMINE SUPPORT OF DCL -DISKETTE CHANGE LINE STAT -DISKETTE SET OASD TYPE FAR I NTERRUPTS BACK ON AX BX CX OS SI 01 BP OX BP,SP DDS BH, BH BL,AH TEMPORARY SAVE AREA SAVE ADDRESS EC 0000 FF DC PUSH PUSH PUSH PUSH PUSH PUSH PUSH PUSH MOV CALL SUB MOV FC 08 15 FC 15 05 FC 18 08 CMP JBE CMP JB CMP JB AH,8 010_1 AH,15H DIO_INLCMD AH,18H 010_0 CHECK FUNCTION RANGE JUMP I F OKAY CHECK FUNCTION RANGE JUMP I F ERROR JUMP I F BELOW LIMIT JUMP IF OKAY AND IN 15-17 RANGE SAVE SEGMENT REGISTER VALUE SAVE ALL REGISTERS DURING OPERATION SET UP POINTER TO HEAD PARM SET FUNCTION CODE IN LOW BYTE FUNCTION CODE OUT OF RANGE ROM BIOS 2-123 0039 0039 003E 0041 0041 0044 0044 0047 DIO_INLCMD: MOV DISKETTE_STATUS,BAD_CMD ; INDICATE INVALID COMMAND JMP DIO_2 GET STATUS AND EXIT C6 06 0041 R 01 EB 26 90 DIO_O: SUB DIO_l : CMP JBE 80 EB OC 80 FC 01 76 05 BL,12 CORRECT FUNCTION CODE FOR 15,16 RESET COMMAND OR STATUS COMMAND? JUMP AROUND DRIVE RANGE CHECK IF SO RANGE CHECK DRIVE NUMBER 0049 004C 80 FA 03 EB 004E 004E 0050 0055 Dl E3 80 26 003F R 7F 2E: FF 97 0000 R 005A 005B 005E 0061 0065 91 BB 0004 E8 0259 R 88 26 0040 91 0066 0066 006A 006D 0070 0071 0071 0072 0073 0074 0075 0076 oon 0078 0079 007C CMP JA n DIO_11: SHL AND CALL XCHG MOV CALL MOV XCHG DL ,3 DIO_INLCMD BX,l ; DOUBLE LINK TABLE OFFSET MOTOR_STATUS, NOT WRITE_OP ; RESET WRITE OPERATION FLAG DSKLTABLE[8X] CALL PROPER ROUTINE CX,AX BX,4 GELPARM MOTOR_COUNT, AH AX,CX DIO_2 : MOV AH, DI SKETTE_STATUS MOV AHSAVE [BP] ,AH CMP AH,l CMC DIO_3: POP DX POP BP POP DI POP SI POP DS POP CX POP BX POP AX RET 2 DSKLIO ENDP 8A 26 0041 88 66 OF 80 FC 01 F5 5A 5D 5F 5E IF 59 5B 58 CA 0002 JUMP IF INVALID SAVE AX GET THE MOTOR WAIT PARAMETER SET THE TIMER COUNT FOR TH E MOTOR RESTORE AL GET STATUS OF OPERATION SAVE RETURN CODE ON STACK SET THE CARRY FLAG FOR FAILURE RESTORE ALL REGISTERS RECOVER ADDRESS RESTORE AX REGISTER THROW AWAY SAVED 'flAGS ****************************** INVALID COMMAND RECEIVED 007C 007C 0081 0082 ****************************** C6 06 0041 R 01 C3 DSKLINLCMD PROC NEAR MOV DISKETTCSTATUS, BAD_CMD RET DSKLI NLCMD ENDP SV STAT & ST CRY FOR ERR . *********************************************************** ~----- 0082 0082 0085 0086 008B 008E 0090 0092 0094 0096 0098 009A 009C 009E OOAO OOAO 00A2 00A2 RESET THE DISKETTE SYSTEM ; *********************************************************** BA FA C6 AO Bl D2 A8 75 A8 75 A8 74 FE 03 F2 06 0040 R FF 003F R 04 EO 20 OC 40 06 80 06 CO FE CO FE CO DISK_RESET MOV CLI MOV MOV MOV SAL TEST JNZ TEST JNZ TEST JZ INC J4: INC J5: INC 2-124 ROM BIOS NEAR PROC DX, DRIVE_CNTL MOTOR_COUNT ,OFFH AL,MOTOILSTATUS CL,4 AL, CL AL, 20H J5 AL, 40H J4 AL, 80H J6 AL AL AL ADAPTER CONTROL PORT NO INTERRUPTS SET LONG MOTOR ON TIME WHICH MOTOR IS ON SHI FT COUNT MOVE MOTOR VALUE TO HIGH NYBBLE SELECT CORRESPONDING DRIVE JUMP I F MOTOR ONE IS ON JUMP I F MOTOR TWO IS ON JUMP I F MOTOR ZERO IS ON 00A4 00A4 00A6 DC 08 EE J6: 00A7 C6 06 003E R 00 OOAC OOBI 00B3 00B4 00B7 00B9 OOBC OOBD C6 DC EE E8 72 B8 50 B9 06 0041 R 00 04 oDeD OOCO 00C2 00C5 00C8 OOCB OOCD OOCF 0001 0003 B4 E8 E8 AO 24 3C El DB 74 08 022C R 03B3 R 0042 R F8 CO EF C9 08 STALLOOP: MOV CALL CALL MOV AND CMP LOOPZ OR JZ 0005 0006 OODB 58 80 OE 0041 R 20 EB 18 OR OUT 0373 3C 00F5 R 0004 AL, FDCDMA.-ENAB DX,AL TURN ON INTERRUPT ENABLE RESET THE ADAPTER MOV SEEICSTATUS,O SET RECAL REQUIRED ON ALL DRIVES MOV OR OUT CALL JC MOV PUSH MOV DISKETTE_STATUS,O AL, FDCRUN DX,AL WAILINT J8 AX,OFFSET J8 AX CX,4 SET OK STATUS FOR DISKETTE TURN OFF RESET TURN OFF THE RESET WAIT FOR INTERRUPT IF NO INTERRUPT THEN EXIT SET ERROR RETURN ADDRESS FOR NECOUT AH, READ_INLSTATUS NECOUTPUT RESULTS AL, NECSTATUS AL,OF8H AL ,OCOH STALLOOP cX,ex J7 SENSE INTERRUPT STATUS COMMAND TO NEC GET THE RESULTS IGNORE ERROR RETURN AND DO OWN TEST IGNORE DRIVE SPECIFIER TEST FOR DRIVE READY TRANSITION IF OKAY GET NEXT DRIVE READY INFO ALL BYTES PICKED UP? I F SO THEN OKAY READ RESET STATUS FOR ALL 4 DRIVES NEC ERROR: ALL 4 DRIVE STATUSES NOT CORRECT AFTER RESET POP OR JMP ; DISCARD ERROR ADDRESS ON STACK AX DISKETTE_STATUS,BAD_NEC ; SET ERROR CODE SHORT J8 ; EXIT SEND SPECI FY COMMAND TO NEC 0000 0000 OODF 00E2 00E5 00E8 OOEB OOEE OOF! 00F4 00F5 00F5 00F6 J7: B4 E8 BB E8 E8 BB E8 E8 58 03 022C 0001 0259 022C 0003 0259 022C MOV CALL MOV CALL CALL MOV CALL CALL POP R R R R AH,SPECIFY NECOUTPUT BX,l GELPARM NECOUTPUT BX,3 GELPARM NECOUTPUT AX J8: C3 DRIVE_READY SPECI FY COMMAND OUTPUT THE COMMAND FIRST BYTE PARM IN BLOCK TO THE NEC CONTROLLER SECOND BYTE PARM IN BLOCK TO THE NEC CONTROLLER DISCARD ERROR RETURN ADDRESS RESELRET RETURN TO CALLER RET DISICRESET ENDP *********************************************************** ----- DISKETTE STATUS ROUTINE 00F6 00F6 00F9 OOFC OOFD *********************************************************** AD 0041 R 88 46 DE C3 DISICSTATUS PROC NEAR AL, 01 SKETTE_STATUS MOV ALSAVE[BP] ,AL MOV RET DISICSTATUS ENDP MOVE STATUS IN AL SAVE AREA ; *********************************************************** ;----- DISKETTE READ OOFD OOFD 0100 0102 0104 0107 0109 0100 010F ; *********************************************************** E8 72 BO E8 72 C6 EB 050B R IF 46 02Fl 18 46 OF E6 41 DISICREAD CALL JC MOV CALL JC MOV JMP DISICREAD PROC NEAR DSKLCHANGE DSKLERR AL,DMA_READ DMA_SETUP DSKLERR ; AHSAVE[BP] ,READ_CMND SHORT RW_OPN ; ENDP CHECK FOR MEDIA CHANGE READ COMMAND FOR DMA SET UP THE DMA JUMP I F ERROR ; RD COMMAND (AH SAVE) GO DO THE OPERATION ; *********************************************************** DISKETTE VERI FY ROM BIOS 2-125 010F 010F Oll2 Oll4 Oll6 Oll9 OllB OllF 0121 ; *********************************************************** DISICVERF CALL JC MOV CALL JC MOV JMP DISK_VERF E8 050B R 72 00 BO 42 E8 02Fl 72 06 C6 46 OF E6 E8 2F PROC NEAR DSKLCHANGE DSKLERR AL, DMILVERI FY DMA_SETUP DSKLERR AHSAVE[BP] ,READ_CMND SHORT RW_OPN ; ENDP CHECK FOR MEDIA CHANGE VERI FY COMMAND FOR DMA SET UP THE DMA ; RD COMMAND (AH SAVE) GO DO THE OPERATION ; *********************************************************** ; DISKETTE ERROR OCCURRED ; *********************************************************** 0121 0121 DSKLERR: RET C3 ; RETURN TO MAIN ROUTINE ; *********************************************************** ; ----- DISKETTE FORMAT ; *********************************************************** 0122 0122 0125 0127 012C 0l2E 0131 0133 0137 0139 DISKJORMAT PROC NEAR CALL DSKLCHANGE CHECK FOR MEDIA CHANGE JC DSKT _ERR OR MOTOR_STATUS, WRITE_OP ; INDICATE WRITE OPERATION MOV AL, DMA_WRlTE WILL WRITE TO THE DISKETTE CALL DMILSETUP SET UP THE DMA JC DSKLERR MOV AHSAVE [BP] ,FORMALCMND ; FORMAT COMMAND (AH SAVE) JMP SHORT RW_OPN ; DO THE OPERATION DISICFORMAT ENDP E8 72 80 BO E8 0508 R FA OE 003F R 80 4A 02F1 R 72 EE C6 46 OF 40 EB 17 ; *********************************************************** ;----- DISKETTE WRITE ROUTINE ; *********************************************************** 0139 0139 Ol3C Ol3E 0143 0145 0148 014A 014E 0150 DISICWRITE CALL JC OR MOV CALL JC MOV JMP DISICWRITE E8 050B R 72 E3 80 BO E8 72 C6 EB OE 003F R 80 4A 02F1 R 07 46 OF C5 00 PROC NEAR DSKLCHANGE CHECK FOR MEDIA CHANGE DSKLERR MOTOILSTATUS,WRlTE_OP ; INDICATE WRITE OPERATION AL,DMILWRITE DMA WRITE COMMAND DMA_SETUP DSKLERR AHSAVE[BP] ,WRITE_CMND WRITE COMMAND (AH SAVE) SHORT RW_OPN ENDP ; **************************************************************** ; RW_OPN THIS ROUTINE PERFORMS THE READ/WRITE/VERIFY AND FORMAT OPERATIONS ; **************************************************************** RW_OPN PROC NEAR CALL MOTOILSTARTUP 0150 0150 E8 041B R 0153 0156 88 4E OA E8 0268 R MOV CALL CX,CXSAVE[BP] SEEK GET TRACK/ SECTOR PARMS MOVE TO CORRECT TRACK 0159 C6 46 OE 00 MOV ALSAVE[BP] ,0 0150 72 79 JC J17 SET NO SECTORS READ IN CASE OF ERROR IN AL SAVE AREA I F ERROR, THEN EXIT AFTER MOTOR OFF CHECK MOTOR STATE AND WAIT FOR STARTUP I F NECESSARY DO THE SEEK OPERATION NECOUTPUT WILL POP RETURN ADDRESS AND RETURN TO THE 1ST LEVEL CALLER 015F 0162 B8 0221 R 50 0163 0166 0169 8A 66 OF E8 022C R 8A 66 01 MOV PUSH AX,OFFSET J20 AX DUMMY RETURN ON STACK FOR NECOUTPUT SO THAT IT WILL EXIT ROUTINE IF ERROR SEND OUT THE PARAMETERS TO THE CONTROLLER MOV CALL MOV 2-126 ROM BIOS AH ,AHSAVE [BP] NECOUTPUT AH, DHSAVE [BP] GET NEC COMMAND (AH SAVE) OUTPUT THE OPERATION COMMAND GET THE CURRENT HEAD NUMBER 016C 016E 0170 0173 0175 DO DO 80 OA E8 E4 E4 E4 04 E2 022C R SAL SAL AND OR CALL AH,l AH,l AH,4 AH,DL NECOUTPUT MOVE IT TO BIT 2 ISOLATE THAT BIT OR IN THE DRIVE NUMBER ; ----- TEST FOR FORMAT COMMAND 0178 017C 80 7E OF 40 75 20 CMP JNE AHSAVE[BP] ,FORMALCMND ; IS THIS A FORMAT OPERATION J15 ; NO. CONTINUE WITH R/W/V GET THE DATA FOR A FORMAT OPERATION 017E 0181 0184 0187 0l8A 0180 0190 0193 0196 0199 019C BB E8 E8 BB E8 E8 BB E8 E8 BB EB 0007 0259 022C 0009 0259 022C OOOF 0259 022C 0011 30 R R R R R R MOV CALL CALL MOV CALL CALL MOV CALL CALL MOV JMP BX,7 GELPARM NECOUTPUT BX,9 GELPARM NECOUTPUT BX,15 GELPARM NECOUTPUT BX,17 SHORT J16 GET THE BYTES/SECTOR VALUE TO NEC GET THE SECTORS/TRACK VALUE TO NEC GET THE GAP LENGTH VALUE TO NEC GET THE FILLER BYTE TO THE CONTROLLER SEND THE DATA FOR A READ/WRITE/VERIFY OPERATION 019E 019E 01Al 01M 01A7 01AA 01AD 01BO 01 B3 01B6 01B9 01 BC 01 BF 01C2 01C5 01C8 OlCB 8A E8 8A E8 8A E8 B8 E8 E8 BB E8 E8 BB E8 E8 BB 66 OB 022C R 66 01 022C R 66 OA 022C R 0007 0259 R 022C R 0009 0259 R 022C R 'OOOB 0259 R 022C R 0000 J15: MOV CALL MOV CALL MOV CALL MOV CALL CALL MOV CALL CALL MOV CALL CALL MOV AH,CHSAVE[BP] NECOUTPUT AH, DHSAVE [BP] NECOUTPUT AH,CLSAVE[BP] NECOUTPUT BX,7 GELPARM NECOUTPUT BX,9 GELPARM NECOUTPUT BX,l1 GELPARM NECOUTPUT BX,13 CYLINDER NUMBER (CH SAVE) HEAD NUMBER FROM STACK SECTOR NUMBER (CL SAVE) BYTES/SECTOR PARM FROM BLOCK TO THE NEC EOT PARM FROM BLOCK TO THE NEC GAP LENGTH PARM FROM BLOCK TO THE NEC DTL PARM FROM BLOCK COMPLETE SETUP TO NEC AND WAIT FOR INTERRUPT OlCE 01CE OlD1 OlD4 E8 0259 R E8 022C R 58 J16: CALL CALL POP GELPARM NECOUTPUT AX RW_OPN_F I NI SH TO THE NEC CAN NOW DISCARD THAT DUMMY RETURN ADDRESS LET THE OPERATION HAPPEN 0105 0108 0108 OlDA 0100 E8 0373 R OlDF OlEO 01E3 01E4 FC BE 0042 AC 24 CO 01E6 01E8 OlEB OlED 75 EB 3C 75 72 49 E8 03B3 R 72 42 CALL J17 : JC CALL JC WAILINT J21 RESUL TS J20 WAIT FOR THE INTERRUPT MOTOR_OFF LOOK FOR ERROR GET THE NEC STATUS LOOK FOR ERROR CHECK THE RESULTS RETURNED BY THE CONTROLLER 03 3E 90 40 29 CLD MOV LODS AND JFZ JNZ JMP CMP JNZ ; SET THE CORRECT DIRECTION SI,OFFSET NEC_STATUS ; POINT TO STATUS FIELD NECSTATUS GET STO AL,OCOH TEST FOR NORMAL TERMINATION J22 OPN_OK $+5 I F NOT ZERO JUMP AROUND JUMP J22 ELSE TAKE A LONG JUMP AL,040H TEST FOR ABNORMAL TERMINATION J18 NOT ABNORMAL, BAD NEC ;----- ABNORMAL TERMINATION, FIND OUT WHY ROM BIOS 2-127 01EF 01FO 01F2 01F4 01F6 01F8 01FA 01FC 01FE 0200 0202 0204 0206 0208 020A 020C 020E 0210 0212 0214 0216 AC 00 B4 72 DO DO B4 72 DO B4 72 DO DO B4 72 DO B4 72 DO B4 72 EO 04 24 ED EO 10 lC EO 08 16 ED ED 04 OE EO 03 08 EO 02 02 LODS SAL MOV JC SAL SAL MOV JC SAL MOV JC SAL SAL MOV JC SAL MOV JC SAL MOV JC NELSTATUS AL,1 AH, RECORO_NOT _FND J19 AL,1 AL,1 AH,BAD_CRC J19 AL,1 AH, BAD_DMA J19 AL,1 AL,1 AH, RECORD_NOTJND J19 AL,1 AH, WRITE_PROTECT J19 AL,1 AH, BAD--ADDR~ARK J19 GET STl TEST FOR EDT FOUNO RW_FAIL TEST FOR CRC ERROR RWJAIL TEST FOR DMA OVERRUN RW_FAIL TEST FOR RECORD NOT FOUND RW_FAIL TEST FOR WRITE_PROTECT RWJAIL TEST MISSING ADDRESS MARK RWJAIL NEC MUST HAVE FAILED 0218 0218 021A 021A 021E 0221 0221 0223 0223 0226 B4 20 08 26 0041 E8 03F5 R EB 08 E8 03B3 EB 03 J18: MOV J19 : OR CALL J20: JMP J21 : CALL JMP RW-NEC-FAIL AH,BAD_NEC RW-FAIL 01 SKETTE_STATUS ,AH NUM_TRANS SHORT RW_EX IT RESUL TS SHORT RW_EXIT HOW MANY WERE REALLY TRANSFERRED RW_ERR RETURN TO CALLER RW_ERR_RES FLUSH THE RESULTS BUFFER OPERATION WAS SUCCESSFUL 0228 0228 022B 022B 022C E8 03F5 R C3 J22 : CALL NUM_TRANS OPN_OK HOW MANY GOT MOVED RW_EXIT: RET RW_OPN ENDP NECOUTPUT THIS ROUTINE SENDS A BYTE TO THE NEC CONTROLLER AFTER TESTING FOR CORRECT DIRECTION AND CONTROLLER REAOY THIS ROUTINE WILL TIME OUT IF THE BYTE IS NOT ACCEPTEO WITHIN A REASONABLE AMOUNT OF TIME, SETTING THE DISKETTE STATUS ON COMPLETION. INPUT (AH) BYTE TO BE OUTPUT OUTPUT CY = 0 SUCCESS CY = 1 FAILURE -- DISKETTE STATUS UPOATED IF A FAILURE HAS OCCURRED, THE RETURN IS MADE ONE LEVEL HIGHER THAN THE CALLER OF NECOUTPUT. THIS REMOVES THE REQUIREMENT OF TESTING AFTER EVERY CALL OF NELOUTPUT. (AL) DESTROYED 022C 022C 022D 022E 0231 0233 0233 0234 0236 0238 023A 52 51 BA 03F4 33 C9 EC A8 40 74 OE E2 F9 NECOUTPUT PUSH PUSH MOV XOR J23 : IN TEST JZ LOOP J24: 2-128 ROM BIOS PROC NEAR DX CX DX, FDCSTATUS CX,€X AL, DX AL,DATLREADY J25 J23 SAVE REGISTERS STATUS PORT COUNT FOR TIME OUT GET STATUS TEST DIRECTION BIT DIRECTION OK TIME_ERROR 023A 023F 0240 0241 0244 0245 0246 0246 0248 0248 0249 024B 0240 024F 0251 0251 0253 0255 0256 0257 0258 0259 C6 06 0041 R 80 59 5A 83 C4 02 F9 C3 33 C9 EC A8 75 E2 EB 80 04 F9 E9 8A C4 B2 F5 EE 59 5A C3 MOV POP POP ADD STC RET J25: XOR J26: IN TEST JNZ LOOP JMP J27 : MOV MOV OUT POP POP RET NECOUTPUT DISKETTLSTATUS, TIME_OUT CX SET ERROR CODE AND RESTORE REGS OX DISCARD THE RETURN ADDRESS SP,2 INDICATE ERROR TO CALLER CX,CX RESET THE COUNT AL,DX AL, REQ~ASTER J27 J26 J24 GET THE STATUS IS IT READY YES, GO OUTPUT COUNT DOWN AND TRY AGAIN ERROR COND IT I ON OUTPUT GET BYTE TO OUTPUT DATA PORT (3F5) OUTPUT THE BYTE RECOVER REGISTERS AL,AH DL ,OF5H DX,AL CX OX CY = 0 FROM TEST INSTRUCTION ENDP --- - -- - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - -- - - - - -- - - - - -- - - - - - - - - - - - - - - - - - - - -GELPARM THIS ROUTINE FETCHES THE INDEXED POINTER FROM THE DSKLBASE BLOCK POINTED AT BY THE DATA VARIABLE DISK-POINTER. A BYTE FROM THAT TABLE IS THEN MOVED INTO AH, THE INDEX OF THAT BYTE BEING THE PARM IN BX ENTRY -BX = INDEX OF BYTE TO BE FETCHED * 2 EX IT -AH = THAT BYTE FROM BLOCK - -- - - - - - - - -- - - -- - - - - -- - - - - - - -- - - - - - - - - -- - - - - - - - - - -- - - - - - - - - - - - - - - - - - - --0259 0259 025A 025C IE 2B CO 8E 08 025E 0262 C5 36 0078 R 01 EB 0264 0266 8A 20 IF 0267 0268 C3 GELPARM PUSH SUB MOV ASSUME LOS SHR PROC NEAR OS AX,AX DS,AX OS: ABSO SI,DISK-POINTER BX,1 MOV POP ASSUME RET GELPARM AH, [SI+BX] OS DS:DATA SAVE SEGMENT ZERO TO AX POINT TO BLOCK DIVIDE BX BY 2, AND SET FLAG FOR EXIT GET THE WORD RESTORE SEGMENT RETURN TO CALLER ENDP SEEK THIS ROUTINE WILL MOVE THE HEAD ON THE NAMED DRIVE TO THE NAMED TRACK. IF THE DRIVE HAS NOT BEEN ACCESSED SINCE THE DRIVE RESET COMMAND WAS ISSUED, THE DRIVE WILL BE RECALIBRATED. FOR DRIVES 0,1 NO SEEK PERFORMED I F ALREADY ON TRACK INPUT (DL) = DRIVE TO SEEK ON (CH) = TRACK TO SEEK TO OUTPUT CY = 0 SUCCESS CY = 1 FAILURE -- DISKETTE_STATUS SET ACCORDINGLY (AX, OJ) DESTROYED -- ---- -- - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - -0268 0268 026B 026C 026E 0270 0272 0274 0278 027A 027E 0281 0281 B8 50 BO 8B 8A 02 02EE R 84 75 08 B9 06 003E R IB 06 003E R 0002 01 F9 CA CO B4 07 SEEK PROC NEAR MOV AX,OFFSET J32 PUSH AX MOV AL,1 MOV OJ, CX MOV CL,DL AL,CL ROL TEST JNZ OR MOV J27A: MOV SET ERROR EXIT FOR NECOUTPUT ESTABLISH MASK FOR RECAL TEST SAVE TRACK NUMBER (01 HIGH) GET DRIVE VALUE INTO CL SHIFT IT BY THE DRIVE VALUE AL,SEEK-STATUS J28 SEEK-STATUS,AL CX,02H TEST FOR RECAL REQU I RED NO_RECAL TURN ON THE NO RECAL BIT IN FLAG # RECALS ATTEMPTS FOR 80 TRACKS AH,RECALIBRATE RECAll BRATE COMMAND ROM BIOS 2-129 0283 0286 0288 0288 028E 0290 0292 0293 E8 8A E8 E8 73 E2 58 EB 022C R E2 022C R 0340 R 05 EF CALL MOV CALL CALL JNC LOOP POP JMP 59 NELOUTPUT AH,DL NELOUTPUT CHK-STAL2 J28 J27A AX SHORT J32 OUTPUT THE DRIVE NUMBER GET THE INTERUPT AND SENSE INT STATU~ RECAL SUCCESSFUL RETRY I F MORE THAN 77 STEPS NEEDED DISCARD ERROR RETURN ADDRESS SEEK-ERROR DRIVE IS IN SYNC WITH CONTROLLER, SEEK TO TRACK 0295 0295 029A 0290 C6 06 0041 R 00 80 FA 01 77 20 J28: MOV CMP JA DISKETTLSTATUS ,0 DL ,01 J28_3 CLEAR DISKETTE STATUS CHECK FOR ABOVE DRIVE CHECK FOR CURRENT TRACK = DESIRED TRACK 029F 02Al 02A3 02A5 02A6 02A8 02AB 02AD 02AF 02AF 02Bl 02B3 02B5 02B7 02B8 02BA E4 A8 74 50 24 80 75 OC 77 80 lA E6 8B E4 3A 58 E6 75 77 CF 77 C5 02BC 02BD F8 EB 2F 02BF 02Cl 02C4 02C6 02C9 02CB 02CE 02CF B4 E8 8A E8 8B E8 58 E8 0202 0203 0206 0209 02DC 02DE 02EO 02EO 02E2 02E4 02E7 02E9 02E8 02ED 02ED 9C BB E8 80 73 B4 0012 0259 R FC OF 02 OF OA 74 B9 E2 FE EB E4 09 0102 FE CC F3 IN TEST JZ PUSH AND CMP JNE OR J28_2 : OUT MOV IN CMP POP OUT JNE E2 FA 00 02 08 77 03 AL,DSKLCNTL AL,DSKLNMI ; IS DISKETTE CONTROL REG CORRECT? J28_3 ; JUMP I F NOT AX AL, DSKLNMI +FDLPWR+DSKLDEGATE+CNTL_SEL ; READ DRI TRK DL,O J28_2 AL,DRO_TRK-SEL SET TRACK SENSE FOR DRIVE 0 DSKT_CNTL, AL CX,DI AL,DSKLCNTL AL,CH AX DSKLCNTL, AL J28_3 SELECT DRIVE # FOR TRACK SENSE GET TRACK NUMBER IN CH READ TRACK POSITION COMPARE TRACK ON WITH DESIRED TRACK RESTORE SENSE REGISTER ON SAME TRACK SO JUST EXIT WITH NO ERROR CLC JMP OF 022C E2 022C R C7 022C R 0340 R SHORT J32 J28_3: MOV AH,SEEK-CMD CALL NELOUTPUT MOV AH,DL CALL NELOUTPUT MOV AX,DI CALL NELOUTPUT POP AX CALL CHK-STAL2 EXIT SEEK COMMAND TO NEC DRIVE NUMBER TRACK NUMBER DISCARD ERROR RETURN ADDRESS GET ENDING INTERRUPT AND ;----- WAIT FOR HEAD SETTLE 02EE 02EE 02FO 02Fl 9D 8B CF C3 PUSHF MOV CALL CMP JAE MOV J29 : OR JZ MOV LOOP DEC JMP J31 : POPF J32 : MOV RET SEEK 2-130 ROM BIOS BX,18 GELPARM AH,15 J29 AH,15 SAVE STATUS FLAGS GET HEAD SETTLE PARAMETER CHECK FOR AT LEAST 15 MSEC SET IT TO 15 I F NOT = OF ABOVE HEAD_SETTLE AH,AH J31 CX, MS_DELAY EXIT LOOP IF NO WAIT $ AH SHORT J29 CX, DI ENDP cn DO IT SOME MORE SEEK-ERROR RESTORE CX RETURN TO CALLER -- -- - - - -- - - - - - - - -- -- - - - - - -- - - - - - - - - - - - - - -- - - - - - - - - - - - - - -- - - - - - - -- - - - - - -- DMiLSETUP THIS ROUTINE SETS UP THE DMA FOR READ/WRITE/VERIFY OPERATIONS. INPUT (AL) = MODE BYTE FOR THE DMA (ES) - SEGMENT TO READ/WRITE THE DATA (BP) - STACK POINTER (TO GET INPUT PARAMETERS) OUTPUT (AX,CX) DESTROYED --- - -- -- -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - -- - - - - - -02Fl 02Fl 02F2 02F4 02F6 02F8 02F9 02FB 02FD 02FF 0301 0303 0306 0308 030A 030A 030B 0300 030F 0311 0313 0315 FA E6 EB E6 50 8C Bl 03 8A 24 03 73 FE 50 E6 8A E6 8A 24 E6 OC 00 OB CO 04 CO E8 FO 46 OC 02 C5 04 C4 04 C5 OF 81 DMiLSETUP CLI OUT JMP OUT PUSH MOV MOV ROL MOV AND ADD JNC INC J33 : PUSH OUT MOV OUT MOV AND OUT PROC DMA+12,AL $+2 DMA+11,AL AX AX, ES CL,4 AX,CL CH,AL AL,OFOH AX,BXSAVE[BP] J33 CH AX DMA+4,AL AL,AH DMA+4,AL AL,CH AL ,OFH DMiLPAGE2,AL NEAR NO MORE INTERRUPTS SET THE FIRST/LAST F/F DELAY FOR DMA CONTROLLER OUTPUT THE MODE BYTE SAVE COMMAND GET THE ES VALUE SHI FT COUNT ROTATE LEFT GET HIGHEST NYBLE OF ES TO CH ZERO THE LOW NYBBLE FROM SEGMENT ADD ADDRESS OFFSET TEST FOR CARRY FROM ADDITION CARRY MEANS HIGH 4 BITS MUST BE INC SAVE START ADDRESS OUTPUT LOW ADDRESS OUTPUT HIGH ADDRESS GET HIGH 4 BITS OUTPUT THE HIGH 4 BITS TO DETERMINE COUNT 0317 031A 031C 031E 031F 0322 0325 0327 0328 032A 032B 032C 032E 0330 0332 0333 0334 0335 0337 0339 033B 033C 8A 2A 01 50 BB E8 8A 58 03 48 50 E6 8A E6 FB 59 58 03 BO E6 58 73 033E 0340 3C 42 74 OA 0342 0347 034B 034C 034C C6 06 0041 R 09 C6 46 OE 00 F9 0340 C3 66 OE CO E8 0006 0259 R CC EO 05 C4 05 Cl 02 OA OE MOV SUB SHR PUSH MOV CALL MOV POP SHL DEC PUSH OUT MOV OUT STI POP POP ADD MOV OUT POP JNC AH,ALSAVE[BP] AL,AL AX,1 AX BX,6 GELPARM CL,AH AX AX,CL AX AX DMA+5,AL AL,AH DMA+5,AL CMP JE AL,42H DMiLOUT MOV MOV STC DMA_OUT: RET DMiLSETUP CX AX AX,CX AL,2 DMA+lO,AL AX DMiLOUT NUMBER OF SECTORS (AL SAVE) TIMES 256 INTO AX SECTORS * 128 INTO AX GET THE BYTES/SECTOR PARM USE AS SHIFT COUNT (0=128, 1=256 ETC) MUL TIPLY BY CORRECT AMOUNT -1 FOR DMA VALUE SAVE COUNT VALUE LOW BYTE OF COUNT HIGH BYTE OF COUNT I NTERRUPTS BACK ON RECOVER COUNT VALUE RECOVER ADDRESS VALUE ADD, TEST FOR 64K OVERFLOW MODE FOR 8237 INITIALIZE THE DISKETTE CHANNEL RESTORE COMMAND NON-DMA OPERATION? I F SO THEN NO BOUNDRY ERROR DISKETTE_STATUS,DMA_BOUNDARY ; SET DMA BOUNDRY ERROR BYTE PTR [BP+14] ,0 NO SECTORS TRANSFERRED (AL SAVE) SET CARRY TO INDICATE ERROR RETURN TO CALLER, CARRY SET BY ABOV ElF ERROR ENDP ROM BIOS 2-131 CHLSTAL2 THIS ROUTINE HANDLES THE INTERRUPT RECEIVED AFTER A RECALIBRATE, SEEK, OR RESET TO THE ADAPTER. THE INTERRUPT IS WAITED FOR, THE INTERRUPT STATUS SENSED, AND THE RESULT RETURNED TO THE CALLER. INPUT NONE OUTPUT CY = 0 SUCCESS CY = I FAILURE -- ERROR IS IN DISKETTE_STATUS (AX) DESTROYED 0340 0340 0350 0352 0355 0356 0358 035B 035E 0360 0361 0364 0366 0368 036A 036B 036B 036C 036C 0371 0372 0373 E8 0373 R 72 19 B8 036B R 50 B4 E8 E8 72 58 AO 24 3C 74 F8 08 022C R 03B3 R OB 0042 R 60 60 02 C3 80 OE 0041 R 40 F9 C3 ; -- CHLSTAL2 CALL JC MOV PUSH PROC NEAR WAILINT J34 AX,OFFSET J34 AX MOV CALL CALL JC POP MOV AND CMP JZ CLC J34: RET J35 : OR STC RET CHLSTAL2 AH, READ_INLSTATUS NECOUTPUT RESUL TS J34 AX AL,NECSTATUS AL ,060H AL,060H J35 WAIT FOR THE INTERRUPT I F ERROR, RETURN IT SET ERROR RETURN ADDRESS SENSE INTERRUPT STATUS COMMAND READ IN THE RESULTS CHKLRETURN DISCARD ERROR RETURN ADDRESS GET THE FIRST STATUS BYTE ISOLATE THE BITS TEST FOR CORRECT VALUE I F ERROR, GO MARK IT GOOD RETURN RETURN TO CALLER ; CHKLERROR DISKETTE_STATUS, BAD_SEEK ; ERROR RETURN CODE ENDP --- - -- - - - - - - - - - - - - - - - -- - - - - - - - - -- - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --- WAILINT THIS ROUTINE WAITS FOR AN INTERRUPT TO OCCUR. A TIME OUT ROUTINE TAKES PLACE DURING THE WAIT, SO THAT AN ERROR MAY BE RETURNED I F THE DRIVE IS NOT READY. INPUT NONE OUTPUT CY = 0 SUCCESS CY = I FAILURE -- DISKETTE_STATUS IS SET ACCORDINGLY (AX, BX) DESTROYED ; -- - 0373 0373 0374 0375 -------------------- -------- ----- ---- ---- - -- - - - - - - - -- - - - - - - -- - - - - - - -WAILINT STI PUSH CLC FB 51 F8 PROC NEAR CX ; TURN ON INTERRUPTS, JUST IN CASE ; SAVE REGISTERS CALL DEVICE BUSY SERVICE ROUTINE 0376 0379 037B B8 9001 CD 15 7211 MOV INT JC AX,D900IH 15H CALL DEVICE BUSY (DISKETTE) J36~ JUMP I F TIMEOUT OCCURRED BIOS WILL PASS CONTROL HERE WITH CARRY FOR TIMEOUT OR WITH NO CARRY FOR OPERATION COMPLETE. 0370 037F 0381 0381 0386 0388 038A 038C B3 04 2B C9 F6 75 E2 FE 75 06 003E R 80 OC F7 CB F3 MOV SUB J36: TEST JNZ LOOP DEC JNZ BL,4 CX,CX SEELSTATUS,INLFLAG ; TEST FOR INTERRUPT COMPLETE JUMP I F INTERRUPT COMPLETE J37 I NNER LOOP COUNT J36 BL OUTER LOOP COUNT J36 NO INTERRUPT RECEIVED TIMEOUT ERROR 038E J36~: 2-132 ROM BIOS ; WAIT FOR 2 SECONDS ; CLEAR THE COUNTER 038E 0393 0394 0394 0395 039A 039B 039C 80 OE 0041 R 80 F9 9C 80 26 003E R 7F 9D 59 C3 039D OR STC J37 : PUSHF AND POPF POP RET WAILINT DISKETTLSTATUS, TIMLOUT; NO INTERRUPT OCCURRED ERROR ; ERROR RETURN ; SAVE CURRENT CARRY SEEICSTATUS, NOT INLFLAG ; TURN OFF INTERRUPT FLAG RECOVER CARRY CX GOOD RETURN CODE COMES FROM TEST I NST ENDP , ----- -- - - - - - -- - - - - - - - -- - - - - - - - - - -- - - - - - -- - -- - -- - - - - -- - -; DSKLINTE THIS ROUTINE HANDLES THE DISKETTE INTERRUPT ; INPUT ; NONE ; OUTPUT THE INTERRUPT FLAG IS SET IS SEEICSTATUS ; - - -- - - - - - - -- - - - - -- -- - - - -- -- - - - - - - - - - - - - -- - - - - - - - -- -- - - -039D 039D 039E 039F 03A2 03A7 03A9 03AB 03AE 03BO 03B1 03B2 03B3 1E 50 E8 80 BO E6 B8 CD 58 1F CF 0000 E OE 003E R 80 20 20 9101 15 DSKLINTE PUSH PUSH CALL OR MOV OUT MOV INT POP POP IRET DSKLINTE FAR PROC DS AX DDS ; SEEICSTATUS,INLFLAG AL,EOI INTAOO,AL AX,09101H 15H AX DS SET UP DATA SEGMENT END OF INTERRUPT MARKER I NTERRUPT CONTROL PORT SIGNAL DEVICE OPERATION COMPLETE RECOVER SYSTEM RETURN FROM INTERRUPT ENDP RESULTS THIS ROUTINE WILL READ ANYTHING THAT THE NEC CONTROLLER HAS TO SAY FOLLOWING AN INTERRUPT. INPUT NONE OUTPUT CY = 0 SUCCESSFUL TRANSFER CY = 1 FAILURE -- TIME OUT IN WAITING FOR STATUS NECSTATUS AREA HAS STATUS BYTE LOADED INTO IT (AH,BX,Si) DESTROYED 03B3 03B3 03B4 03B7 03B8 03B9 FC BE 0042 51 52 B3 07 ; -- - - - - - - - - - - - - - - - - - - - - - -- - - - - - -- -- - - - - - - - - -- --- - - - - - - - - - - -- - - - -- - - - - - - -RESUL TS PROC NEAR CLD MOV SI,OFFSET NECSTATUS ; POINTER TO DATA AREA PUSH CX SAVE COUNTER PUSH DX ; MAX STATUS BYTES MOV BL,7 ; ----- WAIT FOR REQUEST FOR MASTER 03BB 03BB 03BD 03CO 03CO 03C1 03C3 03C5 03C7 03CC 03CC 03CD 03CE 03CF 33 C9 BA 03F4 EC A8 75 E2 80 F9 5A 59 C3 80 OB F9 OE 0041 R 80 J38: XOR MOV J39: IN TEST JNZ LOOP OR J40: STC POP POP RET INPULLOOP COUNTER STATUS PORT WAIT FOR MASTER AL,DX GET STATUS AL, REQ~ASTER MASTER READY J40A TESLDIR J39 ; WAILMASTER DISKETTE_STATUS, TIME_OUT ; RESULTS_ERROR ; SET ERROR RETURN DX CX CX,CX DX, FDCSTATUS ;----- TEST THE DIRECTION BIT ROM BIOS 2-133 0300 0300 0301 0303 0305 0305 03DA EC A8 40 75 07 80 DE 0041 R 20 EB FO J40A: IN TEST JNZ J41 : OR JMP AL,DX AL,DATA_READY J42 GET STATUS REG AGAIN TEST DIRECTION BIT OK TO READ STATUS ; NECFAIL DISKETTE_STATUS, BAD_NEC ; RESULTS_ERROR J40 READ IN THE STATUS 03DC 03DC 0300 03DE 03EO 03El 03E4 03E6 03E7 03E8 03EA 03EC 03EE 03FO 42 EC 88 46 B9 E2 4A EC A8 74 FE 75 EB J42: INC OX IN AL,DX MOV [SI] ,AL INC SI MOV CX,10 J43: LOOP J43 DEC OX IN AL,DX TEST AL, FDCBUSY JZ J44 DEC BL JNZ J38 JMP J41 04 OOOA FE 10 06 CB CB E3 INPULSTAT POINT AT DATA PORT GET THE DATA STORE THE BYTE INCREMENT THE POINTER LOOP TO KILL TIME FOR NEC POINT AT STATUS PORT GET STATUS TEST FOR NEC STI LL BUSY RESULTS DONE DECREMENT THE STATUS COUNTER GO BACK FOR MORE CHIP HAS FAILED RESUL T OPERATION I S DONE 03F2 03F2 03F3 03F4 03F5 J44: POP OX POP CX RET RESUL TS ENDP 5A 59 C3 RECOVER REGI STERS GOOD RETURN CODE FROM TEST INST NUM_TRANS THIS ROUTINE CALCULATES THE NUMBER OF SECTORS THAT WERE ACTUALLY TRANSFERRED TO/FROM THE DISKETTE INPUT (BP) = POINTER TO ORIGINAL STACK ENTRIES OUTPUT (BP+14) = AL SAVE AREA ON STACK = # ACTUALLY TRANSFERRED NO OTHER REGISTERS MODIFIED 03F5 03F5 03F8 03FB 03FE 0401 0405 0407 040B 040E 0410 0412 0412 0414 0414 0417 041A 041B BB E8 AO 8A 3A 75 8A 3A 74 02 0008 0259 R 0047 R 7E 01 3E 0046 R DB 3E 0045 R 7 E DB 04 C4 02 C4 2A 46 OA 88 46 DE C3 NUM_TRANS MOV CALL MOV MOV CMP JNZ MOV CMP JZ ADD DIF_HD: ADD SAMLTRK: SUB MOV RET NUM_TRANS 2-134 ROM BIOS PROC NEAR BX,8 GELPARM AL,NECSTATUS+5 BH, DHSAVE [BP] BH,NECSTATUS+4 01 F_HD BH,NECSTATUS+3 BH,CHSAVE[BP] SAME_TRK AL,AH SECTORS/TRACK OFFSET TO DL AH = SECTORS/TRACK GET ENDING SECTOR BH = STARTING HEAD # GET HEAD ENDED UP ON I F ON SAME HEAD, THEN NO ADJUS GET TRACK ENDED UP ON SEE I F TRACK SWITCH IF SAME TRACK NO INCREASE ADD SECTORS/TRACK AL,AH ADD SECTORS/TRACK AL, CLSAVE [BP] ALSA VE [BP] ,AL SUBTRACT START FROM END SECTORS SAVE RESULTS IN STACK SAVE AREA ENDP MOTOILSTARTUP FUNCTION: TO CHECK FOR MOTOR STATE, TURN ON MOTOR OF REQUESTED DRIVE AND WAIT THE NECESSARY STARTUP TIME BEFORE RETURNING TO CALLER. I NPUT PARAMETERS: DL = 0-3 (DISKETTE DRIVE NUMBER) OUTPUT PARAMETERS: MOTOILSTATUS FLAGS UPDATED MOTOR OF DRIVE IS TURNED ON REGISTERS MODIFIED: AX,BX,CX,DH 041B MOTOILSTARTUP PROC NEAR ;----- TURN ON THE MOTOR AND SELECT THE DRIVE 041B B6 00 MOV 041D DH,O ; SET FIRST TIME THROUGH FLAG MOL01: GET MOTOR STARTUP TI ME 0410 0420 0423 0426 0428 042A 042A 042C 042E 0430 BB E8 80 73 B4 0014 0259 R FC 04 02 04 MOV CALL CMP JAE MOV MOLOll: MOV MOV MOV SAL 8A 8A BO D2 EC CA 01 EO 0432 FA CLI 0433 0437 84 06 003F R 75 IB TEST JNZ 0439 043E 0442 0.4.44 0446 0448 044A 044C 044D 0450 0451 0452 80 08 BO 8A D2 OA OC 52 BA EE 5A EB BX,20 GELPARM AH,04 MOLOn AH,04 GET THE MOTOR WAIT CH HAS MOTOR START UP DELAY MUST BE MINIMUM OF 500 MSECS JUMP IF OKAY DEFAULT TIME TO 500 MSECS CH,AH CL,DL AL,l AL,CL SAVE MOTOR START UP DELAY GET DRIVE NUMBER AS SHIFT COUNT MASK FOR DETERMINING MOTOR BIT SHI FT THE MASK BIT AL ,MOTOR_STATUS MOL02 NO INTERRUPTS WHILE DETERMINING MOTOR STATUS TEST THAT MOTOR FOR OPERATING IF RUNNING GO CHECK TIME ; TURN ON MOTOR 26 003F R FO 06 003F R 10 CA EO C2 OC 03F2 07 AND OR MOV MOV SAL OR OR PUSH MOV OUT POP JMP MOTOR_STATUS,OFOH TURN OFF ALL MOTOR BITS MOTOILSTATUS, AL TURN ON THE CURRENT MOTOR AL,10H MASK BIT CL,DL GET DRIVE NUMBER AS SHI FT COUNT AL,CL DEVELOP BIT MASK FOR MOTOR ENABLE AL,DL ; GET DRIVE SELECT BITS IN AL,FDCDMILENAB+FDCRUN ; NO RESET, ENABLE DMA/INT DX SAVE REG DX,DRIVE_CNTL CONTROL PORT ADDRESS DX,AL DX RECOVER REGISTERS SHORT MOL04 GO DELAY FOR STARTUP CHECK TO SEE I F MOTOR ON LONG ENOUGH 0454 0454 0459 F6 06 003F R 20 75 24 , MOL02: TEST JNZ MOTOILSTATUS,MOTOILOK ; CHECK FOR MOTOR RUNNING LONG ENOUGH MOL08 IF MOTOR OKAY THEN EXIT ; CH HAS TIME TO WAIT IN 1/8 SECONDS 045B 045B C6 06 0040 R FF 0460 FB 0461 OA ED 0463 74 1A 0465 OA F6 0467 75 08 MOL04: MOV STI OR JZ OR JNZ MOTOILCOUNT,OFFH CH,CH MOL08 DH,DH MOL06 SET LONG MOTOR DELAY I NTERRUPTS BACK ON DON'T WAIT IF NO WAIT SET CHECK FOR FIRST TIME THROUGH WAIT I F NOT FIRST TIME BYPASS OP _SYS HOOK NOTIFY OPERATING SYSTEM OF WAIT FOR MOTOR STARTUP 0469 F8 CLC ; RESET TIMEOUT INDICATOR ROM BIOS 2-135 046A 0460 046F B8 90FD CD 15 72 OE MOV INT JC AX ,90FDH 15H MOL08 SET WAIT ON DISKETTE MOTOR SLEEP OR DO OTHER WORK BYPASS TIME DELAY I F TIMEOUT TIME DELAY LOOP TO WAIT FOR MOTOR STARTUP 0471 0471 0473 0475 0475 0477 0479 047B 0470 MOL06: MOV OR MOL07: JZ SUB LOOP DEC JMP 8A E5 OA E4 74 2B E2 FE EB 08 C9 FE CC F6 AH,CH AH,AH MOL08 CX, CX $ AH SHORT MOL07 MOVE TIME IN AH TEST FOR NO WAIT TESLWAILTIME EXIT WITH TIME EXPIRED SET UP 1/8 SECOND LOOP TIME WAIT FOR THE REQUIRED TIME DECREMENT TIME VALUE ARE WE DONE YET MOTOR IS RUNNING SO CONTINUE WITH OPERATION 047F 047F 0484 0486 048B C6 B6 F6 74 06 0040 R FF 01 06 003F R OF 90 MOL08: MOV MOV TEST JZ MOTOR_COUNT,OFFH DH,Ol MOTOR_STATUS,OFH MOLOI SET LARGE COUNT AFTER WAIT SET 2ND TIME THROUGH FLAG TEST FOR MOTORS STILL ON I F NOT OKAY THEN GO BACK AND RESTART ; MOTORS STI LL ON AFTER WAIT 0480 0492 0493 0494 80 OE 003F R 20 FB C3 OR MOTOR_STATUS,MOTOR_OK ; SET MOTOR ON LONG ENOUGH FLAG STI ; ALLOW INTERRUPTS RET MOTOR_STARTUP ENDP ;-~ -~ -~ -~ --~ -i-;; -K- ~ -~ -~ -E-- ~ - ~ -i-v -E--P-~ - ~ - ~ -M-E- ~ -E-R-;; -- ~ -a-u-~ -i-N-E ; -- -------- ----------- ------------- ----------- ----- ----- -- - - - - - - - 0494 0494 0497 0499 049B 0490 049F 04Al 04A3 04A5 04A8 04AA 04AC 04AF 04Bl 04B3 04B3 04B6 04BA 04BE 04C2 04C2 04C5 04C8 04CB 04CD 0400 0404 0406 0408 04DA 0400 04E2 04E3 E8 2B 2B 2B 8E 8A 3C 74 BE 3C 74 BE 3C 75 2E 2E 2E 2E 89 89 89 2B 89 8A Bl 02 FE 89 C6 C3 0586 R FF C9 02 C2 E6 00 10 0000 03 07 0000 01 OF 8E 8B 8B 8B 7E 4E 46 CO 46 16 06 EA C2 56 06 04 7C 02 4C 04 54 06 04 OA OC OE 0010 R 00 0041 R 00 - -- - - DSKLRDPARM PROC NEAR CALL GELDRLCONFIG GET DRIVE CONFIGURATION IN AL SUB 01,01 CLEAR REGISTERS SUB CX,CX SUB DX,DX MOV ES,DX CLEAR ES MOV AH,DH CLEAR AH CMP AL,NO_DRIVE DRIVE PRESENT? JE RDPARM_02 MOV SI,OFFSET PARMS_TPIl35 ; SET 720K DRIVE CMP AL, TPL135 JE RDPARM_Ol MOV SI,OFFSET PARMS_TPI48 SET 360K DRIVE CMP AL, TPL48 JNE RDPARM_02 IF NOT VALID SET NO DRIVE RDPARM_Ol : MOV ES,CS:[SI] SETUP SEG TO DSKLPARMS MOV DI,CS: [SI+2] POINTER TO PARMS MOV CX,CS: [SI+4] TRACKS AND SECTORS MOV DX,CS: [SI+6] GET HEADS RDPARM_02 : MOV DISAVE[BP] ,01 MODIFY REGISTERS ON STACK MOV CXSAVE [BP], CX MOV BXSAVE[BP] ,AX SET DRIVE TYPE IN BL SUB AX,AX MOV AXSAVE [BP],AX ; CLEAR AL MOV DL,BYTE PTR EQUIP_FLAG; GET LOW BYTE OF EQUIPMENT MOV CL,6 GET # DISKETTES IN LOW SHR DL, CL BITS INC DL CORRECT FOR AT LEAST 1 DRIVE MOV DXSAVE [BP], OX SAVE # HEADS AND # DRIVES MOV DISKETTE_STATUS,O GET RETURN CODE RET DSKLRDPARM ENDP 2-136 ROM BIOS DSKLREADDASD INPUT PARAMETERS: AH = 15H Dl = DRIVE NUMBER (0-3) OUTPUT PARAMETERS: AH = 00 - NO DRIVE PRESENT 01 - DISKETTE DRVIE WITH NO CHANGE LINE SUPPORT INSTAllED 02 - DISKETTE DRIVE WITH CHANGE LINE SUPPORT INSTAllED 03 - FIXED DISK DISKETTLSTATUS = 0 04E3 04E3 80 OE 0016 R 04 04E8 04ED 04FO 04F2 04F4 04F6 04F8 C6 E8 B4 3C 74 3C 74 06 0041 R 00 0586 R 00 00 OB 03 05 DSKLRDDASD PROC NEAR OR BIOS_STATUS,DCl_SUPPORTED ; SET CHANGE LINE SUPPORTED FLAG MOV DISKETTLSTATUS,O SET GOOD RETURN CODE GET DRIVE CONFIGURATION CAll GELDRLCONFIG MOV AH,O CLEAR RETURN CODE Al,NO_DRIVE CHECK FOR DRIVE PRESENT CMP DASD_EXIT JUMP I F NOT PRESENT JE CMP Al, TPL135 3 1/2 DRIVES? DASD_Ol JE YES THEN JUMP SET NO CHANGE LINE AVAILABLE 04FA 04FC B4 01 EB 03 90 MOV JMP AH,OI DASD_EXIT SET NO CHANGE LINE AVAIL SET CHANGE LINE AVAILABLE 04FF 04FF 0501 0501 0504 0507 0508 050B DASD_Ol : MOV AH,02 DASD_EXIT : MOV AHSAVE[BP] ,AH ADD SP,2 ClC DIO_3 JMP DSKLRDDASD ENDP B4 02 88 66 OF 83 C4 02 F8 E9 0071 CHANGE LINE AVAILABLE SAVE VALUE IN AH SAVE AREA THROW AWAY RETURN ADDRESS GO BACK TO MAIN ROUTINE ; ******************************************************************* ;DISKETTE 050B 050B 050E 0510 0512 0514 0516 CHANGE lINE STATUS ROUTINE ; ******************************************************************* E8 OA 74 3C 75 E8 DSKLCHANGE PROC NEAR CAll GELDRVJONFIG OR Al,Al JZ DCl_06 CMP Al, TP L135 JNE DCLI0 CAll MOTOILSTARTUP 0586 R CO 41 03 63 041B R GET DRIVE CONFIGURATION CHECK FOR DRIVE NO THERE IF SO THEN SET TIMEOUT STATUS CHECK FOR 3.5 JUMP IF NO CHANGE lINE TURN ON MOTOR AND SELECT CHECK CHANGE LINE 0519 0519 051A 0510 051E 0521 0522 0523 0525 0527 052C 52 BA EC BA EC 5A A8 75 F6 75 03F4 03 F7 80 OF 06 0016 R 02 2C DCl_Ol : PUSH MOV IN MOV IN POP TEST JNZ TEST JNZ OX OX, FDCSTATUS Al,DX DX,DRIVE_SENSE Al,DX OX Al,CHG_LINE DCl_03 ; BIOS_STATUS, FORCLDCl DCl_07 ; ENSURE CONTROllER IS ON DIGITAL INPUT PORT RESTORE DRIVE NUMBER TEST FOR DISKETTE CHANGE JUMP IF ACTIVE ; FORCE CHANGE ERROR AFTER RESUME? - JUMP IF YES CHANGE LINE NOT ACTIVE 052E 052E 0533 0534 C6 06 0041 R 00 F8 EB 49 DCl_02: MOV ClC JMP DISKETTE_STATUS,O SHORT DCl_EXIT SET GOOD RETURN RESET ERROR FLAG RETURN CHANGE LINE ACTIVE ROM BIOS 2-137 SEEK TO 1 THEN TO 0 TO RESET CHANGE LINE 0536 0536 0538 053B 0530 053F 0542 B5 E8 72 B5 E8 73 DCl_03: MOV CAll JC MOV CAll JNC 01 0268 R 07 00 0268 R 05 CH,OlH SEEK DCl_04 CH,OOH SEEK DCL05 SET UP TO SEEK TO TRACK 1 TO RESET CHANGE LINE JUMP I F ERROR ON THE SEEK NOW SET TO SEEK TO ZERO DO THE SEEK SEEKS FAilED SO SET RECAl REQUIRED 0544 0544 C6 06 003E R 00 DCl_04: MOV SEEICSTATUS,O ; SEEK FAilED RECAl REQUIRED CHECK TO SEE I F CHANGE LINE WAS SUCCESSFUllY RESET 0549 0549 054A 0540 054E 52 BA 03F7 EC 5A 054F 0551 A8 80 74 07 DCl_05: PUSH MOV IN POP TEST JZ OX DX,DRIVE_SENSE Al,DX OX Al, CHG_LI NE DCl_07 DIGITAL INPUT PORT RESTORE DRIVE NUMBER TEST FOR DISKETTE CHANGE I F RESET THEN MEDIA CHANGE CHANGE LINE DID NOT RESET SO SET TIMEOUT ERROR 0553 0553 0558 C6 06 0041 R 80 EB 17 DCl_06: MOV JMP DISKETTE_STATUS, TIMLOUT ; NO DISKETTE IN DRIVE SHORT DCl_09 ; EXIT WITH TIMEOUT ERROR MEDIA CHANGE WAS ACTIVE, AND RESET SUCCESSFUllY, IF CHANGE LINE NOT SUPPORTED AND NO READ DCl STATUS DON'T REPORT THE ERROR 055A 055A 055F 0561 0565 F6 75 80 75 06 0016 R 04 06 7E OF 16 C7 DCl_07: TEST JNZ CMP JNE BIOS_STATUS,DCl_SUPPORTED ; CHANGE LINE SUPPORTED DCl_08 JUMP IF YES AHSAVE[BP], 16H ; FUNCTION" READ DCl STATUS? DCl_02 ; NO THEN INDICATE INACTIVE 0567 0567 056C 80 26 0016 R FD C6 06 0041 R 06 DCL08: AND MOV BIOS_STATUS,NOT FORCLDCl ; RESET RESUME FLAG DISKETTLSTATUS,MEDIA-CHANGE ; SET RETURN CODE 0571 0571 80 26 003F R OF DCL09: AND 0576 0577 F9 EB 06 STC JMP MOTOILSTATUS,NOT MOTOILOK ; ACTIVATE STARTUP DELAY ON NEXT OPERATION ; SET INTERNAL ERROR FLAG SHORT DCl_EXIT ; RETURN TO CAllER NO CHANGE LINE AVAilABLE (NOT AN INTERNAL FLAGGED ERROR) 0579 0579 057E 057F 057F 0580 C6 06 0041 R 06 F8 DCl_lO: MOV ClC DCl_EXIT: RET DSKLCHANGE C3 DISKETTE~TATUS,MEDIA-CHANGE ; DEFAULT TO DISKETTE CHG RESET INTERNAL ERROR FLAG RETURN TO CAllER ENDP ; *********************************** ; SET DASD TYPE FOR FORMAT ; *********************************** 0580 0580 0585 0586 C6 06 0041 R 00 C3 DSKLSETDASD PROC NEAR MOV DISKETTE_STATUS,O RET DSKLSETDASD ENDP 2-138 ROM BIOS SET OKAY RETURN CODE ******************************************** GELDRLCONFIG GET DRIVE INFORMATION SUBROUTINE INPUT CONDITIONS: DL = DRIVE NUMBER 0-3 OUTPUT CONDITIONS: AL (LOW NI BBLE CONTAINS DRIVE TYPE) CARRY FLAG SET I F DRIVE # OUT OF RANGE REGISTERS MODIFIED: AX,BX,CX ******************************************** 05S6 GELDRLCONFIG PROC NEAR 05S6 05SS 05SB 05SD 05SF 0592 0594 0596 059S 059A 059C 059E B4 ES SA FE E8 SA Bl 2A 74 DO DO 03 10 0000 E FS C4 0000 E7 03 CA 06 El El ES 05AO 05AO 05A2 05A3 24 OF C3 MOV CALL MOV INC CALL MOV MOV SUB JZ SHL SHL SHR AH, RTCDSKLCON GELRTCREG BH,AL AH GELRTCREG AH, BH CL,3 CL,DL GELDRVOI CL,1 CL,1 AX,CL GELDRVOI : AND AL,OFH RET GELDRY..-CONFIG ENDP GET DRIVE INFORMATION DRIVE 0,1 IN BH DRIVE 2,3 IN AL DRIVE 0-3 INFO IN AX (NIBBLES) SET SHIFT COUNT SUBTRACT DRIVE NUMBER MULTIPLY BY 4 (BITS/ DRIVE) SHI FT TO GET DRIVE INFO SAVE ONLY LOW NIBBLE Bootstrap Loader Interrupt Hex 19 (SYS-BOOT) ;--- INT 19H -------------------------------------------BOOT STRAP LOADER TRACK 0, SECTOR 1 IS READ INTO THE BOOT LOCATION (SEGMENT 0, OFFSET 7COO) AND CONTROL IS TRANSFERRED THERE. IF THERE IS A HARDWARE ERROR CONTROL IS TRANSFERRED TO THE ROM BASIC ENTRY POINT. ASSUME CS: ROMCODE, OS: DATA, ES: ABSO SYS_BOOT PROC NEAR CLD ; SET FORWARD 01 RECTI ON 05A3 05A3 FC 05A4 05A7 B8 ---- R SE os MOV MOV AX, DATA DS,AX 05A9 ES 0000 CALL DSP_INIT CLEAR THE SCREEN 05AC 05AF ES 0000 75 4C CALL JNZ RES_ERR_CHK HL3 CHECK AND DISPLAY RESUME ERRORS JUMP I F ANY RESUME ERRORS 05Bl 05Bl 05B2 05B4 FB 2B CO SE CO FORCE DCL SUPPORT FOR BOOTSTRAP RETRLBOOT: STI SUB AX,AX MOV ES,AX ENABLE INTERRUPTS ESTABLI SH ADDRESS I NG RESET THE DSKT PARAMETER TABLE VECTOR ROM BIOS 2-139 05B6 05BD 26: C7 06 0078 R 0000 E 26: 8C DE 007A R MOV 05C2 05C5 05C8 05CA B9 0100 BF 7COO R 2B CO F3/ AB 05CC 05CF 05CF 05DO 05DO 05D2 05D4 05D6 05D7 B9 0002 MOV WORD PTR DISK-POINTER, OFFSET DSKLBASE WORD PTR DISK-POINTER+2,CS CLEAR THE BOOT LOCATION (256 WORDS) MOV MOV SUB REP CX,256 DI,OFFSET BOOLLOCN AX,AX STOSW LOAD SYSTEM FROM DISKETTE 05D9 05DC 05DC 05DF 05El 05E4 05E7 05E9 05EA 05EC 05EF 05EF 05F1 05F3 05F6 05F8 05FA 05FD 05FD 0602 0604 MOV CX,2 RETRY COUNTER HO: 51 PUSH CX MOV INT JNC POP LOOP AH,O 13H HL1 CX HO HI: B4 CD 73 59 E2 00 13 06 F6 EB 7C 90 JMP HL1: MOV SUB MOV B8 0201 2B D2 BB 7COO R B9 0001 CD 13 59 72 03 EB 76 90 B4 CD F6 75 E2 E9 16 13 C4 80 05 D5 068C R F6 06 0016 R 10 74 03 EB 51 90 MOV INT POP JC JMP HL2: MOV INT TEST JNZ LOOP JMP HL3: TEST JZ JMP RESET THE DISKETTE SYSTEM DISKETTE_IO I F ERROR, TRY AGAIN IF RETRY EXCEEDS TWO THEN BASIC HBASI C AX,201H DX,DX BX,OFFSET BOOLLOCN CX ,I 13H CX HL2 H4 AH ,16H 13H AH, TIMeOUT HL3 HO H10 READ IN THE SINGLE SECTOR TO THE BOOT LOCATION DRIVE 0, HEAD 0 SECTOR I, TRACK 0 DISKETTE_IO GET RETRY COUNT GO CHECK BOOT IF READ OKAY CHECK FOR NO MEDIA IN DRIVE BY CHECKING CHANGE LINE CHECK FOR NO MEDIA IN DRIVE IF NO MEDIA THEN SHOW ICON ELSE GO RETRY ERROR RETRY EXCEEDED GO SHOW BAD DISKETTE BIOS_STATUS,BOOLF1HIT ; DID THE USER INDICATE BASIC OPTIOI HL1 ; JUMP I F NOT HBASIC ; EXIT TO BASIC SHOW DISKETTE 0607 0607 80 26 0016 R EF OGOC 060C BA 1200 060 F 8D 0000 E 0612 E8 06BE R 0615 0615 BA OllF 0618 BD 0000 E 061B E8 06BE R 061E BA OE21 0621 BD 0000 E 0624 E8 06BE R 0627 0627 B3 05 0629 E8 06C4 R HL1: AND H3: MOV MOV CALL H3_1 : MOV MOV CALL MOV MOV CALL H3_2: MOV CALL BIOS_STATUS,NOT BOOLFlHIT ; RESET Fl KEY HIT FLAG DX ,1200H BP,OFFSET FLICON DSPLICON DX POINTS TO DISPLAY POSITION POINT THE Fl I CON DX,OllFH ; DX POINTS TO BP ,OFFSET SYS_DSKLICON ; POINT TO DSPLICON DX,OE21H DX POINTS TO BP ,OFFSET DSKLICON POINT TO THE DSPLICON BL,05 KELWAIT DISPLAY POSITION THE DISKETTE ICON DISPLAY POSITION DISKETTE ICON SET TIMEOUT TO 275 MSECS WAIT FOR Fl KEY OR TIME WAIT TIMEOUT OR Fl KEY OCCURRED 062C 062C 062D 0630 0633 0636 0637 0639 TO: 52 BA BD E8 5A FE 80 OllF 0000 E 06BE R CE FE 06 2-140 ROM BIOS PUSH MOV MOV CALL POP DEC CMP DX ; SAVE DISKTETTE POINTER DX,OllFH ; DX POINTS TO DISPLAY POSITION BP ,OFFSET SYS_DSKLICON ; POINT TO THE DISKETTE ICON DSPLICON DX DH DH,06H 063C 063E 0641 0644 74 8D E8 EB 08 0000 E 06BE R El JE MOV CALL JMP TO_l BP ,OFFSET DSKLICON DSPLICON H3_2 YES THEN REDISPLAY ICONS OTHERWISE JUST MOVE DISKETTE WAIT AGAIN CHECK FOR Fl HIT AND IF SO THEN RETRY DISKETTE 0646 0646 064B 0640 064F 0652 F6 75 B3 E8 EB 0654 E9 05Bl 06 0016 R 10 07 14 06C4 R Cl TO_I: TEST JNZ MOV CALL JMP TO_3: BIOS_STATUS,BOOLFlHIT ; Fl KEY WAS HIT? TO_3 NO THEN KEEP DISPLAYING ICONS .DELAY LONGER FOR NO DISKETTE BL,20 WAIT TIME KELWAIT SHORT H3_1 GO RE DISPLAY ICONS JMP RETRLBOOT GO RETRY BOOT USER WANTS BASIC OR CONTROLLER FAILURE 0657 0657 065C 065 F 0662 80 E8 E8 CD 26 0016 R EF 0000 E 0000 E 18 HBASIC: AND CALL CALL INT BIOS_STATUS,NOT BOOLFlHIT ; RESET Fl HIT FLAG DSP_INIT CLEAR THE DISPLAY DSP_FSETM ; SET MODE TARGET DISPLAY 18H ; GO TO RES I DENT BAS I C I PL WAS SUCCESSFUL NOW CHECK BOOLLOCN FOR NON ZERO DATA 0664 0664 0667 066A 066E 0670 BF 7COO R B9 OOOA 26: Al 7COO OB CO 74 lA H4: 0672 0675 0678 067A 83 C7 02 26: 3B 05 E1 F8 74 10 067C 0681 0684 0687 80 E8 E8 EA MOV MOV MOV OR JE DI,OFFSET BOOLLOCN CX,10 AX, WORD PTR BOOLLOCN AX,AX HI0 I F ZERO BAD BOOT RECORD NOW CHECK NEXT 10 WORDS FOR NOT EQUAL H4_LP: ADD DI,2 CMP AX, ES: [DI] LOOPZ H4_LP JZ HIO 26 0016 R EB 0000 E 0000 E 7COO ---- R AND CALL CALL JMP ; LOOP I F DATA SAME ; BAD BOOT RECORD I F ALL DATA SAME BIOS_STATUS, NOT BOOLFIHIT+DCL_SUPPORTED ; RESET BIOS FLAGS DSP_INIT ; CLEAR THE DISPLAY DSP_FSETM ; CLEAR THE TARGET DISPLAY BOOLLOCN ; SHOW DISKETTE EXITING DRIVE AND SPLITTING APART 068C 80 26 0016 R EF HI0: 0691 0694 0694 0695 0698 069B 069E 069F 06Al 06A3 BA 0621 52 BA BD E8 5A FE B3 BD MOV HI0_2 : PUSH MOV MOV CALL POP INC MOV MOV OllF 0000 E 06BE R C6 05 0000 AND BIOS_STATUS, NOT BOOLFIHIT ; RESET KEY HIT FLAG DX,0621H START INITIAL DISPLAY DX SAVE DISKTETTE POINTER DX,OllFH ; DX POINTS TO DISPLAY POSITION BP,OFFSET SYS_DSKLICON ; POINT TO THE DISKETTE ICON DSPLICON OX DH BL,05 ; SET TIMEOUT TO 275 MSECS BP ,OFFSET DSKLICON ; WITH GOOD DISKETTE ICON CHECK FOR LAST POSITION FOR DISKETTE BEFORE BROKEN DISKETTE IS SHOWN 06A6 06A9 06AB 06AE 0680 0680 0683 0686 06B9 068B 80 75 BD B3 FE OE 05 0000 E 28 E8 E8 80 75 E9 068E R 06C4 R FE OE D9 060C R CMP JNE MOV MOV HI0_3 : CALL CALL CMP JNE JMP DH ,OEH HI0_3 ; YES THEN DISPLAY BROKEN ICON BP ,OFFSET BAD_DSKLICON ; OTHERWISE SHOW BAD DISKETTE BL,40 TIME DELAY FOR BROKEN DISKETTE DSPLICON KELWAIT DH,OEH HlO_2 H3 WAIT FOR TIME OR Fl KEY AT LAST ICON NO THEN KEEP MOVING DISKETTE YES THEN SHOW DISKETTE GOING IN ROM BIOS 2-141 DISPLAY BROKEN ICON SYS_BOOT ENDP 06BE 06BE 06BE 06BF 06CO 06C3 06C4 DSPLICON PROC NEAR PUSH CS POP ES CALL ICON_PR RET DSPLICON ENDP OE 07 E8 0000 E C3 POINT ES TO CODE SEGMENT DISPLAY THE INSERT DISKETTE ICON THIS CODE WAITS FOR THE Fl KEY TO BE DEPRESSED OR THE TIME LIMIT EXPIRED WHICH EVER COMES FIRST 06C4 06C4 06C5 06C6 06C9 06CD IE 07 BF OOIC R 8A 3E OOIA R BO 02 06CF E8 0000 06D2 72 22 0604 06D6 0608 06DB B4 CD 80 74 00 16 FC 3B 00 0600 06DF 06El 06E7 3C 75 C7 E9 OC E3 06 0072 R ABCD 0000 E 06EA 06EB 06ED 06EF FB E4 60 3C 3B 74 F9 KELWAIT PROC NEAR PUSH OS POP ES ; POINT ES TO DATA SEGMENT MOV DI,OFFSET BUFFER_TAIL; GET ADDRESS OF BUFFER_TAIL MOV BH,BYTE PTR BUFFEILHEAD ; GET DATA IN BUFFER HRAD MOV AL, 02H COMPARE RETURN NOT EQUAL USING BH AND DATA AT DI CALL EXLEVENT WILL RETURN AFTER TIME LIMIT OR WHEN THERE IS DATA IN KEYBOARD BUFFER JC KW_EXIT I F TIMEOUT THEN JUMP A KEY WAS HIT MOV INT CMP JE AH,O l6H AH,3BH FlBRK OTHERWISE PURGE THE KEY Fl KEY? YES THEN WAIT FOR BREAK CHECK FOR POWER ON SELF TEST LOOP MODE REQUEST AL,OCH ; CNTL + L KEY? KELWAIT ; NO THEN WAIT SOME MORE RESELFLAG,LOOP_MODE ; SET POST LOOP MODE ACTIVE POSLLOOP ; EXIT BACK TO POST CMP JNE MOV JMP WAIT FOR BREAK OF Fl KEY Fl BRK: IN CMP JE STI AL,KLDATA AL,03BH FlBRK ENABLE INTERRUPTS READ KEYBOARD PORT CHECK FOR STILL Fl KEY WAIT UNTIL NOT Fl KEY MAKE Fl KEY WAS DEPRESSED THEN RELEASED 06Fl 80 OE 001 R 10 OR BIOS_STATUS,BOOLFlHIT RETURN TO CALLER 06F6 06F6 06F7 06F7 C3 KW_EXIT: RET KELWAIT ENDP ROMCODE ENDS END 2-142 ROM BIOS SET Fl HIT FLAG Communications and Printer BIOS (B14COMMO) 0000 ROMCODE SEGMENT BYTE PUBLIC ASSUME CS:ROMCODE,DS:DATA IDENT BI4COM,14,00 ; ********************************************************************* ROUTINE-NAME: B14COMMO DATE LAST MODIFIED: 09/12/85 DESCRIPTIVE-NAME: INT 14H CALLS COMMUNICATION BIOS FUNCTIONS. INT 17H CALLS PRINTER BIOS ROUTINES. COPYRIGHT: 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: 0.0 FUNCTIONS: COMMO_IO PRLIO COM_POWER MODULE SIZE: COMMUNICATIONS BIOS PRINTER BIOS POWER ON/OFF COM DEVICES 550 BYTES (DECIMAL) ENTRY CONDITIONS: EXIT CONDITIONS: REFER TO PROLOGUES REFER TO PROLOGUES ROUTINES IN MODULE: COMMO_IO PRLIO COM_POWER INTERNAL DATA AREAS COMMUNICATIONS BIOS PRINTER BIOS POWER ON/OFF COM DEVICES TABLES: NONE EXTERNALL Y REFERENCED ROUTINES: EXTERNALL Y REFERENCED DATA AREAS: , CHANGE ACTIVITY: REFER TO EXTRN LIST BIOS DATA SEGMENT NONE ; ********************************************************************* ROM BIOS 2-143 Communications Interrupt Hex 14 (COMMO_IO) ; -----INT 14H -------------------------------------------------------COMMO_IO THIS ROUTINE PROVIDES BYTE STREAM I/O TO THE COMMUNICATIONS PORT ACCORDING TO THE PARAMETERS: (AH)~O INITIALIZE THE COMMUNICATIONS PORT (AL) HAS PARAMETERS FOR INITIALIZATION 7 ----000 001 010 011 100 101 110 111 - 6 5 BAUD RATE -110 150 300 600 1200 2400 4800 9600 4 3 -PARITY-XO - NONE 01 - ODD 11 - EVEN 2 STOP BIT o- 1 1 - 2 1 0 --WORD LENGTH10 - 7 BITS 11 - 8 BITS ON RETURN, CONDITIONS SET AS IN CALL TO COMMO STATUS (AH~3) (AH)~l SEND THE CHARACTER IN (AL) OVER THE COMMO LINE (AL) REGISTER IS PRESERVED ON EXIT, BIT 7 OF AH IS SET IF THE ROUTINE WAS UNABLE TO TRANSMIT THE BYTE OF DATA OVER THE LINE. I F BIT 7 OF AH IS NOT SET, THE REMAINDER OF AH IS SET AS IN A STATUS REQUEST, REFLECTING THE CURRENT STATUS OF THE LINE. (AH)~2 RECEIVE A CHARACTER IN (AL) FROM COMMO LINE BEFORE RETURNING TO CALLER ON EXIT, AH HAS THE CURRENT LINE STATUS, AS SET BY THE THE STATUS ROUTINE, EXCEPT THAT THE ONLY BITS LEFT ON ARE THE ERROR BITS (7,4,3,2,1) IF AH HAS BIT 7 ON (TIME OUT) THE REMAINING BITS ARE NOT PREDICTABLE. THUS, AH IS NON ZERO ONLY WHEN AN ERROR OCCURRED. (AH)~3 RETURN THE COMMO PORT STATUS IN (AX) AH CONTAINS THE LINE STATUS BIT 7 ~ TIME OUT BIT 6 ~ TRANS SH I FT REGISTER EMPTY BIT 5 ~ TRAN HOLDING REGISTER EMPTY BIT 4 ~ BREAK DETECT BIT 3 ~ FRAMING ERROR BIT 2 ~ PARITY ERROR BIT 1 ~ OVERRUN ERROR BIT 0 ~ DATA READY AL CONTAINS THE MODEM STATUS BIT 7 ~ RECEIVED LINE SIGNAL DETECT BIT 6 ~ RING INDICATOR BIT 5 ~ DATA SET READY BIT 4 ~ CLEAR TO SEND BIT 3 ~ DELTA RECEIVE LINE SIGNAL DETECT BIT 2 ~ TRAILING EDGE RING DETECTOR BIT 1 ~ DELTA DATA SET READY BIT 0 ~ DELTA CLEAR TO SEND (AH) ~OTHER NO ACTI ON TAKEN. (DX) ~ PARAMETER INDICATING WHICH RS232 CARD (0,1 ALLOWED) DATA AREA RS23LBASE CONTAINS THE BASE ADDRESS OF THE 8250 ON THE CARO. LOCATION 400H CONTAINS UP TO 4 RS232 ADDRESSES POSSIBLE. DATA AREA LABEL RS23LTIILOUT (BYTE) CONTAINS OUTER LOOP COUNT VALUE FOR TIMEOUT (DEFAULT~l). REGISTERS MODIFIED AX MODIFIED ACCORDING TO PARMS OF CALL ALL OTHERS UNCHANGED 2-144 ROM BIOS INTERRUPTS: INTERRUPTS ARE ENABLE UPON ROUTINE ENTRY. ; ********************************** , PUBLICS ; ********************************** PUBLI C COMMO_IO PUBLI C PRLIO PUBLIC COfLPOWER ; ********************************** , EXTERNALS ; ********************************** EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN DDS: NEAR BAUD_TABLE: BYTE GELRTCREG: NEAR GELVECTOR@:NEAR Dll:NEAR CHECLFOR_8250: NEAR ; ********************************** ; EQUATES ; ********************************** DSR_BIT CTS_B IT DTR_BIT RTS_BIT RCLERR DLAB 0020 0010 0001 0002 001E 0080 EQU EQU EQU EQU EQU EQU 20H lOH 01H 02H OOOllllOB 80H RECV ERROR BITS DIVISOR LATCH ACCESS BIT ; ********************************** START OF CODE ; ********************************** 0000 PROC FAR VECTOR TO APPROPRIATE ROUTINE 0000 0001 0002 0003 0004 0005 0006 0008 OOOA OOOC OOOF 0013 0015 IE 52 56 57 51 53 8B 8B 01 E8 8B OB 74 0017 8A 08 F2 FA E6 0000 E 94 0000 02 28 83 E8 FB 72 0022 0025 80 CC 80 EB 18 0027 002A 002C 002E 0030 0032 0034 0036 0038 003A 003C 83 8A OA 74 FE 74 FE 74 FE 75 E9 003F 0040 OS OX SI 01 CX BX SI,DX DI,DX SI,l DDS OX, RS23LBASE [S I] DX,DX A3 PORT NUMBER TO SI AND 01 MAKE WORD OFFSET BIOS DATA SEG INTO DS GET PORT BAS E ADDRESS TEST FOR 0 (NO PORT) RETURN MOV BL ,AL SAVE SEND CHAR IF IS ONE EA 03 C3 E4 16 CC 47 CC 6C CC 03 00C6 R OR JMP AO: AI: AH ,80H SHORT SUB MOV A3 DX,3 AL, BL NO, SET TIMEOUT ERROR EXIT OR JZ DEC JZ DEC JZ DEC JNZ JMP AH,AH A4 AH A5 AH A12 AH A3 A18 RESTORE ADDRESS RESTORE SEND CHAR IF IS ONE TEST FOR AH=O YES, COMMO INIT TEST FOR AH= 1 YES, SEND CHAR TEST FOR AH=2 YES, RECEIVE CHAR TEST FOR AH=3 NO, EXIT YES, GET PORT STATUS POP POP BX RESTORE REGISTERS A3: 5B 59 SAVE SEGMENT AND REGISTERS USED ;-----CHECK FOR PRESENSE OF 8250 AT THIS PORT C2 03 ADD DX,3 ADDRESS 8250 LINE CTRL REG 0000 E CALL CHECLFOR_8250 CARRY SET IF PRESENT STI SHIELDS DOWN 05 JC AO YES, GO ON IF PRESENT 0019 001C 001F 0020 003F PUSH PUSH PUSH PUSH PUSH PUSH MOV MOV SHL CALL MOV OR JZ RETURN FROM RS232 cx ROM BIOS 2-145 0041 0042 0043 0044 0045 5F 5E 5A IF CF POP POP POP POP IRET DI SI DX DS ; RETURN TO CALLER INITIALIZE THE COMMUNICATIONS PORT M: 0046 0046 0048 004B 004D 8A EO 83 C2 03 BO 80 EE 004E 0050 0052 0054 0058 005B 005D 0061 0062 0066 0067 0068 006B 006C 006F 0071 0073 0074 0075 0076 0078 0079 8A D4 Bl 04 D2 C2 81 E2 OOOE BF 0000 E 03 FA 8B 94 0000 R 42 2E: 8A 45 01 EE 4A 2E: 8A 05 EE 83 C2 03 8A C4 24 IF EE 4A 4A BO 00 EE EB 4B MOV ADD MOV OUT AH,AL DX,3 AL,DLAB DX,AL SAVE INIT PARMS IN AH POINT TO 8250 CONTROL REG ACCESS BAUD RATE BY SETTING DLAB=1 DETERMINE BAUD RATE DIVISOR MOV MOV ROL AND MOV ADD MOV INC MOV OUT DEC MOV OUT ADD MOV AND OUT DEC DEC MOV OUT JMP DL,AH GET PARMS TO DL CL,4 DL,CL DX,OEH ; ISOLATE THEM DI,OFFSET BAUD_TABLE; BASE OF TABLE DI,DX PUT INTO INDEX REGISTER DX,RS23LBASE[SIJ POINT TO HIGH ORDER OF DIV DX AL,CS: [DIJ+l GET HIGH ORDER OF DIVISOR DX,AL SET HIGH OF DIVISOR DX GET LOW ORDER OF DIVISOR AL,CS: [DIJ SET LOW OF DIVISOR DX,AL ADDRESS LINE CTR REG DX,3 GET PARMS BACK AL,AH AL,OIFH STRIP OFF THE BAUD BITS DX,AL SET LINE CTRL TO WORD LENGTH DX PARITY AND # STOP BITS DX ADDRESS INTR ENABLE REG AL,O DX,AL DISABLE INTERRUPTS (IER) COM_STATUS SHORT AI8 SEND CHARACTER IN (AL) OVER COMMO LINE 007B 007B 007C 007F 0081 0082 0083 0084 0086 0089 008B 008B 008C 008E 008E 0091 0093 0093 0094 0096 0099 009B 009E 009F OOAI 00A2 AS: 50 83 BO EE 42 42 B7 E8 74 C2 04 03 30 0158 R 08 PUSH ADD MOV OUT INC INC MOV CALL JZ AX ; DX,4 ; AL, DTR_BIT OR RTS_BIT DX ,AL ; DX ; DX BH, DSR_BIT OR CTS_BIT WAILFOR_STATUS A9 POP MOV CX AL,CL OR JMP AH ,80H A3 DEC MOV CALL JNZ SUB POP MOV DX BH,DSILBIT WAILFOR_STATUS A7 DX,5 CX AL,CL OUT JMP DX,AL A3 SAVE CHAR TO SEND ADDRESS MODEM CONTROL REG ; SET DTR AND RTS DATA TERM RDY, REO TO SEND MODEM STATUS REGISTER ; DATA SET RDY & CLR TO SEND ARE BOTH TRUE YES, READY TO TRANSMIT CHAR A7: 59 8A Cl RELOAD DATA BYTE A8: 80 CC 80 EB AC A9: 4A B7 E8 75 83 59 8A 20 0158 R FO EA 05 Cl EE EB 9B INDICATE TIME OUT RETURN CLEAILTO_SEND ADDRESS LINE STATUS REGISTER IS TRANSMITTER READY TEST FOR TRANSMITTER READY NO, RETURN WITH TIME OUT SET ADDRESS DATA PORT RECOVER IN CX TEMPORARI LY MOV E CHAR TO AL FOR OUT, STATUS IN AH OUTPUT CHARACTER RETURN RECEIVE CHARACTER FROM COMMO LINE 00A4 00A4 00A7 83 C2 04 BO 01 A12: ADD MOV 2-146 ROM BIOS DX,4 AL,DTILBIT MODEM CONTROL REGISTER SET DATA TERM I NAL READY 00A9 OOAA OOAB OOAC OOAE OOBI 00B3 00B4 00B6 00B9 OOBB OOBE 00C2 00C3 EE 42 42 B7 E8 75 4A B7 E8 75 80 8B EC E9 OUT INC INC MOV CALL JNZ DEC MOV CALL JNZ AND MOV IN JMP 20 0158 R DB 01 0158 R 03 E4 lE 94 0000 003F R DX,AL OX OX BH,DSR_BIT WAILFOILSTATUS A8 OX BH,1 WAILFOILSTATUS A8 AH,RCLERR OX, RS23LBASE [S I] AL,DX A3 MODEM STATUS REGISTER DATA SET READY TEST FOR DSR NO, RETURN WITH ERROR LINE STATUS REGISTER RECEIVE BUFFER FULL TEST FOR REC. BUFF. FULL NO, SET TIME OUT ERROR SAVE ERR ON RECV CHAR DATA PORT GET CHARACTER FROM LINE RETURN COMMO PORT STATUS ROUTINE 00C6 00C6 OOCA OOCD OOCE 0000 0001 0002 8B 83 EC 8A 42 EC E9 94 0000 R C2 05 EO 003F R A18: MOV ADD IN MOV INC IN JMP OX, RS23LBASE [SI] DX,5 AL,DX AH,AL OX AL,DX A3 LINE STATUS REGISTER GET LINE CONTROL STATUS PUT IN AH FOR RETURN ~I~ ro ~D~ ~MUS Rffi GET MODEM CONTROL STATUS RETURN COM_POWER TURN POWER ON/OFF TO COMMO CARD ENTRY: BL = MODEM/ASYNC POWER BIT IN FEATURE CONFIGURATION REGISTER ( =02 FOR MODEM, =04 FOR ASYNC SEC, =05 ASYNC PRIMARY BH = 0 - TURN POWER OFF = 1 - TURN POWER ON EXIT: AH = 0 AND CF = 0 IF OPERATION OKAY AH = 80 AND CF = 1 I F POWER ON REQSTED AND NO RESP FROM 8250 WITHIN 500 MSEC REGISTERS USED: AX IS DESTROYED. ALL OTHERS ARE NOT MODIFIED. INTERRUPTS: INTERRUPTS ARE ENABLED WITHIN ROUTINE, RESTORED UPON EXIT. --- - -- - - - - -- -- - - - -- -- -- -- - -- - ------ ---- - - - - -- ---------------- ------ -- ; LOCAL EQUATES = 03FB 0005 COM-POWER 0005 0006 0007 0008 OODA 0000 OODF OOEl 00E4 00E6 00E8 OOEA 53 51 52 E4 BA B4 Bl F6 75 FE DO FE 7C 03FB 10 04 C3 03 06 CE EC C9 OOEC OOEE OOFO 00F2 00F4 OA 74 OA E6 EB FF 06 C3 7C 47 PUSH PUSH PUSH IN MOV MOV MOV TEST JNZ DEC SHR DEC CPO: JZ OR OUT JMP EQU 3FBH PROC NEAR BX SAVE REGISTERS CX OX AL,KYBD_CNTL GET INITIAL REG CONTENTS DX,LINE_CTL_REG PRI PORT LINE CONTROL REG AH,10H SET FOR LVL 4 SYSTEM IRPT CL,4 ; PARM FOR GELVECTOR CALL BL,SELRS23LPRIM+ACLMODEM; PRIMARY ASYNC? CPO DH NO - POINT TO SEC INT 10 REG AH,1 SET FOR LEVEL 3 SYSTEM IRPT CL ADJUST PARM FOR LEVEL 3 I RPT OR BH, BH CPl AL,BL KY BD_CNTL, AL SHORT CP2 CHECK REQUEST CODE JUMP I F A POWER OFF REQUEST TURN POWER ON BE ABLE TO HANDLE ANY PENDING INTERRUPT WHEN POWER IS TURNED OFF ROM BIOS 2-147 00F6 00F7 00F8 OOFA OOFC OOFE OOFF 0102 9C FA F6 22 E6 56 E8 IE 0103 0106 0108 010A OlOB OlOE 010F 0113 B9 BE 8B 51 88 51 C7 8C CP1 : PUSHF CLI 03 C3 7C 0000 ---09 OC 4C 02 04 0000 E 4C 02 SAVE FLAGS SHI ELOS UP TURN POWER OFF NOT AND OUT PUSH CALL PUSH 8L AL, BL KYBO_CNTL ,AL SI GELVECTOR@ OS MOV MOV MOV PUSH MOV PUSH MOV MOV CX ,ABSO OS,CX SEGMENT THAT CONTAINS VECTOR CX, [SIJ CX SAVE OFFSET CX,[SI+2J CX ; SAVE SEGMENT WORD PTR[SIJ ,OFFSET D11 ; SET UP DUMMY IRPT HNDLER [SI+2J ,CS SAVE SI SI CONTAINS VECTOR OFFSET SAVE OS UNMASK INTERRUPT LEVEL 3/4 0116 0118 011A 011C 011E F6 E4 8A 22 E6 04 21 08 C4 21 NOT IN MOV AND OUT AH AL,INTA01 BL,AL AL,AH INTA01,AL GET CURRENT SYSTEM IRPTS SAVE CURRENT SYSTEM IRPTS LEVEL 3/4 INTERRUPT UNMASK INTERRUPT ENA8LE SYSTEM INTERRUPTS 0120 0121 0124 F8 89 64C8 E2 FE STI MOV LOOP CX,100*MS_DELAY SH I ELDS DOWN DELAY lOOms $ RESTORE INTERRUPT MASK 0126 0127 0129 0128 0120 012F FA E4 F6 22 OA E6 CLI 21 04 DC C3 21 IN NOT AND OR OUT SHI ELDS UP CURRENT INTERRUPTS MASK INTERRUPT LEVEL 3/4 IF UNMASKED DURING THIS ROUTINE AL,INTA01 AH BL,AH AL,BL INTA01,AL MASK INTERRUPT RESTORE INTERRUPT VECTOR 0131 0132 0135 0136 59 89 4C 02 59 89 OC POP MOV POP MOV CX [Sl+2J ,CX CX [SI],CX 0138 0139 o13A 0138 1F 5E 90 E8 15 POP POP POPF JMP DS SI 0130 83 05 CP2 : 013F 0142 B9 64C8 E2 FE CP2_1: MOV LOOP 0144 0147 0149 014B E8 72 FE 75 SHORT RESTORE I RPT VECTOR SEGMENT RESTORE IRPT VECTOR OFFSET CP3 ; EXIT GOOD WAIT FOR RESPONSE FROM 8250 UP TO 500 msec MOV BL,5 ; LOOP COUNT FOR 500 MSEC CX,lOO*MS_OELAY ; INNER LOOP COUNT CHECK FOR RESPONSE FROM 8250 0000 09 CB F2 CALL JC DEC JNZ CHECKJOL8250 CP3 BL CPL1 SETS CARRY I F PRESENT YES, GO ON. NO, TRY TIL TIMES UP NO RESPONSE FROM 8250 - TIMEOUT 0140 014F 0150 B4 80 F9 EB 02 MOV STC JMP RESET ASYNC 2-148 ROM BIOS AH,80H SHORT CP4 SET TIMEOUT SET CARRY FLAG 0152 2A E4 CP3: SUB AH,AH GOOD RETURN 0154 0155 0156 0157 5A 59 58 C3 CP4: POP POP RET POP OX RESTORE REGISTERS CX BX COM_POWER 0158 ENDP - --- ------- - - ---- - -- - - - -- - - - -- - - - - - - - - -WAIT FOR STATUS ROUTINE ENTRY: BH=STATUS BIT(S) TO LOOK FOR, DX=ADDR. OF STATUS REG EXIT: ZERO FLAG ON = STATUS FOUND ZERO FLAG OFF = TIMEOUT. AH=LAST STATUS READ 0158 0158 015C 015C 015E 015E 015F 0161 0163 0165 0167 0169 016B 0160 016F 016F 0170 0170 ---- -- -- - - - - - - - - - - - - - -- -- - - - - - - - - - - - -- -8A 90 007C R 2B C9 EC 8A 22 3A 74 E2 FE 75 EO C7 C7 08 F5 CB EF OA FF C3 WAILFOR_STATUS PROC NEAR MOV BL, RS23LTIM_OUT[DI] WFSO: SUB CX,CX WFS1: IN AL,DX MOV AH,AL AND AL,BH CMP AL,BH WFS_END JE LOOP WFSI BL DEC JNZ WFSO BH, BH OR WFS_END: RET WAILFOR_STATUS ENDP COMMO_IO ENDP LOAD OUTER LOOP COUNT GET STATUS MOVE TO AH ISOLATE BITS TO TEST EXACTL Y = TO MASK RETURN WITH ZERO FLAG ON TRY AGAIN SET ZERO FLAG OFF ROM BIOS 2-149 Printer Interrupt Hex 17 (PRT_IO) ; - - - I NT 17 H - - - - - - - - - - - - - - - - - - -- - - - - - - - -- - - - - - - -- - - - - - - - - - - - - - - - - -- -PRLIO THIS ROUTINE PROVIDES COMMUNICATION WITH THE PRINTER INPUT (AH) =0 PRINT THE CHARACTER IN (AL) ON RETURN, AH=l IF CHARACTER COULD NOT BE PRINTED (TIME OUT). OTHER BITS SET AS ON NORMAL STATUS CALL (AH) =1 INITIALIZE THE PRINTER PORT RETURNS WITH (AH) SET WITH PRINTER STATUS (AH)=2 READ THE PRINTER STATUS INTO (AH) 7 6 5 4 3 2-1 0 I I I I I I_TIMEOUT I I I I I_UNUSED 1_ 1 I (0 ERROR I I I I I 1_ 1 SELECTED I 1_ 1 = OUT OF PAPER 1_ 1 = ACKNOWLEDGE = NOT BUSY (AH)=OTHER NO ACTION TAKEN. (OX) = PRINTER TO BE USED (0,1,2) CORRESPONDING TO ACTUAL VALUES IN PRINTEILBASE AREA DATA AREA PRINTER_BASE CONTAINS THE BASE ADDRESS OF THE PRINTER CARD(S) AVAILABLE (LOCATED AT BEGINNING OF DATA SEGMENT, 408H ABSOLUTE, 3 WORDS). DATA AREA PRINLTIM_OUT (BYTE) MAY BE CHANGED TO CAUSE DIFFERENT TIME-OUT WAITS. DEFAULT=20. IF NO PRINTER ATTACHED OR INVALID FUNCTION CODE RECEIVED, A RETURN IS MADE WITH AH= PRINTER TIMEOUT (01) REGISTERS USED AH IS MODIFIED ALL OTHERS UNCHANGED INTERRUPTS: INTERRUPTS ARE ENABLE UPON ROUTINE ENTRY, RESTORED ON EXIT. 0170 0170 0171 0172 0173 0174 0175 0176 0179 017B 017F 0181 0185 0187 0189 018B 0180 018F 0191 0193 FB IE 52 56 51 53 E8 8B 8A 01 8B OB 74 OA 74 FE 74 FE 74 0000 F2 9C 0078 R E6 94 0008 R 02 OC E4 10 CC 57 CC 3F ASSUME CS: ROMCODE, OS: DATA PRLIO PROC FAR STI SHIELDS DOWN PUSH SAVE SEGMENT OS PUSH OX SAVE REGISTERS USED HERE PUSH SI PUSH CX PUSH BX CALL DDS ; BIOS DATA SEG TO OS MOV SI,DX ; GET PRINTER PARM MOV BL,PRINLTIM_OUT[SI] ; LOAD TIME-OUT PARM SHL SI,l WORD OFFSET INTO TABLE MOV OX, PRINTER_BASE [SI] GET BASE ADDRESS FOR PRINTER OR DX,DX ANY PRINTERS PRESENT? JZ BO NO,SIGNAL ERROR OR AH,AH TEST FOR (AH) =0 JZ B2 YES, PRINT CHAR DEC AH TEST FOR (AH)=l JZ B8 YES, INIT PRINTER TEST FOR (AH) =2 DEC AH JZ B5 YES, GET STATUS INVALID COMMAND OR NO PRINTER ATTACHED; SIGNAL TIMEOUT 2-150 ROM BIOS 0195 B4 01 BO: MOV AH,OlH NO, RETURN TIMEOUT STATUS COMMON EXIT FOR ALL PRINTER FUNCTIONS 0197 0198 0199 019A 019B 019C 5B 59 5E 5A IF CF B1 : POP POP POP POP POP IRET BX CX SI DX DS RECOVER REGISTERS RECOVER REGISTERS PRINT THE CHARACTER IN (AL) 019D 019D 019E B2 : 50 42 PUSH INC SAVE VALUE TO PRINT POINT TO STATUS PORT AX DX CHECK FOR PRINTER BUSY 019F 01AO 01A2 IN EC A8 80 75 23 AL,DX AL,NOLBUSY B4 TEST JNZ GET STATUS IS PRINTER CURRENTLY BUSY? NO THEN OULSTROBE NOTIFY OPERATING SYSTEM THAT A PRINTER BUSY WAIT IS IN AFFECT 01A4 01A5 01A8 01AA 01AC 01AC 01AE 01AE OlAF 01B1 01B3 01B5 01B7 01B9 01BB 01BD F8 B8 90FE CD 15 72 13 CLC MOV INT JC AX,90FEH 15H B3_2 JUMP I F TIMEOUT OCCURRED B3 : 2B C9 EC 8A A8 75 E2 A8 74 FE 75 SUB BL1: IN MOV TEST JNZ LOOP TEST JZ DEC JNZ EO 80 12 F7 08 07 CB ED CX, CX WAIT_BUSY AL,DX AH,AL AL,NOLBUSY B4 B3_1 AL, NOLERROR B3_3 BL B3 GET STATUS STATUS TO AH ALSO IS PRINTER CURRENTLY BUSY NO, OULSTROBE YES, TRY AGAIN CHECK FOR I (0 ERROR YES, JUMP FINISHED 500 MS DELAY? NO, DO AGAIN BUSY TIMEOUT OCCURRED 01BF 01BF 01C2 01C2 01C5 ***INT 15 DEVICE BUSY FUNCTION 90 PRINTER ID BL2: OR B3_3: AND JMP 80 CC 01 80 E4 F9 EB 19 YES, TIMEOUT AH,l SET ERROR FLAG AH,OF9H SHORT B7 TURN OFF THE OTHER BITS RETURN WITH ERROR FLAG SET PRINTER IS NOT BUSY SO STROBE OUT CHARACTER 01C7 01C8 01C9 01CA 01CB 58 4A EE 42 50 01CC 01CE 01CF 01DO 0102 01D3 BO OD 42 EE 24 FE EE 58 POP B4 : AX GET VALUE TO PRINT POINT TO DATA REG OUTPUT VALUE TO DATA REG POINT TO STATUS PORT SAVE VALUE TO PRINT DEC OUT INC PUSH DX DX,AL DX AX MOV INC OUT AND OUT POP ; OULSTROBE AL,SELECT+NO_INIT+STROBE ; SET THE STROBE HIGH OX STRB IS BIT 0 OF PORT C DX,AL AL,NOT STROBE SET THE STROBE LOW DX,AL AX RECOVER THE OUTPUT CHAR PRINTER STATUS 01D4 01D4 0105 01D5 0109 B5: 50 PUSH B6: 8B 94 0008 R 42 MOV INC DX, PRINTEILBASE [S I] OX ROM BIOS 2-151 01DA 01DB 0100 OlEO OlEO 01El 01E3 01E6 EC 8A EO 80 E4 F8 IN MOV AND AL,DX AH,AL AH ,OF8H POP MOV XOR JMP OX AL,DL AH ,ACK+NOLERROR B1 B7 : 5A 8A C2 80 F4 48 EB AF GET PRINTER STATUS TURN OFF UNUSED BITS STATUS_SET RECOVER AL REG GET CHARACTER INTO AL FLIP A COUPLE OF BITS RETURN FROM ROUTINE INITIALIZE THE PRINTER PORT 01E8 01E8 01 E9 OlEA 01EB OlEO 01EE 88: 50 42 42 BO 08 EE B9 0352 PUSH INC INC MOV OUT MOV AX OX OX AL,SELECT DX,AL CX ,850 SAVE AL POINT TO OUTPUT PORT SET INIT LINE LOW, SLCT HIGH SET MAX TIME CNT TO 4.25 SEC WAIT FOR UP TO 4 SECONDS FOR COMPACT PRINTER TO DROP BUSY I F PARALLEL PRINTER THEN JUST WAIT 5 MSECS AND EXIT 01F1 01 F2 01F5 01F7 01F8 01FB 51 B9 E2 59 83 75 PUSH CX BlO: CX,5*MS_DELAY MOV LOOP $ POP CX OX, CPRT _MODE CMP JNE B11 050A FE FA 7A 1B DELAY FOR 5 MSECS COMPACT PRINTER? EX IT LOOP I F NOT WAIT FOR COMPACT PRINTER TO DROP BUSY 01FD 01FF 0201 E4 79 A8 02 El EE 0203 0205 0208 020A 020C B3 B9 E2 FE 75 IN TEST LOOPZ DELAY 08 FBF4 FE CB F7 AL, CPRLSTAT AL,02 B10 , CHK FOR BUSY DROP IN STATUS ; NOT BUSY? ; LOOP I F STILL BUSY SECONDS AFTER BUSY DROP TO LET PRINTER MOVE HEAD TO HOME MOV BL, SELECT BlO_1: MOV CX, 250*MS_DELAY LOOP $ DEC BL JNE B10_1 ACTIVATE PRINTER POWER 020E 0210 BO OC EE MOV OUT AL,SELECT+NO_INIT DX,AL ; NO INTERRUPTS, NON AUTO LF, ; SELECT AND INIT LINE HIGH DELAY 60 MSEC AFTER PRINTER POWER HAS BEEN ENABLED 0211 0214 0216 B9 3C78 E2 FE EB BD 0218 021A 021B 0210 BO OC EE EB B8 0210 MOV LOOP JMP B11: OUT JMP PRLIO CX,60*MS_DELAY SHORT B6 MOV EXIT ROUTINE AL, SELECT+NO_I NIT ; NO I RPTS, NON AUTO LF, DX,AL ; SELECT AND INIT LINE HIGH SHORT B6 ; PRLSTATUS_l ENDP ROMCODE ENDS END 2-152 ROM BIOS 60 MSEC DELAY $ Time of Day (B15TOD) 0000 ROMCODE SEGMENT BYTE PUBLIC ASSUME CS:ROMCODE,DS:DATA IDENT BI5TOD,15,00 ; ********************************************************************* MODULE-NAME : B15TOD DATE LAST MODIFIED: 9/12/85 DESCRIPTIVE-NAME: TIME OF DAY SUPPORT COPYRIGHT: 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: 0.0 FUNCTION: TOD_PROC SELTOD TMRO_INT8 INITIALIZLSTATUS RTCLTST MODULE SIZE: ALLOW READ/SET OF REAL TIME CLOCK INITIALIZE TIMER DATA AREA SYSTEM TIMER INTERRUPT HANDLER INITIALIZE REAL TIME CLOCK TEST REAL TIME CLOCK FOR TIME UPDATE 936 BYTES ENTRY CONDITIONS: REFER TO ROUTINE PROLOGUES EXIT CONDITIONS: REFER TO ROUTINE PROLOGUES ROUTINES IN MODULE: TOD_PROC SELTOD TMRO_INT8 INTERNAL DATA AREAS ALLOW READ/SET OF REAL TIME CLOCK INITIALIZE TIMER DATA AREA TIMER 0 INTERRUPT HANDLER TABLES: NONE EXTERNALL Y REFERENCED ROUTINES: REFER TO EXTRN LIST EXTERNALL Y REFERENCED DATA AREAS: CHANGE ACT I VITY: TIMER DATA AREA NONE ; ********************************************************************* ***************************************************************** EXTERNAL REFERENCES ***************************************************************** EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN GELRTCNMI: NEAR PULRTCNMI : NEAR DDS:NEAR ENABLE_NMI :NEAR DISABLLNMI: NEAR KB_NOISE:NEAR ROM BIOS 2-153 ***************************************************************** PUBLICS DECLARATION ***************************************************************** PUBLIC PUBLIC PUBLIC PUBLIC PUBLI C TOD_PROC SELTOD TMRO_INT8 INITIALIZE-STATUS RTCLTST ; ***************************************************************** ;* S TAR T 0 F COD E * ; ***************************************************************** Time of Day Interrupt Hex lA (TOD_PROC) SUBTTL TOD_PROC ; ********************************************************************* ROUTINE-NAME: TOD_PROC ([NT IAH) FUNCTION: ALLOW REAL TIME CLOCK TO BE READ/SET ALLOW TIMER DATA AREA TO BE READ/SET ENTRY AND EXIT CONDITIONS: 1. READ THE CURRENT CLOCK SETTING (TIMER DATA AREA) INPUT CONDITIONS: AH = OOH NORMAL EXIT CONDITIONS: AL = 0 IF TIMER HAS NOT PASSED 24 HRS SINCE LAST READ. <>0 I F ON ANOTHER DAY. ex = HIGH WORD OF COUNT OX = LOW WORD OF COUNT REGISTERS MODIFIED: AL, CX, OX 2. PURPOSE OF ENTRY: INPUT CONDITIONS: PURPOSE OF ENTRY: REGISTERS MODIFIED: SET CURRENT CLOCK (TIMER DATA AREA) AH OIH CX = HIGH WORD OF COUNT OX = LOW WORD OF COUNT AH 3. PURPOSE OF ENTRY: READ TIME OF REAL TIME CLOCK INPUT CONDITIONS: AH = 02H NORMAL EXIT CONDITIONS: CH HOURS IN BCD CL MINUTES IN BCD DH SECONDS IN BCD DL 00 - NOT DAYLIGHT SAVINGS 01 - DAYLIGHT SAVINGS ERROR EXIT CONDITIONS: CF FLAG SET IF CLK NOT OPERATING REGISTERS MODIFIED: AX, CX, OX 4. PURPOSE OF ENTRY: INPUT CONDITIONS: 2-154 ROM BIOS. SET TIME OF REAL TIME CLOCK AH 03H CH HOURS IN BCD CL MINUTES IN BCD DH SECONDS IN BCD DL I IF DAYLIGHT SAVINGS OPTION. ELSE O. RESTRICTIONS: DL SHOULD = I OR = 0 ONLY. DL MADE TO = ITS OWN BITO. REGISTERS MODIFIED: AX 5. PURPOSE OF ENTRY: READ DATE FROM REAL TIME CLOCK INPUT CONDITIONS: AH = 04H NORMAL EXIT CONDITIONS: CH = CENTURY IN BCD (19H OR 20H) Cl = YEAR IN BCD DH = MONTH IN BCD Dl = DAY OF MONTH IN BCD ERROR EXIT CONDITIONS: CF FLAG SET IF ClK NOT OPERATING REGISTERS MODIFIED: AX, CX, OX 6. PURPOSE OF ENTRY: INPUT CONDITIONS: REGISTERS MODIFIED: SET DATE OF REAL TIME CLOCK AH = 05H CH = CENTURY IN BCD (19H OR 20H) Cl = YEAR IN BCD DH = MONTH I N BCD Dl = DAY OF MONTH IN BCD AX 7. SET ALARM TIME OF REAL TIME CLOCK AH = 06H CH = HOURS I N BCD Cl = MINUTES IN BCD DH = SECONDS I N BCD NORMAL EXIT CONDITIONS: CF FLAG = 0 ERROR EXIT CONDITIONS: CF FLAG SET IF ClK NOT OPERATING CF FLAG SET I F ALARM ALREADY ENABLED RESTRICTIONS: THE USER MUST CODE A RTN AND PUT CORRECT ADDRESS IN THE VECTOR TABLE FOR INT 4AH. REGISTERS MODIFIED: AX 8. PURPOSE OF ENTRY: RESET THE ALARM INPUT CONDITIONS: AH = 07H NORMAL EXIT CONDITIONS: NONE ERROR EXIT CONDITIONS: NONE REGISTERS MODIFIED: AX 9. PURPOSE OF ENTRY: INPUT CONDITIONS: SET ALARM TIME OF RTC FOR POWER ON AH = 08H CH = HOURS IN BCD Cl = MINUTES IN BCD DH = SECONDS I N BCD NORMAL EXIT CONDITIONS: CF FLAG = 0 ERROR EXIT CONDITIONS: CF FLAG SET IF ClK NOT OPERATING CF FLAG SET I F ALARM ALREADY ENABLED REGISTERS MODIFIED: AX 10. PURPOSE OF ENTRY: READ ALARM TIME OF RTC AND STATUS INPUT CONDITIONS: AH = 09H NORMAL EXIT CONDITIONS: CH = HOURS I N BCD Cl = MINUTES IN BCD DH = SECONDS IN BCD Dl = ALARM STATUS 00 - ALARM NOT ENABLED (AI E=O) 01 - ALARM ENABLED BUT Will NOT POWER ON SYSTEM (AIE=l, EN_PON-'llRM=O) 02 - ALARM ENABLED AND WILL POWER ON SYSTEM (AIE=l, EN_PON_AlRM=l) ERROR EXIT CONDITIONS: CF FLAG SET IF CLK NOT OPERATING REGISTERS MODIFIED: AX, CX, OX NOTE: INTERRUPTS: PURPOSE OF ENTRY: INPUT CONDITIONS: FUNCTION CALLS WITH AH NOT EQUAL TO THE ABOVE RESULT IN NO OPERATION WITH THE CARRY FLAGE BEING CLEARED FUNCTIONS 0, 1 FORCED OFF (CLI) FUNCTIONS 2 - 9 FORCED ON (STI) ON EXIT RESTORED AS WERE ROM BIOS 2-155 I NTERNALL Y REFERENCED ROUTINES: INITIALIZE_STATUS INITIALIZES RTC REGISTERS A THRU D UPD_IN_PR WAITS UNTIL CLOCK NOT BEING UPDATED SELALRM SETS RTC ALARM TIME BYTES AND ENABLES THE RTC ALARM EXTERNALL Y REFERENCED ROUTI NES: DDS GELRTCNMI PULRTCNMI ENABLCNMI DISABLE_NMI ESTABLISH SEGMENT ADDRESSES AND READS A RTC REGISTER AH = REGISTER #, AL = DATA READ ADDRESSES AND PUTS A RTC REGISTER AH = REGISTER #, AL = DATA PUT ENABLE NMI' S DISABLE NMI'S ********************************************************************* = 0001 0000 0000 0001 0002 SELCF TOD_PROC STI PUSH CALL FB IE E8 0000 01H EQU PROC FAR INTERRUPTS ON FOR TIMER SAVE SEGMENT SET DATA SEGMENT OS DDS ;-------CHECK FOR FUNCTION REQUESTS 0 AND 1- - - - - - - - - - - - - - - - - - - - - - - - -RTCCHKO: OR JZ DEC JZ CMP 0005 0005 0007 0009 OOOB 0000 OA 74 FE 74 80 0010 0012 0015 73 06 E8 0000 E EB 40 90 E4 2B CC 3A FC 09 AH,AH RTCO AH RTCI AH,9 TOD_NRET DISABLE_NMI RTCCHKl JAE CALL JMP I F PARAMETER AH=O THEN READ TIMER I F PARAMETER AH=l THEN SET TIME CHECK IF VALID DATA PASSED IN AH (0 <= AH <= 9) NORMAL RETURN IF NOT VALID DISABLE NMI' S GO CHECK FOR OTHER FUNCTIONS ; ---- --- TOD_PROC NORMAL RETURN- ---- ----------------------------------0018 0018 OOIB 001B ODIC 0010 OOIE 0020 FB IF 55 8B EC 80 66 06 FE 0024 0025 50 CF E8 0000 TOD_NRET: CALL TOO_RET: STI POP PUSH MOV AND POP IRET ENABLE_NMI RE-ENABLE NMI' S ENABLE INTERRUPTS FOR TIMER OS RECOVER SEGMENT BP BP ,SP BYTE PTR SS: [BP+6], NOT SELCF RST CARRY OF FLAGS I N STACK BP ; RETURN WITH GOOD CODE (CF=O) ; ------- TOD_PROC ERROR RETURN---- -------- -------------- - ------- ---- --0026 0026 0029 002A 002B 002C 002E 0032 0033 E8 0000 FB IF 55 8B EC 80 4E 06 01 50 CF TOD_ERET: CALL STI POP PUSH MOV OR POP IRET ;-------G E T 0034 0034 0035 0038 0030 0041 0045 FA AO C6 8B 8B EB 0070 R 06 0070 R 00 OE 006E R 16 006C R 04 T RTCO: CLI MOV MOV MOV MOV JMP ;-------S E T 2-156 ROM BIOS ENABLE_NMI ENABLE INTERRUPTS FOR TIMER OS RECOVER SEGMENT BP BP, SP BYTE PTR 55: [BP+6-,SELCF ; SET CARRY OF FLAGS BP ; RETURN WITH ERROR CD (CF=l) MER OAT A----- FUNCTION DOH AL, TIMER_OFL TIMER_OFL,O CX, TIMEILHIGH OX, TIMEILLOW TOD_RET T - ----- - -- - - - - - -- DISABLE INTERRUPTS FOR READ GET OVERFLOW, AND RESET THE FLAG CX RETURNS TIMER_HIGH DATA OX RETURNS TIMER_LOW DATA NORMAL RETURN WITH TMR DATA M E R--------------- FUNCTION OlH -------------- 0047 0047 0048 004C 0050 0055 FA 89 89 C6 EB 16 006C R OE 006E R 06 0070 R 00 C4 RTC1: CLI MOV MOV MOV JMP TIMEILLOW, OX TIMEILHIGH,CX TIMEILOFL,O TOO_RET DISABLE INTERRUPTS FOR READ SET TIMEILLOW = TO PARAM OX SET TIMER_HIGH = TO PARAM CX RESET OVERFLOW NORMAL RTN AFTER SETTING TMR ; -------CHECK FOR FUNCTION REQUESTS 2 AND 3-------------------------0057 0057 0059 005B 0050 005F FE 74 FE 74 E9 CC 07 CC 20 OOEE R RTCCHK1: DEC JZ DEC JZ JMP ;-------G E T 0062 0062 0065 0067 0069 0069 006B 006E AH RTC2 AH RTC3 RTCCHK2 IF PARAMETER THEN GET RTC I F PARAMETER THEN SET RTC GO CHECK FOR AH=2 TIME AH=3 TIME OTHER FUNCTIONS TIM E--------- FUNCTION 02H --------------- RT UPD_IN_PR RTC2A TOD_ERET CLOCK OPERATING? YES, GO AROUND NO, ERROR RETURN B4 00 E8 0000 8A FO RTC2: CALL JNC JMP RTC2A: MOV CALL MOV AH,RTCTSEC GELRTCNMI DH,AL ADDRESS AND GET RTCTSEC (RegO) DH RETURNS TSEC DATA 0070 0072 0075 B4 02 E8 0000 8A C8 MOV CALL MOV AH,RTCTMIN GELRTCNMI CL ,AL ADDRESS AND GET RTCTMIN (Reg2) CL RETURNS TMIN DATA 0077 0079 D07C B4 04 E8 0000 8A E8 MOV CALL MOV AH,RTCTHRS GELRTCNMI CH,AL ADDRESS AND GET RTCTHRS (Reg4) CH RETURNS THRS DATA 007E 0080 0082 0085 0087 0089 008A 2A B4 E8 A8 74 42 EB E8 OlFE R 73 02 EB BD 02 DB 0000 01 01 SUB DL,DL MOV AH,RTCMODE CALL GELRTCNMI TEST AL,SELDAYLIGHT JZ RTC2B INC OX TOD_NRET RTC2B: JMP 8C ;-------S E T RT C SET NOT -DAYLIGHT -SAVINGS GET RTCMODE (RegB) DAYLIGHT SAVINGS SET? NO, JUMP AROUND YES, SET DL=Ol NORMAL RETURN WITH TIME TIM E--------- FUNCTION 03H ---------------- 008C 008C 008F 0091 E8 OlFE R 73 03 E8 01E5 R RTC3: CALL JNC CALL UPD_IN_PR RTC3A IN ITIALI ZE_STATUS CLOCK OPERATING? YES, GO AROUND NO, INIT CONTROL/STATUS REG. S (A-D) 0094 0094 0096 0098 B4 00 8A C6 E8 0000 RTC3A: MOV MOV CALL AH,RTCTSEC AL,DH PULRTCNMI ADDRESS AND SET RTCTSEC (RegO) = TO TSEC PARAMETER, CH 009B 0090 009F B4 02 8A C1 E8 0000 MOV MOV CALL AH,RTCTMIN AL,CL PULRTCNMI ADDRESS AND SET RTCTMIN (Reg2) = TO TMIN PARAMETER, CL 00A2 00A4 00A6 B4 04 8A C5 E8 0000 MOV MOV CALL AH,RTCTHRS AL,CH PULRTCNMI ADDRESS AND SET RTCTHRS (Reg4) = TO THRS PARAMETER, CH 00A9 OOAB OOAE B4 DB E8 0000 24 71 MOV CALL AND OOBO ODB3 00B5 00B7 80 OA OC E8 AND OR OR CALL ADDRESS AND AH,RTCMODE ; GET RTCMODE (RegB) GELRTCNMI AL ,AI E_ENABLE+U I E_ENABLE+P I LENABLE+S ELDAYL IGHT RESET UNUSED FLAGS CLEAR ALL OTHERS. DL,SELDAYLIGHT SET DL = TO ITS BITO AL,DL IF DSE=l, KEEP, ELSE DSE=DL. AL,SEL24HR TURN ON 24HR-MODE ADDR AND SET RTC_MODE (REG B) PULRTCNMI E2 01 C2 02 0000 ROM BIOS 2-157 OOBA OOBC OOBF OOCl 00C4 B4 E8 24 E8 E9 OE 0000 7F 0000 E 0018 R MOV CALL AND CALL JMP ; -------G E T 00C7 00C7 OOCA OOCC OOCF OOCF 00D1 00D4 B4 07 E8 0000 E 8A DO 00D6 00D8 OODB AH,RTCDIALSTAT GELRTCNMI AL,NOT RTCTIMLBAD PULRTCNMI TOD_NRET R T C ADDRESS AND GET RTCDIAG_STAT (RegE) RESET RTCTIME_BAD FLAG (=0) PUT BACK RTCDIAG_STAT (RegE) NORMAL RTN AFTER SETTING TIME D A T E--------- FUNCTION 04H ---------------- RTC4: CALL JNC JMP RTC4A: MOV CALL MOV UPD_IN_PR RTC4A TOD_ERET CLOCK OPERATING? YES, GO AROUND NO, ERROR RETURN AH,RTCMDAY GELRTCNMI DL,AL ADDRESS AND GET RTCMDAY (Reg?) DL RETURNS DAY OF MON. DATA B4 08 E8 0000 8A FO MOV CALL MOV AH,RTCMON GELRTCNMI DH,AL ADDRESS AND GET RTL...MON (Reg8) DH RETURNS MONTH DATA OODD OODF 00E2 B4 09 E8 0000 8A C8 MOV CALL MOV AH,RTCYEAR GELRTCNMI CL,AL ADDRESS AND GET RTCYEAR (Reg9) CL RETURNS YEAR DATA 00E4 00E6 00E9 B4 32 E8 0000 8A E8 MOV CALL MOV AH, RTCCENTURY GELRTCNMI CH ,AL ADDRESS AND GET RTCCENTURY (Reg50/32H) CH RETURNS CENTURY DATA OOEB E9 0018 R JMP TOD_NRET NORMAL RETURN WITH DATE E8 01FE R 73 03 E9 0026 R :-------CHECK FOR FUNCTION REQUESTS 4, 5, AND 6---------------------OOEE OOEE OOFO 00F2 00F4 00F6 00F8 OOFA FE 74 FE 74 FE 74 EB RTCCHK2: DEC JZ DEC JZ DEC JZ JMP CC D5 CC 07 CC 3B 59 90 ;-------S E T OOFD OOFD 0100 0102 AH RTC4 AH RTC5 AH RTC6 RTCCHK3 RT C I F PARAMETER THEN GET RTC I F PARAMETER THEN SET RTC I F PARAMETER TH EN SET RTC GO CHECK FOR AH=4 DATE AH=5 DATE AH=6 ALARM REMAINING FUNCT D A T E--------- FUNCTION 05H ---------------- E8 01FE R 73 03 E8 01E5 R RTC5: CALL JNC CALL UPD_IN_PR RTC5A IN ITIALI ZE_STATUS CLOCK OPERATING? YES, GO AROUND NO, INIT CONTROL/STATUS REG.S (A-D) 0105 0105 0107 0109 B4 06 BO 00 E8 0000 RTC5A: MOV MOV CALL AH,RTCWDAY AL,O PULRTCNMI ADDRESS AND CLEAR RTCWDAY (Reg6) OlOC OlOE 0110 B4 07 8A C2 E8 0000 MOV MOV CALL AH,RTCMDAY AL,DL PULRTCNMI ADDRESS AND SET RTCMDAY (Reg?) = TO DAY OF MON. PARAMETER, DL 0113 0115 0117 B4 08 8A C6 E8 0000 MOV MOV CALL AH, RTC...MON AL,DH PULRTCNMI ADDRESS AND SET RTC...MON (Reg8) = TO MONTH PARAMETER, DH OllA OllC OllE B4 09 8A Cl E8 0000 E MOV MOV CALL AH,RTCYEAR AL,CL PULRTCNMI ADDRESS AND SET RTC YEAR (Reg9) = TO YEAR PARAMETER, CL 0121 0123 0126 0128 B4 E8 24 E8 OB 0000 7F 0000 MOV CALL AND CALL AH,RTCMODE GELRTCNMI AL,NOT SELCLOCK PULRTCNMI ADDRESS AND GET RTCMODE (RegB) TURN OFF SET -MODE ONLY ADDR AND SET RTC...MODE (RegB) 012B 012D 012F B4 32 8A C5 E8 0000 MOV MOV CALL AH, RTCCENTURY AL,CH PULRTCNMI ADDRESS AND SET RTCCENTURY (Reg50/32H) = TO CENTURY PARAMETER, CH 2-158 ROM BIOS 0132 E9 0018 R , 0135 0135 0138 013B 0130 0140 0140 E8 3D 75 E9 01A9 R 0000 03 0026 R E9 0018 R TOD_NRET JMP ;-------S E T R T C RTC6: CALL CMP JNE JMP RTC6A: JMP ; IiML RTN AFTER SETTING DATE A L A R M------- FUNCTION 06H ---------------- SELALRM AX,O RTC6A TOD_ERET SET ALARM REGISTERS GOOD RELCODE RETURNED? .•. YES, CONTINUE. ... NO, ERROR RET. TOD_NRET ; -------R ESE T RTC_7: MOV CALL AND CALL R T C NtoIL RTRN AFTER SETTING ALARM A L A R M--- FUNCTION 07H ---------------- 0143 0143 0145 0148 014A B4 E8 24 E8 0140 80 26 OOAO R F8 AND RTCWAILFLAG,NOT 0152 E9 0018 R JMP TOD_NRET OB 0000 OF 0000 AH,RTCMODE GELRTCNMI AL,NOT AIE_ENA8LE PULRTCNMI ADDRESS AND GET RTCMODE (Reg8) RESET ALARM INT ENA8LE ADDR & PUT RTCMODE (RegB) PON~LRM_PEND ; RST PWR BY ALARM NML RTRN RESETTING ALARM ;-------CHECK FOR FUNCTION REQUESTS 7, 8, AND 9---------------------0155 0155 0157 0159 0158 0150 FE 74 FE 74 EB RTCCHK3 : DEC JZ DEC JZ JMP CC EA CC 03 14 90 AH RTC7 AH RTC8 RTC9 IF PARAMETER AH=7 THEN RESET ALARM I F PARAMETER AH=8 THEN SET RTC ALARM POWER-ON PARAM AH=9, GET ALARM TIME & STATUS RT C A L ARM FOR POW E R o N----------FUNCTION 08H RTC8: CALL SET~LRM ; SET ALARM REGISTERS CMP AX,O ; GOOD RELCODE RETURNED? RTC8A JNE ; ... YES, CONTINUE. TOD_ERET JMP ; .•. NO, ERROR RET. RTC8A: OR RTCWAI T_FLAG, PON~LRtLPEND ; SET PWR ON BY ALARM PENDING TOD_NRET JMP ; NML RTRN AFTER SETTING ALARM ;-------S E T 0160 0160 0163 0166 0168 016B E8 3D 75 E9 80 0170 E9 0018 R 01A9 R 0000 03 0026 R OE OOAO R 04 ;-------G E T RT C S TAT U S--------------A L ARM AND FUNCTI ON 09H 0173 0173 0176 0178 017B 017B 0170 0180 B4 01 E8 0000 8A FO RTC9: CALL JNC JMP RTC9A: MOV CALL MOV 0182 0184 0187 84 03 E8 0000 8A C8 MOV CALL MOV AH,RTC~MIN 0189 0188 018E 84 05 E8 0000 8A E8 MOV CALL MOV AH,RTC~HRS 0190 0192 0194 0197 0199 0198 0190 2A 84 E8 A8 74 FE F6 SUB MOV CALL TEST JZ INC TEST DL,DL SET DL TO ZERO AH,RTCMODE ADDRESS AND GET RTCMODE (Reg8) GELRTCNMI RTC ALARM DISABLED (AIE=O)? AL,AIE_ENA8LE YES, RETURN DL=O EXIT9 DL ; DL=l RTCWAI T_FLAG, PON~LRtLPEND E8 01FE R 73 03 E9 0026 R 02 OB 0000 20 08 C2 06 OOAO R 04 UPD_IN_PR RTC9A TOD_ERET CLOCK OPERATING? YES, GO AROUND NO, ERROR RETURN AH,RTC~SEC ADDRESS AND GET RTC~SEC (Reg1) DH RETURNS ASEC DATA GELRTCNMI DH,AL GELRTCNMI CL,AL GELRTCNMI CH,AL ADDRESS AND GET RTC~MIN (Reg3) CL RETURNS AMIN DATA ADDRESS AND GET RTC~HRS (Reg5) CH RETURNS AHRS DATA ROM BIOS 2-159 01A2 01A4 01A6 74 02 FE C2 E9 0018 R JZ INC EXIT9 : EXIT9 DL TOD_NRET JMP IS PWR ON BY ALARM PENDING? NO, RETURN DL=l YES, RETURN DL=2 NML RTRN W/ALRM TIME & STAT - - - - - --SU BROUT I NES- - - - - - - -- - - - - -- - - -- - - - - - -- - - - - - - - - - - - -- -- - -- - - - - -- -- -- - - - - - -- - - - - - - -- - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - -- - - - - - ---SELALARM IF RTC ALARM IS DISABLED AND THE CLOCK IS OPERATING, SET THE ALARM TIME AND ENABLE THE RTC ALARM. FUNCTION: INPUT: DH = ALARM SECONDS IN BCD CL = ALARM MINUTES IN BCD CH = ALARM HOURS I N BCD OUTPUT: AX = 0 ERROR RETURN CODE AX <> 0 GOOD RETURN CODE REGISTERS MODIFIED: AX - --- - -- - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - -- -01A9 01A9 01AB 01AE 01BO 01B2 01B4 01B5 01B5 OlB8 01BA E8 01FE R 73 03 E8 OlE5 R SELALRM MOV CALL TEST JZ XOR RET CONTI: CALL JNC CALL 01BD 01BD 01BF 01C1 B4 01 8A C6 E8 0000 E 01C4 01C6 01C8 B4 E8 A8 74 33 C3 OB 0000 20 03 CO PROC NEAR AH,RTCMODE GELRTCNMI AL ,AI LENABLE CONTI AX,AX ADDRESS AND GET RTCMODE (RegB) I F ALARM DISABLED (AIE=O) THEN CONTINUE ELSE CLEAR AX AND RETURN UPD_IN_PR CONT2 I NIT IALI ZE_STATUS CLOCK OPERATING? YES, GO AROUND NO, INIT CONTROL/STATUS REG. S (A-D) CONT2 : MOV MOV CALL AH,RTCASEC AL,DH PULRTCNMI ADDRESS AND SET RTCASEC (Reg1) = TO ASEC PARAMETER, DH B4 03 8A Cl E8 0000 MOV MOV CALL AH,RTCAMIN AL, CL PULRTCNMI ADDRESS AND SET RTU\MIN (Reg3) = TO AMIN PARAMETER, CL 01CB 01CD 01CF B4 05 8A C5 E8 0000 E MOV MOV CALL AH,RTCAHRS AL,CH PULRTCNMI ADDRESS AND SET RTU\HRS (Reg5) = TO AHRS PARAMETER, CH 01D2 0104 0107 0109 01DB B4 E8 24 OC E8 MOV CALL AND OR CALL AH,RTCMODE GELRTCNMI AL,NOT SELCLOCK AL,AIE_ENABLE PULRTCNMI ADDRESS AND GET RTCMODE SET MODE OFF ENABLE ALARM ADDR AND SET 010E OlEO 01E2 E4 61 24 F7 E6 61 IN AND OUT AL,NMLCNTL AL,NOT DIS_ALARM NMLCNTL,AL ENABLE RTC NM I FOR ALARM 01E4 01E5 C3 DB 0000 E 7F 20 0000 RET SET...ALRM 2-160 ROM BIOS (RegB) (SET=O) INT. (AI E=l) RTCMODE (RegB) RETURN TO RTC6 OR RTC8 ENDP INITIALIZE_STATUS FUNCTION: INITIALIZE RTC CONTROL AND STATUS REGISTERS REG A = 976.6 USEC PERIODIC INTERRUPT 32.768 KHZ TIME BASE REG B = ENABLE SET, 24HR, BCD MODES DISABLE ALL INTERRUPTS AND DAYLIGHT SAVINGS READ REG C AND D TO CLEAR STATUS INPUT: NONE OUTPUT: NONE REGISTERS MODIFIED: 01E5 01E5 01E7 01E9 B4 OA BO 26 E8 0000 OIEC OlEE OIFO B4 OB BO 82 E8 0000 DIF3 01F5 01F8 OIFA OlFD OIFE B4 E8 B4 E8 C3 AX INITIALIZE_STATUS PROC MOV AH, RTCUP _STAT MOV AL, 26H CALL PULRTCNMI MOV MOV CALL OC 0000 00 0000 NEAR ADDRESS AND INITIALIZE ; RTCUP_STAT (RegA) TO GIVE ; **INT.=976.6 MICRO SEC. AH,RTCMODE ; ADDRESS AND INITIALIZE AL,SELCLOCK+SEL24HR ; RTCMODE (RegB): (=82H) PULRTCNMI * MODES ON ... SET, 24HR, BCD * DSABLE ALL OTH (NO DYLGHT) MOV AH,RTCINLSTAT CALL GELRTCNMI AH,RTCCOND_STAT MOV CALL GELRTCNMI RET INITIALIZLSTATUS ENDP GET RTCINLSTAT (RegC) TO INITIALIZE IT GET RTCCOND_STAT (RegD) TO INITIALIZE IT RETURN TO CALLER UPD_IN_PR FUNCTION: WAIT FOR RTC CLOCK TO UPDATE TIME. SET CARRY IF CLK NOT OPERATING (DOESN'T LEAVE UPDATE MODE AFTER 600 MSEC). INPUT: NONE OUTPUT: AX = 0 CLOCK NOT UPDATING CARRY FLAG = 1 CLOCK NOT OPERATING = 0 CLOCK HAS BEEN UPDATED REGISTERS MODIFIED: 01FE 01FE 01FF 0202 0202 0204 0207 0209 020B 0200 020F 0210 0210 0211 0212 0212 51 B9 0258 B4 E8 A8 74 E2 33 F9 59 C3 OA 0000 80 05 F5 CO AX UPD_IN_PR PROC NEAR PUSH CX MOV CX ,600 UPDATE : AH,RTCUP _STAT MOV CALL GELRTCNMI TEST AL,RTCUIP UPD_I N_PREND JZ LOOP UPDATE XOR AX,AX STC UPD_IN_PREND: POP CX RET UPD_IN_PR ENDP TOD_PROC SUBTTL SAVE CX SET LOOP COUNT ADDRESS AND GET RTCUP _STAT (RegA) IF NOT UPDATING (UIP=O) THEN RETURN ELSE IF CX <> 0 THEN LOOP ELSE CLEAR AX AND SET CARRY FOR ERROR SIGNAL RESTORE CX RETURN TO CALLER ENDP SET TIME OF DAY ROM BIOS 2-161 ******'It*********************************************** *************** ROUTINE-NAME: FUNCTION: SELTOD SET TIMER DATA AREA FROM RTC TIME OR INITIAL TO ZERO (FOR COLD~DE) ENTRY CONDITIONS: PURPOSE OF ENTRY: SET TIMER DATA AREA INPUT CONDITIONS: NONE RESTRI CTI ONS: NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: TIMER DATA AREA SET FROM RTC TIME ERROR EXIT CONDITIONS: TIMER DATA AREA SET TO ZERO REGISTERS MODIFIED: AX RETURNS STATUS CODE FOR DISPATCHER AX = 4000 NON-FATAL ERROR AX = 0 GOOD INTERRUPTS: LEFT AS ARE INTERNALLY REFERENCED ROUTINES: CVLBINARY EXTERNALLY REFERENCED ROUTINES: DDS, GELRTCNMI, PULRTCNMI, INLIA ********************************************************************* 0212 SELTOO PROC 0212 IE PUSH 0213 0215 0218 021B 28 A2 A3 A3 021E 0220 0223 B4 OE E8 0000 24 84 0225 75 56 ;-------RESET TIMER CO SUB 0070 R MaY 006C R MOV 006E R MaV MOY CALL AND JNZ NEAR OS SAVE SEGMENT DATA AREA AX,AX TIMER_OFL,AL TIMER_LOW,AX TIMEILHIGH,AX RESET TIMER DATA AREA AH,RTCOIAG_STAT ADDRESS AND GELRTCNMI ; GET RTCDIAI'--STAT (RegE) AL, RTCTIMLBAD+RTCFAILED TIME BAD OR CLOCK ERROR? TOD_NOTSET YES. TIMER SET TO ZERO 0227 0228 022A 022C F8 B4 02 CD lA 72 3F ; -------GET RTC TIME CLC MOV AH,GELRTCTIME INT lAH JC SELRET 022E 0231 0233 0236 0238 023B 80 77 80 77 80 77 FE 59 3E F9 59 39 FD 23 34 ;-------CHECK VALIDITY OF RTC TIME CMP DH,SECMALLIMIT BAD_TIME JA CL, MIN_MALL I MIT CMP BAD_TIME JA CH,HRS~ALLIMIT CMP BAD_TIME JA 0230 023F 0242 0244 0246 8A E8 B3 F6 8B ;-------SET C6 0286 R 12 E3 DO TIMER FROM RTC TIME MOV AL,DH CVT_BINARY CALL BL, COUNTS_SEC MOV MUL BL MOV DX,AX BCD TSEC INTO AL BINARY TSEC RETURNED IN AL BL <-- # OF COUNTS PER SEC AX <-- # OF CNTS IN RTCTSEC OX IS TOTAL-CNTS ACCUMULATOR 0248 024A 0240 0250 0251 0253 0254 8A E8 BB 52 F7 5A 03 Cl 0286 0444 MOV CALL MOV PUSH MUL POP ADD BCD TMIN INTO AL BINARY TMIN RETURNED IN AL BX <-- # OF COUNTS PER MIN SAVE TOTAL AX <-- # OF CNTS IN RTCTMIN RETRI EVE TOTAL ADD TMIN-CNTS TO TOTAL-CNTS E3 DO 2-162 ROM BIOS AL,CL CVLBINARY BX, COUNTS~I N OX BX OX DX,AX SET CF=O "NO ERROR" STATE FOR INLIA, AH=2=GET RTC GET RTC TIME: CH=H CL=M DH=S IF CF=I, NML RETURN. CF=1 CLK NOT OPERATING (UIP=I) IF RTCTSEC NOT IN LIMITS THEN RETURN IF RTCTMIN NOT IN LIMITS THEN RETURN IF RTCTHRS NOT IN LIMITS THEN RETURN 0250 B3 07 MOV BL, COUNTS_HOUR 025F F6 E3 MUL BL 0261 0263 03 C2 83 01 00 ADD ADC AX,DX CX,OOOOH BCD THRS INTO AL BINARY THRS RETURNED IN AL CX = HIGH WO (THRS-CNTS # OF COUNTS PER HR.) BL <-- # CHTS PER H (LOW WO) **TRUE CNTS/H IS 17 BIT VAL AX <-- # OF COUNTS IN RTCTHRS (LOW WORD) AX = TOTAL-COUNTS (LOW WORD) CX = TOTAL-COUNTS (HIGH WD) 0266 026A 89 OE 006E R A3 006C R MOV MOV TIMER_HIGH,CX TIMER_LOW,AX MOV E TOTAL - COUNTS TO TIMER DATA AREA 0260 0260 026F 0270 2B CO IF C3 0271 0271 0273 0276 0278 027B B4 E8 DC E8 EB 0270 0270 027F 0281 0284 0285 A8 04 75 EC B8 4000 IF C3 0256 0258 025B MOV CALL MOV 8A C5 E8 0286 R 8B C8 AL,CH CVLBINARY CX,AX ;-------RETURN ROUTINES SELRET: SUB AX,AX POP OS RET BAD_TIME: MOV CALL OR CALL JMP OE 0000 04 0000 FO SET GOOD RETURN CODE RETSORE SEGMENT RETURN TO CALLER AH, RTCDIAG_STAT GELRTCNMI AL,RTCFAILED PULRTCNMI SELRET TOO_NOTS ET: TEST AL,RTCFAILEO JNZ SELRET ; MOV AX,NON_FATALERR*100H POP OS ; RET ; ADDRESS AND GET RTCDIAG_STAT (RegE) SET RTCFAILED BIT (=1) PUT RTCOIAli-STAT (RegE) RETURN WITH GOOD RETURN CODE IS RTCFAILED SET (=1)? YES, RTN WITH GOOD RTN CODE ; NO, RTN WITH ERR CD IN AH RESTORE SEGMENT RETURN TO CALLER -------SUBROUTI NES CVLBINARY FUNCTION: INPUT: OUTPUT: CONVERT A 1 BYTE BCD NUMBER TO BINARY AL = BCD NUMBER AH = 0, AL = BINARY NUMBER RESTRI CTIONS: 0286 I NVALI 0 BCD NUMBER RESULTS I N I NVALI 0 BI NARY NUMBER. NO RANGE CHECKING DONE CVLBINARY 0286 0288 0289 028B 0280 028E 0290 BA 51 Bl 02 59 24 05 0292 0293 0293 C3 EO 04 EC OF OA MOV PUSH MOV SHR POP AND PROC AH,AL CX CL,4 AH,CL CX AL,OFH AAD RET CVT_BINARY SELTOD ENDP NEAR INPUT: AL = BCD NUMBER OUTPUT: AH = 0, AL = BINARY PLACE LEFT BCD DIGIT INTO RIGHT NIBBLE OF AH GET RID OF LEFT BCD DIGIT AL CONVERT UNPACKED BCD TO BIN (BINARY # IN AL, AH=O) RETURN TO CALLER ENDP ROM BIOS 2-163 ******************************************************************** ROUTINE-NAME: RTC2_TST FUNCTION: CHECK REAL TIME CLOCK FOR TIME UPDATE FUNCTION. IF RTCTlME_BAD FLAG IS SET INDICATED INVALID TIME, A CALL TO INITIALIZE_STATUS IS MADE TO SET THE RTC REGISTERS AND THE TlME,DATA, AND ALARM REGISTERS ARE SET TO O. ENTRY CONDITIONS: PURPOSE OF ENTRY: CALLED BY POST TO CHECK RTC TIME FUNCTION INPUT CONDITIONS: OS: DATA RESTRI CTI ONS: NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: AX = 0 ERROR EXIT CONDITIONS: AH=40 (NON_FATAL ERR) AL=63 (RTC ERR) REGISTERS MODIFIED: AX RETURNS STATUS CODE FOR POST INTERRUPTS: LEFT AS ARE I NTERNALL Y REFERENCED ROUTI NES: INITIALIZLSTATUS EXTERNALL Y REFERENCED ROUTINES: GELRTCNMI, PULRTCNMI ********************************************************************* 0293 RTCZ-TST PROC NEAR 0293 0295 0298 029A B4 E8 A8 74 OE 0000 80 11 029C 029F 02A) 02A3 E8 B4 BO B9 ; OlE5 R 00 00 OOOA MOV CALL TEST JZ AH,RTCDIAG_STAT GELRTCNMI AL ,RTCTlME_BAD RTC2_02 CHECK FOR CLOCK NOT SET JUMP IF CLOCK IS SET MUST INITIALIZE AND SET TIME TO 0:0:0 DATE TO 0:0:0 02A6 02A6 02A9 02AB E8 0000 FE C4 E2 F9 CALL MOV MOV MOV RTCZ-O) : CALL INC LOOP INSURE SELCLOCK 02AD 02AD 02AF 02B2 02B4 B4 E8 24 E8 02B7 02B9 B3 02 2B C9 OB 0000 7F 0000 RTCZ-02: MOV CALL AND CALL MOV SUB I NITIALI ZE_STATUS AH,RTCTSEC AL,O CX, )0 PULRTCNMI AH RTCZ-O) SET TIME AND DATE TO 0 SET REGISTER TO 0 INCREMENT REGISTER NUMBER BIT IS RESET AH,RTCMODE GELRTCNMI AL,NOT SELCLOCK PULRTCNMI BL,02 CX,CX TURN OFF SELCLOCK OUTER LOOP COUNTER SET MAX LOOP TO 1. 3 SECONDS WAIT FOR UPDATE IN PROGRESS FLAG TO BE SET 02BB 02BB 02BD 02BF 02C) 02C3 02C5 02C7 02C9 02CB BO E6 E4 A8 75 E2 FE 75 EB OA 70 71 80 09 F4 CB FO )0 90 RTCZ-03: MOV OUT IN TEST JNZ LOOP DEC JNE JMP AL,RTCUP_STAT RTCR_PORT ,AL AL, RTCD_PORT AL,RTCUIP RTCZ-04 RTCZ-03 BL RTC2_03 RTC2JAIL READ CLOCK UPDATE STATUS UPDATE IN PROGRESS? JUMP I F YES KEEP LOOKING JUMP I F NEVER CAME ON WAIT FOR UPDATE IN PROGRESS FLAG TO BE RESET 02CE 02CE B9 0258 RTCZ-04: MOV 2-164 ROM BIOS CX,600 SET LOOP FOR 6 MSEC 02Dl 02Dl 02D3 02D5 02D7 02D9 02DB BO E6 E4 A8 74 E2 RTCL05: MOV OUT IN TEST JZ LOOP OA 70 71 80 14 F4 AL,RTCUP_STAT RTCILPORT ,AL AL, RTCD_PORT AL,RTCUIP RTCLINTS RTCL05 READ CLOCK UPDATE STATUS UPDATE IN PROGRESS? JUMP I F RESET KEEP LOOKING RTC FAILED TO UPDATE 02DD 02DD 02DF 02E2 02E4 02E7 02EA 02EC B4 E8 OC E8 B8 B3 EB RTCLFAIL: MOV CALL OR CALL MOV MOV JMP OE 0000 04 0000 E 4063 01 46 90 AH,RTCDIAG_STAT GELRTCNMI AL,RTCFAILED PULRTCNMI AX ,4063H BL ,01 RTCLEXIT SET CLOCK FAILED FLAG SET NON-FATAL ERROR FLAG SET MFG ERROR CODE TEST PERIODIC INTERRUPT FOR POST AFTER 100 MSECS 02EF 02EF 02FO 02Fl 02F4 02F7 02FA 02FD 02FF IE 07 BB B9 BA B8 CD B2 RTCLINTS: PUSH POP MOV MOV MOV MOV INT MOV OOAO R 0001 86AO 8300 15 52 ; SET ES: BX PTR RTCWAILFLAG DS ES BX,OFFSET RTCWAILFLAG ; SET UP FOR INT 15 CALL CX,OI POST AFTER 100 MSECS DX ,86AOH POST ON EVENT FUNCTION CALL AX ,8300H ISH SET MAX TIME CNT TO 110 MSEC DL,82 WAIT FOR POST FLAG TO BE SET BY NMI HNDLR - EACH CNT ON DL = 1. 35MS 0301 0301 0305 0307 030A 030C 030E 0310 0312 0312 0315 0317 031B 031D 26: F6 07 80 75 OB B9 0102 E2 FE FE CA 75 Fl EB 00 RTCLWAIT: TEST JNZ MOV LOOP DEC JNE JMP DL RTCLWAIT SHORT RTCLBAO 80 FA OF 77 08 26: 80 27 7F 2B CO EB 15 INLOONE: CMP JA AND SUB JMP OKAY IF> = 90 MSECS DL,15 RTCLBAD BYTE PTR ES: [BX-,NOT PSTD ; CLR POSTED FLAG ; SET GOOD RETURN CODE AX,AX SHORT RTCLEX IT ; EXIT TEST BYTE PTR ES: [BX-,PSTD ; WAIT FOR POSTED FLAG INLDONE CX ,MS_DELAY ; DELAY FOR 1 MSEC $ BAD IF> 110 MSECS PERIODIC INTERRUPT TEST FAILED 031F 031F 0321 0323 0326 0328 032B 032F 0332 B4 OB BO 00 E8 0000 FE C4 E8 0000 E 26: C6 07 00 B8 4063 B3 02 RTCLBAD: MOV MOV CALL INC CALL MOV MOV MOV AH,RTCMODE AL,O PULRTCNMI AH GELRTCNMI BYTE PTR ES: [BX], 0 AX,4063H BL,02 CLEAR ALL INTERRUPT ENABLES RD STAT TO CLR PENDING INTS CLEAR WAIT FLAG SET NON-FATAL ERROR FLAG SET MFG ERR CODE I NTS BAD PERIODIC INTERRUPT TEST PASSED 0334 0334 0335 0337 0339 033B 033C 033D 50 E4 61 OC 08 E6 61 58 C3 RTCLEXIT: PUSH AX IN AL,NMLCNTL OR AL , 0 I S..J\LARM OUT NMLCNTL,AL POP AX RET RTCLTST ENDP DISABLE ALARM NMI ROM BIOS 2-165 Timer 0 Interrupt S (TMRO_INTS) ; ********************************************************************* TMRO_INT8 DESCRIPTION: THIS ROUTINE HANDLES THE TIMER INTERRUPT FROM CHANNEL 0 OF THE 8253 TIMER. INPUT FREQUENCY IS 1.19318 MHZ AND THE DIVISOR IS 65536, RESULTING IN APPROX. 18.2 INTERRUPTS EVERY SECOND. THE INTERRUPT HANDLER MAINTAINS A COUNT OF INTERRUPTS SINCE POWER ON TIME, WHICH MAY BE USED TO ESTABLISH TIME OF DAY. THE INTERRUPT HANDLER ALSO DECREMENTS THE MOTOR CONTROL COUNT OF THE DISKETTE, AND WHEN IT EXPIRES, WILL TURN OFF THE DISKETTE MOTOR, AND RESET THE MOTOR RUNNING FLAGS. THE INTERRUPT HANDLER WILL ALSO INVOKE A USER ROUTINE THROUGH INTERRUPT lCH AT EVERY TIME TICK. THE USER MUST CODE A ROUTINE AND PLACE THE CORRECT ADDRESS IN THE VECTOR TABLE. INPUT: OS = DATA OUTPUT: AX=O (GOOD RETURN) AH=40 (NON_FATAL ERROR) AL=63 (RTC ERROR) RESTRICTIONS: NONE REGISTERS MODIFIED: INTERRUPTS: NONE FORCED ON (STI) I NTERNALL Y REFERENCED ROUTI NES: NONE ; EXTERNALLY REFERENCED ROUTI NES: DDS, INT lCH, I NT 4AH ; ********************************************************************** 0330 0330 033E 033F 0340 0341 0344 0348 034C FB IE 50 52 E8 FE FF 75 034E FF 06 006E 0000 E OE 007B R 06 006C R 04 TMRO_INT8 STI PUSH PUSH PUSH CALL DEC INC JNZ INC PROC FAR I NTERRUPTS BACK ON OS AX OX DDS EVENLTIM_OUT TIMER_LOW T4 TlMEILHIGH SAVE MACHINE STATE DEC WAIT ON EVNT TIMEOUT CTR INCREMENT TIME TESLDAY INCREMENT HIGH WORD OF TIME CHECK TIMER FOR 24 HOUR ROLL OVER 0352 0352 0357 0359 035F T4: 83 75 81 75 3E 006E R 18 15 3E 006C R OOBO 00 CMP JNZ CMP JNZ ; TESLDAY TIMER_HIGH,COUNTS_DALHI ; TST FOR CNT T5 ; DISKETTE_CTL TIMER_LOW, COUNTS_DAY_LO T5 ; DISKETTE_CTL 24 HOURS TIMER HAS GONE 24 HOURS 0361 0363 0366 0369 2B A3 A3 C6 CO 006E R 006C R 06 0070 R 01 SUB MOV MOV MOV AX,AX TlMER_HIGH,AX TIMER_LOW,AX TIMEILOFL,1 TEST FOR DISKETTE TIME OUT 036E 036E T5: 80 3E 0040 R 00 2-166 ROM BIOS CMP DISKETTE_CTL SKI P MOTOR OFF I F ALREADY 0 0373 0375 0379 74 ID FE OE 0040 R 75 17 JE DEC JNZ T6 MOTOILCOUNT T6 ; RETURN I F COUNT NOT OUT DEGATE DISKETTE DRIVES BEFORE TURNING OFF MOTOR TO INSURE THAT A RE-SELECT OF A DRIVE WITHIN 800 USECS OF MTR OFF WILL NOT GLITCH DRV LINES 037B 037D 037F 0381 0383 0385 E4 A8 74 24 OC E6 77 80 06 BF 20 77 IN TEST JZ AND OR OUT 0387 038C 038E 0391 0392 0392 80 26 003F R CO BO 04 BA 03F2 EE 0394 0396 BO 20 E6 20 AL, DSKLCNTL AL,DSKLNMI T5A AL ,NOT FDLPWR AL, DSKLDEGATE DSKLCNTL, AL DEGATE DISKETTE DRIVES DISKETTE POWER NMIS ENABLED? JUMP I F NOT ONLY DEGATE IF NMI ENABLED TURN OFF DISKETTE MOTORS AND DESELECT DRIVE CD lC T5A: MOV MOV OUT T6: INT AND MOTOILSTATUS,OCOH ; TURN OFF MTR STATUS BITS AL, FDLRUN ; TRN OFF MTRS SLCTS & DMAII NTS DX,DRIVE_CNTL DX,AL lCH XSFER CONTROL TO A USER RTNE END OF INTERRUPT MOV OUT AL,EOI INTAOO,AL ; END OF INTERRUPT TO CNTLR CHECK FOR ANY OTHER INTERRUPTS IN SERVICE 0398 039A 039C 039E 03AO BO E6 E4 OA 75 OB 20 20 CO OE MOV OUT IN OR JNZ AL, READ_I SR INTAOO,AL AL,INTAOO AL,AL T7 SET TO READ INSERVICE REG READ IN-SERVICE-REG ANYTHING IN SERVICE? YES, ALARM SERVICE MUST WAIT CHECK FOR USER RTC ALARM ROUTINE PENDING ACTIVATION 03A2 03A7 F6 06 OOAO R 02 74 07 03A9 03AE 03BO 03BO 03Bl 03B2 03B3 03B4 80 26 OOAO R FD CD 4A TEST JZ RTLWAILFLAG,ALARM_PEND ; ALRM INTERRUPT PENDING? T7 ; JUMP IF NOT CALL USER ALARM ROUTINE DUE TO RTC ALARM PENDING FLAG BEING SET 03B4 AND INT RTLWAILFLAG, NOT 4AH ALAR~PEND ; TURN OFF FLAG ; XSFER CTOL TO USR ALARM RTNE T7 : 5A 58 IF CF POP POP POP IRET TMRO_INT8 DX AX DS RESET MACHINE STATE RETURN FROM INTERRUPT ENDP ROMCODE ENDS END ROM BIOS 2-167 System Services (B16SYSV) 0000 ROMCODE SEGMENT BYTE PUBLIC ASSUME CS: ROMCODE IDENT BI6SYSV,16,00 ***************************************************************************** I NT 15H MODULE-NAME: B16SYSV CHANGE LEVEL: 0.0 DATE LAST MODIFIED: 9/12/85 DESCRIPTIVE-NAME, COPYRIGHT: SYSTEM SERVICES (INT 15H) FUNCTiON CALL SUPPORT ROUTINES. 7396-917 (C) COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NO. G120-2083 FUNCTION: REFER TO ROUTINE PROLOGUE BELOW. MODULE SIZE: 1014 BYTES. ENTRY CONDITIONS: PURPOSE OF ENTRY: EXECUTE SYSTEM SERVICE INDICATED BY INPUT PARAM. INPUT CONDITIONS: REFER TO ROUTINE PROLOGUES BELOW. RESTRICTIONS: FOR SPECIAL RESTRICTIONS REFER TO INDIVIDUAL FUNCTION ROUTI NE PROLOGUES. INTERNALLY REFERENCED ROUTINES: SYS_PROF, EXLEVENT, SYS_POWER_OFF, SYS_STAUS, POSLINTV, WAIT_INTV, DELBUSY, TMRO_CHK, INLCOMPLETE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: REFER TO ROUTINE PROLOGUE BELOW. ERROR EXIT CONDITIONS: CARRY FLAG AND AH = B6H IS SET FOR INVALID FUNCTION REQUEST OR INVALID PARAMETER ERROR. REGISTERS MODIFIED: AH &. RETURNED OUTPUT PARAM (REFER TO PLOGUES). INTERNAL DATA AREAS/ TABLES SYS_TABLE. EXTERNALL Y REFERENCED ROUTINES: REFER TO EXTERNAL REFERENCES LIST. EXTERNALL Y REFERENCED DATA AREAS REFER TO EXTERNAL REFERENCES LIST CHANGE ACTIVITY: NONE ********************************************************************* 2-168 ROM BIOS ********************************************************************* EXTERNAL REFERENCES ********************************************************************* EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN GELRTLREG PULRTLREG DISABLLNMI ENABLE_NMI DDS VIDEO_IO_1 COM_POWER BALSALSETUP TMRO_INT8 SYS_DESCILTABLE COMMO_IO MODEM_POWEILON SEND_COM MODEM_CON FIG :NEAR :NEAR :NEAR :NEAR :NEAR :NEAR :NEAR :NEAR :NEAR :NEAR : NEAR :NEAR :NEAR :NEAR ********************************************************************* PUBLICS ********************************************************************* PUBLIC SYS_SERVICES PUBLI C EXLEVENT SUBTTL 0000 SYSTEM SERVICE ROUTINES SYS_TABLE LABEL 0000 0002 0004 0006 0008 0083 OlBE 0298 02C1 030F R R R R R ; ENTRI ES FOR 40H - 44H OFFSET DW OFFSET DW OFFSET DW DW OFFSET OFFSET DW OOOA OOOC OOOE 0010 0012 0014 0016 0472 0472 0472 032A 007F 0472 0380 R R R R R R R ; ENTRI ES FOR 80H - 86H OFFSET DW OFFSET DW DW OFFSET DW OFFS ET DW OFFSET OW OFFSET DW OFFSET 0018 001A 03DB R 0472 R WORD SYS_PROF ; 40H - READ/MOO SYS PROFILE EXLEVENT ; 41H - WAIT ON EXTERNAL EVENT SYS_POWER_OFF ; 42H - SYSTEM POWER OFF SYS_STATUS ; 43H - READ SYSTEM STATUS SYS-.MODEM_PWR ; 44H - MODEM POWER CONTROL RETURN RETURN RETURN POSLI NTV JOYSTI CK RETURN WAILI NTV ; ENTRI ES FOR 90H - 91H DW OFFSET DELBUSY DW OFFSET INLCOMPLETE 80H 81H 82H 83H 84H 85H 86H DEVICE OPEN DEVICE CLOSE PROGRAM TERMINATION POST ON ELPS TME I NTV JOYSTI CK SUPPORT SYSTEM REQUEST WAIT ON ELPS TME INTV 90H 91H DEVICE BUSY DEV INTERRUPT COMPLETE System Services Interrupt Hex 15 (SYS_SERVICES) ROUTINE-NAME INT 15H, SYSTEM SERVICES FUNCTION: PROVIDES ACCESS TO SYSTEM SERVICES. ENTRY /EXIT CONDITIONS INPUT: OUTPUT: ROM BIOS 2-169 CASSETTE I/O: AH = 0-3 AH = 86H, CARRY SET PORT NOT PRESENT READ/MODI FY SYSTEM PROFILE: AH = 40H AL = 0 READ BX,CX CONTAINS PROFILE INFORMATION PROFILE IS MODIFIED AND EXECUTED AL = 1 MODIFY BX,CX CONTAINS PROFILE AL = 2 READ MODEM CONFIG AL = 3 MODI FY MODEM CON FIG (REFER TO SYS_PROF PROLOG FOR DETAILS) EXTERNAL EVENT: AH = 41H (REFER TO EXLEVENT PROLOG FOR DETAILS) SYSTEM POWER OFF: AH = 42H (REFER TO SYS_POWER_OFF PROLOG FOR DETAILS) SYSTEM STATUS: AH = 43H (REFER TO SYS_STATUS PROLOG FOR DETAILS) MODEM POWER: AH = 44H (REFER TO SYS_MODEM_POWER PROLOG FOR DETAILS) KEYBOARD INTERCEPT: AH = 4FH ENTRY CONDITION: AL = SCAN CODE OF KEY FROM I NT 9 (PORT 60) EXIT CONDITION: CARRY SET IF INT 9 SHOULD PROCESS KEY CARRY CLEAR IF INT 9 SHOULD NOT PROCESS KEY BUT JUST ISSUE EOI AND EXIT LEVEL. (RESERVED FOR OPERATING SYSTEM USE - THIS BIOS WILL RETURN WITH CARRY SET TO ENABLE INT 9 TO HANDLE KEY) DEVICE OPEN: AH BX CX = 80H = DEVICE ID = PROCESS I D IMMEDIATE RETURN DEVICE CLOSE: PROGRAM TERMINATION: POST ON TIME INTERVAL JOYSTICK SUPPORT: SYSTEM REQ. KEY CHANGE: 2-170 ROM BIOS AH = 81H BX = DEVICE ID CX = PROCESS ID IMMEDIATE RETURN = 82H = DEVICE IMMEDIATE RETURN AH BX ID AH = 83H AH = 0 SET INTERVAL ES. BX PTR TO BYTE IN CALLERS STORAGE FOR POST NOTI FI CATON CX,DX NUMBER OF MICROSECONDS TO ELAPSE BEFORE POSTING. AL = I CANCEL THE INTERVAL POST BIT 7 SET IN ES:-BXWH EN I NTERVAL HAS ELAPSED POST IS CANCELLED AH = 84H AH = 86H, CARRY SET PORT NOT PRESENT AH = 85H AL = 00 - MAKE OF KEY AL = 01 - BREAK OF KEY IMMEDIATE RETURN WAIT ON TIME INTERVAL: AH = S6H CX,DX NUMBER OF MSECONDS TO ELAPSE BEFORE RETURN TO CALLER RETURN AFTER TIME ELAPSED XXX DEVICE BUSY: AH = 90H AL = DEVICE TYPE (SEE CODE) 01 - DISKETTE DEVICE INTERRUPT COMPLETE: 02 - KEYBOARD RETURN WHEN KEYBOARD BUFFER TAIL <> CURRENT VALUE 03 - FFH ALL OTHERS IMMEDIATE RETURN AH = 91H IMMEDIATE RETURN AL = DEVICE TYPE OOH -> 7FH SERIALLY REUSABLE DEVICES OPERATING SYSTEM MUST SERIALIZE ACCESS SOH -> BFH REENTRANT DEVICES; ES:BX IS USED TO DISTINGUISH DIFFERENT CALLS (MULTIPLE I/O CALLS ARE ALLOWED SIMUL TANEUSLY) COH -> FFH WAIT ONLY CALLS; THERE IS NO COMPLEMENTARY 'POST' FOR THESE WAITS - - THESE ARE TIMEOUT ONLY. TIMES ARE FUNCTION NUMBER DEPENDENT. DEVICE OOH 01H 02H FDH READ SYSTEM DESCRIPTION TABLE RETURN AFTER IRPT RECEIVED OR 2 SECOND TIMEOUT HAS OCCURRED CARRY SET I F TIMEOUT TYPE = = = = DESCRIPTION TIMEOUT DISK DISKETTE KEYBOARD DISKETTE MOTOR START YES YES NO YES AH = COH AH=O, CARRY CLEAR ES: BX TABLE POINTER TABLE DEFINED AS FOLLOWS: BYTE 1&2: LENGTH OF TABLE IN BYTES STARTING AT BYTE 3 3: SYSTEM MODEL BYTE BYTE 4: SECONDARY MODEL BYTE BYTE BYTE 5: BIOS REVISION NUMBER BYTE 6: FEATURE INFORMATION BYTE 1: MSB: BIT 7 = 1 - BIOS USES DMA CHANNEL 3 o - DMA CHANNEL 3 NOT USED BIT 6 = 1 - 2ND INTERRUPT CONTROLLER INSTALLED o - 2ND INTERRUPT CNTLR NOT INSTALLED BIT 5 = 1 - REAL TIME CLOCK PRESENT o - REAL TIME CLOCK NOT PRESENT BIT 4 = 1 - INT 15H FUNCTION 4FH LINKAGE FROM BIOS INT9 SUPPORTED o - LI NKAGE NOT SUPPORTED Bi t 3 = 1 - INT 15H FUNCTION 41H WAIT ON EXTERNAL EVENT SUPPORTED o - INT 15H FUNCTION 41H NOT SUPPORTED Bit 2-0= RESERVED BYTES 7-10: RESERVED FOR FUTURE FEATURE EXPANSION ROM BIOS 2-171 REGISTERS MODI FI ED : AH AND RETURNED PARAMETER REGISTERS INVALID FUNCTION REQUESTS (INVALID REGISTER AH VALUES) WILL RETURN AND THE CARRY FLAG WILL BE SET. ASSUME 001C 001C OOlD 001F 0023 0024 0025 0026 0029 002B 002E 53 8B DC 36: 8B 5F 06 53 90 5B 80 FC 40 72 4E 80 FC 80 73 OA 0030 0033 0035 0038 80 FC 44 n 44 80 EC 40 EB 17 OS: OATA, ES: NOTH I NG SYS_SERVICES PROC FAR PUSH BX MOV BX,SP MOV BX,SS: [BX+6] PUSH BX POPF POP BX CMP AH,40H JB INLFUN CMP AH ,80H JAE SYS_SV2 CHECK FOR SYSTEM SERVICES CMP JA SUB JMP 80 FC n 2C 80 EC 80 FC 72 05 80 EC EB 05 SYS_SV2 : CMP JA SUB CMP JB SUB JMP 91 7B 15 09 (AH = 40-44H) AH,44H INLFUN AH ,40H SHORT SYS_SVC CHECK FOR SYSTEM SERVICES 003A 003A 0030 003F 0042 0045 0047 004A GET POINTER TO SYSTEM STACK GET FLAGS FROM SYSTEM STACK & SAVE IN STK FOR FLG REG LD RETORE FLAGS RESTORE BX BELOW SYS SVCS 1 (CSST I/O)? INVLD PARM OR UNSUPTD CSST IS SELECT PARM ABOVE 80H? YES, CK SYS SVCS 2 REQUEST IN VALID SYS SVCS UP RANGE? NO, INVALID FUNCTION YES, SET TABLE OFFSET GO LINK TO PROPER ROUTINE •.. (AH = 80-91H) AH,91H CHLDESCR AH,7BH AH,15H SYS_SV3 AH,9 SHORT SYS_SVC IN VlD SYS SVCS 2 UP RANGE? YES, CK READ DESCRIPTOR ... MAKE REL TO 4TH ENTRY IN TBl FUNCTION> = 90H? NO, GO SYS SERV 3 REQUEST •.. YES, CORRECT THE OFFSET GO LINK TO THE ROUTINE ..• CHECK FOR FUNCTIONS 87H-8FH THAT ARE INVALIO 004C 004C 004F SYS_SV3 : CMP JAE 80 FC OC 73 28 AH,12 INLFUN IS PARM = 87H - 8FH CODE? YES, INVALID PARAMETER ... LINK TO PROPER ROUTINE 0051 0051 0052 0053 0054 0057 0059 005B 1E 55 50 BD 8E 2A 86 SYS_SVC: PUSH PUSH PUSH MOV MOV SUB XCHG 0050 005F 0061 0062 0067 0068 0069 01 EO 8B E8 58 2E: FF 96 0000 R 50 1F EB 11 ---DO CO EO SHL MOV POP CALL POP POP JMP OS BP AX BP,DATA OS, BP Al,Al AH,AL AX,l BP ,AX AX SYS_TABLE[BP] BP OS SHORT IMM_RET SAVE DS, BP ,AX USE IN SY SERV SET OS <-- DATA SEGMENT - BP SET AL TO 0 & FUNCT CODE IN LOW BYTE & AH=O RET CODE CLR DOUBLE LINK TABLE OFFSET GET OFFSET IN BP RESTORE AX JUMP TO PROPER ROUTINE RESTORE BP, OS SERVICE EXECUTED LEAVE ... CHECK FOR READ SYSTEM DESCRIPTOR TABLE ADDRESS 006B 006B 006E 0070 0071 0072 0075 oon 80 75 OE 07 BB 2A EB FC CO 09 0000 E E4 03 CHLDESCR: CMP JNE PUSH POP MOV SUB JMP 2-172 ROM BIOS AH,OCOH IS REQ PARM SYS DESC READ? INLFUN NO, INVALID FN PARM REQUEST CS SAVE CURRENT CODE SEGMENT ES ; SET ES TO POINT TO TABLE BX,OFFSET SYS_DESCILTABLE ; POINT TO TABLE AH ,AH CLEAR RETURN CODE SHORT IMM_RET ; EXIT AH = 86H INVALID FUNCTION CODE RETURN POINT 0079 0079 007B 007C 007C 007F 007F 007F 0081 0082 0083 INLFUN: MOV AH,86H STC IMM_RET: RET 2 SYS_SERVICES ENDP B4 86 F9 CA 0002 SET BAD COMMAND RETURN CODE SET CARRY FLAG ON - ERROR RETURN WITH CURRENT FLAGS JOYSTICK PROC MOV AH,86H STC RET JOYSTI CK ENDP B4 86 F9 C3 NEAR SET JOYSTI CK NOT SUPPORTED SET CARRY FLAG - ERROR System Profile Services (SYS_PROF) INT 15H ROUTINE-NAME: SYS_PROF FUNCTION: ROUTINE TO ALLOW READ/MODIFY OPS ON THE SYS PROFILE INFORMATION. SYS PROFILE IS STORED IN CLK CHIP RAM. INPUT: (AH = 40H) AL = 0 READ SYSTEM PROFILE INTO BX AND CX AL = 1 MODIFY SYSTEM PROFILE FROM BX AND CX AL = 2 READ MODEM SWITCH SETTING INTO BX AL = 3 WRITE MODEM SETTINGS FROM BX AND TURN ON MODEM DEFINITION OF BITS IN SYSTEM PROFILE REGISTERS (AL = 0,1) BH: BIT 7 - 0 = SET SYSTEM COLD START MODE *1 = SET SYSTEM WARM START MODE BIT 6 - 0 = DISABLE LOW BATTERY WARNING MESSAGE *1 = ENABLE LOW BATTERY WARNING MESSAGE BITS 5,4 - INITIAL VIDEO MODE 00 = RESERVED 01 = 40 X 25 MONOCHROME USING CGA/LCO *10 = 80 X 25 MONOCHROME USING CGA/LCD 11 = 80 X 25 MONOCHROME USING MONO/LCD BITS 3,2 - *00 = IGNORE LCD HIGH INTENSITY 01 = MAP LCD HIGH INTENSITY TO 10 = MAP LCD HIGH INTENSITY TO 11 = MAP LCD HIGH INTENSITY TO ATTRIBUTE UNDERSCORE REVERSE VIDEO ALTERNATE FONT BIT 1 - *0 = INTERNAL MODEM NOT AVAILABLE ON BATTERY PWR 1 = INTERNAL MODEM AVAILABLE ON BATTERY POWER BIT 0 - *0 = RS232/PARALLEL NOT AVAILABLE ON BATTERY 1 = RS232/PARALLEL AVAILABLE ON BATTERY BL: BITS 7-0 RESERVED CH: BITS 7-0 - KEYBOARD INACTIVITY TIME BEFORE LCD BLANKING. (TIME IN MINUTES, *0 = DISABLE BLANKING). ROM BIOS 2-173 CL: BITS 7-0 - KEYBOARD INACTIVITY TIME BEFORE SYSTEM POWER OFF (TIME IN MINUTES, *0 = DISABLE POWER OFF). DEFINITION OF BITS IN MODEM PROFILE REGISTER (AL = 2,3) BL: BIT 6,7 - NOT USED. BIT 5 - *0 = MANUAL ANSWER. / 1 = AUTO ANSWER. BITS 4-2 - B4 B3 B2 PARITY AND FRAMING - -- -- - - - - - - - -- - 0 0 0 *0 1 1 1 1 BITS 1-0 - B1 0 0 1 1 0 0 1 1 - - - - - - - -- --- -- - -- -- MARK, 7 BITS DATA SPACE, 7 BITS DATA ODD, 7 BITS DATA EVEN, 7 BITS DATA NONE, 8 BITS DATA RESERVED RESERVED RESERVED 0 1 0 1 0 1 0 1 BO MODEM DATA RATE ------- - -- --- - -- - --------- - -- - - - - -110 BITS PER SECOND o o *1 **1 300 BITS PER SECOND 1200 BITS PER SECOND 2400 BITS PER SECOND *DEFAULT SETTINGS AFTER STANDY POWER LOST **NOT PRESENTLY SUPPORTED BH: RESERVED FOR FUTURE USE. OUTPUT: AL = 80H IF MODEM CANNOT BE CONFIGURED OR IS NOT PRESENT. AL = OOH IF MODEM CONFIGURATION IS PERFORMED OK. AL UNDEFINED FOR OTHER FUNCTIONS. REGISTERS MODIFIED: 0083 0083 0085 0087 008A 008e 008E 0090 0092 0094 0096 0097 3C 75 E9 3C 74 3C 74 3C 74 F9 E9 01 03 0125 R 00 57 02 08 03 15 01BD R SYS_PROF CMP JNE JMP SYS1 : JE CMP JE CMP JE STC JMP AX PROC AL,l SYS1 SPROF_MODI FY CMP SPROF_READ AL,2 MPROF_READ AL,3 MPROF...MODI FY SPROF_OUT NEAR IS REQUEST FOR MODIFY? AL,O YES, GO SYS PROF MODI FY •. NO, REQUEST FOR SYS READ? YES, EXECUTE SYS PROF READ .. NO, IS REQ FOR MODEM READ? YES NO, IS REQ FOR MODEM WRITE? YES SET ERROR RETURN CODE EX IT ROUTI NE READ MODEM PROFILE 009A 009C 009F 00A1 00A3 00A6 00A8 B4 E8 8A FE E8 8A E9 10 0000 08 C4 0000 F8 01BB R OOAB OOAD OOAF 00B2 0084 00B6 B4 8A E8 FE 8A E8 10 C3 0000 E C4 C7 0000 MPROF_READ: MOV CALL GELRTCREG MOV BL ,AL INC AH CALL GELRTCREG MOV BH ,AL SPROF_EXIT JMP AH,RTCMOD_PROF1 ; ADDR PROFILE BYTE READ IT ADDRESS NEXT BYTE READ IT RETURN TO CALLER WRITE MODEM PROFILE AND CONFIGURE MODEM (IF POWER ON) MPROF...MODI FY: MOV MOV AL, BL CALL PULRTCREG INC AH MOV AL,BH PULRTCREG CALL 2-174 ROM BIOS AH,RTCMOD_PROF1 ; ADDR PROFILE BYTE WRITE IT ADDRESS NEXT BYTE PROFILE IS NOW STORED CHECK TO SEE I F MODEM IS PRESENT 00B9 OOBC OOBF A1 0010 R F6 C4 20 74 19 MOV TEST JZ AX, EQU I P_FLAG AH,20H MODEM_ERROR GET EQUIPMENT FLAG TEST MODEM INSTALLED BIT EXIT WITH ERROR IF PRESENT, CHECK BATT PWR AND MODEM POWER-ON-BATT ALLOWED BIT 00C1 00C3 00C5 E4 7F A8 40 75 09 IN TEST 00C7 00C9 OOCC OOCE B4 E8 A8 74 MOV CALL TEST 17 0000 E 02 OA JNZ JZ AL,PWR_STAT AL, EXLPWR MPROFl YES, SKIP NEXT TEST AH, RTCSYS_PROF1 GELRTCREG AL,MODEM_BATT MODEM_ERROR FIND PWR_ON_BATT BIT FROM PROFILE IS BATT PWRED MODEM OK? NO, TURN OFF MODEM EXTERNAL POWER? SET UP CONFIG DATA IN AL, AND CALL SET ROUTINE 0000 0002 0005 0007 8A E8 72 E9 C3 0000 03 01BB R MPROFl : CALL JC JMP MOV MODEMJONFIG MODEM_ERROR SPROF_EXIT AL,BL GET CONFIG INPUT DATA AND DO IT ERROR OUT I F PROBLEM INT RETURN ERROR FOUND IN CONFIGURING MODEM, TURN OFF AND EXIT OODA OODA 0000 OOEO 00E2 BB E8 BO E9 0002 0000 80 01BD R MODEM_ERROR: MOV BX, 0002H CALL COM_POWER MOV AL,80H JMP SPROF_OUT MODEM POWER OFF NOW ERROR RETURN READ PROFILE ONLY 00E5 00E7 OOEA OOEC OOEE 00F1 00F3 B4 E8 8A FE E8 8A FE 17 0000 F8 C4 0000 08 C4 SPROF_READ: MOV CALL GELRTCREG MOV BH,AL INC AH CALL GELRTCREG MOV BL,AL INC AH AH,RTCSYS_PROF1 GET HIGH PROF BYTE GET LCD TIMEOUT VALUE 00F5 00F6 00F9 OOFB OOFD 0100 0102 0104 0106 0108 52 E8 8A FE E8 8A B1 8B F6 8A 0000 DO C4 0000 FO 3C C2 F1 E8 PUSH CALL MOV INC CALL MOV MOV MOV DIV MOV OX GELRTCREG DL ,AL AH GELRTCREG DH,AL CL,60 AX,DX CL CH,AL SAVE OX GET DISPLAY TIMEOUT (LO) GET DISPLAY TIMEOUT (HI) DIVIDE TO GET MINUTES SAVE TIMEOUT IN SECS GET SYSTEM OFF TIMEOUT VALUE alOA 010C 010F 0111 0113 0116 0118 0119 011B onc 011E 011F 0121 0122 B4 E8 8A FE E8 8A 51 B1 92 F6 59 8A 5A E9 1B 0000 DO C4 0000 FO 3C F1 C8 01BB R MOV CALL MOV INC CALL MOV PUSH MOV XCHG DIV POP MOV POP JMP AH, RTCSYS_I NACT GELRTCREG DL,AL AH GELRTCREG DH,AL CX CL,60 AX,DX CL CX CL,AL OX SPROF_EXIT GET SYSTEM INACTIVITY VALUE GET DISPLAY TIMEOUT (LO) GET DISPLAY TIMEOUT (HI) SAVE CX REG DIVIDE TO GET MINUTES RESTORE CX SAVE TIMEOUT IN SECS RESTORE OX REGISTER MODIFY PROFILE ROM BIOS 2-175 0125 0126 0129 012B 0120 0130 0132 0134 0137 0138 9C E8 B4 8A E8 FE 8A E8 53 52 0000 17 C7 0000 C4 C3 0000 SPROF_MODI FY: PUSHF CALL DISABLE_NMI MOV AH,RTCSYS_PROFI MOV AL, BH CALL PULRTCREG INC AH MOV AL, BL CALL PULRTCREG PUSH BX PUSH OX DISABLE INTERRUPTS SELECT HIGH PROFILE BYTE ; SAVE REGISTERS CONVERT UNITS FROM MINUTES TO SECONDS FOR LCD INACTIVITY 0139 0139 013B 0130 013F 0141 0143 0145 0148 014A 014C 8A 2A B3 F6 8B B4 E8 FE 8A E8 C5 E4 3C E3 08 19 0000 C4 C7 0000 014F 0151 0153 0155 0157 0159 0158 015E 0160 0162 0165 0168 016B 016C 0160 8A 2A B3 F6 8B 84 E8 FE 8A E8 E8 E8 5A 5B 90 CI E4 3C E3 08 IB 0000 C4 C7 0000 0000 0000 SPROF_MOl: MOV AL,CH SUB AH,AH MOV BL,60 MUL BL MOV BX,AX AH, RTCLCD_I NACT MOV CALL PULRTCREG INC AH MOV AL, BH CALL PULRTCREG GET TIMEOUT IN MINUTES MULTIPLY TO GET SECONDS GET INACT VALUE ADDRESS INCREMENT ADDRESS WRITE HIGH VALUE CONVERT UNITS FROM MINUTES TO SECONDS FOR SYSTEM OFF INACTIVITY MOV SUB MOV MUL MOV MOV CALL INC MOV CALL CALL CALL POP POP POPF AL, CL AH,AH BL,60 BL BX,AX AH, RTCSYS_I NACT PUT_RTCREG AH AL, BH PUT_RTCREG BALSALSETUP ENABLE_NMI OX BX GET TIMEOUT IN MINUTES MUL TIPL Y TO GET SECONDS GET INACT VALUE ADDRESS INCREMENT ADDRESS WRITE HIGH VALUE SETUP FOR BATTERY SAVE RESTORE REGISTERS RESTORE INTERRUPTS SET MODEM AND RS-232 POWER STATE IF ON BAT PWR ACCORDING TO PROFILE I F ON EXTERNAL POWER THEN FORCE MODEM AND RS-232 ON 016E 0170 0172 0174 0177 0178 017A 017C 017F 0181 0184 0184 0186 E4 AS 74 80 52 8B 2A F6 74 80 7F 40 03 CF 03 0189 018B 018E 0190 0193 0193 0195 0197 019A 019C 019E 01AI 2A F6 74 80 FF C6 01 03 CF 01 B3 B4 E8 A8 74 80 E8 04 IF 0000 E 10 03 CB 01 0000 E 03 FF C6 02 03 CF 01 B3 02 E8 0000 IN AL,PWILSTAT TEST AL, EXLPWR JZ EXECPROF OR BH ,03 EXECPROF : PUSH OX MOV OX, BX SUB BH, BH TEST DH,MODEM_BATT JZ SETJoIOD OR BH ,01 SELMOD: MOV BL ,ACTJoIODEM COM_POWER CALL ; GET POWER STATUS ; ON EXTERNAL POWER? NO, GO ACCORDING TO PROF YES, SELECT FORCE TO POWER SAVE REGISTER SAVE & SET UP SYS PROF TEST SET DEFAULT TO POWER OFF PROF MODEM BAT POWER ACTIVE? NO, EXECUTE MODEM POWER OFF YES, ACTIVATE MODEM BAT PWR SELECT MODEM SET CORRESPONDING PWR STATE IN DEVICE SPECIFIED BY BL SUB BH, BH SET DEFAULT TO POWER OFF TEST DH, RS232_BATT PROF RS-232 BATT PWR ACTIVE? JZ SELRSP NO, EXECUTE RS-232 POWER OFF OR BH ,01 YES, ACTIVATE RS-232 BAT PWR SELRSP: MOV BL ,ACLRS232 SET DEFAULT MOV AH,RTCFEALCON SELECT FEATURE CONFIG CALL GELRTCREG GET FEATURE CON FIG TEST AL,PRLINST IS RS-232 PRIMARY COM PORT? JZ SELRS232 NO, ITS NOT PRIMARY OR BL,SELRS23LPRIM ; YES, SELECT RS-232 PRIMARY SELRS232 : CALL COM_POWER ; SET POWER STATE 2-176 ROM BIOS 01M 01A6 8B OA 5A MOV POP BX, OX OX RESTORE SYS PROF SAVE REGISTER SET LCD HIGH INTENSITY SUBSTITUTE 01A7 01A7 0lA8 01AA 01AC 01AE 01B1 01B3 01B5 01B6 01B7 01BA 01BB 01BB OIBO 01BO 01BE 53 8A DO DO 80 B4 BO 9C DE E8 5B OF EB EB E3 03 14 02 0000 E 2A CO C3 SELLCO_OPT: PUSH BX MOV BL, BH SHR BL,l SHR BL,l AND BL,03H MOV AH,20 MOV AL,2 PUSHF PUSH CS CALL VIDEO_IO_I POP BX SPROF_EXIT: SUB AL,AL SPROF_OUT: RET SYS_PROF ENOP SAVE BX REG SAVE ONLY LCD SUBSTITUTE TYP VIDEO FUNCTION CALL 20 SET LCD HIGH INTENSITY SUB I NT 10 CALL RESTORE BX REG SET GOOD RETURN External Event Services (EXT _EVENT) INT 15H ROUTINE-NAME: FUNCTION: EXLEVENT (AH " 41H) TO WAIT FOR A SPECIFIC STATUS CHANGE AFTER AN EXT EVENT (OMA OR INTERRUPT) WHILE KEEPING THE SYS CLKS STOPPED TO CONSERVE BATTERY POWER. ROM BIOS 2-177 INPUT: ES:DI CONTAINS POINTER TO BYTE IN USERS STORAGE FOR EVENT DETERMINATION (FOR AL:01-04) - 0 R OX CONTAINS ADDRESS OF 1/0 PORT ADDRESS TO BE READ FOR EVENT DETERMINATION (FOR AL:11-14) AL - EVENT 00 01 02 03 04 11-14 TYPE CODE - RETURN AFTER ANY EVENT HAS OCCURRED - COMPARE: RETURN I F EQUAL - COMPARE: RETURN I F NOT EQUAL - TEST: RETURN I F NOT ZERO - TEST: RETURN I F ZERO - SAME FUNCTION AS ABOVE EXCEPT OX CONTAINS 1/0 PORT ADDRESS FOR EVENT DETERMINATION BH - CONDITION COMPARE OR MASK VALUE BL - TIMEOUT VALUE (IN 55 MSEC UNITS) BL : 0 - NO TIME LIMIT OUTPUT: CARRY FLAG: SET - TIMEOUT REACHED CLEAR - EVENT OCCURRED REGISTERS MODIFIED: AX RESTRICTIONS: THIS ROUTINE WILL ENABLE PROC IRPTS NO TIMEOUT WILL OCCUR IF TMR 0 IS NOT ENABLED WAITING ON NMI IRPTS I S NOT ALLOWED. -- --------- --- ----------- --- --- --------------- --- -- -- - - - ----- - -- - - - - -- - - - - - - -01BE EXLEVENT PROC NEAR 01BE 01CO 01C3 01C5 01C8 8A 80 74 80 88 EO FB 00 07 CC 20 IE 007B R 01CC 01CC 01CE 0100 0102 24 3C 75 E9 OF 00 03 0259 0105 0105 0107 0109 01DB OlDD 01DF OlEl 01E3 3C 74 3C 74 3C 74 3C 75 01 64 02 44 03 24 04 1C MOV CMP JE OR MOV AH,AL BL,O EXLWTl AH,20H EVENLTIM_OUT ,BL SAVE TYPE CODE NO TIME LIMIT FOR TIMEOUT? NO, GO CHECK FOR WAIT TYPE YES, SET NO TIMEOUT FLAG SAVE TIMEOUT VALUE EXLWTl: AND CMP JNE JMP AL ,OFH AL,O EXLWT2 ANLWAIT SAVE ONLY TYPE WAIT ON ANY EVENT? NO, CHECK FOR SPECIFIC EVENT YES, WA IT ON ANY EVNT TO RET EXLWT2 : CMP JE CMP JE CMP JE CMP JNE AL,Ol CEQ_WAIT AL,02 CNEQ_WAIT AL,03 TNLWAIT AL,04 I NY-EVENT COMPARE, RETURN EQUAL? COMPARE , RETURN NOT EQUAL TEST, RETURN NOT ZERO I F NOT 4 THEN INVALID EVENT TEST, RETURN I F ZERO 01E5 01E5 01E8 01EB OlEO 01FO 01F2 E8 026B R F6 C4 10 75 08 26: 84 3D 74 70 EB 06 90 TLWAIT: CALL TEST JNZ TEST JZ JMP 2-178 ROM BIOS PREP_WAIT AH,10H TLWTl BYTE PTR ES: [01], BH WAIT_DONE TLWT2 PREPARE FOR WAIT TEST FOR 110 PORT READ RETURN I F ZERO 01F5 01F5 01F6 01F8 EC 84 C7 74 68 TLWTl: IN TEST JZ AL,DX AL,BH WAILDONE 01FA 01FA 01FD 01FF E8 0277 72 64 EB E4 TLWT2: CALL JC JMP EVENLWAIT WAIT_EXIT TLWAIT READ FROM I/O PORT INVALID EVENT SO SET CARRY AND EXIT 0201 0201 0202 F9 EB 5F 90 INLEVENT: STC WAIT_EXIT JMP SET CARRY FOR INVAL EVNT TVP TEST, RETURN I F NOT ZERO 0205 0205 0208 020B 020D 0210 0212 0215 0215 0216 0218 EC 84 C7 75 48 TNLWAIT: CALL TEST JNZ TEST JNZ JMP TNLWTl: IN TEST JNZ 021A 021A 0210 021F E8 0277 R 72 44 EB E4 TNLWT2: CALL JC JMP E8 026B R F6 C4 10 75 08 26: 84 3D 75 50 EB 06 90 PREP _WAIT AH,10H TNLWTl BYTE PTR ES: [DI], BH WAIT_DONE TNLWT2 PREPARE FOR WAIT TEST FOR I/O PORT READ AL,DX AL,BH WAIT_DONE READ FROM I/O PORT RETURN I F ZERO EVENLWAIT WAILEXIT TNLWAIT COMPARE, RETURN I F NOT EQUAL 0221 0221 0224 0227 0229 022C 022E E8 026B R F6 C4 10 75 08 26: 38 3D 75 34 EB 06 90 CNEQ_WAIT : CALL TEST JNZ CMP JNE JMP PREP_WAIT AH,10H CNEQ_WTl BYTE PTR ES: [Dll ,BH WAIT_DONE CNEQ_WT2 PREPARE FOR WAIT TEST FOR I/O PORT READ 0231 0231 0232 0234 EC 3A C7 75 2C CNEQ_WTl : IN CMP JNE AL,DX AL, BH WAILDONE READ FROM I/O PORT 0236 0236 0239 023B E8 0277 R 72 28 EB E4 CNEQ_WT2 : CALL JC JMP EVENLWAIT WAILEXIT CNEQ_WAIT RETURN I F ZERO COMPARE, RETURN I F ZERO 023D 023D 0240 0243 0245 0248 024A E8 026B R F6 C4 10 75 08 26: 38 3D 74 18 EB 06 90 CEQ_WAIT : CALL TEST JNZ CMP JE JMP PREP_WAIT AH,10H CEQ_WTl BYTE PTR ES: [DI],BH WAIT_DONE CEQ_WT2 PREPARE FOR WAIT TEST FOR I/O PORT READ 024D 024D 024E 0250 EC 3A C7 74 10 CEQ_WTl : IN CMP JE AL,DX AL,BH WAIT_DONE READ FROM I/O PORT 0252 0252 E8 0277 R CEQ_WT2: CALL EVENLWAIT RETURN I F ZERO ROM BIOS 2-179 0255 0257 72 OC EB E4 JC JMP WAILEXIT CEQ_WAIT WAIT ON ANY EVENT 0259 0259 025C 025F E8 026B R E8 0277 R EB 02 90 ANLWAIT: CALL CALL JMP 0262 0262 F8 WAILDONE: CLC 9C BO 27 E6 72 9D FB C3 WAILEXIT: PUSHF ; SAVE FLAGS AL,DISABLE_SLEEP+CLOCK_RUN+GLOBALNMI ; ON NMIS MOV OUT CLOCICCTL ,AL ; RESTORE FLAGS POPF ; RE-ENABLE INTERRUPTS STI ; EXIT RET 0263 0263 0264 0266 0268 0269 026A PREP_WAIT EVENLWAIT WAIT_EXIT SET UP FOR CLOCK STOP EXECUTE CLOCK STOP CLEAR CARRY FLAG THIS ROUTINE ENABLES THE SLEEP CLOCK BUT SETS THE STATE TO CLOCK RUN THIS MUST BE DONE IN ORDER TO COVER THE TIMING PROBLEM OF THE IRPT OCCURRING AFTER THE CONDITION TEST BUT BEFORE THE CLOCKS ARE STOPPED 026B 026B 026C 026E 0270 0272 0274 0276 0277 PREP _WAIT FA BO E6 EB 24 E6 C3 CLI MOV OUT JMP AND OUT RET PREP _WAIT 07 72 00 FB 72 PROC NEAR ; DISABLE INTERRUPTS AL,CLOCK_RUN+DISABLCSLEEP ; DSABL NMI ST FL SPEED CLOCICCTL,AL ; NO ENABLE SLEEP CLOCK $+2 ; DELAY AL,NOT DISABLE_SLEEP; ENABLE SLEEP CLOCK CLOCICCTL, AL ENDP THIS SUBROUTINE STOPS THE SYSTEM CLOCKS AND RTN AFTER THEY HAVE BEEN RESTARTED. IF AN INTERRUPT HAS OCCURRED BTWN PREP_WAIT & EVENLWAIT THE SLEEP CLOCK WILL HAVE BEEN DISABLED BY HARDWARE & THE EVENLWAIT ROUTINE WILL "FALL THROUGH" WITHOUT STOPPING THE CLOCKS. ONCE THE CLOCKS HAVE RESUMED, THE TIMEOUT VALUE IS CKED (IF USED) & THE CARRY FLAG SET I F TIMEOUT 0277 0277 0279 027B 027D 027E 0280 EVENLWAIT IN AND OR STI OUT JMP E4 24 OC FB E6 EB 72 FC 20 72 00 F6 74 38 77 80 75 C4 20 OF IE 007B R 07 3E 007B R 00 02 PROC NEAR AL, CLOCICCTL AL, NOT CLOCK_RUN AL,GLOBALNMI CLOCICCTL,AL $+2 TURN ON NMIS ENABLE INTERRUPTS STOP CLOCKS DELAY CLOCKS HAVE RESTARTED 0282 0285 0287 028B 028D 0292 0294 0294 0295 0296 0296 0297 0298 0298 F9 C3 F8 C3 TEST JZ CMP JA CMP JNZ TIMEOUT: STC RET AH,20H NO_TIMEOUT EVENLTlM_OUT ,BL TIMEOUT EVENLTlM_OUT ,0 NO_TIMEOUT NO_TIM EOUT: CLC RET EVENLWAIT ENDP EXLEVENT ENDP 2-180 ROM BIOS TIMEOUT TO BE TAKEN JUMP I F NOT CHECK ENOUGH TIME I F ORIGINAL TIME THEN ERROR CHECK FOR TIME ELAPSED TIMEOUT - SET CARRY RETURN NO TIME_OUT SO CLEAR CARRY RETURN System Power Off Services (SYS_POWER_OFF) I NT ISH ROUTINE-NAME: THIS ROUTINE POWERS THE SYSTEM DOWN BY THE REQUEST OF THE APPLICATION PROGRAM. IF WARM START WAS SELECTED THE PGM WILL RESUME IN THIS ROUTINE AND RETURN TO THE CALLER. INPUT: = 00 = 01 AL AL 3C 01 75 05 80 OE 0016 R 40 80 26 003F R CO BA 03F2 BO 04 EE E4 24 OC E6 EB OC E6 B9 E2 7F F7 04 7F 00 02 7F 0102 FE FOR IPL/RESUME DETERMINED BY PROFILE FOR RESUME MODE FORCED THE SYSTEM IS POWERED OFF. IF SYS SUCCESSFULLY SUSPENDED, THIS ROUTINE WILL RETURN CONTROL TO THE USER WHEN THE POWER IS RE-ACTIVATED. REGISTERS MODIFIED: 02AC 02AE 02BO 02B2 02B4 02B6 02B8 02BA 02BD (AH = 42H) FUNCTION: OUTPUT: 0298 0298 029A 029C 02Al 02Al 02A6 02A9 02AB SYS_POWEILOFF AX SYS_POWEILOFF PROC NEAR CMP AL,OI SYS_POFFl JNE BIOS_STATUS, F_RESUME OR SYS_POFFI : MOTOR_STATUS,OCOH AND MOV OX, 03 F2H MOV AL,04H OUT DX,AL IN AND OR OUT JMP OR OUT MOV LOOP AL, PWR_STAT AL,NOT HDWR_RESET AL,EN_SUS_NMI PWR_STAT ,AL $+2 AL, REQ_POFF PWR_STAT ,AL CX ,MS_D ELA Y $ REQUEST FOR RESUME MODE? SET FORCE RESUME FLAG RESET DISKETTE MOTORS TURN OFF MOTORS/SELECT ENSURE SUSPEND NMI ENABLED TURN OFF RESET FLAG DELAY REQUEST SYSTEM POWER OFF DELAY 1 MSEC POWER HAS BEEN RESTORED 02BF 02CO 02Cl F8 C3 CLC RET SYS_POWER_OFF SET GOOD RETURN ENDP ROM BIOS 2-181 System Status Services (SYS-STATUS) INT 15H ROUTINE-NAME: FUNCTION: SYS_STATUS (AH = 43H) THIS ROUTINE RETURNS THE CURRENT SYSTEM STATUS IN THE AL REGISTER AS DEFINED BELOW. INPUT: NONE. OUTPUT: AL CONTAINS SYSTEM STATUS AS FOLLOWS: 17161514131211101 1 1 ----> LCD DETACHED ----> RESERVED 1 ----> RS-232 POWERED ON ----> MODEM POWERED ON ----> POWER ACTIVATED BY RTC ALARM ----> STANDBY POWER LOST (RTC TIME BAD) ----> OPERATING ON EXTERNAL POWER ----> LOW BATTERY 1 REGISTERS MODIFIED: 02Cl 02Cl 02C2 02C4 02C7 02C9 02CB 02CD 02CF 0201 0203 0206 0208 02DA 0200 0200 53 B4 E8 24 8A E4 24 OA B4 E8 AS 74 80 21 0000 10 08 7F CO 08 OE 0000 80 03 CB 20 E4 7C AX SYS_STATUS PROC NEAR PUSH BX MOV AH, RTCSYS_STAT CALL GELRTCREG AND AL, PON_ALRM MOV BL,AL IN AL,PWR_STAT AND AL,LOW_BAT+EXLPWR OR BL,AL MOV AH, RTCDIAG_STAT CALL GELRTCREG TEST AL, RTCTIME_BAD JZ SYS_STATl OR BL,20H SYS_STATl : IN AL,KYBD_CNTL 2-182 ROM BIOS SAVE BX SELECT POWER ON STAT GET POWER ON STAT SAVE ONLY POWER ON ALARM STATUS GET CURRENT POWER STATUS SAVE ONLY POWER STATUS SET COMBINED POWER STATS SELECT RTC TIME GET RTC TIME IS RTC TIME BAD? NO, THEN GO READ SETTINGS YES, SET RTC TIME BAD STANDBY POWER LOST GET COMMO POWER STATUS 02DF 02El 02E3 02E6 02E8 8A B4 E8 A8 74 02EA 02ED 02EF F6 C7 02 74 03 80 CB 08 MOV MOV CALL TEST JZ F8 IF 0000 E 40 08 SAVE THE STATUS SELECT FEATURE CONFIG GET FEATURE CON FIG I NTERNAL MODEM PRESENT? NO, CHECK FOR RS-232 BH,AL AH,RTCFEALCON GELRTCREG AL,INTMOD_INST CHLFOILRS TEST MODEM FOR POWER ACTIVE TEST JZ OR YES, IS MODEM POWER ON? NO, CHECK FOR RS-232 CARD YES, SET MODEM ACTIVE BH ,ACLMODEM CHLFOILRS BL,08 TEST RS-232 FOR POWER ACTI VE 02F2 02F2 02F4 02F6 02F9 02FB A8 74 F6 74 80 CHLFOR_RS: AL, SERPLL_INST TEST JZ CHLFOILLCD TEST BH, ACLRS232 JZ CHLFOILLCD OR BL,04 80 08 C7 04 03 CB 04 IS RS-232 CARD INSTALLED? NO, JUMP TO LCD CHECK YES, IS RS-232 POWER ON? NO, JUMP TO LCD CHECK YES, SET RS POWER ACTIVE TEST I F LCD IS OPERATIVE 02FE 02FE 0300 0303 0305 0307 030A 030A 030C 0300 030E 030F B4 E8 A8 75 80 CHLFOR_LCD: AH, RTCDSP _CON MOV CALL GELRTCREG AL, DSP~LCD+DSP _CLCD TEST SYS_STALEXIT JNZ OR BL,OI SYS_STALEXIT: MOV AL,BL POP BX CLC RET SYS_STATUS ENDP 20 0000 E 03 03 CB 01 8A C3 5B F8 C3 LOOK AT THE DISPLAY CONFIGURATION IS LCD CONFIGURED? YES, THEN LEAVE ROUTINE NO, LCD IS INOPERATIVE RESTORE STATUS BACK TO AL RESTORE BX REG SET NORMAL GOOD RETURN Modem Power Services (SYS_MODEM_PWR) ; -- - - --- --- -- -- -- -- - - ---- - - -- -- -- - - - -- - -- - - - - - -- -- - - - - - - - - - -- - - - - -- --- INT 15H (AH = 44H) SYS_MODE~PWR: INPUT: THIS PROCEDURE TURNS ON OR OFF THE MODEM <> AL = 0, POWER OFF; AL 0, POWER ON. OUTPUT: AL = 0 IF SUCCESSFUL; AL = 80H IF NOT SUCCESSFUL REGISTERS USED: SYS~ODEM_PWR 030F 030F 0311 OA co 74 OE 0313 0313 0315 0318 031B B4 E8 E8 73 0310 031F BO 80 EB 08 OR JZ AX DESTROYED. PROC NEAR AL,AL SYS~OD_OFF ; TEST AL FOR COMMAND ; TURN MODEM OFF SYS~OD_ON: 10 0000 E 0000 E OA AH, RTC~OD_PROFl GELRTCREG MOV CALL CALL JNC MODE~CONFIG SYS~OD_END MOV JMP AL,80H SHORT SYS~OD_EXIT GET THE PROFI LE REG PLACE PROFILE IN AL CONFIGURE AND POWER MODEM ERROR EXIT ROM BIOS 2-183 0321 0321 0324 0327 0327 0329 0329 032A BB 0002 E8 0000 E 2A CO C3 SYS_MOD_OFF: MOV BX ,0002H COM_POWER CALL SYSjlOD_END: SUB AL,AL SYS_MOD_EX IT: RET SYSjlODEM_PWR 2-184 ROM BIOS SELECT MODEM AND TURN OFF RETURN WIO ERROR ENDP POST Interval Services (POST_INTV) I NT 15H ROUTINE-NAME: FUNCTION: INPUT: POSLINTV (AH = 83H) POST USER WHEN ELAPSED TIME INTERVAL HAS EXPIRED WITH NO WAIT. (RETURNS IMMEDIATELY AND POSTS OCCURRENCE VIA RTC INTERRUPTS) AL = 0 SET UP FOR POST ON ELAPSED TIME INTERVAL ES: BX POINTER TO BYTE IN CALLERS STORAGE FOR POST CX,DX NUMBER OF MICROSECONDS TO ELAPSE BEFORE POSTING (CX MOST SIGNIFICANT) AL = 1 CANCEL THE INTERVAL POST OUTPUT: FOR POST SET - RTC PERIODIC INTERRUPT IS ACTIVATED TO KEEP TRACK OF ELAPSED TIME. INTERRUPTS AT APPROXIMATELY A 1 MILLISECOND RATE. WHEN TIME HAS ELAPSED THE USER FLAG POINTED BY ES:BX WILL HAVE BIT 7 SET TO A 1. THE PERIODIC INTERRUPT WILL THEN BE TURNED OFF. FOR CANCEL - RTC PERIODIC INTERRUPT IS TURNED OFF AND THE POST ACTIVE FLAG IS RESET. REGISTERS MODIFIED: 032A 032A 032C 032E B4 OB 3C 00 74 14 0330 0331 0334 0337 0339 033C 0341 9C E8 E8 24 E8 80 EB AX POSLINTV MOV CMP JE PROC NEAR AH, RTCMODE AL,O POSTLI SET REGISTER NUMBER FOR RTC CHECK FOR SET MUST BE CLEAR CANCEL ANY OUTSTANDING INTERVAL 0000 E 0000 E BF 0000 E 26 OOAO R FE 37 90 PUSHF CALL CALL AND CALL AND JMP DISABLE INTERRUPTS AND 8259 INTERRUPTS GELRTCREG GET MODE AL, NOT PIE_ENABLE RESET PERIODIC IRPT ENABLE PULRTCREG ; SET MODE RTCWAILFLAG,NOT INTERVAL_WAIT; RST INTVL ACTIVE POSTL3 ; ENABLE INTERRUPTS AND EXIT oI SA BL E_NM I ; SET INTERVAL UNLESS ALREADY ACTIVE 0344 0344 0349 F6 06 OOAO R 01 74 04 034B 034C F9 EB 31 90 POSTLI : TEST JZ RTCWAILFLAG, INTERVAL_WAIT POSTL2 CHECK WAIT IN PROG WAIT IS ACTIVE SO SIGNAL ERROR STC JMP POSTI_EXIT SET ERROR RETURN ACTIVATE RTC PERIODIC INTERRUPT 034F 034F 0350 0353 0357 035B 035F 9C E8 8C 89 89 89 0000 E 06 009A IE 0098 DE 009E 16 009C R R R R POSTL2: PUSHF CALL MOV MOV MOV MOV DISABLLNMI USER-FLAG....SEG, ES USER_FLAG, BX RTCHIGH,CX RTCLOW,DX DISABLE INTERRUPTS SET UP TRANSFER TABLE ROM BIOS 2-185 0363 0368 036C 036F 0371 0374 0376 0378 037A 037A 0370 037E 037F 037 F 0380 80 OE OOAO R 01 26: 80 27 7F E8 0000 E OC 40 E8 0000 E4 61 24 F7 E6 61 E8 0000 90 F8 OR AND CALL OR CALL IN AND OUT POSTL3: CALL POPF CLC RTCWAILFLAG,INTERVALWAIT ; SET INTVL POST ACT BYTE PTR ES: [BX-,NOT POSTED; RST POST FLAG GELRTCREG GET MODE AL,PILENABLE ENABLE RTC PERIODIC IRPT PULRTCREG SET MODE AL,NMLCNTL ENABLE ALARM INTERRUPT AL,NOT DIS-.ALARM NMLCNTL,AL ENBL RTC ALARM AND SUSP NMIS RESTORE INTERRUPT STATUS SET GOOD RETURN POSTLEXIT: RET POSLINTV ENDP C3 Wait Interval Services (WAIT_INTV) - ; ---------------------------- - ----- - ----- - -- - -- - - - - - - - - - - - -- - - - - - -- -- INT 15H ROUTINE-NAME: WAILINTV WAIT FOR ELAPSED TIME TO EXPIRE BEFORE PASSING CONTROL THE USER. THIS FUNCTION USES THE RTC PERIODI C IRPT AND WAIT ON EXTERNAL EVENT TO CONSERVE BATTERY POWER. INPUT: CX,DX NUMBER OF MICROSECONDS TO ELAPSE BEFORE RETURNING. OUTPUT: RETURN WITH CARRY CLEAR DONE AFTER ELAPSED TIME REACHED. 06 OOAO R 01 04 50 90 0000 E IE 009A R 06 0098 R OE 009E 16 00ge OE OOAO 26 OOAO OB 0000 40 0000 61 F7 61 0000 = 86H) FUNCTION: REGISTERS MODIFIED: 0380 0380 F6 0385 74 0387 F9 0388 EB 038B 038B 9C 038C E8 038F 8C 0393 C7 OOAO R 0399 89 039D 89 03Al 80 03A6 80 03AB B4 03AD E8 03BO OC 03B2 E8 03B5 E4 03B7 24 03B9 E6 03BB E8 03BE 9D (AH R R R 01 R 7F AX WAILINTV TEST JZ STC JMP WAILl: PUSHF CALL MOV MOV MOV MOV OR AND MOV CALL OR CALL IN AND OUT CALL POPF PROC NEAR RTCWAILFLAG, INTERVAL_WAIT; TEST INTERVAL ACTIVE WAILI ; SET ERROR WINTLEXIT ; RETURN DISABLE_NMI USEILFLAG...SEG,DS ; SET UP TRANSFER TABLE US ER_FLAG, 0 FFS ET RTCWA I LFLAG RTCHIGH,CX RTCLOW,DX RTCWAILFLAG, INTERVAL_WAIT; SET FUNCTION ACTIVE RTCWAILFLAG,NOT POSTED; RESET POST FLAG AH, RTCMODE GET MODE REGISTER GELRTCREG AL, PI E_ENABLE ENABLE RTC PERIODIC IRPT SET MODE PULRTCREG ENABLE ALARM INTERRUPT AL,NMLCNTL AL,NOT DIS-.ALARM NMLCNTL,AL ENABLE_NMI RE-ENABLE NMI'S RESTORE FLAGS WAIT ON EXTERNAL EVENT TO CONSERVE BATTERY PWR FOR THE ALLOTTED TIME 2-186 ROM BIOS 03BF 03CO 03C1 06 57 53 PUSH PUSH PUSH ES 01 BX SAVE REGISTERS 03C2 03C3 03C4 03C8 03CA 03CC 03CE IE 07 8B BO B7 2A E8 PUSH POP MOV MOV MOV SUB CALL OS ES 01 ,USER_FLAG AL,03 BH, POSTED BL,BL EXLEVENT SET ES TO DATA SEGMENT 0301 0302 0303 0304 0309 5B 5F 07 80 26 OOAO R 7E F8 03DA 030A 03DB C3 3E 0098 R 03 80 DB 01BE R GET POSTED BYTE ADDR IN ES:DI SET TEST & RTRN I F NOT ZERO SET RTRN FOR INTERVAL POSTED SET NO TIME LIMIT WAIT ON EVENT TIME HAS ELAPSED, RESTORE REGISTERS AND TURN OF PERIODIC INTERRUPT POP POP POP AND CLC BX ; RESTORE REGISTERS 01 ES RTCWAILFLAG, NOT POSTED+ INTERVAL_WAIT WINTLEXIT: RET WAILINTV RST FUNCT ENDP Device Busy Services (DEV_BUSY) INT 15H ROUTINE-NAME: FUNCTION: DELBUSY (AH THIS ROUTINE IS CALLED TO INDICATE THAT A DEV IS BUSY. FOR THE DEVICE TYPE = DISKETTE, A RTRN IS NOT MADE UNTIL A DISKETTE INTERRUPT HAS BEEN RECEIVED OR 2 SECONDS HAVE ELAPSED (WHICHEVER IS FIRST). FOR THE DEV TYPE = KYBRD A RETURN WILL NOT BE MADE UNTIL T*HE KYBD BFR IS IN A NOT EMPTY CONDITION. ENTRY IEXIT CONDITIONS: INPUT: AL = DEVICE TYPE: 01 - DISKETTE RETURN AFTER IRPT RECEIVED OR 2 SECOND TIMEOUT HAS OCCURRED CARRY SET I F TIMEOUT 02 - KEYBOARD RETURN WHEN KEYBOARD BUFFER HEAD <> BUFFER TAIL FD - WAIT FOR MOTOR STARTUP RETURN WHEN TIME HAS EXPIRED IF TIMER 0 IS RUNNING OR IMMEDIATE RETURN WHEN NOT RUNN I NG ON ENTRY CH CONTAINS TIME TO WAIT IN 1/8 SEC UNITS ALL OTHERS REGISTERS MODIFIED: = 90H) IMMEDIATE RETURN WITH CARRY CLEAR AX ROM BIOS 2-187 03DB 03DB 03DC 0300 03DE 03El 03E3 03E5 03E7 03E9 03EB 03ED 57 06 53 BF 8E 3C 74 3C 74 3C 75 DELBUSY PUSH PUSH PUSH MOV MOV CMP JE CMP JE CMP JNE ---C7 01 4B 02 3A FD 33 PROC 01 ES BX DI,DATA ES,DI AL,OI DSKLBUSY AL,02 KYBD_WAIT AL ,OFDH DEVB_CLEAR NEAR SAVE REGISTERS SET ES TO DATA IS DEVICE TYPE = DISKETTE? YES, GO SERVICE FOR DISKETTE NO, DEVICE TYPE = KEYBOARD? YES, GO SERVICE FOR KEYBOARD DEV TYPE = DSKT MTR STARTUP? NO, RETURN WITH CARRY CLEAR WAIT FOR DISKETTE MOTOR STARTUP TIME TO ELAPSE WAIT TIME IS IN 125 MILLISECOND UNITS IN CH 03EF 03F2 03F4 03F5 03F7 03F9 E8 73 51 8A DO 02 0442 R 4A CALL JNC PUSH MOV SHL ADD DO E5 DO TMRO_CHK DEVB_EXIT CX BL ,CH CH,1 BL ,CH CHECK FOR TIMER 0 RUNNING I F NOT RUNN I NG THEN EX IT, NO WAIT COPY TIME IN CH MULTIPLY BY 3 WAIT TIME is IN BL REQUEST CONTROLLER POWER ON TO OVERLAP PWR ON SEQ WITH MOTOR STARTUP DELAY 03FB 03 FF 0400 0401 0404 88 IE 007B R 59 52 BA 03F4 EC MOV POP PUSH MOV IN 0405 90 NOP 0406 0407 040B 0400 0411 0413 0415 0416 0418 0418 041A 041B 041C 5A 38 77 8A OA 75 F9 EB B7 00 OE 07 2B FF POP eMP JA MOV OR JNE STC JMP DEVB_Ol : MOV PUSH POP SUB 041E 0420 BO 01 EB 19 MOV JMP IE 007B R 31 IE 007B R DB 03 26 EV ENT _TIM_OUT, BL CX OX DX,3F4H AL,DX SAVE TIME DLY IN TIMEOUT CTR RESTORE CX SAVE OX DO DUMMY READ TO PWR ON CNTL FOR MOTOR WAIT OVERLAP TIMER 0 ROUTINE WILL DECRMNT TIME VAL EVENLTIM_OUT WHILE CNTLR IS BEING POWERED ON BE BACK FROM NMI IF PWR WAS OFF HERE RESTORE OX OX EVENLTIM_OUT, BL DEVLEXIT BL, EV ENLTI M_OUT BL, BL DEVLOI EXIT I F MORE THAN ENOUGH TME RETRI EVE ADJUSTED WAIT TIME DON'T WAIT IF TIME EXPIRED SET CARRY TO SHOW TIMEOUT EXIT WITH TIME EXPIRED SHORT DEVB_EXIT BH,O CS ES 01,01 SET COMPARE MASK TO 0 SET ES TO ROM SEGMENT SET ADDR 0 IN ROM FOR DUMMY COMPARE RETURN ON COMPARE EQUAL WAIT FOR TIMEOUT TO OCCUR AL,OI SHORT BUSLWAIT RETURN WITH CARRY CLEAR 0422 0422 0423 DEVBJLEAR: CLC JMP SHORT DEVLEXIT F8 EB 19 WAITING FOR KEY IN KEYBOARD BUFFER PERFORM WAILON_EVENT FOR BUFFEILHEAD 0425 0425 0428 042C 042E 0430 BF 8A BO 2A EB 001C R 3E 001A R 02 DB 09 KYBD_WAIT: MOV MOV MOV SUB JMP ; EXIT ROUTINE <> BUFFER TAIL (LOW BYTES) DI,OFFSET BUFFER_TAIL; POINT ES:DI TO BFR HEAD BH,BYTE PTR BUFFER_HEAD; MASK TO CURRENT BFR TAIL AL,02 ; FN CODE=CMP, RTRN NOT EQUAL BL, BL ; NO TIMEOUT SHORT BUSLWAIT WAIT FOR DISKETTE INTERRUPT COMPLETE (INLFLAG TO BE SET IN SEEK-STATUS) 0432 0432 BF 003E R DSKLBUSY: MOV DI,OFFSET SEEK-STATUS 2-188 ROM BIOS GET ADD OF DSKT INTR FLAG 0435 0437 0439 B7 80 BO 03 B3 25 043B 043B E8 01BE R 043E 043E 043F 0440 0441 0442 MOV MOV MOV BH,INLFLAG AL,03 BL,25H INTERRUPT COMPLETE FLAG FN CODE = TEST, RETURN NOT 0 SET TWO SECOND TIMEOUT BUSLWAIT: CALL EXLEVENT DEVB_EXIT: POP BX POP ES POP 01 RET DEY-BUSY ENDP --------------------------------------------------------------------- 5B 07 5F C3 INT 15H ROUTINE-NAME: TMRO_CHK FUNCTION: THIS ROUTINE CHECKS TO SEE I F TIMER 0 IS SET UP AS FOLLOWS IRPT ENABLED TIMER COUNTING INT 8 VECTOR=TMRO_INT8 ADDR INPUT: NONE. OUTPUT: CARRY FLAG REGISTERS MODIFIED: SET - TIMER IS RUNNING CLEAR - TIMER NOT RUNNING NONE. ----------------------------_ .... _------------------------------------0442 0442 0443 0444 0445 0448 044A 0440 044E 0451 0453 0455 0457 0459 045B 0450 045F 0460 0461 0463 0465 0467 0469 046B 0468 046C 046E 046E 046F 046F 0470 0471 0472 50 53 1E 88 8E A1 1F 3D 75 E4 A8 75 E4 8A E4 50 58 E4 8A E4 38 74 0000 08 0020 R 0000 E 1B 21 01 15 40 EO 40 40 EO 40 C3 03 F9 EB 01 F8 58 58 C3 ASSUME DS:ABSO TMRO_CHK PROC NEAR PUSH AX PUSH 8X PUSH OS MOV AX,O MOV DS,AX MOV AX,INT...ADDR POP OS CMP AX,OFFSET TMRO_INT8 JNE TMRO_NORUN IN AL,INTA01 TEST AL,Ol JNE TMRO_NORUN IN AL, TIMERO MOV AH,AL IN AL, TIMERO PUSH AX POP 8X IN AL, TIMERO MOV AH,AL IN AL, TIMERO CMP AX,8X TMRO_NORUN JE TMRO_OK: STC SHORT TMRO_EXT JMP CK FOR TMR 0 I RPT ENABLED EXIT IF DISABLED MAKE SURE TIMER IS RUNNING TMRO_NORUN: CLC TMRO_EXT: POP 8X POP AX RET TMRO_CHK ENDP RESTORE REGS GET INT 8 OFFSET ADDRESS CHECK FOR OUR TIMER ROUTINE IF NOT THEN EXIT SAVE CURRENT TMR 0 TIME CNT RETRI EVE ORIGINAL COUNT RE-READ TIMER LOW RE-READ TIMER HI COMPARE WITH ORIGINAL JUMP I F TIMER NOT RUNNING SET CARRY TO INDICATE OKAY CLEAR CARRY ROM BIOS 2-189 Interrupt Complete Services (INT_COMPLETE) I NT 15H ROUTINE-NAME: INLCOMPLETE 0472 0472 0472 0473 0474 0474 FB C3 (AH = 91H) FUNCTION: DUMMY INTERRUPT RETURN (FUNCTION NOT HANDLED BY BIOS) INPUT: NONE. OUTPUT: NONE. REGISTERS MODI FI ED: NONE. INLCOMPLETE PROC NEAR RETURN: CLC RET INLCOMPLETE ENDP ROMCODE ENDS END 2-190 ROM BIOS SET GOOD RETURN CODE General Subroutines and Tables (B17TABLE) ROMCODE SEGMENT BYTE PUBLIC 0000 ASSUME CS:ROMCOOE, OS:DATA IDENT BIlTABLE,O,O ********************************************************************* MODULE-NAME: BllTABLE DATE LAST MODIFIED: 09/13/1985 DESCRIPTIVE-NAME: MODULE CONTAINING ALL TABLES USED BY POST/ BIOS, GENERAL USE SUBROUTINES AND COMPATABLE LINK ADDRESSES COPYRIGHT: 7396-918 (Cl COPYRIGHT IBM CORP. 1985 REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 CHANGE LEVEL: ECOOO MODULE SIZE: 8K BYTES EXTERNALLY REFERENCED ROUTINES: REFER TO EXTRN LIST SUBROUTINES: DDS ERILBEEP BEEP DSP _BYTE XLALNIB DSP_HEX GELRTCREG PULRTCREG 011 E_MSG ICON_PR STR_CON ENABLE_NMI DISABLE_NMI BALSALSETUP GELVECTOR@ RES_ERR_CHK TABLES: PRLTAB VECTOR_TABLE BAUD_TABLE DSKLBASE VIDEO_PARMS MI-M7 CHAR_GEN_LO CHAR_GEN_HI K6-K30 KBPAD_TBL KBFUN_TBL KBNMLTBL DEF_SYS_PROF - SET DATA SEGMENT TO BIOS DATA AREA BEEP THE SPEAKER FOR POST ERROR CONDITIONS BBEP THE SPEAKER TRANSLATE AND DISPLAY HEX BYTE TO SCREEN TRANSLATE HEX NIBBLE TO ASCII CHARACTER WRITE HEX BYTE TO SCREEN READ REAL TIME CLOCK REGISTER WRITE REAL TIME CLOCK REGISTER DEFAULT INTERRUPT HANDLER POST ERROR MESSAGE HANDLER ICON DISPLAY PROCESSING ROUTINE CONVERT HEX WORD TO ASCI I STRING ENABLE KEYBOARD,RTC, AND SUSPEND NMIS DISABLE KEYBOARD, RTC, AND SUSPEND NMIS ENABLES/DISABLES THE RTC 1 SECOND BAT SAVING INTERRUPT - GET ABSOLUTE VECTOR ADDRESS FOR HARDWARE LEVEL - CHECK AND DISPLAY ANY RESUME ERRORS - PRINTER PORT SEARCH TABLE INTERRUPT VECTOR INITIALIZATION TABLE COMMUNICATION BAUDE RATE SELECT TABLE DISKETTE DRIVE TIMING PARAMETERS VIDEO 10 PARAMETER TABLES VIDEO LINKAGE TABLE LOWER 128 DISPLAY CHARACTER SET UPPER 128 DISPLAY CHARACTER SET KEYBOARD TRANSLATE TABLES PREPROCESSOR KEYPAD XLATE TABLE PREPROCESSOR FUNCTION KEY XLATE TABLE PREPROCESSOR NORMAL KEY XLATE TABLE DEFAULT SYSTEM PROFILE ROM BIOS 2-191 MESSAGES AND ICONS: MEM.-MSG - 'KB OK' MEMORY MESSAGE ROM.-MSG - 'XXXXX ROM' MESSAGE SYS_UNIT SYSTEM UNIT ICON FEALICON FEATURE DEVICE ICON CLOCK SYSTEM CLOCK NOT SET ICON BALI CON - BATTERY LOW ICON PAR_CHK - PARITY CHECK (I/O CHANNEL CHECK) ICON FLICON PRESS Fl TO CONTINUE ICON CHANGE ACTIVITY: , NONE ; ********************************************************************* ; ***************************************************************** .. EXTERNAL REFERENCES ; ***************************************************************** PRIVATE BIOS AND POST ROUTINE NAMES POSTMA! N: NEAR NMLFLIH: NEAR SYS_BOOT: NEAR KYBD_JO: NEAR KYBD_INT9:NEAR DSKLIO: NEAR DSKLINTE:NEAR PRLIO:NEAR VIDEO_IO_l:NEAR SYS_SERV ICES: NEAR TOD_PROC:NEAR TMRO_INT8: NEAR COMMO_JO: NEAR PRLSCRN: NEAR COM_POW ER: NEAR MODEM_CON FIG : NEAR EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN VIDEO I/O SUBROUTI NES EXTERNALS EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN EXTRN SELMODE: NEAR SELCTYPE: NEAR SELCPOS: NEAR READ_CURSOR: NEAR READ_LPEN: NEAR ACLDISP_PAGE:NEAR SCROLL_UP: NEAR SCROLL_DOWN: NEAR READ-ACCURRENT: NEAR WRITE-ACCURRENT:NEAR WRITE_CCURRENT: NEAR SELCOLOR:NEAR WRITE_DOT: NEAR READ_DOT: NEAR WRITE_TTY:NEAR VIDEO_STATE:NEAR ***************************************************************** PUBLICS ***************************************************************** ; PRINTER, VECTOR, COMMUNICATION AND DISKETTE TABLE PUBLICS PUBLIC PRLTAB PUBLIC PRLTAB_END PUBLIC VECTOR_TABLE PUBLIC BAUD_TABLE PUBLIC PARMS_TPI48 PUBLI C PARMS_TP I 135 PUBLIC DSKLBASE ;VIDEO PUBLICS PUBLIC 2-192 ROM BIOS VIDEO_PARMS PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLI C MI MIL M4 M5 M6 M7 CHAR_GEN_LO CHAILGEN_H I MONO_TBL CGA_TBL LCD_CGA_TBL LCD_MONO_TBL KEYBOARD PUBLICS PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLI C PUBLIC PUBLI C PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC K6 K6L K7 K8 Kg KIO Kll KI2 K13 KI4 KI5 K30 KBPAD_TBL KBPADL KBFUN_TBL KBFUNL KBNMLTBL COMPATABILITY ENTRY POINTS PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLI C PUBLIC PUBLIC PUBLIC PUBLIC RESET START RS23LIO DUMMLRETURN NMLINT BOOLSTRAP KEYBOARD_IO KLINT DISKETTE_IO DSKLINT PRINTER_IO VIDEO_IO MEMORLSIZE_DET EQUIPMENT CASSETTLIO PRINLSCREEN TIME_OF_DAY TIMER_I NT P_O_R GENERAL PURPOSE SUBROUTINES PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLI C PUBLIC PUBLI C PUBLIC PUBLI C PUBLIc PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC DDS ERILBEEP BEEP BEEP _SUB DSP_BYTE XLALNIB DSP_HEX GELRTCREG PULRTCREG 011 E_MSG ICON_PR STILCON KB_NOISE DISABLE--.NMI ENABLE_NMI SYS_SETUP ROM BIOS 2-193 PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC SYS_CHK KYBD_RESET BALSALSETUP VECTOILSETUP GELVECTOR@ RES_ERILCHK POST ICONS AND MESSAGES AND TABLES PUBLIC PUBLIC PUBLIC PUBLIC PUBLIC PUBLI C PUBLIC PUBLIC PUBLIC PUBLIC MEM...MSG ROM...MSG DEF_SYS_PROF PAR_CHK RTCSIILSAVE FLI CON SYS_DSKLICON DSKLICON BAD_DSKLICON SYS_DESCR_TA6LE ; ******************************************************* , IBM COPYRIGHT STATEMENT ; ******************************************************* 0000 373339 38 20 43 2E 20 49 31 39 38 36 39 31 4F 50 52 42 4D 20 35 DB '7396918 COPR. IBM 1985' ; COPYRIGHT NOTICE Software Reset Routine ;ORG 005B 005B 005B 0056 005D 005F 0061 0063 0065 0067 0069 BO E6 E4 24 E6 BO E6 EB 00 74 75 BF 75 08 7F FE OE05BH ORG RESET START: MOV OUT IN AND OUT MOV OUT JMP 0005BH LABEL FAR AL,O LCD_I NDX ,AL AL,LCD_DATA AL,NOT PANEL_ENABLE LCD_DATA,AL AL, HDWILRESET PWILSTAT ,AL SET LCD INDEX TURN OFF PANEL POWER $ WAIT FOR RESET CAUSE HARDWARE RESET - --- - ------- -- -- - ------- -- ---- - -- ~ POST ERROR ICONS AND MESSAGES 006B 0066 LABEL BYTE , Kb OK ' MEMORY OK MESSAG 0072 MEMJlSG 20 46 62 20 4F 4B DB 20 30 20 52 4F 4D 04 ROM...MSG DB '0 ROM' ,4 ROM CHECKSUM ERROR MSG 0078 00 00 14 28 3C 0,0,20,40,60 VALUES FOR LMSG ROUTINE . ************************************************** ~POWER ON SELF TEST ICONS ; ************************************************** 007D 007D 0081 0086 008D 0098 01 C9 04 BA C7 DA C7 LABEL BYTE 1,04,11,8 OC9H ,01 ,09 ,OCDH, OBBH 4,2,OBAH, 1,9 ,ODBH, OBAH 04 OB 08 01 09 CD BB 02 BA 01 09 DB C4 (}C C4 BF 20 C4 DC C4 B6 C4 C4 C4 Cl C4 DB OC7H, OC4H, ODCH, OC4H, OBFH, 020H, ODAH, OC4H, O(}CH, OC4H, OB6H DB OClH, OC4H, OC4H, OC4H, OCIH, OC4H, OCIH, OC4H, OC4H, OC4H, 066H 2-194 ROM BIOS 00A3 OOAA OOAF OOAF 00B3 00B6 OOCO OOCD 00D5 00D5 00D9 OODE 00E8 OOED 00F8 OOFD 0107 OlOC OlOC 0110 0116 011C Cl C4 C4 C4 B6 04 02 BA 01 09 FE BA C8 01 09 CD BC DB 4,2, OBAH, 1,9, OFEH, OBAH DB OC8H, 1,9, OCDH, OBCH FEALI CON LABEL BYTE DB 05,OFBH,15,04 DB OB9H,OBBH,03 05 20 C9 DB 020H,OBAH,01,05,020H,OC9H,01,06,OCDH,OBBH BB 05 CD B9 DB 020H,OC8H,01,05,OCDH,OBgH,020H,049H, 02FH ,04FH, 020H, 020H, OBAH 20 49 2F 4F 20 20 BA 01 07 20 C8 01 06 DB 01,07, 020H, OC8H, 01,06, OCDH, OBCH CD BC 05 B9 20 01 20 FB BB BA 06 C8 OF 03 01 CD 01 04 02 C9 BA 20 BA BA 87 BA BA 20 C8 05 01 5C 20 01 39 3F 01 2F 20 01 OA 08 20 2F 08 20 20 08 20 5C 08 07 CD 20 BA 20 01 33 20 20 BA CD 06 C4 20 B3 BALI CON DB 07 C4 CA BF DB 20 2D B3 DB 01 04 20 DB 07 CA 2B 04 CLOCK DB BB OB 31 32 DB LABEL BYTE 02,05,10,07 OC9H, 01,8 ,OCDH ,OBBH OBAH, 05CH, 020H, 020H, 031H, 032H, 020H, 020H, 02FH, OBAH BA 04 02 BA BA 20 36 DB DB OBAH,Ol, 8 ,020H ,OBAH OBAH, 039H, 020H ,01,04,02, 087H, 03 FH, 020H, 033H, OBAH DB DB OBAH, 01,8 ,020H ,OBAH OBAH, 02FH, 020H, 020H, 020H, 036H, 020H, 020H, 05CH, OBAH BC DB OC8H ,01,8, OCDH ,OBCH LABEL BYTE 02,07,06,07 ODAH, OCAH, OC4H, OC4H, OCAH, OBFH OB3H, 02BH, 020H, 020H, 02DH, OB3H 04,04,OB3H,01,04,020H,OB3H 0123 02 DA B3 04 B3 CO 0128 0128 012C 02 OF 33 04 20 20 46 31 20 20 013B 20 46 32 20 20 20 46 33 20 20 20 46 34 20 20 DB 020H, 020H, 46H, 34H, 2QH, 20H, 20H, 46H, 35H, 20H, 20H, 20H, 46H, 36H, 20H 014A 20 46 35 20 20 20 46 36 20 20 20 46 37 20 20 DB 020H, 020H, 46H, 37H, 20H, 20H, 20H, 46H, 38H, 20H, 20H, 20H, 46H, 39H, 20H 0159 20 46 38 20 20 20 46 39 20 20 46 31 30 20 20 DB 020H, 46H, 31H, 30H, 20H, 20H 015F 20 02 87 19 20 20 DB 020H, 2 ,87H, 19H, 20H, 20H, 2, 87H, 19H, ODAH, 5,8,5, OC4H, OC4H, OC4H, OC4H, OC2 DB 1,4,OC4H,OBFH 01 04 C4 D9 DB FLICON DB DB OCOH, 01,04, OC4H, OD9H LABEL BYTE 02,15,51,4 020H, 020H, 46H, 31H, 20H, 20H, 20H, 46H, 32H, 20H, 20H, 20H, 46H, 33H, 20H H 0171 02 87 19 DA 05 08 05 C4 C4 C4 C4 C2 01 04 C4 BF 0175 DA 01 04 C4 B4 05 09 05 20 20 20 20 B3 DB OOAH, 1 ,4,OC4H,OB4H, 5,9, 5,20H, 20H, 20H ,20H ,OB3H 0182 CO 05 09 05 C4 C4 C4 C4 C1 01 04 C4 D9 DB OCOH, 5,9,5, OC4H, OC4H, OC4H, OC4H, OClH, 1,4, OC4H, 009H 018F 018F 0193 0198 019E 02 01 01 01 07 09 08 07 OB 20 20 20 07 FB FB FB FB 03 Fa FB 03 PAR_CHK DB DB DB DB LABEL BYTE 02,07,11,07 1/0 CHANNEL CHECK ICON 01,09, 020H, OFBH, OFBH 01,08, 020H, OFBH, OFBH, 03 01,07, 020H, OFBH, OFBH, 03 ROM BIOS 2-195 01A4 01AA 01B2 01B9 01 FB FB 20 03 20 06 20 FB FB 03 FB 20 20 20 FB 03 FB FB 20 FB FB DB DB 01,06, 020H, OFBH, OFBH ,03 OFBH, OFBH, 020H, 020H, 020H, OFBH, OFBH, 03 DB 020H ,OFBH ,OFBH, 020H,OFBH, OFBH ,03 20 20 FB FB 03 DB 020H ,020H ,020H, OFBH,OFBH,03 ~ SYSTEM UNIT WITH INSERT DISKETTE ICON (USED DURING BOOT) 01BF 01BF 01C3 01C8 OlDl 01D8 01DF 01E5 01EB 01Fl 01F8 01FF 0208 020F 0000 C9 01 04 04 DB 20 C8 D1 20 20 D5 BC 20 B3 DC C3 DC FO 20 C3 C4 C4 Cl 20 04 03 FE B3 20 D4 20 04 OS 12 10 BA BA 01 11 CD BB 20 01 OE SYS_DSKLICON LABEL BYTE DB 0,0,18,17 DB OC9H,01,16,OCDH,OBBH DB 04,04,OBAH,20H,01,14,ODBH,20H,OBAH OS CD B8 DB OC8H,OD1H,01,05,OCDH,OB8H,20H 01 OS CD 01 DB 20H,OD5H,01,05,QCDH,OD1H,OBCH DC C4 DC 01 DC DC 20 Cl DB DB DB DB 20H,OB3H,ODCH,ODCH,OFOH,ODCH ODCH,OC3H,OC4H,OC4H,OB4H,ODCH ODCH,OFOH,ODCH,ODCH,OB3H,20H 20H,OC3H,01,05,OC4H,OCIH,OC4H 01 OS C4 B4 OB OC4H,OC1H,01,05,OC4H,OB4H,20H 20 B3 01 OE 20 01 OE CD BE DB 04,03,20H,OB3H,01,14,OFEH,OB3H,20H OB 20H,OD4H,01,14,OCDH,OBEH,20H 01 12 20 OB 04,05,01,18,020H DC C4 DC OS FO 84 B3 C4 , ; DISKETTE ICON (USED DURING BOOT) 0214 0214 0218 021B 0210 0224 00 OA C4 04 B3 CO 00 OS 04 C4 DC BF 02 B3 20 20 20 01 03 C4 D9 DSKLICON LABEL BYTE OB 0,0,5,4 OB ODAH, OC4H, ODCH DB OC4H,OBFH flB 04H, 02H, OB3H, 20H, 20H ,020H ,OB3H DB OCOH, 01H, 03H,OC4H, OD9H ; BAD DISKETTE ICON 0229 0229 022D 0234 023B 0242 00 DA BF B3 B3 B3 B3 CO 09 00 07 04 BF 20 DA C4 C4 (USED DURING BOOT) BAD_DSKLI CON LABEL BYTE DB 0,0,7,4 DB 218,191,32,218,196,196,191 CO BF CO BF 20 DB 179,192,191,192,191,32,179 20 CO BF CO BF DB 179,32,192,191,192,191,179 C4 C4 0920 CO DB 192,196,196,217,32,192,217 ~ TABLE OF ICON ADDRESSES USED BY LMSG ROUTINE 0249 0249 0251 0000 0005 OlOC 0128 ICON-ADR LABEL WORD 0070 R OOAF R OW OO,OFFSET SYS_UNIT ,OFFSET FEALICON,OFFSET CLOCK R R 018F R OW OFFSET BAT_ICON,OFFSET PAILCHK,OFFSET F_ICON R 2-196 ROM BIOS System Descriptor Table SYSTEM DESCRIPTOR TABLE ACCESSED VIA INT 15H FUNCTION OCOH 0257 0257 0259 025A 025B 025C 025D 025E 025F 0260 SYS_DESCR_TABLE LABEL DW 8 DB OF9H DB 0 DB 0 DB 00111000B DB 0 DB 0 DB 0 DB 0 0008 F9 00 00 38 00 00 00 00 BYTE DESCRIPTOR TABLE LENGTH SYSTEM MODEL BYTE SECONDARY MODEL BYTE BIOS REVISION LEVEL FEATURE INFORMATION BYTE FEATURE INFORMATION BYTE FEATURE INFORMATION BYTE FEATURE INFORMATION BYTE FEATURE INFORMATION BYTE 1 2 3 4 5 Default System Profile DEFAULT SYSTEM PROFILE THIS IS THE SET OF PARAMETERS DEFINING THE DEFAULT SYSTEM PROFILE WHICH IS LOADED AFTER STANDBY POWER LOST CONDITIONS DEF_SYS_PROF LABEL DB OEOH,O 0261 0261 EO 00 0263 0000 0000 DW 0,0 0267 OE 00 DB OEH,O BYTE ; PROFILE BYTE 1 AND 2 ; WARMSTART, LOW BAT WNG ENAB INIT VIDEO MODE = CGA 80X25 LCD HIGH INT = NO OPERATION RS232 AND MOM NOT AV ON BATT KYBD INACT TIMEOUT VALUES LCD BLANK = NO TIMEOUT SYSTEM OFF = NO TIMEOUT DFL T MDM SET 1200BPS, E-PRTY NO AUTO-ANSWER REAL TIME CLOCK VALID SIGNATURE 0269 0269 52 54 43 47 RTCSIG_SAVE LABEL DB "RTCG" BYTE REAL TIME CLOCK SIGNATURE WRTN & CKO BY POST (POIMAIN) Printer Configuration Table (PRT_TAB) ----- --- -- - - - - - - - - -- - - - - - -- - - - - - - - - - - - -- - --; PRINTER PORT SEARCH TABLE USED DURING POST 026D 0260 026F 0271 0273 0275 0078 0378 03BC 0278 PRLTAB 078H OW OW 378H OW 3BCH OW 278H PRLTAB_END LABEL WORD COMPACT PRINTER PORT PRIMARY PRINTER PORT MONO ADAPTER PRINTER PORT ALTERNATE PRINTER PORT LABEL WORD ROM BIOS 2-197 ASCII Conversion (STR_CON) ****************************************************************** ROUTINE-NAME: FUNCTION: STR_CON THIS ROUTINE CONVERTS HEX NUMBERS TO ASCII AND STORES THEM AT ADDRESS ES: DI . ENTRY CONDITIONS: PURPOSE OF ENTRY: INPUT CONDITIONS: RESTRICTIONS: TO POST ERROR MESSAGES IN MEMORY DX = HEX NUMBER TO BE CONVERTED ES: DI = PLACE I N MEMORY TO PUT ASC I I STRNG NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: ERROR EXIT CONDITIONS: REGISTERS MODIFIED: CX,DX,ES,DI INTERNALLY REFERENCED ROUTINES: NONE EXTERNALLY REFERENCED ROUTINES: NONE ****************************************************************** 0275 0275 0276 0278 027C 027D 027E 0280 0283 0286 0288 028B 028E 0291 0292 0293 0296 0299 029B 029C 029D STR_CON 51 B1 OC 26: C6 05 20 47 52 D3 EA 80 E2 OF 80 FA 09 7E 03 80 C2 07 80 C2 30 26: 88 15 47 5A 80 E9 04 80 F9 00 7D E2 59 C3 PROC NEAR PUSH CX MOV CL,12 ; CONVERT 2 BYTES MOV BYTE PTR ES: [DI-, 020H ; INSERT ASCII BLANK INC INC POINTER DI SAVE COUNT SClO: PUSH DX MOVE HIGH NIBBLE TO LOW NIB SHR DX,CL MASK OUT NEW HIGH NIBBLE AND DL,OFH ALPHA OR NUMERIC CMP DL,09 NO ADJUST FOR ALPHA JLE SC24 ADD ADJUST FOR ALPHA DL,07 SC24 : ADD CONVERT TO ASCI I DL ,30H MOV ES:[DI],DL SEND ERROR TO SCREEN POINT TO NEXT MEMOERY LOCAT INC DJ RESTORE AX POP DX SUB 4 FROM SH I FT COUNT SUB CL,4 SEE I F MINUS CMP CL,O JGE SClO LOOP POP CX SCRET: RET RETURN STR_CON ENDP NMI Handler Entry Point Address (NMI_INT) ; ************************************* NMI HANDLER ENTRY POINT ADDRESS ; ************************************* ;ORG 02C3 = 02C3 02C3 E9 0000 OE2C3H ORG NMLJNT JMP 2-198 ROM BIOS 002C3H EQU NMLFLIH Character Generator Graphics 128-255 (CHAR_GEN_HI) ; ****************************************************************** ; ; CHARACTER GENERATOR GRAPHICS FOR 320X200 AND 640X200 GRAPHICS FOR CHARACTERS 80H THROUGH FFH AND FOR DEFAULT LCD CHARACTER GENERATOR ; ****************************************************************** 02C6 02C6 02CE 0206 02DE 02E6 02EE 02F6 02FE 0306 030E 0316 031E 0326 032E 0336 033E 0346 034E 0356 035E 0366 036E 0376 037E 0386 038E 0396 10 OE 6C 3B OE 3E 18 78 36 7B 30 7B 18 7B 00 lC 18 3E 36 3E 30 3E 6C 3C 10 3C 30 3C 36 63 lC 63 07 7F 00 77 3F 6F 18 3C 66 3C 70 3C 18 3B 70 3B 36 6C 63 Ie 36 33 lC 00 00 18 00 3C 00 00 00 18 00 18 00 00 38 3C 00 00 00 18 00 00 00 38 00 18 00 08 00 14 00 OC 00 00 00 3D 00 3C 00 00 00 18 00 3C 00 18 00 00 38 lC 00 41 61 60 60 31 CHAR_GEN_HI LABEL BYTE DB OlDH, 033H, 061H, 060H, 060H, 031H, OOEH, OlCH 66 66 66 66 DB 06CH, OOOH, 066H, 066H, 066H, 066H, 03BH, OOOH 3C 66 7E 60 DB OOEH, 018H, 03CH, 066H, 07EH, 060H, 03 EH, OOOH 3C 66 IE 66 DB 018H, 03CH, 03CH, 066H, OlEH, 066H, 07BH, OOOH 3C 66 IE 66 DB 036H, OOOH, 03CH, 066H, 0IEH, 066H, 07 BH, OOOH 3C 66 1 E 66 DB 030H, 018H, 03CH, 066H, 01 EH, 066H, 07BH, OOOH 3C 66 IE 66 DB 018H, 0 18H, 03CH, 066H, 01 EH, 066H, 07BH, OOOH 3E 66 60 36 DB OOOH, OOOH, 03EH, 066H, 060H, 036H, 0ICH, 038H 3C 66 7 E 60 DB 018H, 03CH, 03CH, 066H, 07 EH, 060H, 03 EH, OOOH 3C 66 7 E 60 DB 036H, OOOH, 03CH, 066H, 07EH, 060H, 03EH, OOOH 3C 66 7E 60 DB 030H, 0l8H, 03CH, 066H, 07 EH, 060H, 03EH, OOOH 38 18 18 18 DB 06CH, OOOH, 038H, 018H, 018H ,018H, 03CH, OOOH 08 38 18 18 DB 010H, 038H, 008H, 038H, 018H, 018H, 03CH, OOOH 08 38 18 18 DB 030H, 018H, 008H, 038H, 018H, 018H, 03CH, OOOH lC 16 36 3F DB 036H, 008H, 0ICH, 016H, 036H, 03FH, 063H, OOOH lC IE 36 3F DB 0ICH, 014H, 0ICH, 0IEH, 036H, 03FH, 063H, OOOH 7 F 31 3C 31 DB 007H, OOCH, 07 FH, 031H, 03CH, 031H, 07FH, OOOH 76 1B 3 F 6C DB OOOH, OOOH, 076H, 0IBH, 03 FH, 06CH, 077H, OOOH 2C 3E 6C 60 DB 03 FH, 03DH, 02CH, 03EH, 06CH, 06DH, 06FH, OOOH 3C 66 66 66 DB 018H, 03CH, 03CH, 066H, 066H, 066H, 03CH, OOOH 3C 66 66 66 DB 066H, OOOH, 03CH, 066H, 066H, 066H, 03CH, OOOH 3C 66 66 66 DB 070H, 018H, 03CH, 066H, 066H, 066H, 03CH, OOOH 42 66 66 66 DB 018H, 03CH, 042H, 066H, 066H, 066H, 03 BH, OOOH 66 66 66 66 DB 070H, 0l8H, 066H, 066H, 066H, 066H, 03BH, OOOH 77 33 lA OC DB 036H, OOOH, 077H, 033H, 0IAH, OOCH, 06CH, 038H 36 63 63 36 DB 063H, 0ICH, 036H, 063H, 063H, 036H, 0ICH, OOOH 63 63 63 63 DB 036H, 041H, 063H, 063H, 063H, 063H, 03EH, OOOH ROM BIOS 2-199 039E 03A6 03AE 03B6 03BE 03C6 03CE 03D6 03DE 03E6 03EE 03F6 03FE 0406 040E 0416 041E 0426 042E 0436 043E 0446 044E 0456 045E 0466 046E 0476 047E 0486 048E 0496 049E 04A6 04AE 04B6 04BE 3E 00 06 04 3C 6E 3C 30 IE 33 33 7C 76 00 66 66 3C 7E 18 00 78 6C 6C 7A 66 03 OE IB IB 3E 58 70 OE 18 3C 66 7B 00 lC 30 18 38 3C 00 OE 18 3C 66 3C 00 OE 18 66 66 3B 00 lA 2C 76 3B 73 00 lA 2C 73 I~ 63 00 1E 36 36 IF 00 00 lC 36 36 lC 00 00 18 00 18 30 3C 00 00 00 00 7 E 00 00 00 00 00 7 E 00 00 60 66 6C 7 E 4C OF 60 66 6C 7B 4F 03 30 00 30 30 30 00 00 IB 36 6C IB 00 006C361B 6C 00 11 44 11 44 11 44 55 AA 55 AA 55 AA EE BB EE BB EE BB 18 18 18 18 18 18 18 18 18 F8 18 18 18 18 F8 F8 18 18 34 34 34 F4 34 34 00. 00 00 F8 34 34 00 00 FO F8 18 18 34 34 F4 F4 34 34 34 34 34 34 34 34 00 00 F8 FC 34 34 34 34 F4 F4 00 00 34 34 34 FC 00 00 18 18 F8 F8 00 00 00 00 00 F8 68 6A DB 006H, 004H, 03CH, 06EH, 068H, 06AH, 03CH, 030H D_9B 39 5B DB 01 EH, 033H, 033H, 07CH, 039H, 05BH, 076H, OOOH D_9C 18 7 E DB 066H, 066H, 03CH, 07EH, 018H, 07 EH, 018H, OOOH D_9D 66 6F DB 078H, 06CH, 06CH, 07 AH, 066H, 06FH, 066H, 003H D_9E 18 18 DB OOEH, 01BH, 018H, 03EH, 018H, 018H, 058H, 070H D_9F IE 66 DB OOEH, 018H, 03CH, 066H, 01EH, 066H, 07BH, OOOH D~O 18 18 DB 0ICH, 030H, 018H, 038H, 018H, 018H, 03CH, OOOH D~l 66 66 DB OOEH, 018H, 03CH, 066H, 066H, 066H, 03CH, OOOH D~2 66 66 DB OOEH, 018H, 066H, 066H, 066H, 066H, 03BH, OOOH D_A3 33 33 DB 0IAH, 02CH, 076H, 03BH, 033H, 033H, 073H, OOOH D~4 6F 67 DB olAH, 02CH, 073H, 07BH, 06FH, 067H, 063H, OOOH D~5 00 3F DB 01 EH, 036H, 036H, 0IFH, OOOH, 03 FH, OOOH, OOOH D~6 00 3E DB 01CH, 036H, 036H, 0ICH, OOOH, 03EH, OOOH, OOOH D~7 64 66 DB 018H, OOOH, 018H, 030H, 064H, 066H, 03CH, OOOH D~8 60 60 DB OOOH, OOOH, OOOH, 07EH, 060H, 060H, OOOH, OOOH D~9 06 06 DB OOOH, OOOH, OOOH, 07 EH, 006H, 006H, OOOH, OOOH D~A 3 B 66 DB 060H, 066H, 06CH, 07EH, 03BH, 066H, 04CH, OOFH D~B 37 6B DB 060H, 066H, 06CH, 07BH, 037H, 06BH, 04FH, 003H D~C 30 30 DB 030H, OOOH, 030H, 030H, 030H, 030H, 030H, OOOH D~D 6C 36 DB OOOH, 01BH, 036H, 06CH, 06CH, 036H, 01 BH, OOOH D~E IB 36 DB OOOH, 06CH, 036H, 0IBH, 01 BH, 036H, 06CH, OOOH D~F 11 44 DB 011H, 044H, 011H, 044H, 011H, 044H, 011H, 044H D_BO 55 AA DB 055H, OAAH, 055H, OAAH, 055H, OAAH, 055H, OAAH D_Bl EE BB DB OEEH, OBBH, OEEH, OBBH, OEEH, OBBH, OEEH, OBBH D_B2 18 18 DB 018H, 018H, 018H, 018H, 018H, 018H, 018H, 018H D_B3 F8 18 DB 018H, 01BH, 018H, OF8H, OF8H, 018H, 018H, 018H D_B4 18 F8 DB 018H, 018H, OF8H, OF8H, 018H, OF8H, 018H, 018H D_B5 F4 34 DB 034H, 034H, 034H, OF4H, OF4H, 034H, 034H, 034H D_B6 FC 34 DB OOOH, OOOH, OOOH, DF8H, OFCH, 034H, 034H, 034H D_B7 18 F8 DB OOOH, OOOH, OFOH, OF8H, 018H, OF8H, 018H, 018H D_B8 04 F4 DB 034H, 034H, OF4H, OF4H, 004H, OF4H, 034H, 034H D_B9 34 34 DB 034H, 034H, 034H, 034H, 034H, 034H, 034H, 034H D_BA 04 F4 DB OOOH, OOOH, OF8H, OFCH, 004H, OF4H, 034H, 034H D_BB 04 FC DB 034H, 034H, OF4H, OF4H, 004H, OFCH, OOOH, OOOH D_BC FC 00 DB 034H, 034H, 034H, OFCH, OFCH, OOOH, OOOH, OOOH D_BD 18 F8 DB 018H ,018H, OF8H, 0 F8H, 018H, OF8H, OOOH, OOOH D_BE F8 18 DB OOOH, OOOH, OOOH, OF8H, OF8H, 018H, 018H, 018H D_BF 2-200 ROM BIOS 04C6 04CE 0406 040E 04E6 04EE 04F6 04FE 0506 050E 0516 051E 0526 052E 0536 053E 0546 054£ 0556 055£ 0566 056£ 0576 057E 0586 058E 0596 059E 05A6 05AE 05B6 05B£ 05C6 05CE 0506 050£ 05E6 18 18 00 18 00 00 18 18 18 00 00 18 18 18 18 34 34 34 00 00 34 34 00 00 34 34 34 00 00 34 34 18 00 34 00 00 18 00 34 34 00 18 00 00 18 00 34 34 34 18 18 18 00 00 18 FF FF 00 FF FO FO OF OF FF 00 00 3B OE 6E 7F 78 00 CC FE 18 18 00 18 00 00 18 18 18 00 00 18 18 18 18 34 34 34 00 00 34 34 00 00 34 34 34 00 00 34 34 18 00 34 00 00 18 00 34 34 00 18 00 00 18 00 34 34 34 18 18 18 00 00 18 FF FF 00 FF FO FO OF OF FF 00 00 00 IB 60 33 00 7E 00 66 18 1 F IF 00 DB 018H, 018H, 018H ,01 FH, 01 FH, OOOH, OOOH, OOOH O_CO 18 FF FF 00 DB 018H, 018H, 018H, OFFH, OFFH, OOOH, OOOH, OOOH O_Cl 00 FF FF 18 DB OOOH, OOOH, OOOH, OFFH, OFFH, 018H, 018H, 018H OJ2 18 IF IF 18 DB 018H, 0ISH, 018H ,01 FH, 01 FH, 0ISH, 018H, 018H 0_C3 00 FF FF 00 DB OOOH, OOOH, OOOH ,OFFH, OFFH, OOOH, OOOH, OOOH 0_C4 18 FF FF 18 DB 018H, 018H, 0 18H, OFFH, OFFH, 018H, 018H, 018H 0_C5 IF IF 18 IF DB 018H, 018H, 0 1FH ,01 FH, 018H, 01 FH, 018H, 018H 0_C6 34 37 37 34 DB 034H, 034H, 034H, 037H, 037H, 034H, 034H, 034H O_Cl 37 37 30 IF DB 034H, 034H, 037H, 037H, 030H, 01 FH, OOOH, OOOH 0_C8 3 F 3 F 30 37 DB OOOH, OOOH, 03 FH, 03FH, 030H, 037H, 034H, 034H 0_C9 F7 F7 00 FF DB 034H, 034H, OF7H, OF7H, OOOH, OFFH, OOOH, OOOH O_CA FF FF 00 F7 DB OOOH, OOOH, OFFH, OFFH, OOOH, OF7H, 034H, 034H O_CB 37 37 30 37 DB 034H, 034H, 037H, 037H, 030H, 037H, 034H, 034H OJC FF FF 00 FF DB OOOH, OOOH, 0 FFH, OFFH, OOOH ,OFFH, OOOH, OOOH O_CO F7 F7 00 F7 DB 034H, 034H, 0 F7H, OF7H, OOOH, OF7H, 034H, 034H O_CE FF FF 00 FF DB 018H, 018H, 0 FFH, OFFH, OOOH, OFFH, OOOH, OOOH O_CF 34 FF FF 00 DB 034H, 034H, 034H, OFFH, OFFH, OOOH, OOOH, OOOH 0_00 FF FF 00 FF DB OOOH, OOOH, OFFH, OFFH, OOOH, OFFH, 018H, 018H 0_01 00 FF FF 34 DB OOOH, OOOH, OOOH, OFFH, OFFH, 034H, 034H, 034H 0_02 34 3 F IF 00 DB 034H, 034H, 034H, 03 FH, 01 FH, OOOH, OOOH, OOOH 0_03 IF IF 18 OF DB 018H, 018H, 01FH, 01 FH, 018H, OOFH, OOOH, OOOH 0_04 1F 1 F 18 1 F DB OOOH, OOOH, 01 FH, 01 FH, 018H, 01FH, 018H, 018H 0_05 00 3 F 3 F 34 DB OOOH, OOOH, OOOH ,03 FH, 03 FH, 034H, 034H, 034H 0_06 34 FF FF 34 DB 034H, 034H, 034H, OFFH, OFFH, 034H, 034H, 034H 0_07 FF FF 18 FF DB 018H, 018H, OFFH, OFFH, 018H, OFFH, 018H, 018H 0_08 18 F8 F8 00 DB 018H, 018H, 018H, OF8H, OF8H, OOOH, OOOH, OOOH 0_09 00 1 F 1 F 18 DB OOOH, OOOH, OOOH, 01 FH, 01 FH, 018H, 018H, 018H O_OA FF FF FF FF DB OFFH, OFFH, OFFH, OFFH, OFFH, OFFH, OFFH, OFFH O_OB 00 00 FF FF DB OOOH, OOOH, OOOH, OOOH, OFFH, OFFH, OFFH, OFFH O_OC FO FO FO FO DB OFOH, OFOH, OFOH, OFOH, OFOH, OFOH, OFOH, OFOH 0_00 OF OF OF OF DB OOFH ,OOFH, OOFH, OOFH, 00 FH, OOFH, OOFH, OOFH O_OE FF FF 00 00 DB OFFH, OFFH, OFFH, OFFH, OOOH, OOOH, OOOH, OOOH O_OF 3D 6E 66 6E DB OOOH, OOOH, 030H, 06EH, 066H, 06EH, 03BH, OOOH O_EO 33 3£ 33 73 DB OOEH, 01 BH, 033H, 03EH, 033H, 073H, 06EH, 060H O_El 31 30 30 30 DB 07FH, 033H, 031H, 030H, 030H, 030H, 078H, OOOH 0_E2 FC A8 28 6C DB OOOH, 07 EH, OFCH, OA8H, 028H, 06CH, OCCH, OOOH 0_E3 30 18 30 66 DB OF£H, 066H, 030H, 018H, 030H, 066H, OFEH, OOOH 0_E4 ROM BIOS 2-201 05EE 05F6 05FE 0606 060E 0616 061E 0626 062E 0636 063E 0646 064E 0656 065E 0666 066E 0676 067E 0686 068E 0696 069E 06A6 06AE 06B6 06BE FE 00 38 00 60 00 OC IC IC IC IC IC 77 IC 3C 00 36 01 3E 00 IE 3C 66 00 00 18 7E 60 7E 06 7E OE 18 18 70 18 18 00 00 IC 00 00 00 00 00 03 18 76 00 3C 00 00 00 00 00 00 00 00 00 60 3F 00 08 00 36 00 36 00 30 00 36 00 03 40 00 00 66 00 7E 00 18 00 38 00 IC 00 IB 18 18 00 18 00 3B 00 36 00 00 00 00 00 02 10 3B 00 66 00 00 00 00 00 3 F 6C 6C 6C DB OOOH, OOOH, 03 FH, 06CH, 06CH, 06CH, 038H, OOOH 0_E5 33 33 33 37 DB OOOH, OOOH, 033H, 033H, 033H, 037H, 060H, 060H 0_E6 7E 50 18 IC DB OOOH, 03 FH, 07EH, 050H, 018H, OICH, OOCH, OOOH 0_E7 3E 6B 3E 08 DB OICH, 008H, 03EH, 06BH, 03EH, 008H, OICH, OOOH 0_E8 63 7 F 63 36 DB OICH, 036H, 063H, 07FH, 063H, 036H, OICH, OOOH 0_E9 63 63 36 55 DB OICH, 036H, 063H, 063H, 036H, 055H, 077H, OOOH O_EA 18 2C 66 66 DB OICH, 030H, 018H, 02CH, 066H ,066H, 03CH, OOOH O_EB 7 F 40 59 7 F DB OOOH, 036H, 07 FH, 040H, 059H, 07 FH, 036H, OOOH D_EC 3E 67 6B 73 DB OOIH, 003H, 03EH, 067H, 06BH, 073H, 03EH, 040H O_ED IE 30 3E 30 DB OOOH, OOOH, 01 EH, 030H, 03 EH, 030H, 01 EH, OOOH D_EE 66 56 66 66 DB 03CH, 056H, 066H, 066H, 066H, 066H, 066H, OOOH D_EF 00 7E 00 7E DB OOOH, 07EH, OOOH, 07EH, OOOH, 07EH, OOOH, OOOH D_FO 7 E 18 18 00 DB 018H, 018H, 07EH, 018H, 018H, OOOH, 07EH, OOOH D_FI OE 38 60 00 DB 060H, 038H, OOEH, 038H, 060H, OOOH, 07EH, OOOH D_F2 70 IC 06 00 DB 006H, OICH, 070H, OICH, 006H, OOOH, 07EH, OOOH D_F3 IA 18 18 18 DB OOEH ,01 BH,O IAH ,018H, 018H, 018H,0 18H, 018H D_F4 18 18 58 08 DB 018H, 018H, 018H, 018H, 058H, OD8H, 070H, OOOH D_F5 00 7E 00 18 DB 018H, 018H, OOOH, 07EH, OOOH, 018H, 018H, OOOH DJ6 6 E 00 3 B 6 E DB OOOH, 03BH, 06EH, OOOH, 03BH, 06EH, OOOH, OOOH 0_F7 36 IC 00 00 DB OICH, 036H ,036H, OICH, OOOH, OOOH, OOOH, OOOH 0_F8 08 IC IC 08 DB OOOH, OOOH, 008H, OICH, OICH, 008H, OOOH, OOOH 0_F9 00 18 18 00 DB OOOH, OOOH ,OOOH, 018H, 018H, OOOH, OOOH, OOOH D_FA 06 24 6C 38 DB 003H, 002H, 006H, 024H, 06CH, 038H, 018H, OlOH D_FB 33 33 33 00 DB 076H, 03BH, 033H, 033H, 033H, OOOH, OOOH, OOOH D_FC OC 38 7E 00 DB 03CH, 066H, OOCH, 038H, 07EH, OOOH, OOOH, OOOH DJD 3C 3C 3C 3C DB OOOH, OOOH, 03CH, 03CH, 03CH, 03CH, OOOH, OOOH D_FE 00 00 00 00 08 OOOH, OOOH, OOOH, OOOH ,OOOH, OOOH, OOOH ,OOOH DJF 2-202 ROM BIOS Convert AX to ASCII (DSP_BYTE) ********************************************************************* ROUTINE-NAME: DSP_BYTE FUNCTION: THIS ROUTINE Will CONVERT THE BYTE IN Al INTO TWO ASCII CHARACTERS IN AX AND DISPLAY THEM AT THE CURRENT CURSOR lOCATION. THE CURSOR Will BE MOVED TWO CHARACTERS TO THE RIGHT. ENTRY CONDITIONS: INPUT CONDITIONS: DSP_BYTE: Al XlALNIB: Al DSP_HEX: Al RESTRICTIONS: BYTE TO BE CONVERTED lOW NI BBlE TO BE CONVERTED BYTE TO BE DISPLAYED NONE EXIT CONDITIONS: DSP_BYTE: BYTE IS CONVERTED AND PRINTED, ASCII IN AX XlALNIB: ASCII RETURNED IN Al DSP_HEX: CHARACTER DISPLAYED AND CURSOR ADVANCED REGISTERS MODIFIED: AX ********************************************************************* 06C6 06C6 06C7 06C8 06CA 06CC 06CF 0602 0604 0605 0607 06DA 06DC 0600 06EO 51 50 B1 02 E8 E8 8A 58 24 04 E8 06EO R 06E7 R E8 OF E8 06EO R 8A E5 59 EB 08 90 DSP _BYTE PUSH PUSH MOV SHR CAll CAll MOV POP AND PROC CX AX Cl,4 Al,Cl XlALNIB DSP_HEX CH,Al AX Al,OFH CAll MOV POP JMP DSP _BYTE XlALNIB AH,CH CX DSP_HEX ENDP NEAR SAVE FOR lOW NIBBLE DISPLAY SHI FT COUNT NYBBlE SWAP CONVERT THE HIGH NI BBlE DISPLAY THE FIRST CHARACTER SAVE UPPER ASCI I CHARACTER RECOVER THE NIBBLE ISOLATE TO lOW NIBBLE DO lOW NIBBLE CONVERSION 2ND ASCII CHARACTER IN Al RESTORE 1ST ASCI I CHAR TO AH DISPLAY SECOND CHARACTER CONVERT BYTE IN lOW NIBBLE IN Al TO ASCII IN Al 06EO 06EO 06E2 06E3 06E5 06E6 06E7 04 90 27 14 40 27 C3 XlALNIB PROC ADD Al,090H DAA ADC Al,040H DAA RET XlALNIB ENDP NEAR ADD ADJ ADD ADJ FIRST CONVERSION FACTOR FOR NUM AND ALPHA RANGE CONV AND ADJ lOW NI BBlE HIGH NIB TO ASCHI RANGE PRINT CHARACTER IN Al USING TELETYPE INTERFACE TO VIDEO 1(0 06E7 06E7 06E8 06E9 06EB 06ED 06EF 06FO 06Fl 06F2 50 53 B4 DE B7 00 CD 10 5B 58 C3 DSP _HEX PUSH PUSH MOV MOV INT POP POP RET DSP_HEX PROC AX BX AH,14 BH,O 10H BX AX NEAR SAVE REGS DISPLAY CHARACTER IN Al CAll VIDEO_IO RESTORE REGS ENDP ROM BIOS 2-203 Boot Strap Loader Entry Address (BOOT_STRAP) ; ************************************ BOOT STRAP LOADER ENTRY ADDRESS ; ************************************* ;ORG 06F2 = 06F2 06 F2 E9 0000 E OE6F2H ORG 006F2H BOOLSTRAP EQU JMP SYS_BOOT Keyboard Noise (KB_NOISE) -- - - - - - - - - - - - - - - - - - - - -- - - - - - -- - - -- - - - - - - - - - - - - - - - -- - - - -- - - - - - - - - -- ;KB_NOISE THIS ROUTINE IS CALLED WHEN GENERAL BEEPS ARE REQUIRED FROM THE SYSTEM. ; INPUT DS= BIOS DATA SEGMENT BX=LENGH OF THE TONE ; CX=CONTAINS THE FREQUENCY ;OUTPUT ALL REGISTERS ARE MAINTAINED. ;HINTS AS CX GETS LARGER THE TONE PRODUCED GETS LOWER IN PITCH. KB_NOISE 06F5 PROC NEAR 06F5 06FA 06FC 0701 0702 0703 F6 06 0016 R 01 75 29 80 OE 0016 R 01 50 53 51 TEST JNZ OR PUSH PUSH PUSH BIOS_STATUS,KB_NOISU\CT ; ROUTINE ALREADY ACTIVE? KBN_EXIT ; I F SO THEN EXIT BIOS_STATUS,KB_NOISU\CT ; SET ROUTINE ACTIVE FLAG AX BX CX 0704 0706 0707 0707 E4 61 50 24 FC PUSH LOOPOI : AND IN AL,NMLCNTL AX 0709 070B 070C E6 61 51 E2 FE OUT PUSH LOOP 070E 0710 0712 0713 0714 OC 02 E6 61 59 51 E2 FE OR OUT POP PUSH LOOP AL,SPKR_DATA NMLCNTL,AL CX CX $ RETRI EVE FREQUENCY ANOTHER HALF CYCLE 0716 0717 0718 59 4B 75 ED POP DEC JNZ CX BX LOOPOI RETRI EVE FREQ. TOTAL TIME COUNT DO ANOTHER CYCLE 071A 58 POP AX RECOVER CONTROL 071B 0710 0722 0723 0724 0725 E6 61 80 26 0016 R FE 59 5B 58 OUT AND POP POP POP KBN_EXIT: 2-204 ROM BIOS ; GET CONTROL INFO ; SAVE AL, NOT SPKR_DATA+ TMR2_GATE ; TURN OFF SPEAKER DATA NMLCNTL ,AL OUTPUT TO CONTROL CX HALF CYCLE TIME FOR TONE $ SPEAKER OFF TURN ON SPEAKER OUTPUT TO CONTROL NMLCNTL,AL ; RESTORE TH E CONTROL REGI STER BIOS_STATUS,NOT KB_NOISE...ACT ; RESET ACTIVE FLAG CX BX AX 0725 0726 C3 RET KLNOISE ENDP Communications Baud Rate Table (BAUD_TABLE) ************************************* COMMUNICATIONS BAUD RATE TABLE ************************************* ORG 0729 0729 0729 072B 072D 072F 0731 0733 0735 0737 0417 0300 0180 OOCO 0060 0030 0018 OOOC OE729H ORG 00729H BAUD_TABLE DW 1047 DW 768 DW 384 DW 192 DW 96 DW 48 DW 24 DW 12 LABEL WORD llO BAUD 150 300 600 1200 2400 4800 9600 TBL OF INIT VAL RS-232 I/O Entry Point (RS232_10) ************************************* RS232 1/0 ENTRY POINT ************************************* ORG 0739 = 0739 0739 E9 0000 E OE739H ORG 00739H RS23LIO EQU JMP COMMO_IO Indicate POST Error (ERR_BEEP) ; ********************************************************************* ROUTINE-NAME: ERR_BEEP FUNCTION: THIS ROUTINE WILL ISSUE LONG (3 SEC) AND/OR SHORT (1 SEC) TONES TO THE SPEAKER TO INDICATE POST STATUS TO THE OPERATOR ENTRY CONDITIONS: PURPOSE OF ENTRY: SEND BEEP TONES TO THE SPEAKER INPUT CONDITIONS: DH = NUMBER OF LONG TONES TO SOUND DL = NUMBER OF SHORT TONES TO SOUND RESTRICTIONS: NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: SPEAKER IS SOUNDED ERROR EXIT CONDITIONS: NONE ROM BIOS 2-205 REGISTERS MODIFIED: ********************************************************************** = 0080 073C .073C 073E AX,BX,CX,DX FRCBEP ERR_BEEP OR DH,DH JZ EB_03 OA F6 74 OD 80H ; FORCED BEEP BIT EQU PROC NEAR ANY LONG TONES? NO THEN DO SHORT ISSUE LONG BEEPS 0740 0740 0742 0745 0747 0749 074B B3 E8 2B E2 FE 75 86 075F R C9 FE CE F3 EB_Ol : MOV CALL SUB EB_02 : DEC JNZ BL, FRCBEP+6 BEEP CX, CX LOOP EB_02 DH EB_Ol SET BEEP CNTR LNG & FRC BEEP CLEAR CX REGI STER DELAY BETWEEN BEEPS DECREMENT LONG BEEP COUNTER I SSUE NEXT LONG BEEP ISSUE SHORT BEEPS 074D 074D 074F 0751 0751 0753 0756 0758 075A 075C 075E 075E 075F OA D2 74 OD B3 E8 2B E2 FE 75 81 075F R C9 FE CA F3 C3 EB_03 : OR JZ EB_04 : MOV CALL SUB EB_05 : DEC JNZ EB_EXIT : RET ERR_BEEP DL ,DL ELEXIT ANY SHORT BEEPS? BL, FRCBEP+l BEEP CX ,CX LOOP EB_05 DL EB_04 SET BEEP CNTR FOR SHORT BEEP CLEAR CX REGISTER DELAY BETWEEN BEEPS NEXT SHRT BEEP IF NOT COMPLT RETURN TO CALLER ENDP Beep to Speaker (BEEP) ; ********************************************************************* ROUTINE-NAME: FUNCTION: BEEP TO BEEP THE SPEAKER ENTRY CONDITIONS: PURPOSE OF ENTRY: TO BEEP THE SPEAKER INPUT CONDITIONS: BL CONTAINS THE COUNT FOR THE LENGTH OF TIME MULTIPLIED BY 500 MSECS FOR THE SPEAKER TO SOUND. IF THE MSB IN BL IS SET THE SPEAKER IS SOUNDED WHETHER OR NOT IT WAS DISABLED. RESTRI CTIONS: NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: ERROR EXIT CONDITIONS: REGISTERS MODIFIED: NONE INTERNALLY REFERENCED ROUTINES: NONE EXTERNALLY REFERENCED ROUTINES: ; ********************************************************************* 075F 075F 0760 0761 0762 0762 50 53 51 BO B6 BEEP PUSH PUSH PUSH BEEP_SUB: BPI: 2-206 ROM BIOS PROC AX BX CX NEAR MOV AL,OB6H SAVE REGISTERS NO STACK ENTRY POINT TIMER 2,MSB,LSB,BINARY 0764 0766 0769 076B 076D E6 BB E6 8A E6 43 0533 42 C4 42 OUT MOV OUT MOV OUT TI MER_CTL ,AL AX,533H TIMER2,AL AL,AH TIMER2,AL 076F E4 8A DC F6 74 61 EO 03 C3 80 02 IN MOV OR TEST JZ AL, NMLCNTL GET SPEAKER ENABLE BIT AH,AL ; SAVE SPEAKER ENABLE SETTING AL,SPKR_DATA+TMRLGATE ; ENABLE SPEAKER BL, FRCBEP ; CHECK FOR FORCED BEEP BIT BP10 ; JUMP I F NOT FORCED BEEP anA onE DC 04 E6 61 BO E3 7F BP5 : BPI0: AND OR AL, EN_SPKR ; SET SPEAKER ENABLE BIT OUT NMLCNTL,AL ; TURN ON SPEAKER ENABLE MASK OUT FORCED BEEP BIT BL, a FFH- FRCBEP 0781 0784 0786 0788 B9 E2 FE 75 MOV BP15: DEC JNZ CX,O LOOP BL BP15 078A 078C 8A C4 E6 61 BP20 : OUT MOV AL,AH NMLCNTL ,AL SET PREVIOUS PORT SETTING SEND TO PPI 078E 0791 0793 0795 B8 8C 3B 74 AX ,OFOOOH BX,SS AX,BX BEEP _EXT CH ECK FOR ROM STACK 0797 0798 0799 079A 079A 079B 59 5B 58 CX BX AX RESTORE REGISTERS Onl on3 On5 On8 onc 0000 FE CB FA FOOD D3 C3 03 C3 MOV MOV CMP JE POP POP POP BEEP _EXT: RET BEEP WRITE TO TIMER CONTROL PORT DIVISOR FOR 1000 HZ TIMER 2 COUNT LSB TIMER 2 COUNT MSB BP15 SET CNT TO WAIT 500 MSECS WAIT 500 MSECS DECREMENT COUNTER LOOP I F COUNT NOT ZERO IF ROM STACK THEN RETURN RETURN ENDP Disable All Interrupts (DISABLE_NMI) DISABLE ALL INTERRUPTS 079B 079B 079C 079D 079F 07 Al 07 A2 07A3 ************************** DISABLE_NMI FA 50 80 07 E6 72 58 C3 NEAR PROC ; DISABLE MASKABLE INTERRUPTS CLI PUSH AX AL,DISABLE_SLEEP+CLOCLRUN ; DISABLE NMIS MOV OUT CLOCLCTL,AL ; WRITE TO PORT POP AX RET DISABLE_NMI ENDP Enable Global NMIs (ENABLE_NMI) ************************************************************* ENABLE GLOBAL NMI' S 07A3 07A3 ************************************************************* 50 ENABLE_NMI PUSH AX PROC NEAR ROM BIOS 2-207 07A4 07A6 07A8 07A9 07AA BO 27 E6 72 58 C3 MOV AL,DISABLE_SLEEP+CLOCK-RUN+GLOBAL_NMI OUT CLOCK-CTL ,AL ; WRITE TO PORT POP AX RET ENABLE_NMI ENDP ENABLE NMIS Get RTC Register (GET_RTC_REG) ; ********************************************************************* ROUTINE-NAME: GELRTCREG FUNCTION: THIS ROUTINE WILL GET THE DESIGNATED RTC REGISTER LOCATION INTO THE AL REGISTER. ALL INTERRUPTS WILL BE DISABLED DURING THIS PROCESS AND RESTORED WHEN COMPLETE. ENTRY CONDITIONS: INPUT CONDITIONS: AH = REAL TIME CLOCK REGISTER NUMBER RESTRICTIONS: NONE AL EXIT CONDITIONS: REGISTERS MODIFIED: = CONTENTS OF SPECIFIED REGISTER AL . ********************************************************************* 07AA 07AA 07AB 07AC 07AD 07AF 07Bl 0783 0785 0787 0789 0788 0780 078F 07Cl 07C3 07C5 07C6 07C7 07C8 9C FA 53 E4 8A 24 E6 SA E6 EB E4 8A 8A E6 SA 5B 90 C3 GELRTCREG PUSHF PROC NEAR CLI 72 08 OF 72 C4 70 00 71 F8 C3 72 C7 PUSH IN MOV AND OUT MOV OUT JMP DISABLE INTERRUPTS BX AL, CLOCKJTL BL,AL AL,NOT GLOBAL_NMI CLOCKJTL, AL AL,AH RTCRjORT ,AL $+2 AL, RTCD_PORT BH,AL AL, BL CLOCK-CTL ,AL AL, BH BX IN MOV MOV OUT MOV POP POPF RET GELRTCREG BL (-- NMI CONTROL STATE DISABLE NMI WRITE RAM ADDRESS READ DATA BH <-- DATA RESTORE NMI STATE RESTORE DATA RESTORE INTERRUPT STATE ENDP Put RTC Register (PUT _RTC_REG) ; ********************************************************************* ROUTINE-NAME: PULRTCREG FUNCTION: THIS RTNE WILL WRITE THE DESIGNATED RTC REGISTER LOCATION WITH THE CONTENTS OF THE AL REGISTER. ALL INTERRUPTS WILL BE DISABLE DURING THIS PROCESS AND RESTORED WHEN COMPLETE. ENTRY CONDITIONS: INPUT CONDITIONS: AH = REAL TIME CLOCK REGISTER NUMBER AL = DATA TO BE STORED INTO REGISTER RESTRICTIONS: NONE 2-208 ROM BIOS EXIT CONDITIONS: DATA IN REGISTER MODIFIED REGISTERS MODIFIED: 07C8 07C8 07C9 07CA OlCB 07CD 07CF 0701 07D3 07D5 07D7 0709 07DB 07DD 07DF 07El 07E3 07E4 07E5 07E6 NONE ********************************************************************* 9C FA 53 8A E4 8A 24 E6 8A E6 8A E6 8A E6 8A 5B 90 C3 08 72 F8 OF 72 C4 70 C3 71 C7 72 C3 PULRTCREG PROC NEAR PUSHF CLI PUSH BX MOV BL,AL IN AL, CLOCK-CTL MOV BH,AL AND AL,NOT GLOBAL_NMI OUT CLOCK-CTL, AL MOV AL,AH RTCR_PORT ,AL OUT MOV AL,BL RTCD_PORT ,AL OUT MOV AL,BH OUT CLOCK_CTL, AL AL,BL MOV POP BX POPF RET PULRTCREG ENDP 01 SABL E INTERRUPTS BL <-- DATA BH <-- NMI CONTROL SAVE DISABLE NMI GET ADDRESS WRITE RAM ADDRESS GET DATA WRITE DATA RESTORE NMI STATE RESTORE DATA RESTORE INTERRUPT STATE Setup for Battery Savings (BAT_SAV -SETUP) ****************************************************************** BALSALSETUP THIS ROUTINE ENABLES THE RTC 1 SEC UPDATE ENDED INTERRUPT AS A TIME BASE FOR THE LCD BLANK AND THE SYSTEM POWER OFF OPTIONS IF THE SYSTEM PROFILE INDICATES THAT ONE OR BOTH OF THESE OPTIONS ARE ENABLED. I F NOT OR WE ARE ON EXTERNAL PWR THEN THE INTERRUPT IS DISABLED. RESTRICTIONS: RTC, AND SYSTEM SUSPEND NMIS MUST BE DISABLED BEFORE CALL TO THIS ROUTINE REGISTERS MODIFIED: AX,BX,CX 07E6 07E6 07E8 07EB B4 OB E8 07AA R 8B 08 07ED D7FO 07F3 80 CB 10 B9 0004 B4 19 D7F5 07F8 07FA 07FC 07FE E8 3C 75 FE E2 07AA R 00 10 C4 F5 0800 0802 0805 0807 B4 E8 A8 75 17 07AA R 40 03 BALSALSETUP PROC MOV AH, RTCMODE CALL GELRTCREG MOV BX,AX OR MOV MOV BALSOI : CMP JNE INC LOOP MOV CALL TEST JNZ NEAR GET CURRENT MODE SAVE ADDRESS AND MODE BL,UIE_ENABLE CX,4 AH, RTCLCD_I NACT CALL AL,O BALS02 AH BALSOI DEFAULT TO SET ENABLE ON CHECK THE FOUR TIME VALUES SPECIFY BEG @ OF PROFILE GELRTCREG CHECK TIME FOR 0 I F NOT 0, OPTION ACTIVATED LOOP TO CHECK NEXT BYTE AH,RTCSYS_PROFl GELRTCREG AL,LOWBALENABLE BALS02 GET LOW BAT WARNING STATE JUMP IF WARNING ENABLED DISABLE UPDATE ENDED INTERRUPT (BATTERY SAVINGS MODE IS DISABLED) 0809 80 E3 EF AND BL, NOT UI E_ENABL E ; TURN OFF INTERRUPT ROM BIOS 2-209 UPDATE MODE REGISTER IN RTC 080C 080E 0811 0813 0815 0817 0818 88 E8 E4 24 E6 IE E8 C3 07C8 61 F7 61 081B 0820 0821 0822 80 OE 0016 R 20 IF C3 085C BALS02 : MOV AX, BX CALL PULRTC_REG IN AL,NMLCNTL AND AL,NOT DIS~LARM OUT NMLCNTL ,AL PUSH OS CALL DDS ASSUME DS:DATA BIOS_STATUS, KYBD~CTIVE OR POP DS RET BALSALSETUP ENDP RESTORE MODE AD DR AND DATA ENABLE RTC INTERRUPT SET OS TO DATA SEGMENT ; FORCE RELOAD OF COUNTERS Keyboard I/O Entry Point (KEYBOARD_IO) KEYBOARD 1(0 ENTRY POINT ; ************************************* ;ORG 082E = 082E 082E E9 0000 OE82 EH ORG 0082EH KEYBOARD_IO EQU JMP KYBD_IO Keyboard Reset (KYBD_RESET) SUBTTL KYBD_RESET ; ********************************************************************* ROUTINE-NAME: KYBD_RESET FUNCTION: THIS ROUTINE INITIALIZES THE KEYBOARD CONTROL AREA TO A NO KEY CONDITION. ENTRY CONDITIONS: PURPOSE OF ENTRY: PERFORM KEYBOARD DATA AREA INITIALIZATION INPUT CONDITIONS: DS:DATA, NMI MUST BE DISABLED RESTRI CTI ONS: KEYBOARD NMI' S MUST BE DISABLED EXIT CONDITIONS: NORMAL EXIT CONDITIONS: KEYBOARD DATA AREA INITIALIZED ERROR EXIT CONDITIONS: REGISTERS MODIFIED: NONE ES,SI ,DI ,AX,CX ;********************************************************************* KYBD_RESET 0831 0831 0832 IE 07 2B CO BF 0017 R B9 0027 NEAR ASSUME ES:DATA,DS:DATA PUSH POP DS ES CLEAR INTERRUPT 0833 0835 0838 PROC SUB MOV MOV 2-210 ROM BIOS AND INTERRUPT 16 BUFFER AND CONTROL FLAGS AX,AX DI,OFFSET KB_AREAl CX, KB~REALLNG CLEAR KEYBOARD AREA 1 083B 0830 0840 F3/ AA A2 0096 R 89 3E 0082 R REP MOV MOV , STOSB KLFLAG_3 ,AL BUFFEILEND,DI ; CLEAR ADDITIONAL FLAGS ; SET UP BUFFER_END ADDR ; SETUP UP DEFAULT KEYBOARD BUFFER POINTERS ; 0844 0847 084B 084F BE 89 89 89 OOlE R 36 OOlA R 36 OOlC R 36 0080 R SI,OFFSET KB_BUFFER ; SETUP KEYBOARD PARAMETERS BU FFER_H EAD, SI BUFFER_TAIL,SI BUFFER_START ,SI MOV MOV MOV MOV INITIALIZE KEYBOARD NMI CONTROL AREA AND BUFFER (KB-AREA2) 0853 0856 0859 085B 085C BF 00B4 R B9 0019 F3/ AA C3 MOV MOV REP RET KYBD_RESET DI,OFFSET KB-AREA2 CX, KB-AREALLNG STOSB ENDP Set Data Segment (DDS) ;********************************************************************* ROUTINE-NAME: DDS FUNCTION: SET DATA SEGMENT (OS) TO BIOS DATA AREA ENTRY CONDITIONS: INPUT CONDITIONS: NONE RESTRI CTIONS: NONE EXIT CONDITIONS: OS = SET TO BIOS DATA SEGMENT REGISTERS MODI FlED: OS 085C 085C 0850 0860 0862 0863 0864 ;********************************************************************* 50 B8 8E 08 58 C3 R DDS PUSH MOV MOV POP RET DDS PROC AX AX,DATA DS,AX AX NEAR SAVE AX SET SEGMENT RESTORE AX ENDP Calculate Absolute Vector Offset (GET_VECTOR@) ************************************************** ROUTINE: GELVECTOR@ FUNCTION: CALCULATE ABSOLUTE VECTOR OFFSET OF HARDWARE INTERRUPT LEVELS. INPUT: OUTPUT: CL = HARDWARE INTERRUPT LEVEL # 0-7 SI = ABSOLUTE OFFSET ADDRESS OF VECTOR REGISTERS MODIFIED: 0864 0864 0865 0867 0869 086B 0860 SI *************************************************** 50 2A E4 24 E6 E4 E4 72 BF 72 63 GELVECTOR@ PROC PUSH AX SUB AH,AH IN AL,CLOCLCTL AND AL,OBFH OUT CLOCLCTL,AL IN AL,63H NEAR SET READ INTERRUPT REG 0 READ CURRENT I RPT TYPE BITS ROM BIOS 2-211 086F 0871 0873 0875 0877 0879 087A 087B 24 02 01 01 8B 58 C3 AL ,OF8H AND ADD AL,CL SHL AX,l SHL AX,l MOV SI,AX POP AX RET GELVECTOR@ ENDP F8 Cl EO EO FO CLEAR UNUSED BITS ADD OFFSET TO LEVEL '# MUL TI PL Y BY 4 MOVE INTO OUTPUT REGISTER Keyboard Support Tables ; ***************************************************** KEYBOARD SUPPORT TABLES NOTE: A -1 ENTRY INDICATES THE CORRESPONDING KEY IS EXCLUDED FROM THE TABLE ; *************************************************71:*** ;ORG 087E OE87 EH ORG 0087EH ---- - ------ ----- ------------ ------ ------------- --------- - -- - - - - - -- ; ----- SHI FT & STATE KEY PCl SCAN CODES 087E 087E 52 3A 45 46 0882 38 10 2A 36 = 0008 K6 LABEL DB DB K6LEQU BYTE I NSJEY , CAPS_KEY, NUM_KEY ,SCROLL_KEY AL LKEY, CTL_KEY, LEFLKEY ,RIGHLKEY $-K6 --------- ----- -------------------------------------- - -- - - - - - - - - - -- ; ----- SHI FT & STATE KEY "MASKS" 0886 0886 088A 80 40 20 10 08 04 02 01 K7 LABEL DB DB BYTE INS_SHIFT,CAPS_SHIFT,NUM_SHIFT,SCROLl_SHIFT ; KB ALLSHIFT,CTL_SHIFT,LEFLSHIFT,RIGHLSHIFT ; KB ---------------------- ------ ----------- ------ ------ ------ - -- - - - - -- ; ----- CTL + TYPEWRITER KEYS 088E 0896 089E 08A6 08AD 08B6 08BE 08C6 IB IE FF FF 17 09 10 13 04 OC FF 16 OE FF 20 - ASCI I CODES ----------- ----------- ------- ----- -------- ----------- ----- ------ -- FF 00 FF FF FF K8 FF FF FF IF FF 7F DB DB ESC,-1 ,NUL ,-1 ,-1 ,-1 ,RS,-1 -1,-I,-I,US,-I,DEL,-l,DCl ; 890 ESC 1 2 3 4 5 6 7 BKSPC TAB Q 11 05 12 14 19 15 OF IBID OA FF 01 06 FF FF 02 00 FF FF DB ETB,ENQ,DC2,DC4,EM,NAK,HT,SIOI5 ; W E R T Y U I 0 DB DLE,ESC,GS,LF,-I,SOH,DC3 ; P [ 07 08 OA OB FF lC lA 18 03 DB EOT,ACK006,BEL,BKSPC,LF,VT,FF,-I,-1 ; 0 F G H J K L DB -1,-I,FS,SUB,CAN,ETX,SYN,STX ; FF FF FF FF DB SO,ENTER,-I,-I,-l,-I,-I,-1 ; B N M DB SPACE,-1 J n ENTER CTL A S LSHFT \ Z xCV B / RSHFT ALT ; SPACE CAPS lOCK ---------------------- ------- ------- ------------- - -- - - - - - - - - - - - - -- :----- CTL + (F KEYS) & (CURSOR KEYS) - EXTENDED ASCII CODES K9 LABEL 08C8 BYTE CTL + (Fl - FlO) 08C8 08CD 5E 5F 60 61 62 63 64 65 66 67 DB DB 94,95,96,97,98 99,100,101,102,103 0802 0807 08DB FF FF 77 FF 84 FF 73 FF 74 FF 75 FF 76 FF FF DB DB DB ; CTl + CURSOR KEYS -1, -1, CTL_HOME, -1, CTL_PGUP -1, CTL_CUR_L FT , -1, CTL_CUR_RHT -1, CTL_END, -1, CTL_PGDN, -1,-1 ; -- -- ----- -- ---- -- -- ------ -- --- --- -- --- -- ------ ------------ -------- ; ----- LOWER CASE TYPEWRITER KEYS - ASCII CODES ; --- -- --- -- -- - 08El 08El --- ------- - -- ----- ----- --------- -- -- ---------- --- ---- KI0LABEL BYTE IB 31 32 33 34 35 DB ESC,' 1234567890-=', BKSPC, TAB 36 37 38 39 30 20 2-212 ROM BIOS 08FO 0909 091B 091B OnA 0944 0952 3D 71 75 00 67 27 60 76 2F 08 77 69 FF 68 09 65 6F 61 6A 72 70 73 6B 74 5B 64 6C 79 50 66 3B 'qwertyui op [] , , ENTER, -I, 'asdfghj kl; ',APOSTR DB IQI ,-1, '\zxcvbnm,.J I ,-1, 1*1 ,-l,SPACE,-l FF 5C 7A 78 63 OB 62 6E 60 2C 2E FF 2A FF 20 FF -----------------------------------------------------------------;----- UPPER CASE TYPEWRITER KEYS - ASCI I CODES 1B 21 40 23 24 25 5E 26 2A 28 29 5F 2B 08 00 515745525459 55 49 4F 50 7B 70 00 FF 41 53 44 46 47 48 4A 4B 4C 3A 22 7E FF 7C 5A 58 43 56 42 4E 40 3C 3E 3F FF 00 FF 20 FF KlILABEL BYTE DB ESC,' !@#$%--,&*()_+',BKSPC,PSEUDO ; PSEUDO SHFLTAB DB 'QWERTYUIOP{}',ENTER,-I,'ASDFGHJKL:"-' DB -I,' IZXCVBNM<>?' ,-I,PSEUDO DB -I,SPACE,-I PSEUDO FOR PRTSC ~ == == =- SH j FT -:-(Fi -=- Fia) --=--EXTENDEii-ASC j j- CODES ----------------0955 0955 095A KI2LABEL BYTE 54 55 56 57 58 DB 84,85,86,87,88 59, 5A 5B 5C 50 DB 89,90,91,92,93 -----------------------------------------------------------------;----- ALT + (F1 - flO) - EXTENDED ASCII CODES 095F 095F 0964 KI3LABEL BYTE 68 69 6A 6B 6C DB 104,105,106,107, lOB 60 6E 6F 70 71 DB 109,110, 111,112,113 ----------------- .. -----------------------------------------------;----- KEYPAD KEYS - ASCI I CODES ; .... -- -- --_ ........ -- --- -- ---_ .... - ---- -- -- -- -- -_ .. -_ .. -_ ........ -- -_ .. -_ ........ - ... - .. KI4LABEL BYTE ; IN KEYPAD_STATE 37 38 39 20 34 35 DB '789-456+1230.' 36 2B 31 32 33 30 2E 0969 0969 , ------------------------------------------------------------------ ;----- BASE CASE KEYPAD KEYS - EXTENDED ASCII CODES ; -- --- .. -- .......... -- .. -- .. -- .. - -- --_ ...... -........ ............ KI5LABEL BYTE 47 48 49 FF DB HOME_KEY, CUILUP, PGUP,-I 4B FF 40 FF DB CUILLFT,-I,CUR_RHT,-I 4F 50 51 DB END_KEY,CUR_DN,PGDN 52 53 DB INS_KEY, DEL_KEY -_ 0976 0976 097A 097E 0981 -_ -- -_ -_ -_ ............ ---_ ... KEYBOARD INTERRUPT 9 ENTRY POINT ORG 0987 = 0987 0987 E9 0000 OE987H ORG KB_INT JMP 00987H EQU KYBD_INT9 ROM BIOS 2-213 System Setup (SYS_SETUP) SUBTTL SYS_SETUP ********************************************************************* ROUTINE-NAME: SYS_SETUP FUNCTION: THIS ROUTINE INITIALIZES INTRPT VECTORS AND SETS UP DATA AREAS FOR DEVICES PRIOR TO BOOTING FROM DISKETTE. ENTRY CONDITIONS: PURPOSE OF ENTRY: PERFORM SYSTEM SETUP PRIOR TO BOOT INPUT CONDITIONS: NONE RESTRICTIONS: NONE EX IT CONDIT IONS: NORMAL EXIT CONDITIONS: RETURN ERROR EXIT CONDITIONS: REGISTERS MODIFIED: NONE AX,BX,CX,DX ********************************************************************* ASSUME 098A DS:DATA,ES:ABSO PROC NEAR CLEAR THE RESET FLAG I F NOT LOOP MODE 098A 0990 0992 81 3E 0072 R ABCD 74 06 C7 06 0072 R 0000 CMP JE MOV RESELFLAG, LOOP_MODE SYS_SETO RESELFLAG,O SET UP THE INTERRUPT VECTORS TO TEMP INTERRUPT 0998 0998 E8 OAOC 099B 0990 099F 09A6 09AB 09B2 2B CO 8E CO 26 C7 26 8C 26 C7 26 8C SYS_SETO: CALL VECTOR_SETUP SETUP INTERRUPT VECTORS COMPLETE THE VECTOR SETUP 06 OE 06 OE 01BO 01B2 0128 012A R R R R SUB MOV IF53 R MOV IF53 R MOV AX,AX ES,AX WORD PTR[RESUME_PTR] ,OFFSET DUMMLRETURN MOV WORD PTR [RESUME_PTR+2] ,CS ; SET SEGMENT WORD PTR [RTCA_PTR] ,OFFS ET DUMMLRETURN MOV WORD PTR[RTCA_PTR+2] ,CS ; SET SEGMENT SET UP KEYBOARD DATA AREA 09B7 09BA E8 0831 R 80 OE 00B4 R 08 09BF 09Cl 09C4 09C6 09C9 B4 E8 24 E8 E8 CALL OR KYBD_RESET ; RESET KEYBOARD KB_NMLCNTL, CLI CK_ON ; ACT I VATE KEYBOARD CLI CKER DISABLE RTC PERIODIC,ALARM AND UPDATE INTERRUPTS AND RESET SET OB 07AA OF 07C8 R 07E6 R MOV CALL AND CALL CALL AH, RTCMODE ; GET RTC MODE CONTROL GELRTCREG AL, NOT PI E_ENABLE+SELCLOCK+AI E_ENABLE+U IE_ENABLE PULRTCREG ; UPDATE RTC MODE CONTROL BALSALSETUP ; SETUP FOR BATTERY SAVINGS TURN OFF MODEM I F ON BATTERY POWER AND PROFILE SO INDICATES 09CC 09CE 0900 E4 7F A8 40 75 13 IN TEST JNZ AL, PWR_STAT AL,EXLPWR SYS_SET2 0902 0904 B4 17 E8 07AA MOV CALL AH, RTCSYS_PROFI GELRTCREG 2-214 ROM BIOS ; CHECK FOR BATTERY OPERATION GET SYSTEM PROFILE 09D7 09D9 A8 02 75 OA 09DB 09DD 09DF 09E2 B3 2A E8 EB TEST JNZ AL,MODEM_BATT SYS_SET2 ; OPERATE MODEM ON BATTERY? ; YES THEN JUMP ON BATTERY POWER AND MODEM PROFILE INDICATES NO BATTERY OPERATION 02 FF 0000 E 09 90 MOV SUB CALL JMP BL,ACLMODEM BH,BH COM-POWER SYS_SET3 SPECI FY MODEM OFF INDICATE POWER OFF REQUEST TURN OFF PRIMARY COM POWER MODEM POWER LEFT ON SO SET MODEM ACCORDING TO CONFIGURATION 09E5 09E5 09E7 09EA B4 1D E8 07AA R E8 0000 E SYS_SET2 : MOV CALL CALL AH, RTCMOD_PROFl GELRTCREG MODEM_CONFIG RETRIEVE MODEM PROFILE GET PROFILE IN AL REGISTER GO SETUP MODEM ENABLE DISKETTE NMIS 09ED 09ED 09EF 09F1 E4 77 OC 80 E6 77 SYS_SET3 : IN OR OUT AL,DSKLCNTL AL,DSKLNMI DSKLCNTL , AL READ FROM DISKETTE PORT SET ON DISKETTE NMI ENABLE OUT IT ENABLE KEYBOARD NMIS 09F3 09F5 09F7 E4 7C OC 80 E6 7C IN OR OUT AL,KYBD_CNTL AL, EN-KYBD_NMI KYBD_CNTL,AL ; ENABLE KEYBOARD NMI' S ENABLE SPEAKER, RTC ALARM NMI, AND I/O CHECK NMI 09F9 09FB 09FD 09FF E4 24 OC E6 61 D7 04 61 OA01 OA03 BO 80 E6 AO IN AND OR OUT AL,NMLCNTL ; ENABLE RTC INTERRUPT AL , NOT 0 I S_ALARM+D I S_IOCHK AL, EN_SPKR ; ENABLE SPEAKER NMLCNTL,AL ENABLE I/O CHANNEL CHECK MOV OUT AL, EN_IOCHK IONMLCNTL,AL ENABLE KEYBOARD, TIMER 0 AND DISKETTE INTERRUPTS OAOS OA07 OA09 OAOB OAOC E4 21 24 BC E6 21 C3 IN AL,INTA01 AND AL ,OBCH INTA01,AL OUT RET SYS_SETUP ENDP ENABLE KEYBOARD AND TIMER AND DISKETTE INTERRUPTS Vector Setup (VECTOR_SETUP) SUBTTL VECTOR_SETUP ********************************************************************* ROUTINE-NAME: VECTOILSETUP FUNCTION: THIS ROUTINE INITIALIZES INTERRUPT VECTORS 0-32 AND THE PRINTER AND RS232 TIMEOUT VALUES. VIDEO VECTORS lOH,lDH,lFH,44H ARE NOT INITIALIZED BY THIS ROUTINE. THEY ARE INITIALIZED IN THE LCD_CONFIG ROUTINE DURING POST. ENTRY CONDITIONS: INPUT CONDITIONS: DS:DATA RESTRICTIONS: NMI' S MUST BE DISABLED EX IT CONDITIONS: NORMAL EXIT CONDITIONS: INTERRUPT VECTORS AND TIMEOUTS SET ROM BIOS 2-215 ERROR EXIT CONDITIONS: REGISTERS MODIFIED: NONE ES,SI,DI,AX,CX ********************************************************************* VECTOR_SETUP PROC NEAR OAOC OAOC OAOD OAIO OAl2 IE B9 OOIF 2B FF 8E C7 ASSUME DS:DATA,ES:ABSO PUSH MOV SUB MOV OS CX,31 01,01 ES,DI SAVE OS FILL ALL 31 INTERRUPTS FIRST INTERRUPT LOCATION SET ES=ABSO INITIALIZE FIRST 31 VECTORS TO 011 (TEMPORARY INTERRUPT HANDLER) VECTORS 0-lEH SET TO 011 SETUP _1: MOV OAl4 OAl4 B8 I F23 R OAl7 OA1A OA1C OA1F 83 74 83 75 OA21 OA21 OA24 83 C7 04 E2 EE SETUP _lA: ADD LOOP OA26 OA26 OA27 OA29 OA2A AB 8C C8 AB E2 E8 SETUP_IB: STOSW MOV STOSW LOOP FF 40 05 FF 74 05 cr~p JE CMP JNE AX,OFFSET 011 MOVE ADDR OF INTR PROC TO TBL 01, 10H*4 SETUP_lA 01, 1DH*4 SETUP_1B VIDEO INT 10H? YES THEN SKIP VIDEO INT IDH? YES THEN SKIP 01,4 SETUP_1 SKI P VECTORS AX,CS SET VECTORS GET ADDR OF INTR PROC SEG SETUP_1 -INITIALIZE BIOS VECTORS 8-1EH FROM VECTOR_TABLE SKIPPING VIDEO VECTORS 10H AND IDH OA2C B9 OA2 FOE OA30 1 F OA31 BE OA34 BF OA37 OA37 83 OA3A 74 OA3C 83 OA3F 75 MOV PUSH POP MOV MOV SETUP_2: CMP JE CMP JNE 0017 1EF3 0020 FF 40 05 FF 74 08 CX ,23 ; GET VECTOR COUNT CS ; SETUP OS SEG REG OS SI,OFFSET VECTOR_TABLE DI,OFFSET INLPTR DI,10H*4 SETUP _2A DI,lDH*4 SETUP _2B VIDEO INT lOH? YES THEN SKIP VIDEO INT 1DH? YES THEN SKIP SKIP VIDEO VECTORS OM1 OM1 OM4 OM7 83 C7 04 83 C6 02 E2 EE SETUP_2A: ADD ADD LOOP 01,4 SI,2 SETUP _2 0A49 0A49 OMA OMD OMF A5 83 C7 02 E2 E8 1F SETUP_2B: MOVSW ADD LOOP POP 01,2 SETUP_2 OS SET UP NMI,PRINT SCREEN, BASIC SEGMENT, USER REAL TIME CLOCK ALARM VECTORS OA50 OA57 OA5E 26: C7 06 0008 R 0000 E 26: C7 06 0014 1 F54 R 26: C7 06 0062 F600 SET VECTORS SKI P OVER SEGMENT RESTORE OS RESUME VECTOR, AND MOV NMLPTR,OFFSET NMLFLIH ; NMI INTERRUPT HANDLER MOV INT5_PTR,OFFSET PRINLSCREEN ; PRINT SCREEN MOV BASICPTR+2,OF600H ASSUME ES:DATA,DS:DATA 2-216 ROM BIOS ; SEGMENT FOR RESIDENT BASIC PUSH POP OA65 OA66 1E 07 OA67 OA6A OA6D OA70 OA75 OA77 A2 BF B8 83 75 BO OA79 OA79 OA7A OA7C OA7D OA80 OA81 OA82 OA83 AB 8A C4 AA B8 OlD1 AS AB C3 OS ES SET INITIAL RS232 AND PRINTER TIMEOUT VALUES 006B R 0078 R 1414 3E OOOB R 78 02 23 MOV MOV MOV CMP JNE MOV I NTR_FLAG, AL ; CLEAR STRAY INTERRUPT FLAG DI,OFFSET PRINLTlM_OUT ; SET DEFAULT PTR TIMEOUT DEFAUL T = 20 AX,1414H PRI NTER_BASE, 078H PORTABLE PRINTER INSTALLED? SETUP _3 JUMP I F NOT SET PORTABLE TO 25 SECS AL,23H SETUP_3: STOSW MOV AL,AH STOSB MOV AX,0101H STOSW STOSW RET VECTOR_SETUP ENDP THREE TIMEOUT VALUES USE LPT2 TIMEOUT VALUE RS232 TIMEOUTS 4 TIMEOUTS = 01 RETURN TO CALLER KEYBOARD TABLES CONTINUED ORG OEA87H ORG OA87 00A87H ------------------------------------------------------------------ ~----OA87 OA87 OA8C ALT + (KEYPAD 0 - 9) - EXTENDED ASCII CODES K30 52 4F 50 51 4B 4C 40 47 48 49 DB DB LABEL BYTE 82,79,80,81,75 76,77,71,72,73 ; 10 NUMBERS ON KEYPAD -----------------------------------------------------------------~----- ALT + (A - Z) EXTENDED ASCI I CODES -- SUPER SHIFT -- OA91 OA99 OAA1 OAA9 10 16 18 22 24 2F 31 - - - -- - - - - - - - - - --------- - - - - - -- - -- - - - - --- - - - ---- -- --- - --- -- - ----- -- 11 12 13 14 15 17 19 IE IF 20 21 23 25 26 2C 20 2E 30 32 DB 16,17,18,19,20,21,22,23 ; A-Z TYPEWRITER CHARS DB 24,25,30,31,32,33,34,35 DB 36,37,38,44,45,46,47,48 DB 49,50 ; ******************************************************************* ; KEY TRANSLATION TABLE - INTERNAL SCAN CODES TO PC! SCAN CODES WHILE THE KEYPAD STATE IS ACTIVE (KEY PAD SCAN CODES). ; ******************************************************************* TABLE CONTAINS INTERNAL AND PC! SCAN CODE PAIRS. HIGH BYTE IS INTNL SCAN CODE AND THE LOW BYTE IS THE PC1 EQUIVALENT. OAAB OAAB OABB = 001E 1847 1D4E 384F 4A53 1948 284B 3950 4B35 KBPAD_TBL LABEL WORD 1A49 1C4A OW 1847H, 1948H, 1A49H, 1C4AH, 1D4EH, 284BH, 294CH, 2A4DH 294C 2A4D 3A51 4852 384FH, 3950H, 3A51H, 4B52H, 4A53H, 4B35H, 4E37H OW 4E37 KBPADL EQU $-KBPAD_ TBL ; ******************************************************************* KEY TRANSLATION TABLE - INTERNAL SCAN CODES TO PC1 SCAN CODES WHILE THE FUNCTION KEY IS HELD. ; ******************************************************************* FIRST 6 ENTRIES OF THIS TABLE CONTAIN INTNL AND PC1 SCAN CODE PAIRS. HIGH BYTE IS THE INTERNAL SCAN CODE AND THE LOW BYTE IS THE PC1 EQUIVALENT. ENTRIES 5-8 CONTAIN INTERNAL SCAN CODES AND THEIR STATE BIT IN KB_NMLCNTL. HIGH BYTE IS THE INTERNAL SCAN CODE AND LOW BYTE CONTAINS STATE BIT FOR KEYPAD STATE, CLICKER STATE, AND AUDIO STATE change made for speaker from Fn+A to Fn+Scrol LLock ROM BIOS 2-217 OAC9 OAC9 KBFUN_TBL LABEL WORD 5B47 5C49 5F4F 5E51 OW 5B47H,5C49H,5F4FH,5E51H,0257H,0358H 0257 0358 OAD5 0108 OC04 3102 0001 OW 0108H,OC04H,3102H,ODOIH KBFUNL EQU $-KBFUN_TBL " 0014 ; ******************************************************************* KEY TRANSLATION TABLE TABLE DISPLACEMENT 52H IS THE FUNCTION KEY AND IS SET TO 52H. THIS WILL ALLOW TESTING OF THE FUNCTION KEY EVEN THOUGH IT DOES NOT HAVE A PC! SCAN CODE EQUIVALENT. change made for bksp and \ change EX PLANA TI ON Each entry is the P60 make scan code for the NMI scan code corresponding to this position. P60 sc P60 sc P60 sc OFFH > 080H < 080H means no such NMI scan code means the key may be a FN+key or Keypad key. means the key is a base key ; ******************************************************************* ;------ TABLE OF INTERNAL SCAN CODES TO PC! SCAN CODES DADO DADO OAE5 OAED OAF5 OAFO OB05 OBOO OB15 OB10 OB25 OB2D OB35 FF 3F 41 52 FF 06 88 2B FF 14 96 FF FF 22 A4 lC FF 30 B2 B7 FF 39 FF DO 81 40 42 53 29 07 89 DE OF 15 97 FF BA 23 A5 FF 2A 31 33 FF 10 FF FF CD BB BC 3D 3 E KBNMLTBL LABEL BYTE OFFH, 081H, OBBH, OBCH, 03DH, 03EH, 03 FH, 040H DB 43 44 C5 C6 DB 041H, 042H, 043H, 044H, OC5H, OC6H, 052H, 053H 02 03 04 05 DB OFFH, 029H, 002H, 003H, 004H ,005H, 006H, 007H 8A OB 8C 80 DB 088H, 089H, 08AH, OOBH, 08CH, 08DH, 02BH, OOEH 10 11 12 13 DB OFFH, OOFH, OlOH, 011H, 012H, 013H, 014H, 015H 98 19 lA lB DB 096H, 097H, 098H, 019H ,0IAH, 01 BH, OFFH ,OFFH 1E 1F 20 21 DB OFFH, OBAH, 01 EH, 01 FH, 020H, 021H, 022H, 023H A6 27 28 2B DB OMH, OA5H, OA6H, 027H, 028H, 02BH, 0ICH, OFFH 2C 20 2E 2F DB OFFH ,02AH, 02CH, 02DH, 02EH, 02FH, 030H, 031H B4 B5 36 FF DB OB2H, 033H, OB4H, OB5H, 036H, OFFH, OB7H, OFFH 02 38 56 FF DB OFFH, 010H, OD2H, 038H, 056H, OFFH, 039H, OFFH 38 CB C8 FF DB OFFH, OFFH, 038H, OCBH, OC8H, OFFH, ODOH, OCDH 2-218 ROM BIOS Error Message Routine (SYS_CHK) ********************************************************************* ROUTINE-NAME: SYS_CHK FUNCT ION: TH I S ROUTI NE DSPL YS ERROR MESSAGES ACCORD I NG TO FLAGS SET IN THE RTCDIAG_STAT SAVE AREA. ONCE THE FLAG HAS BEEN FOUND IT IS CLEARED IF AN ASSOCIATED ERROR CODE IS PRESENT. ENTRY CONDITIONS: PURPOSE OF ENTRY: DISPLAY ERROR MESSAGES INPUT CONDITIONS: DS:DATA RESTRICTIONS: NONE EXIT CONDITIONS: NORMAL EX IT CONDITIONS: RETURN ERROR EXIT CONDITIONS: NON FATAL ERROR RETURN CODE WITH ERROR CODE I F ASSOCIATED BIT SET. RE_DISPATCH FLAG SET IF ALL BITS IN RTCDIAG_STAT NOT YET CHECKED. REGISTERS MODIFIED: AX, BX, CX, OX ********************************************************************* OB3D OB3D OB3F OB41 0843 0843 0845 0848 OB4B 084E 084E 0851 OB53 0856 0858 085A 40 73 20 71 10 75 B4 E8 B9 BE OE 07AA R 0003 0830 R 2E: 84 04 75 OA 83 C6 02 E2 F6 2B CO EB 00 90 ERROR_TABLE LABEL WORD DB BAD_RTCSIG,73H DB BAD_STORJKSUM, 7lH DB LCD-ALLFAILED,75H RTC SIGNATURE BAD STG CHECKSUM BAD ON RESUME ALTERNATE LCD MODE FAILED SYS_CHK PROC NEAR MOV AH,RTCDIAG_STAT CALL GELRTCREG MOV CX,3 ; THREE ENTRI ES IN TABLE MOV SI,OFFSET ERROR_TABLE SYS_LP: TEST AL, BYTE PTR CS: [SI] ; CHECK FOR BIT ON SYS_ERR JNZ ADD SI,2 LOOP SYS_LP ; CLEAR ERROR CODE SUB AX,AX JMP SYS_EXIT ERROR MATCH FOUND SO CHECK FOR ERROR CODE 0850 0850 0860 0862 0865 0867 ; SET SYS_ERR: 2E: 8B lC MOV 32 C3 XOR E8 07C8 R CALL B4 50 MOV 8A C7 MOV ERROR CODE FROM TABLE 0869 0869 086A C3 BX,WORD PTR CS: [SI] ; GET CODE FROM TABLE AL, BL ; RESET ERROR BIT PULRTCREG ; SAVE IN RTCDIAG STAT AH,NON_FATAL_ERR+RE_DISPATCH ; SET ERR AND REDISP AL, BH SYS_EXIT: RET SYS_CHK ENDP ROM BIOS 2-219 Resume Error Check (RES_ERR_CHK) ********************************************************************* ROUTINE-NAME: RES_ERILCHK FUNCTION: THIS ROUTINE CHKS AND DSPLYS ANY ERROR MESGS ASSOCIATED WITH OPERATOR CAUSED RESUME ERRORS. THIS IS DONE AT BOOT TIME AFTER AN ABORTED RESUME. ENTRY CONDITIONS: PURPOSE OF ENTRY: DISPLAY ERROR MESSAGES INPUT CONDITIONS: DS:DATA RESTRI CTIONS: NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: RETURN WITH ZERO FLAG SET ERROR EXIT CONDITIONS: ERROR NO. IS DISPLAYED ON ROW XX COLUMN XX OF THE SCREEN AND THAT ERROR FLAG IS RESET RETURN IS MADE WITH ZERO FLAG RESET REGISTERS MODIFIED: OB6A OB6A OB6C OB6E AX,BX,CX,DX,ES,SI,DI,BP ********************************************************************* 02 70 01 72 08 74 OB70 0870 OB73 0873 OB75 OB78 OBlB OB7E OB7E OB81 OB83 OB86 2E: 84 04 75 OB 83 C6 02 E2 F6 OB88 OB8B 80 FE 06 EB 2C 90 BA 0632 B4 E8 B9 BE OE 07AA R 0003 OB6A R ERRLTABLE DB DB DB LABEL WORD LCD_NOLACTlVE,70H DSKLACTIVE,72H LCO_CHANGE,74H RES_ERILCHK PROC NEAR MOV DX, 0632H RES_LPO: AH, RTC_DIAi>-STAT MOV CALL GELRTCR£G MOV CX,3 ; SI,OFFSET ERR2_TABLE MOV RES_LP: TEST AL,BYTE PTR CS: [SI] RES_ERR JNZ ADD SI,2 RES_LP LOOP CMP JMP SET ROW = 6 COLUMN=50 FOR MSG GET THE ERROR FLAGS FROM RTC THREE ENTRIES IN TABLE CHECK FOR BIT ON SAME ROW AS STARTED ON? I F SO NO ERRORS· A Z FLAG 5 ET ELSE ERROR & Z FLAG CLEARED ERROR MATCH FOUND SO CHECK FOR ERROR CODE OB8E OB8E OB91 OB93 2E: 8B 1C 32 C3 E8 07C8 R OB96 OB99 OB9B OB9C OB9E OBAO OBA3 OBA6 OBA7 OBAA OBAD OBBO OBB3 OBB5 B8 8E 52 B6 8A BF E8 5A BB B9 BD B8 CD FE ---CO 01 D7 0009 0275 0007 0004 OOOA R 1300 10 C6 RES_ERR: MOV XOR CALL BX,WORD PTR CS: [51] AL,BL PULRTCREG ASSUME ES:XXDATA MOV MOV PUSH Mav MOV MOV CALL POP MOV MOV MOV MOV INT INC AX,XXDATA ES,AX DX DH,Ol OL,BH OI,OFFSET TEMP STILCON DX BX,0007H CX,4 BP,OFFSET TEMP+1 AX,1300H 10H DH 2-220 ROM BIOS GET CODE FROM TABLE RESET ERROR BIT SAVE IN RTCOIAG STAT SAVE COORDINATES SET HIGH BYTE OF ~RROR CODE SET ERROR CODE FROM TABLE POINT TO MESSAGE SAVE AREA CONVERT CODE TO·ASCI I RESTORE COORDINATES SET ATTRIBUTE AND PAGE SET STRING LENGTH GET ADDRESS OF STRING SET WRITE STRING REQUEST OISPLAY ERROR CODE POINT TO NEXT ROW OBB7 OBB9 OBB9 OBBA GO LOOK FOR MORE ERRORS JMP SHORT RES_LPO RES_EXIT: RET RES_ERR_CHK ENDP EB BA C3 Diskette I/O Entry (DISKETIE-IO) ; ***************************************************** ; DISKETTE I/O ENTRY POINT ; ***************************************************** ;ORG OC59 = OC59 OC59 E9 0000 OEC59H ORG 00C59H DISKETTE_IO EQU JMP DSKLIO Icon and Error Message Routine (E_MSG) ****************************************************************** ROUTINE-NAME: LMSG FUNCTION: THIS ROUTINE DISPLAYS ICONS AND ERROR MESSAGES FOR POST ENTRY CONDITIONS: PURPOSE OF ENTRY: TO DISPLAY A POST ICON AND/OR ERROR MESSAGE INPUT CONDITIONS: AX = ERROR CODE ; IF AH = 0 THEN NO ERROR CODE , ONLY AN ICON ES:DI = POINTS TO AN ADDITIONAL ASCII ERROR MESSAGE. IF 01 = 0 THEN NO MESSAGE CL = I CON NUMBER TO 01 SPLAY RESTRICTIONS: NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: ERROR EX IT COND IT IONS: REGISTERS MODIFIED: AX,BX,CX,DX,BP,DI,SI INTERNALL Y REFERENCED ROUTI NES: NONE EXTERNALL Y REFERENCED ROUTI NES: STR_CON ****************************************************************** ASSUME CS: ROMCODE ASSUME DS:XXDATA ASSUME ES:NOTHING OCSC OC5C OC5D LMSG IE 06 PUSH PUSH PROC OS ES NEAR SAVE SEGMENT REGS ROM BIOS 2-221 OC5E OC5F OC60 57 06 50 PUSH PUSH PUSH 01 ES AX OC61 OC62 OC63 OC66 OC68 OE 07 B8 ---8E 08 B5 00 PUSH POP MOV MOV MOV CS ES AX,XXDATA DS,AX CH,O SAVE PTR TO ASCI I ERROR MSG SAVE ERROR CODE POINT ES TO CODE SEGMENT SET OS TO XXDATA SEGMENT CLEAR CH CHECK FOR NEED TO DISPLAY I CON AND DO SO I F NECESSARY OC6A OC6C OC6E OC73 OC75 OC78 8B F9 01 E7 2E: 8B AD 0249 8B F9 83 FF 06 75 52 EMlO: SHL MOV MOV CMP JNE MOV DI,CX 01,1 BP,ICONJDR[DI] DI,CX 01,6 EM15 ; SAVE ICON NUMBER ; MULTIPLY BY 2 BP POINTS TO ICON DATA ; Fl ICON DISPLAY Fl ICON AND WAIT FOR F1 TO BE PRESSED IF SYS UNIT DISPLAYED OTHERWISE WAIT 10 SECONDS AND THEN RETURN OC7A OC7F 80 3E 002B R 00 74 29 CMP JE ICON_DIS+l,O EM13 SYSTEM UNIT DISPLAYED? JUMP I F NO SYSTEM UN IT OC81 OC84 BA 1200 E8 OD5F R MOV CALL DX,01200H ICON_PR OX POINTS TO DSPLY POSITION DISPLAY F1 ICON KEYSTROKE FOUND SO CHECK FOR CORRECT KEYS OC87 OC87 OCB9 OC8B OC8E OC90 OC92 B4 CD 80 74 3C 75 00 16 FC 3B 11 OC F3 OC94 OC97 OC99 OC9F 88 8E C7 EB ---- R 08 06 0072 R ABCD 25 OCA1 OCA2 OCM OCA6 OCA8 FB E4 3C 74 EB EMIl : MOV INT CMP JE CMP JNE AH,O 16H AH,03BH EM12 AL,OOCH EMIl SET GET KEYSTROKE FN CODE GET A KEYSTROKE Fl KEY? YES THEN WAIT FOR REL OF KEY CTL +L FOR LOOP MODE? NO LOOK FOR NEXT KEY SEQ ASSUME DS:DATA MOV MOV MOV JMP AX,DATA ; SETUP DATA SEGMENT DS,AX RESELFLAG,LOOP_MODE ; SET POST LOOP MODE SHORT EM14 ; EXIT WAIT FOR BREAK OF F1 KEY 60 3B F9 1C EM12 : IN CMP JE JMP STI AL,KB-DATA AL,03BH EM12 SHORT EM14 ENABLE INTERRUPTS READ KEY BOARD PORT CHECK FOR STI LL Fl KEY WAIT UNTI L NOT Fl KEY MAKE EXIT IF Fl KEY RELEASED NO SYSTEM UNIT SO ONLY WAIT 10 SECONDS OR UNTIL KEY HIT OCAA OCAA OCAD OCAE OCBO OCB2 OCB4 OCB6 OCB8 OCBA OCBA OCBC OCBE OCCO OCC2 OCC4 BA EC 8A B3 BO 0060 F8 B5 12 B4 41 CD 15 72 OC B4 CD 74 B4 CD EB 01 16 06 DO 16 F4 EMl3 : MOV IN MOV MOV MOV MOV INT JC EMl3_1 : MOV INT JZ MOV INT JMP 2-222 ROM BIOS DX,KB_DATA Al,DX BH,Al Bl,OBSH AL,12H AH,41H ISH EM14 AH,l 16H EM14 AH,O 16H SHORT EMILI KEYBOARD PORT GET PRESENT PORT 60 VALUE SET TIMEOUT TO 10 SECONDS COMPARE RETURN NOT EQUAL USING BH AND PORT READ (OX) WAIT ON EXTERNAL EVENT WILL RETURN AFTER 10 SECS I F TIMEOUT THEN JUMP CHECK FOR KEY IN BUFFER JUMP I F NO KEY IN BUFFER OTHERWISE. PURGE THE KEY LOOP UNTIL NO MORE KEYS Fl WAIT COMPLETED SO EXIT OCC6 OCC6 OCC9 EM14 : ADD JMP 83 C4 06 E9 005C R BALANCE STACK EXIT WHEN PRESSED NOT REQUEST TO DISPLAY Fl PROMPT ASSUME OCCC OCOO OC03 OC05 OC07 OCOB OCOO OCE1 OCE5 OCE7 OCEC OCEE 8A 80 002A R EM15 : 80 F9 00 CMP 8B F1 MOV 75 lA JNE 8A OE 002A R MOV FE Cl INC 88 80 002A R MOV 88 OE 002A R MOV 8B F1 MOV 2E: 8A 94 0078 R MOV B6 00 MOV E8 005F R CALL OCFl OCF2 OCF4 58 OA E4 74 3C OCF6 OCF7 OCF9 OCFC OCFE 0001 0004 0005 0009 0000 0012 0015 0013 ODIA 57 8B DO B8 ---8E CO BF 0009 E8 0275 5F 8A 90 0031 FE 85 0031 R 2E: 8A 94 0073 R 30 C2 08 83 FF 02 75 03 80 EA 04 OOlD ODIF B6 09 02 F3 0021 0024 0027 0029 002B 0020 0030 B9 BD B4 CD B3 B8 CD MOV OS:XXOATA CL,ICON_OIS[OI- ; MOVE OSPLY SQUARE NO. TO SI HAS ICON BEEN DISPLAYED? CL ,0 SI, CX SAVE DISPLAY SQUARE NO. EM20 CL,ICON_OIS[O] GET NO. ICONS ALREADY DSPLYD CL ICON_OIS[OI] ,CL STORE DSPLY SQUARE WITH ICON ICON_DIS [O],CL SAVE NO. OF ICONS DISPLAYED SI, CX SAVE DISPLAY SQUARE OL, 0 I S_POS [S I] GET COL NUMBER FOR DISPLAY PUT ROW NUMBER IN DH OH,O ICON_PR DISPLAY ICON CONVERT AND DISPLAY ERROR MESSAGE IN AX IF REQUIRED EM20 : OR POP JZ PUSH MOV MOV MOV MOV CALL POP MOV INC 01 OX ,AX AX,XXDATA ES ,AX OI,OFFSET TEMP STR_CON 01 BL,ICON_MSG[OI] MOV DL,DIS_POS[SI] DL,8 01,2 EM25 DL,4 ICON~SG[DI] ADD CMP JNE SUB EM25: ADD MOV OH,9 OH,BL MOV 0004 OOOA R OF 10 07 1300 10 AX AH,AH EM30 CX,4 BP,OFFSET TEMP+l AH,15 10H BL, 07H AX,01300H 10H MOV MOV I NT MOV MOV I NT RESTORE ERROR CODE ERROR MESSAGE? SAVE ICON NUMBER MOVE ERROR CODE ES POINTS TO XXOATA PO I NTER FOR CONVERS ION RTN E CONVERT ERROR CODE TO ASCI I RESTORE I CON NUMBER GET NO. OF MSGD UNDER ICON I NCREMENT NO. OF MESSAGES GET SCREEN POSITION CENTER MESSAGE FEATURE ICON? ADJ OSPLY POS FOR FEAT ICON FIRST MESSAGE GOES AT ROW 9 ERROR MSG. lSI ROW BELOW PREVIOUS ONE LENGTH OF STRING IS 4 CHARS POINT TO ASCII ERROR CODE GET CURRENT PAGE NUMBER NORMAL ATTRI BUTES WRITE STRING FOR INT 10 DISPLAY ERROR MESSAGE DISPLAY ASCI I MESSAGE I F NECESSARY 0032 0033 0034 0036 07 5B OB DB 74 24 EM30: POP OR JE POP ES BX BX, BX EMSG_RET GET ASCI I ERROR MSG POINTER ASCI I ERROR MESSAGE SCAN TO GET LENGTH 0038 003A OD3B 003F 8B EB 43 26: 80 3F 04 75 F9 MOV EM35: CMP JNE 0041 0043 0045 004A 2B DO EM40: 8B CB MOV 2E: 3A 94 0078 R MOV 80 C2 OC ADD BP, BX INC SUB ; BX ; BYTE PTR ES: [BX],04H EM35 BX,BP CX, BX DL,DIS_POS[SI] OL,12 POINT TO MESSAGE FOR INT 10 INC POINTER ; END OF MESSAGE? I F NOT END LOOK AT NEXT BYTE LENGTH OF STRING FOR INT 10 GET COLUMN FOR DISPLAY MOVE OVER 9 COLUMNS ROM BIOS 2-223 004D OD50 OD52 OD55 OD55 OD57 OD5A OD5C OD5C OD5D OD5E OD5F 83 FF 02 75 03 80 EA 04 B3 07 B8 1300 CD 10 07 IF C3 CMP JNE SUB EM45: MOV MOV INT DI,2 EM45 DL,4 FEATURE ICON? NO THEN DONT COLUMN CORRECT MOVE BACK 4 COLUMNS BL,07H AX,01300H 10H SET NORMAL ATTRI Bun WRITE STRING FOR INT 10 DS I PLAY ERROR MESSAGE EMSG_RET: POP ES POP DS RET E_MSG ENDP 2-224 ROM BIOS RESTORE SEGMENT REGS RETURN TO CALLER Icon Display Routine (ICON_PR) ****************************************************************** ROUTINE-NAME: lCON_PR FUNCTION: THIS ROUTINE DISPLAYS ICONS ON THE SCREEN ENTRY CONDITIONS: PURPOSE OF ENTRY: TO DISPLAY AN ICON INPUT CONDITIONS: DH = ROW NUMBER TO DISPALY ICON DL = COLUMN NUMBER TO DISPLAY ICON ES: BP POINTS TO THE DATA TO DISPLAY ICON FORMAT: DB DB ROW OFFSET,cOLUMN OFFSET,WIDTH,DEPTH ASCI I DATA BYTES FOR I CON AND CONTROL CODES CONTROL CODES: 01 XX YY REPEAT CHARACTER XX= NUMBER OF TIMES TO REPEAT CHARACTER YY= CHARACTER TO REPEAT 02 XX YY 03 04 XX YY zz DISPLAY CHARACTER WITH ATTRI BUTE XX= ATTRIBUTE AS DEFINED BY PC YY= CHARACTER NEXT ROW NEXT BYTE WILL BE DISPLAYED ONE ROW DOWN .... REPEAT THE FOLLOWING ROW XX= NUMBER OF TIMES TO REPEAT THE ROW YY ZZ ... = DATA FOR THE ROW TO REPEAT 05 XX YY STR .. REPEAT STRING FUNCTION WHERE XX = THE NO. OF TIMES TO REPEAT STRING YY = THE LENGTH OF THE STRING STR .. = THE STRING TO REPEAT THE STRING MUST NOT CONTAIN ANY REPEAT CHARACTER CONTROL CODES 06 XX YY ZZ STR .. : REPEAT WHERE XX = THE NUMBER OF YY = THE LENGTH OF ZZ = THE ATTRI BUTE STR •. = THE STRING STRING WITH COMMON ATTRIBUTE TIMES TO REPEAT THE STRING THE STRING FOR THE ENTIRE STRING TO REPEAT RESTRICTIONS: CONTROL CODE TO REPEAT A CHARACTER MUST NOT REPEAT THE CHARACTER PAST THE RIGHT MARGIN OF THE ICON. THE CONTROL CODE TO REPEAT A ROW MUST NOT REPEAT THE ROW PAST THE BOTTOM OF THE ICON. REPEAT CODES CANNtlT BE IMBEDDED IN STRINGS TO BE REPEATED. EXIT CONDITIONS: NORMAL EX IT COND IT IONS: ERROR EXIT CONDITIONS: REGISTERS MODIFIED: NONE INTERNALLY REFERENCED ROUTINES: NONE EXTERNALL Y REFERENCED ROUTI NES: ****************************************************************** 0000 0001 0002 00 00 00 lCON_PL STR_ROW STR_COL MALROW STRUC DB DB DB ; defi nes resrvd area on stack ROM BIOS 2-225 0003 0004 0005 0006 00 00 00 MALCOL REPILNO RSTILNO I CON_PL DB DB DB ENDS ASSUME CS: ROMCOOE ASSUME OS: NOTH I NG ASSUME ES: NOTH ING 005F ICON_PR PROC NEAR SAVE PUSH AX BX PUSH PUSH CX OX PUSH BP PUSH SI PUSH 01 PUSH ES PUSH OS PUSH SUB SP ,6 MOV SI,SP PUSH SS POP OS MOV BH,O AH,Ol MOV CH,20H MOV INT 10H MOV BL,07H CH,O MOV MOV OI,CX 01,1 SHL MOV AH, ES: [BP] ADD OH,AH [S I] . STR_ROW, OH MOV INC BP MOV AL, ES: [BP] ADD OL,AL MOV lSI] .STR_COL,OL INC BP MOV AL,ES:[BP] ADD AL,OL MOV [SIj.MALCOL,AL INC BP MOV AH, ES: [BP] ADD AH,OH MOV lSI] .MALROW,AH MOV [51] .REPR_NO,O MOV lSI] .RSTR_NO,O 005F 0060 0061 0062 0063 0064 0065 0066 0067 0068 0066 0060 006E 006F OOll 0073 0075 0077 0079 007B 0070 007F 0083 0085 0087 0088 008C 008E 0091 0092 0096 0098 009B 009C OOAO 00A2 00A5 00A9 50 53 51 52 55 56 57 06 IE 83 EC 06 86 F4 16 IF B7 00 B4 01 B5 20 CO 10 B3 07 B5 00 8B F9 01 E7 26: 8A 66 00 02 F4 88 34 45 26: 8A 46 00 02 DO 88 54 01 45 26: 8A 46 00 02 C2 88 44 03 45 26: 8A 66 00 02 E6 88 64 02 C6 44 04 00 C6 44 05 00 OOAO OOAE 00B1 00B4 00B6 00B9 OOBB OOBE OOCO 45 B9 3A 7C 8A FE 3A 7C E9 I PR20: MOV CMP JL MOV INC CMP JL JMP INC 0001 54 03 1A 54 01 C6 74 02 03 OEB9 R BP CX,l OL, lSI] . MALCOL I PR23 OL, lSI] .STRJOL OH OH, lSI] .MALROW IPR22 IPILRET POINT TO NEXT LOCATION LENGTH OF STRING IS 1 I S PO I NTER PAST MAX COLUMN JUMP I F NOT POINT TO 1ST POS OF NEXT ROW POINT TO NEXT ROW ARE WE PAST THE LAST ROW? 00C3 00C6 OOCA OOCC OOCE FE 80 7E 8B EB 4C 04 7C 04 00 04 EF DO IPR22 : CMP JLE MOV JMP DEC lSI] .REPR_NO lSI] .REPR_NO,O IPR23 BP,OI IPR20 DEC NO. OF ROWS TO REPEAT 0000 0004 0006 0008 0008 OOOA 26: 8A 46 00 3C 07 72 12 IPR23 : CMP JB IPR30: MOV INT MOV AL, ES: [BP] AL,7 I PR_CNT GET NEXT BYTE OF DATA AH,02 10H POSITON CURSOR MAKE ROOM FOR TEMP PARMS PO I NT SI TO TEMPORARY AREA SET OS TO STACK SEGMENT SET CURRENT DISPLAY PAGE TURN OFF CURSOR SET NORMAL ATTRIBUTES INIT CH TO 0 MOVE I CON NO. TO 01 MULTIPLY BY 2 MOVE ROW OFFSET OF ICON TO AH ADD TO OFFSET SENT BY CALLER SAVE STARTING ROW POINT TO NEXT LOCATION MOVE COLUMN OFFSET OF ICON TO AL ADD TO OFFSET SENT BY CALLER SAVE STARTING COLUMN POINT TO NEXT LOCATION MOVE WIDTH OF ICON TO AL GET MAX. TOTAL COLUMN NUMBER SAVE MAXIMUM COLUMN NO. POINT TO NEXT LOCATION MOVE DEPTH OF ICON TO AL ADD TO OFFSET SENT BY CALLER SAVE MAXIMUM ROW NUMBER CLEAR LINE REPEAT COUNTER WRITE STRING LOOP B4 02 CD 10 2-226 ROM BIOS RETURN TO CALLER JUMP iF NO REPEAT ROWS POINT BEG OF ROW TO REPEAT CONTINUE JUMP I F CONTROL CHARACTER ODDC ODDE B3 07 26: 8A 46 00 ODE2 ODE4 ODE6 ODE8 B4 CD FE EB 09 10 C2 C3 3C 74 3C 74 3C 74 3C 74 3C 74 E9 01 13 02 2F 03 33 04 47 05 50 OE90 R MOV MOV IPR40: INT INC JMP BL,07H AL, ES: [BP] MOV AH,09 10H DL I PR20 NORMAL ATTRI BUTES WRITE AT CURSOR DISPLAY CHARACTER POINT TO THE NEXT COLUMN LOOP UNTI L LAST CHARACTER ODEA ODEA ODEC ODEE ODFO ODF2 ODF4 ODF6 ODF8 ODFA ODFC ODFE OEOI OEOI OE02 OE06 OE07 OEOB OEOD 45 26: 8A 4E 00 45 26: 8A 46 00 3C 05 72 12 IPLCNT: CMP JE CMP JE CMP JE CMP JE CMP JE JMP IPLREP: INC MOV INC MOV CMP JB OEOF DEll OE13 OEl7 OEl9 OElB OElD OElF B4 02 CD 10 26: 8A 46 00 B4 09 CD 10 02 01 B3 07 EB 8C REPIO: INT MOV MOV INT ADD MOV JMP OE21 OE21 OE22 OE26 OE27 45 26: 8A 5E 00 45 EB E6 IPR_ATT: INC MOV INC JMP BP BL, ES: [BP] BP REPI0 POINT TO NEXT BYTE STORE ATTRIBUTE IN BL OE29 OE29 OE2B OE2E OE31 OE35 OE37 FE 8A FE 80 7C 8B IPR_NXRW: INC MOV DEC CMP JL MOV DH DL, [51] .STR_COL [SI]. REPR_NO [SI]. REPR_NO,O NXlO BP,DI INCREMEMT ROW POINTER START AT RIGHT MARGIN DEC NO. OF ROWS TO REPEAT OE39 OE3C OE3E 3A 74 02 70 7B E9 ODAD R NXlO: JGE JMP DH, [SI] . MAX-ROW ; ARE WE PAST THE LAST ROW? IPR_RET RETURN TO CALLER I PR20 CONTINUE OE41 OE41 OE42 OE46 OE49 OE4B 45 26: 8A 46 00 88 44 04 8B FD E9 ODAD R IPR_REPR: INC MOV MOV MOV JMP OE4E OE4E OE4F OE53 OE56 OE57 OE5B OE5C OE5E OE5E OE5F C6 54 01 4C 04 7C 04 00 02 EF 45 26: 8A 46 00 88 44 05 45 26: 8A 4E 00 45 8B FD 51 26: 8A 46 00 AL,1 I PR_REP AL,2 IPR_ATT AL,3 IPR_NXRW AL,4 I PR_REPR AL,5 I PR_REPS I PR_RSTA BP CL,ES: [BP] BP AL,ES: [BP] AL,5 REPEAT CHARACTER FUNCTION ATTRIBUTE OTHER THAN NORMAL NEXT ROW REPEAT ROW FUNCTION REPEAT STRING REPEAT STRING WITH ATTRIBUTE INC POINTER GET MODIFIER FOR REPITITIONS INC POINTER GET CHARACTER TO DISPLAY CHECK FOR ATTRIBUTE FUNCTION IPR~TT MOV CMP AH,02 10H AL,ES: [BP] AH,09H 10H DL, CL BL,07H IPR20 BP AL, ES: [BP] [SI]. REPR_NO,AL 01, BP IPR20 IPR_REPS: BP INC MOV AL, ES: [BP] [SI] .RSTR_NO,AL MOV BP INC MOV CL,ES: [BP] INC BP MOV 01, BP REPS09 : PUSH CX REPSIO: MOV AL, ES: [BP] PSN CURSOR MODE FOR I NT 10 POSITION CURSOR WRITE CHAR/ATT AT CURSOR DISPLAY ADD REPITIONS TO POSTION PTR RETURN ATTRI BUTE TO NORMAL CONTINUE CONTINUE JUMP I F NO REPEAT ROWS POINT BEG OF ROW TO REPEAT INC POINTER SAVE NO. TO REPEAT ROW SAVE START OF ROW CONTINUE INC POINTER GET NO. TO REPEAT ROW SAVE NO. TO REPEAT ROW INC POINTER GET LENGTH OF STRING INC POINTER SAVE START OF STRING SAVE LENGTH OF STRING GET CHARCTER ROM BIOS 2-227 OE63 OE65 3C 02 77 06 OE67 OE68 OE6C OE6D OE6F OEll OE72 OE75 OE78 OE7A OE7B OE7D OE7F OE80 OE82 OE83 OE86 OE88 OE8A 45 26: 8A 5E 00 45 B4 02 CD 10 51 B9 0001 B8 1300 CD 10 59 FE C2 B3 07 45 E2 DD 59 FE 4C 05 74 04 8B EF EB 02 REPS20: INC BP MOV BL,ES: [BP] INC BP REPS30 : MOV AH,2 INT 10H PUSH CX MOV CX,l MOV AX,1300H INT 10H POP CX INC DL MOV BL ,07 INC BP LOOP REPS10 POP CX DEC [SI]. RSTILNO JZ REPS50 MOV BP ,DI JMP REPS09 INC POINTER MOVE ATTRI BUTE TO BL INCREMENT BP OE8C OE8D OE90 OE90 OE91 OE95 OE98 OE99 OE9D OE9E OEA2 OEA3 OEA5 OEA7 OEAA OEAC OEAE OEB1 OEB3 OEB3 OEB5 OEB6 4D E9 ODAD R REPS50 : DEC BP JMP IPR20 I PR_RSTA: INC BP MOV AL, ES: [BP] MOV [SI] . RSTR_NO,AL INC BP MOV CL,ES: [BP] INC BP MOV BL,ES: [BP] INC BP MOV DI, BP RSTA10: MOV BP,DI MOV AX,01300H INT lOH ADD DL, CL DEC [SI] . RSTR_NO JNZ RSTA10 RSTA_RET: BP, CX ADD BP DEC JMP IPR20 DECREMENT POINTER CONTINUE 45 26: 8A 46 00 88 44 05 45 26: 8A 4E 00 45 26 : 8A 5E 00 45 8B FD 8B EF B8 1300 CD 10 02 D1 FE 4C 05 75 F2 03 E9 4D E9 ODAD R OEB9 OEB9 83 C4 06 OEBC OEBD OEBE OEBF OECO OECl OEC2 OEC3 OEC4 OEC5 1F 07 5F 5E 5D 5A 59 5B 58 C3 OEC6 CMP JA I PR_RET: ADO RESTORE POP POP POP POP POP POP POP POP POP RET AL ,02 REPS30 SP,6 SET CURSOR POSITION SAVE LOOP COUNT LENGTH OF STRING IS 1 BYTE WRITE STRING FOR INTlO WRITE CHARACTER/ATTRIBUTE RESTORE LOOP COUNT I NC COLUMN PO INTER SET ATTRI BUTE TO NORMAL INC DATA POINTER WRITE CHAR TIL END OF STRING RESTORE LENGTH OF STRING DEC NO. TO REPEAT STRING CONT IF NO MORE REPITITIONS POINT TO BEGINNING OF STRING REPEAT STRING INC POINTER GET NO. TO REPEAT ROW SAVE INC POINTER GET LENGTH OF STRING INC POINTER GET ATTRI BUTE INC POINTER SAVE START OF ROW RESET POINTER WRITE STRING FOR INT 10 DISPLAY STRING ADD TO COLUMN PO INTER DEC NO. TO REPEAT STRING PRINT STRING AGAIN PO I NT TO POSTI ON IN DATA CONTINUE DE-ALLOCATE STACK SPACE OS ES 01 SI BP OX CX BX AX I CON_PR ENDP 2-228 ROM BIOS CONTROL CODE JUMP I F NOT RETURN TO CALLER Diskette Interrupt Entry (DSKT_INT) ; ************************************* DISKETTE INTERRUPT ENTRY ADDRESS ; ************************************* ;ORG OF57 = OF57 OF57 E9 0000 OEF57H ORG 00F57H DSKLINT EQU JMP DSKLI NTE Diskette Drive Parameters . ***************************************************************** ~ DISKETTE DRIVE TYPE PARAMETERS (FOR READ DRIVE PARAMETERS CALL) ; ***************************************************************** TWO SIDED 5 1/4" DRIVE PARMS OF5A OF5A OF5C OF5E OF60 PARMS_TPI48 LABEL BYTE OW OFOOOH OW OFFSET DSKLBASE OW 2709H OW 0100H FOOO OFC7 R 2709 0100 POINTER TO DRIVE PARMS (SEG) POINTER TO DRIVE PARMS (OFF) MAX TRK #/S IDE,SECTOR/TRACK MAX HEAD #, FILL TWO SIDED 3 1/2" DRIVE PARMS OF62 OF62 OF64 OF66 OF68 PARMS_TPIl35 LABEL BYTE OW OFOOOH OW OFFSET DSKLBASE OW 4F09H OW 0100H FOOO OFC7 R 4F09 0100 POINTER TO DRIVE PARMS (SEG) POINTER TO DRIVE PARMS (OFF) MAX TRK #/SIDE,SECTOR/TRACK MAX HEAD #, FI LL ; ********************************* ; DISKETTE PARAMETER TABLE ; ********************************* ;ORG OFCl OEFC7H ORG 00FC7H Diskette Timing Parameters (DSKT_BASE) DSKLBASE THIS IS THE SET OF PARAMETERS REQUIRED FOR DISKETTE OPERATION. THEY ARE POINTED AT BY THE DATA VARIABLE DISLPOINTER. TO MODIFY THE PARAMETERS, BUILD ANOTHER PARAMETER BLOCK AND POINT AT IT ************************************************** OFC7 OFC7 OFC8 OFC9 OFCA OFCB OFCC DO 02 25 02 09 2A DSKLBASE DB DB DB DB DB DB LABEL 11010000B 2 MOTOR_WAIT 2 9 02AH BYTE SRT=D, HD UNLD=OO - 1ST HD LOAD=I, MODE=DMA - 2ND WAIT AFTER OPN TIL MOTOR OFF 512 BYTES/SECTOR EDT ( LAST SECTOR ON TRACK) GAP LENGTH ROM BIOS 2-229 OFCO OFCE OFCF OFOO OFDI FF 50 F6 OF 04 DB DB DB DB DB OFFH 050H OF6H 15 4 DTL GAP LENGTH FOR FORMAT FILL BYTE FOR FORMAT HEAD SETTLE TIME (MSEC) MOTOR START TIME (1/8 SEC) Printer I/O Entry (PRINTER_IO) ********************************* PRINTER_IO ENTRY POINT OEF02H ORG 00FD2H PRINTER_IO EQU JMP PRLIO ORG OFD2 = OF02 OFD2 E9 0000 E Video Parameters *************************************** VIDEO DISPLAY TYPE PARAMETER TABLES *************************************** WORD WORD WORD WORD WORD WORD WORD 1 2 3 4 5 6 7 IBM DISPLAY NUMBER # VERTICAL PELS / MICROMETER # HORIZONTAL PELS / MICROMETER TOTAL # OF VERTICAL PELS TOTAL # OF HORIZONTAL PELS HEIGHT OF PEL IN MICROMETER (VERTICAL DIRECTION) WIDTH OF PEL IN MICROMETER (HORIZONTAL DIRECTION) OFD5 OFD5 MONO_TBL LABEL WORD 5151 0000 0000 OW 5151H,0,0,0,0,0,0 0000 0000 0000 0000 OFE3 OFE3 CGA_TBL LABEL WORD 51530498 OA15 OW 5153H,498H,OAl5H,OC8H,280H,352H,184H 00C8 0280 0352 0184 OFF1 OFF1 LCO_CGA_TBL LABEL WORD 5140 08El 0987 OW 5140H,8ElH,987H,OC8H,280H,172H,172H ; TABLE FOR LCD 00C8 0280 0172 0172 AS A CGA DISPLAY LCD_MONO_TBL LABEL WORD 5140 0000 0000 OW 5140H,0,0,0,0,0,0 TABLE FOR LCD AS A MONO 0000 0000 0000 0000 DISPLAY OFFF OFFF TABLE FOR MONO DISPLAY RGB DISPLAY *************************************** VIDEO_IO SUBROUTINE ADDRESS TABLE *************************************** ORG 1045 1045 1045 1047 1049 104B 1040 104F 1051 1053 1055 1057 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 OF045H ORG 01045H ASSUME CS: ROMCODE, OS: DATA, ES: VIDEO_RAM M1 LABEL ; TBL OF RTNS WITHIN VIDEO I/O WORD OW OFFSET SET~OOE OW OFFSET SELCTYPE OW OFFSET SELCPOS OW OFFSET READ_CURSOR OW OFFSET REAO_LPEN OW OFFS ET ACLDISP_PAGE OW OFFS ET SCROLL_UP OW OFFSET SCROLL_DOWN OW OFFSET REAO_ACCURRENT OW OFFSET WRITE_ACCURRENT 2-230 ROM BIOS 1059 0000 105B 0000 1050 0000 105F 0000 1061 0000 1063 0000 = 0020 OW OW OW OW OW OW MIL OFFSET WRITE_CCURRENT OFFSET SELCOLOR OFFSET WRITE_DOT OFFSET READ_DOT OFFSET WRITE_TTY OFFSET VIDEO_STATE $-M1 EQU Video I/O Entry (VIDEO_IO) . *************************************** : VI DEO_I 0 ROUT! NE ENTRY PO I NT ; ** **** ******* * ** **** ** * ** ** ************ ;ORG OF065H ORG 01065H VIDEO_IO EQU JMP VIDEO_IO_1 1065 1065 1065 E9 0000 = Video Parameters ; VIDEO PARMAMETER TABLE ; *************************************** ;ORG OFOMH ORG 010MH VIDEO_PARMS LABEL 10M 10M BYTE INILTABLE 10M lOAB lOBO = 0010 10B4 38 28 20 OA 1F 06 19 1C 02 07 06 07 00 00 00 00 DB DB DB M4 EQU 38H ,28H, 2DH ,OAH, 1FH, 6, 19H 71 50 5A OA IF 06 19 1C 02 07 06 07 00 00 00 00 DB 7lH, 50H, 5AH, OAH, 1FH, 6, 19H DB DB 1CH,2,7,6,7 0,0,0,0 38 28 20 OA 7 F 06 64 70 02 01 06 07 00 00 00 00 DB 38H, 28H, 2DH, OAH, 7 FH, 6, 64H DB DB 70H,2,1,6,7 0,0,0,0 61 50 52 OF 19 06 19 19 02 00 08 OC 00 00 00 00 DB 61H, 50H, 52H ,OFH, 19H, 6, 19H 10DB 10EO 08 DB 19H, 2, ODH,OBH ,OCH 0,0,0,0 10E4 10E4 10E6 10E8 10EA 0800 1000 4000 4000 10BB lOCO 10C4 10CB 1000 1004 M5 LABEL OW OW OW OW SET UP FOR 40X25 1CH,2,7,6,7 0,0,0,0 $- VIDEO_PARMS WORD 2048 4096 16384 16384 SET UP FOR 80X25 SET UP FOR GRAPH I CS SET UP FOR 80X25 B&W TABLE OF REGEN LENGTHS 40X25 80X25 GRAPH I CS COLUMNS 10EC 10EC 28 28 50 50 28 28 50 50 M6 LABEL DB BYTE 40,40,80,80,40,40,80,80 ROM BIOS 2-231 LREG_TAB 10F4 10F4 2C 28 20 29 2A 2E IE 29 M7 LABEL DB BYTE ; TABLE OF MODE SETS 2CH,28H,2DH,29H,2AH,2EH,IEH,29H Memory Interrupt Hex 12 (MEMORY_SIZE_DET) ; - - - I NT 12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MEMORLS I ZCDET THIS ROUTINE DETERMINES THE AMOUNT OF MEMORY IN THE SYSTEM AS REPRESENTED BY MEMORLSIZE WORD. THE MEMORLSIZE WORD IS SET BY POST WHEN IT HAS DETERMINED HOW MUCH MEMORY IS USABLE. IT IS SET IN lK INCREMENTS ON 8K BYTE BOUNDRIES INPUT NO REGISTERS OUTPUT (AX) = NUMBER OF CONTIGUOUS lK BLOCKS OF MEMORY AS DETERMINED BY THE POWER ON SELF TEST ROUTINE ; 1841 1841 1841 1842 1845 1848 1849 184A IE E8 085C R Al 0013 R IF CF ORG ASSUME OS: DATA OF841H ORG 01841H MEMORLSIZE_DET PROC FAR PUSH OS CALL DDS MOV AX,MEMORLSlZE POP OS IRET MEMORLSIZE_DET ENDP SAVE SEGMENT GET VALUE RECOVER SEGMENT RETURN TO CALLER Equipment Interrupt Hex 11 (EQUIPMENT) ;--- INT 11 ----------------------------------------------------EQUIPMENT DETERMINATION THIS ROUTINE ATEMPTS TO DETERMINE WHAT OPTIONAL DEVICES ARE ATTACHED TO THE SYSTEM. INPUT NO REGISTERS THE EQUIPJLAG VARIABLE IS SET DURING THE POWER ON DIAGNOSTICS USING THE FOLLOWING HARDWARE ASSUMPTIONS: PORT 3FA = INTERRUPT ID REGISTER OF 8250 BITS 7-3 ARE ALWAYS 0 PORT 378 = OUTPUT PORT OF PRINTER -- 8255 PORT THAT CAN BE READ AS WELL AS WRITTEN OUTPUT (AX) IS SET, BIT SIGNIFICANT, TO INDICATE ATTACHED 1/0 BIT 15,14 = NUMBER OF PRINTERS ATTACHED BIT 13 = INTERNAL MODEM INSTALLED BIT 12 = GAME 1/0 ATTACHED BIT 11,10,9 = NUMBER OF SERIAL COMM DEVICES ATTACHED BIT 8 UNUSED BIT 7,6 = NUMBER OF DISKETTE DRIVES 00=1, 01=2 BIT 5,4 = INITIAL VIDEO MODE 00 UNUS ED 01 - 40X25 BW USING COLOR CARD 2-232 ROM BIOS 10 - 80X25 BW USING COLOR CARD 11 - 80X25 BW US I NG BW CARD BIT 3,2,1 = RESERVED BIT 0 = IPL FROM DISKETTE -- ALWAYS A 1 (SYSTEM DISKETTE INSTALLED) NO OTHER REGISTERS AFFECTED ORG 1840 1840 1840 184E 1851 1854 1855 1856 IE E8 085C Al 0010 IF CF OF840H ORG EQUIPMENT PUSH CALL MOV POP IRET EQUIPMENT 01840H FAR PROC 05 ODS AX,EQUIPJLAG OS SAVE SEGMENT REGISTER GET THE CURRENT SETTINGS RECOVER SEGMENT RETURN TO CALLER ENOP Cassette I/O Entry (No BIOS Support) . ************************************************* ~CASSETTE I/O ENTRY POINT (NO 8105 SUPPORT) . ************************************************* ;ORG 1859 = 1859 1859 E9 0000 OF859H ORG 01859H CASSETTE_IO EQU JMP SYS_SERVICES Character Generator Graphics 0-127 (CHAR_GEN_LO) SUBTTL ; ; ; CHARACTER GENERATOR GRAPHICS FOR 320X200 AND 640X200 GRAPHICS AND DEFAULT LCD CHARACTER GENERATOR FOR CHARACTERS OOH - 7 FH - - - - ------ - --- - - - - - - - - - - ---- - --- - - - --- - ------- -- ----------- - ------ -- ;ORG 1A6E 1A6E 1A6E 1A76 1A7E 1A86 1A8E 1A96 1A9E 1AA6 1AAE 00 00 3C 5A 3C 66 36 08 08 08 1C 08 08 08 00 00 FF CHARACTER GENERATOR LOW -- - ----- - - - - - - - --- - ---- -- --- - - - - - ------------- - ----- - ---- - - - - - --- --- OFA6EH ORG 01A6EH CHAR_GEN_LO LABEL BYTE 00 00 00 00 00 DB OOOH,OOOH,OOOH,OOOH,OOOH,OOOH,OOOH,OOOH 00 42 A5 A5 81 BO DB 03CH, 042H, OA5H, OA5H, 081H, OBOH, 05AH, 03CH 3C 7E DB DB FF C3 DB 03CH, 07EH, OOBH, OOBH, OFFH, OC3H, 066H, 03CH 3C 7F 7F 7F 3E 1C 036H, 07 FH, 07 FH, 07 FH, 03EH, 01CH, 008H, OOOH DB 00 1C 3E 7F 3E 1C 008H, 01CH, 03 EH, 07 FH, 03EH, 01CH, 008H, OOOH DB 00 3E 1C 7F 7F 36 01CH, 03EH, 01CH, 07 FH, 07 FH, 036H, 008H, 01CH DB 1C 1C 3E 7F 7F 36 DB 008H, 01CH, 03EH, 07 FH, 07 FH, 036H, 008H, OICH 1C 00 18 3C 3C 18 DB OOOH, OOOH, 018H, 03CH, 03CH, 018H, OOOH, OOOH 00 FF E7 C3 C3 E7 DB OFFH, OFFH, OE7H, OC3H, OC3H, OE7H, OFFH, OFFH 0_00 0_01 0_02 0_03 0_04 0_05 0_06 0_07 0_08 ROM BIOS 2-233 lAB6 lABE lAC6 lACE lAD6 lADE lAE6 lAEE lAF6 lAFE lB06 lBOE lB16 lB1E lB26 lB2E lB36 lB3E lB46 lB4E lB56 lB5E lB66 lB6E lB76 lB7E lB86 lB8E lB96 189E lBA6 lBAE IBB6 lBBE lBC6 lBCE IBD6 FF FF 00 00 3C 66 66 3C 00 00 FF FF C3 99 99 C3 FF FF 07 03 3E 66 66 66 3C 00 3C 66 66 66 3C 18 3C 18 08 DC 0 E OA OA 08 38 30 18 16 19 17 71 61 07 06 48 6B 3E E4 27 7C D6 12 40 70 7C 7F 7C 70 40 00 01 07 IF 7F IF 07 01 00 18 3C 7E 18 18 7E 3C 18 6C 6C 6C 6C 6C 00 6C 00 3 F 6A 6A 3A OA OA lA 00 78 EC 70 D8 6C 38 DC 78 00 00 00 00 7E 7E 7E 00 183C7E18 7E 3C 18 FF 18 3C 7E 5A 18 18 18 00 18 18 18 5A 7E 3C 18 00 00 DC 06 7 F 7F 06 OC 00 00 18 30 7F 7F 30 18 00 00 00 60 60 7F 7F 00 00 00 14 36 7F 7F 36 14 00 08 08 lC lC 3E 3E 7F 00 7F 3E 3E lC lC 08 08 00 00 00 00 00 00 00 00 00 30 30 30 30 30 00 30 00 36 36 14 00 00 00 00 00 OA OA 3F 14 7E 28 28 00 08 3E 68 3E DB 7E 08 00 01 3F 52 6C IB 35 76 00 lC 36 lC 3B 6E 66 38 00 18 18 30 00 00 00 00 00 06 DC 18 18 18 OC 06 00 30 18 DC DC OC 18 30 00 00 36 lC7F1C36 00 00 00 18 18 7E 18 18 00 00 00 00 00 00 00 18 18 30 00 00 00 7E 00 00 DB OOOH, OOOH, 03CH, 066H, 066H, 03CH, OOOH, OOOH D_09 DB OFFH, OFFH, OC3H, 099H, 099H, OC3H, OFFH, OFFH o_OA DB 007H, 003H, 03EH, 066H ,066H, 066H, 03CH, OOOH o_OB DB 03CH, 066H, 066H, 066H ,03CH, 018H, 03CH ,018H D_OC DB 008H, OOCH, OOEH, OOAH, OOAH, 008H, 038H, 030H D_Oo DB 018H, 016H, 019H, 017H, 071H, 061H, 007H, 006H D_OE DB 048H, 06BH, 03EH, OE4H, 027H, 07CH, 006H, 012H D_OF DB 040H, 070H, 07CH, 07 FH, 07CH, 070H, 040H, OOOH 0_10 DB 001H, 007H, 01 FH, 07 FH, 0IFH, 007H, 00 lH, OOOH D_11 DB 018H, 03CH, 07 EH, 018H, 018H, 07 EH, 03CH, 018H D_12 DB 06CH, 06CH. 06CH, 06CH, 06CH, OOOH, 06CH, OOOH D_13 DB 03 FH, 06AH, 06AH, 03AH, OOAH, OOAH, 0IAH, OOOH 0_14 DB 078H ,OECH, 070H, OD8H, 06CH, 038H, ODCH, 078H 0_15 DB OOOH, OOOH, OOOH, OOOH, 07EH, 07 EH, 07EH ,OOOH 0_16 DB 018H, 03CH, 07 EH, 018H, 07EH, 03CH, 018H, OFFH D_17 DB 018H, 03CH, 07EH, 05AH, 018H, 018H, 018H, OOOH D_18 DB 018H, 018H, 018H, 05AH, 07 EH, 03CH, 018H, OOOH 0_19 DB OOOH, OOCH, 006H, 07 FH, 07 FH, 006H, OOCH, OOOH D_1A DB OOOH, 018H, 030H, 07 FH, 07 FH ,030H, 0 18H, OOOH o_IB DB OOOH, OOOH, 060H, 060H, 07 FH, 07 FH, OOOH, OOOH D_1C DB OOOH, 014H, 036H, 07 FH, 07 FH, 036H, 014H, OOOH o_ID DB 008H, 008H, 01 CH, 0ICH, 03EH, 03EH, 07 FH, OOOH o_IE DB 07 FH, 03 EH, 03 EH, 0ICH, 0ICH, 008H, 008H, OOOH D_1F DB OOOH, OOOH, OOOH, OOOH ,OOOH, OOOH ,OOOH ,OOOH SP D_20 DB 030H, 030H, 030H, 030H, 030H, OOOH, 030H, OOOH D_21 DB 036H, 036H, 014H, OOOH, OOOH, OOOH, OOOH, OOOH " D_22 DB OOAH, OOAH, 03 FH, 014H, 07 EH, 028H, 028H, OOOH # D_23 DB OOSH, 03EH, 068H, 03EH, OOBH, 07 EH, OOSH, OOOH $ D_24 DB 001H, 03 FH, 052H, 06CH, 01 BH, 035H, 076H, OOOH % D_25 DB 01 CH, 036H, 0ICH, 03BH, 06EH, 066H, 03BH, OOOH D_26 DB 018H, 018H, 030H, OOOH, OOOH, OOOH, OOOH, OOOH D_27 DB 006H, OOCH, 018H, 0 18H, 018H, OOCH, 006H, OOOH D_28 DB 030H, 018H, OOCH, OOCH ,OOCH, 018H, 030H, OOOH DB OOOH, 036H, 0ICH, 07 FH, 0ICH, 036H, OOOH, OOOH * DB OOOH, 018H, 018H, 07EH, 018H, 018H, OOOH, OOOH + D_2B DB OOOH, OOOH, OOOH, OOOH, OOOH, 018H, 018H, 030H D_2C DB OOOH, OOOH, OOOH, 07 EH, OOOH, OOOH, OOOH, OOOH - D_20 2-234 ROM BIOS D_29 D_2A IBDE IBE6 IBEE IBF6 IBFE lC06 lCOE lC16 lCIE lC26 lC2E lC36 lC3E lC46 lC4E lC56 lC5E lC66 lC6E lC76 lC7E lCS6 lC8E lC96 lC9E lCA6 ICAE lCB6 lCBE lCC6 lCCE lC06 lCDE lCE6 lCEE lCF6 lCFE 00 00 18 03 40 IS 18 IS 3C 3C 7E 3C 3C OC IE 7E 3C lC 3C 7E 38 3C 3C 3C 38 00 18 00 18 06 06 00 00 30 30 3C 18 3E 3E lC 63 7C 7E 10 IE 7C 7C 7F 7F 7F 78 10 IF 66 66 3C 3C 1F 3C 67 67 78 7F 41 63 43 63 lC lC 7E 78 lC lC 7C 00 00 00 06 00 2C 00 18 00 66 00 66 00 lC 00 60 00 30 00 66 00 66 00 66 00 18 00 18 30 OC 00 00 00 18 00 66 00 41 00 OC 00 36 00 33 00 36 00 31 00 31 00 33 00 66 00 18 00 06 00 66 00 30 00 63 00 63 00 36 00 33 00 36 07 66 00 00 00 18 DB OOOH, OOOH, OOOH, OOOH, OOOH, 018H, 018H, OOOH D_2E DC 18 30 60 DB 003H, 006H, OOCH, 018H, 030H, 060H, 040H, OOOH D_2F 66 66 66 34 DB 018H, 02CH, 066H, 066H, 066H, 034H, 018H, OOOH o 0_30 38 18 18 18 DB 018H, 018H, 038H, 018H, 018H, DI8H, 03CH, OOOH D_31 66 OC 18 32 DB 03CH, 066H, 066H, OOCH, 0ISH, 032H, 07 EH, OOOH D_32 OC lC 06 66 DB 03CH, 066H, OOCH, 0ICH, 006H, 066H, 03CH, OOOH D_33 2C 6C 7E OC DB OOCH, 0ICH, 02CH, 06CH, 07EH, OOCH, 01 EH, OOOH 4 D_34 7C 66 06 66 DB 07EH, 060H, 07CH, 0,66H, 006H, 066H, 03CH, OOOH 5 0_35 60 7C 66 66 DB 0ICH, 030H, 060H, OlCH, 066H, 066H, 03CH, OOOH 6 0_36 4C OC 18 18 DB 07EH, 066H, 04CH, OOCH, 0 18H, 018H, 038H, OOOH 7 0_37 76 3C 6E 66 DB 03CH, 066H, 076H, 03CH, 06EH, 066H, 03CH, OOOH 8 0_38 66 3E 06 OC DB 03CH, 066H, 066H, 03 EH, 006H, OOCH, 038H, OOOH 0_39 18 00 00 18 DB OOOH, 018H, 018H, OOOH, OOOH, 018H, 018H, OOOH 0_3A 18 00 00 18 DB OOOH, 018H, 018H, OOOH, OOOH, 0l8H, 018H, 030H 0_3B 18 30 18 OC DB 006H, OOCH, 018H, 030H, 0 ISH, OOCH, 006H, OOOH < D_3C 7E 00 7E 00 DB OOOH, OOOH, 07 EH, OOOH, 07 EH, OOOH, OOOH, OOOH D_30 OC 06 OC 18 DB 030H, 018H, OOCH, 006H, OOCH, 0 18H, 030H, OOOH D_3E 26 OC 18 00 DB 03CH, 066H, 026H, OOCH, 018H, OOOH, 018H, OOOH D_3F 5D 55 5F 40 DB 03EH, 041H, 050H, 055H, 05FH, 040H, 03 EH, OOOH @ lC 16 3E 23 DB 0ICH, OOCH, 0ICH, 016H, 03 EH, 023H, 063H, OOOH A D_41 0_40 36 3E 33 33 DB 07CH, 036H, 036H, 03 EH, 033H, 033H, 07EH, OOOH B 0_42 61606031 DB OlDH, 033H, 061H, 060H, 060H, 031H, 01 EH, OOOH C 0_43 33 33 33 36 DB 07CH, 036H, 033H, 033H, 033H, 036H, 07CH, OOOH o D_44 34 3C 34 31 DB OlFH, 031H, 034H, 03CH, 034H, 031H, 07FH, OOOH E 0_45 34 3C 34 30 DB 07 FH, 031H, 034H, 03CH, 034H, 030H, 078H, OOOH F D_46 61 60 67 33 DB OlDH, 033H, 061H, 060H, 067H, 033H, 01 FH, OOOH G D_47 66 7 E 66 66 DB 066H, 066H, 066H, 07EH, 066H, 066H, 066H, OOOH H D_48 18 18 18 18 DB 03CH, 018H, 018H, 0 18H, 018H, 018H, 03CH, OOOH 0_49 06 06 66 66 DB 01 FH, 006H, 006H, 006H, 066H, 066H, 03CH, OOOH 0_4A 6C 78 6C 66 DB 067H, 066H, 06CH, 078H, 06CH, 066H, 067H, OOOH K D_4B 30 30 31 33 DB 078H, 030H, 030H, 030H, 031H, 033H, 07 FH, OOOH L 0_4C 77 7 F 6B 63 DB 041H, 063H, 077H, 07 FH, 06BH, 063H, 063H, OOOH M 0_4D 73 7B 6F 67 DB 043H, 063H, 073H, 07 BH, 06 FH, 067H, 063H, OOOH N 0_4E 63 63 63 36 DB 0ICH, 036H, 063H, 063H, 063H, 036H, OICH, OOOH o 0_4F 33 3E 30 30 DB 07 EH, 033H, 033H, 03 EH, 030H, 030H, 078H, OOOH PO_50 63 63 6B 36 DB 0ICH, 036H, 063H, 063H, 06BH, 036H, 0ICH, 007H Q 0_51 66 7C 6C 66 DB 07CH, 066H, 066H, 07CH, 06CH, 066H, 067H, OOOH R 0_52 ROM BIOS 2-235 ID06 IDOE ID16 IDlE ID26 ID2E ID36 ID3E 1046 ID4E ID56 ID5E ID66 ID6E ID76 ID7E ID86 1D8E ID96 ID9E IDA6 IDAE lDB6 lOBE IDC6 IDCE lDD6 lODE lDE6 IDEE lDF6 IDFE 1 E06 lEOE lE16 lElE lE26 67 3E 7C 7E 3C 63 3E 77 08 63 22 66 66 E7 3C 7E 7E IE IE 60 01 3C 3C 08 00 00 00 18 00 00 7B 70 6E 00 3C OE 3B 00 3E OE 3C 00 63 70 73 18 3C OC 6C 70 77 38 3C 00 6B 00 73 00 3C 00 30 00 06 00 78 00 7C 08 OC 00 3B 00 08 00 00 66 00 5A 00 63 00 62 00 63 00 66 00 66 00 66 00 18 00 30 00 DC 00 lC 00 00 FE 18 00 00 00 30 00 00 00 06 00 00 00 1B 00 00 3E 30 00 00 00 00 38 30 00 18 00 00 00 00 00 00 00 00 78 00 OF 00 00 00 00 18 00 00 00 00 00 00 70 3C OE 66 DB 03EH, 066H, 070H, 03CH, OOEH, 066H, 07CH, OOOH S D_53 18 18 18 18 D8 07 EH, 05AH, 018H, 018H, 018H, 018H ,03CH, OOOH T D_54 63 63 63 63 DB 063H ,063H, 063H, 063H, 063H, 063H, 03EH, OOOH U D_55 36 34 lC 18 DB 077H, 062H, 036H, 034H, 0ICH, 018H, 008H, OOOH V 0_56 6B 6B 3E 36 DB 063H, 063H, 06BH, 06BH ,03EH, 036H, 022H, OOOH W 0_57 3C 18 3C 66 DB 066H, 066H, 03CH, 018H, 03CH, 066H, 066H, OOOH X 0_58 34 18 18 18 DB OE7H, 066H, 034H, 018H, 018H, 018H, 03CH, OOOH Y D_59 4C 18 32 66 DB 07 EH, 066H ,04CH, 018H, 032H, 066H, 07 EH ,OOOH Z D_5A 18 18 18 18 DB 01 EH, 018H, 018H, 018H, 018H, 018H, 0 1EH, OOOH [ D_5B 18 OC 06 03 DB 060H, 030H, 018H, OOCH, 006H, 003H, 001H, OOOH BSL D_5C DC DC OC OC DB 03CH, OOCH ,OOCH, OOCH, OOCH, OOCH, G3CH ,GOOH J 36 63 00 00 DB 008H, 0 lCH, 036H, 063H, OOOH, OOOH, OOOH, OOOH CIR D_5E 0_50 00 00 00 00 DB OOOH, OOOH, OOOH, OOOH, OOOH, OOOH, OOOH, OFEH _ D_5F OC 00 00 00 DB 018H ,018H, OOCH ,OOOH, OOOH ,OOOH, OOOH, OOOH n 3C 66 IE 66 DB OOOH, OOOH, 03CH, 066H, 01 EH, 066H, 07BH, OOOH LC A D_61 3E 3B 33 3B DB 070H, 030H, 03EH, 03BH, 033H, 03BH, 06EH, OOOH LC B D_62 3E 66 60 66 DB OOOH, OOOH, 03EH ,066H, 060H, 066H, 03CH, OOOH LC C D_63 36 6E 66 66 DB OOEH, 006H, 036H, 06EH, 066H, 066H, 03BH, OOOH LC D D_64 D_60 3C 66 7E 60 DB OOOH, OODH, 03CH, 066H, 07EH, 060H, 03EH, OOOH LC E D_65 18 3E 18 18 DB OOEH, 01BH, 018H, 03 EH, 018H, 018H, 03CH, OOOH LC F D_66 3D 66 38 3 E DB OOOH, OOOH, 03DH, 066H, 038H, 03 EH, 063H, 03EH LC G D_67 36 3B 33 33 DB 070H, 030H, 036H, 03 BH, 033H, 033H ,073H, OOOH LC H 0_68 38 18 18 18 DB 018H, OOOH, 038H, 018H, 018H, DI8H, 03CH, OOOH LC I D_69 lC OC OC 6C DB OOCH, OOOH, 0ICH, OOCH, OOCH, 06CH, 06CH, 038H LC J D_6A 33 36 3C 36 DB 070H, 030H, 033H ,036H, 03CH ,036H, 077H, OOOH LC K D_6B 18 18 18 18 DB 038H, 018H ,D18H, 018H, 018H, 018H, 03CH, OOOH LC L D_6C 76 7F 6B 6B DB OOOH, OOOH, 076H, 07 FH, 06BH, 06BH, 06BH, OOOH LC M D_6D 76 3B 33 33 DB OOOH, OOOH, 076H, 03BH, 033H ,033H, 073H, OOOH LC N D_6E 3C 66 66 66 DB OOOH, OOOH, 03CH, 066H, 066H, 066H, 03CH, OOGH LC 0 D_6F 6E 33 33 3E DB OOOH, OOOH, 06EH, 033H, 033H, 03EH, 030H, 078H LC P D_70 3A 66 66 3E DB OOOH, OOOH, 03AH, 066H, 066H, 03EH, 006H ,OOFH LC Q D_71 6E 3B 33 30 DB OOOH, OOOH, 06EH, 03BH, 033H, 030H, 078H, OOOH LC R D_72 3E 70 3C OE DB OOOH, OOOH, 03EH, 070H, 03CH, OOEH, 07CH, OOOH LC S D_73 3 E 18 18 lA DB 008H, 018H, 03EH, 018H, 018H, 01AH, OOCH, OOOH LC T D_74 66 66 66 66 DB OOOH, OOOH, 066H, 066H, 066H, 066H, 03BH, OOOH LC U D_75 73 32 36 lC DB OOOH, OOOH, 073H, 032H, 036H, 01CH, 008H, OOOH LC V D_76 68 6B 7F 36 DB OOOH, OOOH, 06BH, 06BH, 07 FH, 036H, 022H, OOOH LC W D_77 2-236 ROM BIOS lE2E lE36 lE3E lE46 lE4E lE56 lE5E lE66 22 00 67 00 6C 00 7E OE OE 18 18 70 70 39 00 08 7F 00 00 00 00 38 00 00 18 00 18 00 18 00 4E 00 lC 7F 73 36 lC 36 DB OOOH, OOOH, 073H, 036H, 0 lCH, 036H, 067H, OOOH LC X D_78 77 33 lA OC DB OOOH, OOOH ,077H, 033H, 0 lAH, OOCH, 06CH, 038H LC Y D_79 7E 4C 18 32 DB OOOH, OOOH, 07EH, 04CH, 018H, 032H, 07EH, OOOH LC Z D_7A 18 70 18 18 DB OOEH, 018H, 018H, 070H, 0 18H, OI8H, OOEH, OOOH D_7B 18 00 18 18 DB o18H, 018H, 018H, OOOH, 0 18H, 018H, 018H, OOOH D_7C 18 OE 18 18 DB 070H, 018H, 018H, OOEH, 018H, 018H, 070H, OOOH D_7D 00 00 00 00 DB 039H, 04EH, OOOH ,OOOH, OOOH, OOOH, OOOH, OOOH - 008H, 0ICH, 0ICH, 036H, 026H, 063H, 07FH, 07 FH DELTA D_7F IC 36 26 63 DB D_7E Time of Day Entry (TIME_OF_DAY) . *************************************** TIME_OF _DAY ROUT! NE ENTRY PO I NT . *************************************** ;ORG lE6E = lE6E lE6E E9 0000 OFE6EH ORG 01E6EH T!ME_OF_DAY EQU JMP TOD_PROC Timer 0 Interrupt Handler (TIMER_INT) ; *************************************** ; TIMER 0 INTERRUPT HANDLER ADDRESS ; *************************************** ;ORG lEA5 lEA5 lEA5 E9 0000 = OFEA5H ORG 01EA5H TI MER_I NT EQU JMP TMRO_I NT8 BIOS Vector Table (VECTOR_TABLE) ; *************************************** BIOS VECTOR TABLE ; *******.******************************** ;ORG lEF3 lEF3 OFEF3H ORG 01EF3H VECTOILTABLE LABEL WORD HARDWARE INTERRUPTS ROM BIOS 2-237 1EF3 1EF5 1EF7 1EF9 1EFB 1EFD 1EFF 1F01 0000 0000 1F23 1F23 1F23 1F23 0000 1F23 DW DW OW OW OW DW OW OW OFFSET TMRO_INT8 OFFSET KYBD_INT9 OFFSET 011 OFFSET 011 OFFSET 011 OFFSET Dll OFFSET DSKLINTE OFFSET Dll VECTOR TABLE INTERRUPT 8 TIMER 0 INTERftUPT 9 KEYBOARD INTERRUPT A INTERRUPT B INTERRUPT C INTERRUPT D INTERRUPT E DISKETTE INTERRUPT F SOFTWARE INTERRUPTS 1F03 1F05 1F07 1 F09 1 FOB 1FOD 1 FOF 1Fll 1F13 1065 1840 1841 0000 0000 0000 0000 0000 0000 R R R E E E E E DW DW DW DW DW DW OW OW OW OF6DDH ;DW 1Fl5 1Fl? 1F19 1FlB 1FlD 1FlF 1F21 0000 0000 1F53 1F53 10M OFC7 02C6 OW OW OW OW DW OW DW R R R R ;ORG 1F23 OFF23H ORG OFFSET VIDEO_IO ; INT 10H OFFSET EQUIPMENT ; INT llH OFFSET MEMORLSIZE_DET ; INT 12H OFFSET DSKLIO INT 13H OFFSET COMMO_IO I NT 14H SYS_SERVICES I NT 15H OFFSET KYBD_IO INT 16H OFFSET PRLIO INT 17H OOOOOH I NT ISH (RESIDENT BASIC ST) ; SEGMENT (INT ISH FILLED IN BY SYS_SETUP ROUTINE) OFFSET SYS_BOOT INT 19H TOD_PROC I NT 1AH TIME OF DAY DUMMY_RETURN I NT 1BH KYBD BREAK AD DR DUMMY _RETURN TIMER BREAK ADDR INT 1CH VIDEO_PARMS VIDEO PARAMETERS I NT 1DH OFFSET DSKLBASE I NT 1EH DSKT PARAMETERS CHAR_GEN_HI I NT 1 FH PTR TO CHAR-GEN OlF23H Default Interrupt Services (DII) ~ ********************************************************************** ROUTINE-NAME: 011 FUNCTION: THIS ROUTINE IS UNUSED INTERRUPT LEVEL HANDLER INSTALLED BY POST FOR INTERRUPTS NOT USED BY BIOS. THIS ROUTINE RECORDS THE OCCURRENCE OF AN INTERRUPT IN INTR_FLAG AND PERFORMS A NON_SPECIFIC END_OF_INTERRUPT TO RESET THE INTERRUPT SERVICE. ENTRY CONDITIONS: PURPOSE OF ENTRY: UNUSED I NTERRUPT OCCURRED INPUT CONDITIONS: NONE RESTRICTIONS: NONE EXIT CONDITIONS: NORMAL EXIT CONDITIONS: INTRJLAG = 00-07 TO INDICATE IRPT # INTR_FLAG = OFFH WHEN NO HARDWARE IRPT FOUND ACTIVE THE INTERRUPTING LEVEL WILL BE MASKED IN THE INTERRUPT CONTROLLER IF POST IS NOT ACTIVE. ERROR EXIT CONDITIONS: NONE REGISTERS MODIFIED: NONE . ********************************************************************* IF23 1 F23 1F24 IF25 1F26 1E 52 50 E8 085C 011 PROC ASSUME OS: DATA PUSH OS PUSH OX PUSH AX CALL DDS 2-238 ROM BIOS NEAR SAVE REG AX CONTENTS IF29 IF2B IF2D IF2E IF30 IF32 BO E6 90 E4 OA 75 IF34 IF36 OB 20 AL ,OBH INTAOO,AL 20 CO 05 MOV OUT NOP IN OR JNZ B4 FF EB 08 90 MOV JMP AH,OFFH DILEXIT READ IN-SERVICE REG (FIND OUT WHAT LEVEL BEING SERVICED) GET LEVEL NO HARDWARE IN SERVICE? AL,INTAOO AL,AL HW_INT SET NO LEVEL IN SERVICE FLAG SET FLAG TO FF IF NON-HDWARE HARDWARE INTERRUPT OCCURRED IF39 IF39 E8 IF57 IF3C IF3E BO 20 E6 20 HW_INT: CALL MOV OUT GO MASK LEVEL, RETURN WITH AH INDICATING LEVEL MASKED SEND END OF INTERRUPT MASK-LEVEL AL, EOI INTAOO ,AL SAVE I NTRJLAG AND EX IT IF40 IF40 IF44 IF45 IF46 IF47 IF48 88 26 006B R 58 5A IF CF ;ORG IF53 Dll_EX IT: I NTR_FLAG, AH MOV POP AX POP DX DS POP IRET Dll ENDP OFF53H ORG SET FLAG RESTORE REG AX CONTENTS 01F53H ; ********************************************************************* ; DUMMY INTERRUPT RETURN ; ********************************************************************* IF53 IF53 1F54 DUMMY _RETURN IRET DUMMY _RETURN CF PROC FAR ENDP ; *************************************** PRINT SCREEN ROUTINE ENTRY ADDRESS ; *************************************** ;ORG IF54 = IF54 1 F54 E9 0000 OFF54H ORG 01 F54H PRINLSCREEN EQU JMP PRT _SCRN ; ********************************************************************** ; ROUTINE USED BY Dll HANDLER TO MASK THE INTERRUPT LVL BEING SERVICED IF57 IF57 IF58 IF5A IF5C IF5E IF60 1 F62 IF67 IF69 IF6B IF6D IF6F IF6F 1F70 IF71 ; ********************************************************************* 51 B4 E4 24 8A D2 F6 75 01 AO 07 C8 E4 06 0012 R 01 06 E4 21 OA C4 E6 21 59 C3 MASK-LEVEL PROC NEAR PUSH CX MOV AH,OI IN AL,IONMLCNTL AND AL,07 MOV CL, AL SHL AH,CL TEST POSLSTATUS, POSLACTIVE JNZ MASK_EXIT IN AL,INTAOI OR AL,AH OUT INTAOl,AL MASK-EXIT: POP CX RET MASK-LEVEL ENDP START AT LEVEL 0 READ HIGHEST LVL IN SERVICE JUST KEEP LEVEL BITS GET LEVEL AS SH I FT COUNT AH CONTAINS MASK FOR LEVEL ; POWER_ON_SELF_TEST ACTIVE? JUMP I F POST ACTIVE GET MASK VALUE MASK OFF LVL BEING SERVICED ROM BIOS 2-239 Hardware Power-on Reset Address ***************************************** POWER ON RESET VECTOR **************************************** ORG IFFO IFFO I FFO IFFI I FF3 IFF5 EA 0000 FOOO OFFFOH ORG P_O_R DB OW OW ROMCODE END 2-240 ROM BIOS oI FFOH LABEL OEAH OFFSET OFOOOH FAR POSTMAIN ENDS HARD CODE JUMP FAR OFFSET SEGMENT Release Date Marker TITLE BLDMARK.ASM ROMCODE SEGMENT BYTE PUBLI C 0000 ; ***************************************** MODULE RELEASE DATE MARKER . **************************************** 0000 OOOB 30 39 2F 31 33 2F 38 35 4C DB '09/13/85' ; REL EASE MARKER DB 'L' ;BUILD NUMBER System Model Byte ; ***************************************** P. C. MODEL BYTE FOR TH I S MODEL . **************************************** ;ORG 0009 OOOA F9 OFFFEH DB ROMCODE END OF9H ;THIS PC'S 10 ENDS ROM BIOS 2-241 2-242 ROM BIOS Notes: Notes: Notes: Notes: ---- ----- --- - ---------,- Hardware Reference Library Reader's Comment Form IBM PC Convertible Technical Reference Volume 2 55X8817 Your comments assist us in improving our publication; they are an important part of the input used for revisions. IBM may use and distribute any of the information you supply in any way it believes appropriate without incurring any obligation whatever. You may, of course, continue to use the information you supply. Please do not use this form for questions regarding setup, operation, or program support or for requests for additional publications. Instead, contact your authorized IBM PC Convertible dealer in your area. Comments: 111111 NO POSTAGE NECESSARY IF MAILED IN THE UNITED STATES BUSINESS REPLY MAIL FIRST CLASS PERMIT NO. 40 ARMONK, NEW YORK POSTAGE WILL BE PAID BY ADDRESSEE IBM CORPORATION DEPARTMENT 95H 11400 BURNET ROAD AUSTIN, TEXAS 78758 ......................................................................... ..... . ,'"' aJa4 PIO::I B.l alde~s ~ou op aseald ade.l © IBM Corp. 1986 All rights reserved. International Business Machines Corporation Po. Box 1328-W Boca Raton, Florida 33429-1328 Printed in the United States of America 55X8817 ---- - -----------, -®
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.3 Linearized : No XMP Toolkit : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37 Create Date : 2013:05:24 12:15:40-08:00 Modify Date : 2013:05:24 12:10:12-07:00 Metadata Date : 2013:05:24 12:10:12-07:00 Producer : Adobe Acrobat 9.53 Paper Capture Plug-in Format : application/pdf Document ID : uuid:de1bfe11-d7d5-2749-bf19-a97d2e2834a2 Instance ID : uuid:778d6855-374c-e94e-9a43-973aad34b0e1 Page Layout : SinglePage Page Mode : UseNone Page Count : 275EXIF Metadata provided by EXIF.tools