Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1401 lines
38 KiB

  1. ; SCCSID = @(#)uf.bios4.asm 1.10 7/3/95 Copyright Insignia Solutions Ltd.
  2. ; Author: J. Box (copied from Williams xt original)
  3. ; J. Kramskoy (added 1.disk parameter tables required for fixed disk.
  4. ; 2.ROM BASIC entry point.
  5. ; 3.Configuration parameters.)
  6. ; J. Koprowski (added two 2.88Mb Floppy table entries.)
  7. ;
  8. ; Purpose:
  9. ; provides Intel AT BIOS
  10. ;
  11. ; DUE TO LIMITATIONS IN EXE2BIN, we define
  12. ; the region 0 - 0xdfff (segment 0xf000) in file 'bios1.asm'
  13. ; and the region 0xe000 - 0xffff in this file
  14. ;
  15. ; each file should be SEPARATELY put through
  16. ; MASM,LINK, and EXE2BIN to produce 2 binary image files
  17. ; which get loaded into the appropriate regions during
  18. ; SoftPC startup.
  19. ORG2 MACRO trueOffset
  20. ORG trueOffset-0e000h
  21. ENDM
  22. TRACE_BOP MACRO text
  23. LOCAL over_the_name
  24. BOP 0f8h
  25. jmp SHORT over_the_name
  26. db '&text&'
  27. db 10, 0
  28. over_the_name:
  29. ENDM
  30. MODEL_BYTE = 0fch
  31. SUB_MODEL_BYTE = 1
  32. BIOS_LEVEL = 0
  33. ; INT & BOP numbers
  34. BIOS_RESET = 0
  35. BIOS_PRINT_SCREEN = 5
  36. BIOS_ILL_OP_INT = 6
  37. BIOS_TIMER_INT = 8
  38. BIOS_KB_INT = 9
  39. BIOS_DISK_INT = 0Dh
  40. BIOS_DISKETTE_INT = 0Eh
  41. BIOS_VIDEO_IO = 10h
  42. BIOS_EQUIPMENT = 11h
  43. BIOS_MEMORY_SIZE = 12h
  44. BIOS_DISK_IO = 13h
  45. BIOS_RS232_IO = 14h
  46. BIOS_CASSETTE_IO = 15h
  47. BIOS_KEYBOARD_IO = 16h
  48. BIOS_PRINTER_IO = 17h
  49. BIOS_ROM_BASIC = 18h
  50. BIOS_BOOT_STRAP = 19h
  51. BIOS_TIME_OF_DAY = 1Ah
  52. BIOS_KEYBOARD_BREAK = 1Bh
  53. BIOS_USER_TIMER = 1Ch
  54. BIOS_IDLE_POLL = 1Dh
  55. BIOS_DISKETTE_IO = 40h
  56. ; BOPs
  57. BIOS_BOOTSTRAP_1 = 90h
  58. BIOS_BOOTSTRAP_2 = 91h
  59. BIOS_BOOTSTRAP_3 = 92h
  60. BIOS_FL_OPERATION_1 = 0A0h
  61. BIOS_FL_OPERATION_2 = 0A1h
  62. BIOS_FL_OPERATION_3 = 0A2h
  63. BIOS_FL_RESET_2 = 0A3h
  64. BIOS_MOUSE_INT1 = 0BAh
  65. BIOS_MOUSE_INT2 = 0BBh
  66. BIOS_MOUSE_IO_LANGUAGE = 0BCh
  67. BIOS_MOUSE_IO_INTERRUPT = 0BDh
  68. BIOS_MOUSE_VIDEO_IO = 0BEh
  69. BIOS_CPU_QUIT = 0FEh
  70. ; addresses
  71. DOS_SEGMENT = 0
  72. DOS_OFFSET = 7C00h
  73. BIOS_ROM_SEGMENT = 0f000h
  74. DUMMY_INT_OFFSET = 0FF4Bh
  75. BIOS_PASTE_OFFSET = 0FF4Ch
  76. KB_INT_OFFSET = 0E987h
  77. KEYBOARD_IO_OFFSET = 0E82Eh
  78. RCPU_POLL_OFFSET = 0e850h
  79. RCPU_NOP_OFFSET = 0e950h
  80. RCPU_INT15_OFFSET = 0e970h
  81. RCPU_WAIT_INT_OFFSET = 00CE0h
  82. CASSETTE_IO_OFFSET = 0F859h
  83. TIMER_INT_OFFSET = 0FEA5h
  84. OLD_TIMER_INT_OFFSET = 0FF00h
  85. ILL_OP_INT_OFFSET = 0FF30h
  86. KEYBOARD_BREAK_INT_OFFSET = 0FF35h
  87. PRINT_SCREEN_INT_OFFSET = 0FF3Bh
  88. USER_TIMER_INT_OFFSET = 0FF41h
  89. RESET_OFFSET = 0E05Bh
  90. START_OFFSET = 0FFF0h
  91. PRINTER_IO_OFFSET = 0EFD2h
  92. ; useful stuff
  93. CR = 0Dh
  94. LF = 0Ah
  95. ; keyboard constants
  96. ; bits in kb_flag
  97. RIGHT_SHIFT = 1
  98. LEFT_SHIFT = 2
  99. CTL_SHIFT = 4
  100. ALT_SHIFT = 8
  101. ; bit in kb_flag_1
  102. HOLD_STATE = 8
  103. SCROLL_SHIFT = 10h
  104. NUM_SHIFT = 20h
  105. CAPS_SHIFT = 40h
  106. INS_SHIFT = 80h
  107. ; IBM scan codes
  108. CTL_KEY = 29
  109. LEFT_SHIFTKEY = 42
  110. RIGHT_SHIFTKEY = 54
  111. ALT_KEY = 56
  112. CAPS_KEY = 58
  113. NUM_KEY = 69
  114. SCROLL_KEY = 70
  115. INS_KEY = 82
  116. ; CMOS registers
  117. CMOS_addr = 070h
  118. CMOS_data = 071h
  119. NMI_DISABLE = 080h
  120. CMOS_StatusA = NMI_DISABLE + 0Ah
  121. CMOS_StatusB = NMI_DISABLE + 0Bh
  122. CMOS_StatusC = NMI_DISABLE + 0Ch
  123. CMOS_Shutdown = 0Fh
  124. ; CMOS constants (bits in StatusB or StatusC)
  125. CMOS_PI = 01000000b ; Periodic interrupt
  126. CMOS_AI = 00100000b ; Alarm interrupt
  127. ; microseconds at 1024Hz
  128. CMOS_PERIOD_USECS = 976
  129. ; ICA registers
  130. ICA_MASTER_CMD = 020h
  131. ICA_MASTER_IMR = 021h
  132. ICA_SLAVE_CMD = 0A0h
  133. ICA_SLAVE_IMR = 0A1h
  134. ; and commands
  135. ICA_EOI = 020h
  136. ; BIOS variables area
  137. BIOS_VAR_SEGMENT SEGMENT at 40h
  138. ORG 17h
  139. kb_flag DB ? ; 17
  140. kb_flag_1 DB ? ; 18
  141. ORG 03fh
  142. MOTOR_STATUS DB ? ; 3f
  143. MOTOR_COUNT DB ? ; 40
  144. ORG 06ch
  145. TIMER_COUNT DD ? ; 6c
  146. TIMER_OVFL DB ? ; 70
  147. ORG 098h
  148. rtc_user_flag DD ? ; 98
  149. rtc_micro_secs DD ? ; 9c
  150. rtc_wait_flag DB ? ; a0
  151. BIOS_VAR_SEGMENT ENDS
  152. ; Segment we jump to after booting
  153. DOS_seg SEGMENT at DOS_SEGMENT
  154. ORG DOS_OFFSET
  155. DOS_boot LABEL FAR
  156. DOS_seg ENDS
  157. ; To keep the binary file down to a sensible size, the code segment
  158. ; is at fe00 instead of f000. Far jumps are correctly assembled by
  159. ; using a second 'fake' segment, that just contains labels, and DOES
  160. ; start at f000.
  161. ref SEGMENT at 0F000h
  162. ;
  163. ; NB. the following addresses are allocated to SUN for DOS Windows 3.0.
  164. ; They are not to be used by anyone else.
  165. ; THIS AREA IS SUN PROPERTY - TRESPASSERS WILL BE PROSECUTED
  166. ; However please note that only the ranges below are reserved.
  167. ; Bios2 gets loaded at 0xfe00, so the following does not have any real
  168. ; effect other than to act as a warning.
  169. ;
  170. ORG 0
  171. sunroms_1 LABEL FAR
  172. db 1024 dup (0) ; reserved
  173. ORG 04000h
  174. sunroms_2 LABEL FAR
  175. db 512 dup (0) ; reserved
  176. ORG 05000h
  177. sunroms_3 LABEL FAR
  178. db 512 dup (0) ; reserved
  179. ;
  180. ; BACK TO INSIGNIA
  181. ;
  182. ORG RESET_OFFSET
  183. reset_ref LABEL FAR; Must match reset
  184. ref ENDS
  185. code SEGMENT
  186. ASSUME cs:code,ds:BIOS_VAR_SEGMENT
  187. ORG 0
  188. copyright:
  189. ifndef SOFTWINDOWS
  190. DB "4504512 SoftPC 4.00 (C)Copyright Insignia Solutions Inc. 1995"
  191. else
  192. DB "4504512 SoftWindows 2 (C)Copyright Insignia Solutions Inc. 1995"
  193. endif ; SOFTWINDOWS
  194. include bebop.inc
  195. ORG 40h
  196. DB 00h, 01h ; rom serial number
  197. ORG 5Bh
  198. reset LABEL FAR ; Must match reset_ref
  199. BOP %BIOS_RESET
  200. PRINT_MESSAGES
  201. INT 19h
  202. ; space to insert customer specific startup message
  203. ORG 80h
  204. oem_msg:
  205. DB " "
  206. ORG 100h
  207. serial_number:
  208. DB "(c) Insignia Inc"
  209. DB 15h, 3eh, 5fh, 20h
  210. ; this is a cunning encryption, do not change at all
  211. ORG 150h
  212. hfx_ifs_hdr:
  213. DB 0ffh, 0ffh, 0ffh, 0ffh
  214. DB "HFXREDIR"
  215. DB 00h, 02ch
  216. DB 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
  217. ; this is a fake IFS header to make DOS 4.01
  218. ; happy with HFX. Do not move/alter.
  219. ;
  220. ; Special host_unsimulate BOP to enable DEC code to do an IRET to this
  221. ; location. In this way SoftPC can crunch some Intel and DEC can use
  222. ; the same code that works on PCs, i.e. they don't need to change the IRET
  223. ; instructions.
  224. ;
  225. ORG 170h
  226. pcsa:
  227. INT 72h
  228. BOP BIOS_CPU_QUIT
  229. signatures:
  230. DB CR,LF
  231. ;
  232. ; signatures removed because Microsoft don't like to find Insignia credits.
  233. ;
  234. ORG 401h
  235. ; 23/7/93 MG WinSleuth must have the first two entries of the standard PC
  236. ; BIOS at the beginning of the table, otherwise it will fall
  237. ; over !
  238. disktab:
  239. ; Drive Type 1
  240. dw 0306
  241. db 04
  242. dw 0
  243. dw 0128
  244. db 0
  245. db 0
  246. db 0,0,0
  247. dw 0305
  248. db 17
  249. db 0
  250. ; Drive Type 2
  251. dw 615
  252. db 4
  253. dw 0
  254. dw 300
  255. db 0
  256. db 0
  257. db 0,0,0
  258. dw 615
  259. db 17
  260. db 0
  261. ; Drive Type 3
  262. dw 0 ; DISK PARAMETER BLOCK for drive type 3 (Our C: drive ALWAYS)
  263. ; (the #.of cylinders available gets patched in by fdisk_ioattach()
  264. ; in fdisk.c)
  265. db 4 ; 4 heads (for now)
  266. db 11 dup (0)
  267. db 17 ; 17 sectors per track
  268. db 0
  269. ; Drive Type 4
  270. dw 0 ; DISK PARAMETER BLOCK for drive type 4 (Our D: drive
  271. ; (if configured))
  272. db 4 ; 4 heads (for now)
  273. db 11 dup (0)
  274. db 17 ; 17 sectors per track
  275. db 0
  276. ; 45 unused blocks
  277. db 45*16 dup (0)
  278. ORG 06F2h
  279. boot_strap:
  280. jmp boot_strap_1
  281. ORG 06f5h
  282. ; CONFIGURATION PARAMETERS as defined in '86 BIOS.
  283. ; used for cassette i/o function
  284. conf_table:
  285. db 8 ; length of following table
  286. db 0 ; Pad on length above
  287. db MODEL_BYTE ; system model byte
  288. db SUB_MODEL_BYTE ; system model type
  289. db BIOS_LEVEL ; bios revision level
  290. db 70h ; 80 = DMA channel 3 used by bios
  291. ; 40 = cascaded interrupt level 2
  292. ; 20 = real time clock available
  293. ; 10 = kybd scan code hook 1Ah
  294. db 4 dup (0) ; reserved
  295. org 0700h
  296. boot_strap_1:
  297. BOP BIOS_BOOT_STRAP
  298. INT BIOS_DISK_IO
  299. BOP BIOS_BOOTSTRAP_1
  300. INT BIOS_DISK_IO
  301. BOP BIOS_BOOTSTRAP_2
  302. INT BIOS_DISK_IO
  303. BOP BIOS_BOOTSTRAP_3
  304. JMP DOS_boot ; To MessyDOS
  305. ORG 0739h
  306. rs232_io:
  307. BOP BIOS_RS232_IO
  308. IRET
  309. ORG2 KEYBOARD_IO_OFFSET
  310. keyboard_io:
  311. CMP AH, 1 ; Is it a "test if char available" call ?
  312. JZ nerd ; if so - to the nerd
  313. CMP AH, 11h ; Is it a "extended test if char available" call ?
  314. JZ nerd ; if so - to the nerd
  315. BOP BIOS_KEYBOARD_IO ; call BIOS keyboard function
  316. IRET ; Int return, restoring old status flags
  317. nerd:
  318. BOP BIOS_KEYBOARD_IO ; call BIOS keyboard function
  319. RETF 2 ; Return without trampling on the status flags
  320. ; loop to wait for a keyboard int - called as a recursive CPU
  321. ORG2 RCPU_POLL_OFFSET
  322. sti
  323. push ds
  324. mov ax,BIOS_VAR_SEGMENT
  325. mov ds,ax
  326. kw1: bop %BIOS_IDLE_POLL
  327. mov ax,WORD PTR DS:[1ah] ; bios kb buffer head
  328. cmp ax,WORD PTR DS:[1ch] ; bios kb buffer tail
  329. jz kw1
  330. pop ds
  331. bop %BIOS_CPU_QUIT
  332. ORG 087Eh
  333. shift_keys:
  334. DB INS_KEY,CAPS_KEY,NUM_KEY,SCROLL_KEY
  335. DB ALT_KEY,CTL_KEY,LEFT_SHIFTKEY,RIGHT_SHIFTKEY; K6
  336. shift_masks:
  337. DB INS_SHIFT,CAPS_SHIFT,NUM_SHIFT,SCROLL_SHIFT
  338. DB ALT_SHIFT,CTL_SHIFT,LEFT_SHIFT,RIGHT_SHIFT; K7
  339. ctl_n_table:
  340. DB 27, -1, 0, -1, -1, -1, 30, -1
  341. DB -1, -1, -1, 31, -1, 127, 148, 17
  342. DB 23, 5, 18, 20, 25, 21, 9, 15
  343. DB 16, 27, 29, 10, -1, 1, 19, 4
  344. DB 6, 7, 8, 10, 11, 12, -1, -1
  345. DB -1, -1, 28, 26, 24, 3, 22, 2
  346. DB 14, 13, -1, -1, -1, -1, 150, -1
  347. DB ' ', -1; K8
  348. ctl_f_table:
  349. DB 94, 95, 96, 97, 98, 99, 100, 101
  350. DB 102, 103, -1, -1, 119, 141, 132, 142
  351. DB 115, 143, 116, 144, 117, 145, 118, 146
  352. DB 147, -1, -1, -1, 137, 138; K9
  353. lowercase:
  354. DB 27, '1', '2', '3', '4', '5', '6', '7', '8', '9'
  355. DB '0', '-', '=', 8, 9, 'q', 'w', 'e', 'r', 't'
  356. DB 'y', 'u', 'i', 'o', 'p', '[', ']', 13, -1, 'a'
  357. DB 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 39
  358. DB 96, -1, 92, 'z', 'x', 'c', 'v', 'b', 'n', 'm'
  359. DB ',', '.', '/', -1, '*', -1, ' ', -1; K10
  360. lc_tbl_scan:
  361. DB 59, 60, 61, 62, 63, 64, 65, 66, 67, 68
  362. DB -1, -1
  363. base_case:
  364. DB 71, 72, 73, -1, 75, -1, 77, -1, 79, 80, 81, 82, 83
  365. DB -1, -1, 92, 133, 134; K15
  366. ORG 0940h
  367. kb_int_1:
  368. sti
  369. push ax
  370. bop %BIOS_KB_INT
  371. pop ax
  372. iret
  373. ; intel instructions for recursive CPU to read keyboard interrupts
  374. ; this is used something like this:
  375. ; while(!somecondition)
  376. ; host_simulate();
  377. ; or
  378. ; while((!somecondition)&&(!timout())
  379. ; host_simulate();
  380. ; The conditions can only be met by something (like a keyboard event)
  381. ; in the real world being put on the event queue and being processed.
  382. ; BUT
  383. ; we only process events when timer ticks go off, which only happens
  384. ; if the CPU executes for >20ms. So we sit in a loop waiting.
  385. ; We could exit the intel code on a particular flag, but to make this
  386. ; code less specific, we exit when the low order timer byte changes
  387. ; (Eg a timer tick has gone off). The C calling code from the base
  388. ; therefore
  389. ; a) does the real checking to see if conditions are met.
  390. ; b) doesn't need changing in a host specific manner.
  391. ;
  392. ; We can't just sit in C code waiting for keyboard events because then
  393. ; timer specific stuff (comms etc) wouldn't happen.
  394. ; We can't just do a short call to the recursive CPU because
  395. ; the API for timer ticks won't handle it well, Eg if we just say
  396. ; NOP
  397. ; NOP
  398. ; BOP %BIOS_CPU_QUIT
  399. ; the recursive CPU doesn't execute long enough for the timer tick
  400. ; to go off.
  401. ORG2 RCPU_NOP_OFFSET ; this just allows the CPU to handle an interrupt
  402. sti
  403. push ax
  404. push es
  405. mov ax,0
  406. mov es,ax
  407. mov ax,es:[46ch] ; read low order timer byte from 0x46c
  408. L1: cmp ax,es:[46ch] ; if its changed exit from recursive cpu
  409. je L1
  410. pop es
  411. pop ax
  412. bop %BIOS_CPU_QUIT
  413. ORG2 RCPU_INT15_OFFSET ; this specifically calls INT15
  414. int 15h
  415. jmp w1
  416. w3: bop %BIOS_CPU_QUIT
  417. w2: jmp w3
  418. w1: jmp w2
  419. ORG2 KB_INT_OFFSET
  420. jmp kb_int_1
  421. ORG 098Ah
  422. uppercase:
  423. DB 27, '!', '@', '#', '$', '%', '^', '&', '*', '('
  424. DB ')', '_', '+', 8, 0, 'Q', 'W', 'E', 'R', 'T'
  425. DB 'Y', 'U', 'I', 'O', 'P', '{', '}', 13, -1, 'A'
  426. DB 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"'
  427. DB 126, -1, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M'
  428. DB '<', '>', '?', -1, 0, -1, ' ', -1; K11
  429. ucase_scan:
  430. DB 84, 85, 86, 87, 88, 89, 90, 91, 92, 93
  431. DB -1, -1
  432. num_state:
  433. DB '7', '8', '9', '-', '4', '5', '6', '+', '1', '2', '3', '0', '.'
  434. DB -1, -1, 124, 135, 136; K14
  435. ORG 0A87h
  436. alt_table:
  437. DB 82, 79, 80, 81, 75, 76, 77, 71, 72, 73
  438. DB 16, 17, 18, 19, 20, 21, 22, 23, 24, 25
  439. DB 30, 31, 32, 33, 34, 35, 36, 37, 38, 44
  440. DB 45, 46, 47, 48, 49, 50 ; K30
  441. ; definitions used in diskette BIOS
  442. MOTOR_WAIT = 25h
  443. WRONG_MEDIA = 80h
  444. RS_500 = 00h
  445. RS_300 = 40h
  446. RS_250 = 80h
  447. RS_1000 = 0C0h
  448. ORG 0C00h
  449. rom_basic:
  450. BOP %BIOS_ROM_BASIC
  451. IRET
  452. ORG 0C49h
  453. diskette_io:
  454. BOP %BIOS_DISKETTE_IO
  455. RETF 2 ; exit, keeping flags
  456. ORG 0C50h
  457. dr_type:
  458. DB 01
  459. DW OFFSET md_tbl1
  460. DB 02 + WRONG_MEDIA
  461. DW OFFSET md_tbl2
  462. DB 02
  463. DW OFFSET md_tbl3
  464. DB 03
  465. DW OFFSET md_tbl4
  466. DB 04 + WRONG_MEDIA
  467. DW OFFSET md_tbl5
  468. DB 04
  469. DW OFFSET md_tbl6
  470. DB 05 + WRONG_MEDIA
  471. DW OFFSET md_tbl7
  472. DB 05 + WRONG_MEDIA
  473. DW OFFSET md_tbl8
  474. DB 05
  475. DW OFFSET md_tbl9
  476. ORG 0C6Bh
  477. md_tbl1:
  478. ; MEDIA = 40 track low data rate; DRIVE = 40 track low data rate
  479. DB 0DFh ; 1st specify byte
  480. DB 2 ; 2nd specify byte
  481. DB MOTOR_WAIT ; motor off wait time
  482. DB 2 ; ie 2 bytes/sector
  483. DB 9 ; sectors/track
  484. DB 02Ah ; gap length
  485. DB 0FFh ; data length
  486. DB 050h ; gap length for format
  487. DB 0F6h ; fill byte for format
  488. DB 15 ; head settle time/ms
  489. DB 8 ; ie 1s motor start time
  490. DB 39 ; maximum track number
  491. DB RS_250 ; transfer rate
  492. ORG 0C78h
  493. md_tbl2:
  494. ; MEDIA = 40 track low data rate; DRIVE = 80 track high data rate
  495. DB 0DFh ; 1st specify byte
  496. DB 2 ; 2nd specify byte
  497. DB MOTOR_WAIT ; motor off wait time
  498. DB 2 ; ie 2 bytes/sector
  499. DB 9 ; sectors/track
  500. DB 02Ah ; gap length
  501. DB 0FFh ; data length
  502. DB 050h ; gap length for format
  503. DB 0F6h ; fill byte for format
  504. DB 15 ; head settle time/ms
  505. DB 8 ; ie 1s motor start time
  506. DB 39 ; maximum track number
  507. DB RS_300 ; transfer rate
  508. ORG 0C85h
  509. md_tbl3:
  510. ; MEDIA = 80 track high data rate; DRIVE = 80 track high data rate
  511. DB 0DFh ; 1st specify byte
  512. DB 2 ; 2nd specify byte
  513. DB MOTOR_WAIT ; motor off wait time
  514. DB 2 ; ie 2 bytes/sector
  515. DB 15 ; sectors/track
  516. DB 01Bh ; gap length
  517. DB 0FFh ; data length
  518. DB 054h ; gap length for format
  519. DB 0F6h ; fill byte for format
  520. DB 15 ; head settle time/ms
  521. DB 8 ; ie 1s motor start time
  522. DB 79 ; maximum track number
  523. DB RS_500 ; transfer rate
  524. ORG 0C92h
  525. md_tbl4:
  526. ; MEDIA = 80 track low data rate; DRIVE = 80 track low data rate
  527. DB 0DFh ; 1st specify byte
  528. DB 2 ; 2nd specify byte
  529. DB MOTOR_WAIT ; motor off wait time
  530. DB 2 ; ie 2 bytes/sector
  531. DB 9 ; sectors/track
  532. DB 02Ah ; gap length
  533. DB 0FFh ; data length
  534. DB 050h ; gap length for format
  535. DB 0F6h ; fill byte for format
  536. DB 15 ; head settle time/ms
  537. DB 8 ; ie 1s motor start time
  538. DB 79 ; maximum track number
  539. DB RS_250 ; transfer rate
  540. ORG 0C9Fh
  541. md_tbl5:
  542. ; MEDIA = 80 track low data rate; DRIVE = 80 track high data rate
  543. DB 0DFh ; 1st specify byte
  544. DB 2 ; 2nd specify byte
  545. DB MOTOR_WAIT ; motor off wait time
  546. DB 2 ; ie 2 bytes/sector
  547. DB 9 ; sectors/track
  548. DB 02Ah ; gap length
  549. DB 0FFh ; data length
  550. DB 050h ; gap length for format
  551. DB 0F6h ; fill byte for format
  552. DB 15 ; head settle time/ms
  553. DB 8 ; ie 1s motor start time
  554. DB 79 ; maximum track number
  555. DB RS_250 ; transfer rate
  556. ORG 0CACh
  557. md_tbl6:
  558. ; MEDIA = 80 track high data rate; DRIVE = 80 track high data rate
  559. DB 0AFh ; 1st specify byte
  560. DB 2 ; 2nd specify byte
  561. DB MOTOR_WAIT ; motor off wait time
  562. DB 2 ; ie 2 bytes/sector
  563. DB 18 ; sectors/track
  564. DB 01Bh ; gap length
  565. DB 0FFh ; data length
  566. DB 06Ch ; gap length for format
  567. DB 0F6h ; fill byte for format
  568. DB 15 ; head settle time/ms
  569. DB 8 ; ie 1s motor start time
  570. DB 79 ; maximum track number
  571. DB RS_500 ; transfer rate
  572. ; new for 2.88M floppies
  573. ORG 0CB9h
  574. md_tbl7:
  575. ; MEDIA = 80 track low data rate; DRIVE = 80 track ext data rate
  576. DB 0AFh
  577. DB 2 ; 2nd specify byte (guessed from 1.4)
  578. DB MOTOR_WAIT ; motor wait time
  579. DB 2 ; ie 2 bytes/sector
  580. DB 9 ; sectors/track
  581. DB 01Bh ; gap length
  582. DB 0FFh ; data length
  583. DB 053h ; gap length for format
  584. DB 0F6h ; fill byte for format
  585. DB 15 ; head settle time/ms
  586. DB 8 ; ie 1s motor start time
  587. DB 79 ; maximum track number
  588. DB RS_250 ; transfer rate (guessed from 1.4)
  589. ORG 0CC6h
  590. md_tbl8:
  591. ; MEDIA = 80 track high data rate; DRIVE = 80 track ext data rate
  592. DB 0AFh
  593. DB 2 ; 2nd specify byte (guessed from 1.4)
  594. DB MOTOR_WAIT ; motor wait time
  595. DB 2 ; ie 2 bytes/sector
  596. DB 18 ; sectors/track
  597. DB 01Bh ; gap length
  598. DB 0FFh ; data length
  599. DB 053h ; gap length for format
  600. DB 0F6h ; fill byte for format
  601. DB 15 ; head settle time/ms
  602. DB 8 ; ie 1s motor start time
  603. DB 79 ; maximum track number
  604. DB RS_500 ; transfer rate (guessed from 1.4)
  605. ORG 0CD3h
  606. md_tbl9:
  607. ; MEDIA = 80 track ext data rate; DRIVE = 80 track ext data rate
  608. DB 0AFh ; 1st specify byte (guessed from 1.4)
  609. DB 2 ; 2nd specify byte (guessed from 1.4)
  610. DB MOTOR_WAIT ; motor wait time
  611. DB 2 ; ie 2 bytes/sector
  612. DB 36 ; sectors/track
  613. DB 01Bh ; gap length
  614. DB 0FFh ; data length
  615. DB 053h ; gap length for format
  616. DB 0F6h ; fill byte for format
  617. DB 15 ; head settle time/ms
  618. DB 8 ; ie 1s motor start time
  619. DB 79 ; maximum track number
  620. DB RS_1000 ; transfer rate (guessed from 1.4)
  621. ORG RCPU_WAIT_INT_OFFSET
  622. wait_int:
  623. PUSH DS
  624. PUSH CX
  625. MOV CX, BIOS_VAR_SEGMENT
  626. MOV DS, CX
  627. MOV CX, 0100H ; sufficient to take multiple interrupts
  628. wait_int_0:
  629. TEST byte ptr DS:[3EH], 80h
  630. LOOPZ wait_int_0
  631. POP CX
  632. POP DS
  633. BOP %BIOS_CPU_QUIT
  634. ORG 0D00h
  635. mouse_io:
  636. JMP hopover
  637. BOP %BIOS_MOUSE_IO_LANGUAGE
  638. RETF 8
  639. hopover:
  640. BOP %BIOS_MOUSE_IO_INTERRUPT
  641. IRET
  642. ORG 0D20h
  643. mouse_version: ; dummy, for compatibility
  644. DB 042h,042h,00h,00h
  645. ORG 0D40h
  646. mouse_copyright: ; dummy, for compatibility
  647. DB "Copyright 1987 Insignia Solutions Inc"
  648. ORG 0D80h
  649. mouse_video_io:
  650. BOP %BIOS_MOUSE_VIDEO_IO
  651. IRET
  652. ORG 0E00h
  653. mouse_int1:
  654. BOP %BIOS_MOUSE_INT1
  655. IRET
  656. ORG 0E80h
  657. mouse_int2:
  658. BOP %BIOS_MOUSE_INT2
  659. IRET
  660. ORG 0F57h
  661. diskette_int:
  662. BOP %BIOS_DISKETTE_INT
  663. IRET
  664. ORG 0FC7h
  665. disk_base:
  666. DB 0CFh ; 1st specify byte
  667. DB 2 ; 2nd specify byte
  668. DB MOTOR_WAIT ; motor off wait time
  669. DB 2 ; ie 2 bytes/sector
  670. DB 18 ; sectors/track
  671. DB 02Ah ; gap length
  672. DB 0FFh ; data length
  673. DB 050h ; gap length for format
  674. DB 0F6h ; fill byte for format
  675. DB 25 ; head settle time/ms
  676. DB 4 ; ie 1/2s motor start time
  677. ORG2 PRINTER_IO_OFFSET
  678. printer_io:
  679. BOP %BIOS_PRINTER_IO
  680. IRET
  681. ORG 1065h
  682. video_io:
  683. BOP %BIOS_VIDEO_IO
  684. IRET
  685. ORG 106ch
  686. INT 10h ; allows video handler to be recursive
  687. BOP %BIOS_CPU_QUIT
  688. ORG 10A4h
  689. vid_parm_setup:
  690. ; 40*25
  691. DB 038h, 028h, 02Dh, 0Ah, 01Fh, 6, 019h, 01Ch,2, 7, 6, 7,0,0,0,0
  692. ; 80*25
  693. DB 071h, 050h, 05Ah, 0Ah, 01Fh, 6, 019h, 01Ch,2, 7, 6, 7,0,0,0,0
  694. ; graphics
  695. DB 038h, 028h, 02Dh, 0Ah, 07Fh, 6, 064h, 070h,2, 1, 6, 7,0,0,0,0
  696. ; 80*25 BW
  697. DB 061h, 050h, 052h, 0Fh, 019h, 6, 019h, 019h,2,0Dh,0Bh,0Ch,0,0,0,0
  698. vid_len_setup:
  699. DW 2048 ; 40*25 screen size
  700. DW 4096 ; 80*25 screen size
  701. DW 16384; graphics
  702. DW 16384; graphics
  703. vid_col_setup:
  704. DB 40, 40, 80 , 80, 40, 40, 80, 80 ; screen columns
  705. vid_mode_setup:
  706. DB 2Ch, 28h, 2Dh, 29h, 2Ah, 2Eh, 1Eh, 29h ;mode register?
  707. ORG 1841h
  708. memory_size:
  709. BOP %BIOS_MEMORY_SIZE
  710. IRET
  711. ORG 184Dh
  712. equipment:
  713. BOP %BIOS_EQUIPMENT
  714. IRET
  715. ;;=======================================================================
  716. ;; INT 15h "Cassette IO" e.g. miscellaneous functions
  717. ;;
  718. ORG2 CASSETTE_IO_OFFSET
  719. cassette_io:
  720. sti
  721. cmp ah, 4fh ; Check frequent case (keyboard) first
  722. jne int15_not_kb
  723. mov ah, 86h ; AH = INVALID option code
  724. int15_fail: stc ; CF = 1, implies not OK
  725. retf 2
  726. ; Int 15h function 83h (other than the frequent kb enquiry)
  727. ;
  728. int15_not_kb: cmp ah, 83h ; INT15_EVENT_WAIT
  729. je int15_83
  730. cmp ah, 86h ; INT15_WAIT
  731. .386
  732. je int15_86
  733. cmp ah, 89h ; switch to protected mode
  734. je int15_89
  735. .286
  736. ;; Handle other cases in tape_io.c
  737. or ax, ax ; clear CF
  738. bop %BIOS_CASSETTE_IO
  739. retf 2
  740. ; Int 15h function 83h
  741. ;
  742. ; Change bit7 of byte at es:[bx] when cx::dx micro-seconds has passed.
  743. ;
  744. int15_83: cmp al, 0
  745. jnz int15_83_stop
  746. push ds
  747. mov ax, BIOS_VAR_SEGMENT
  748. mov ds, ax ; load up DS to point to BIOS data
  749. test rtc_wait_flag, 1 ; Test timer-in-use ?
  750. jnz int15_83_inuse
  751. ;; Set up address of user's flag byte
  752. mov word ptr ds:[rtc_user_flag], bx
  753. mov word ptr ds:[rtc_user_flag+2], es
  754. ;; Save mSec count to decrement
  755. mov word ptr ds:[rtc_micro_secs], dx
  756. mov word ptr ds:[rtc_micro_secs+2], cx
  757. ;; Produce a trace message if time "large", i.e. > 1,000,000 uS
  758. cmp cx, 0Fh ; 1000000. == 000F4240
  759. jb int15_83_small
  760. TRACE_BOP <int15/83: #cx #dx>
  761. int15_83_small:
  762. ;; Program the RTC to periodically interrupt at 1024Hz
  763. cli
  764. ;; Make sure PIC line for RTC is not masked
  765. in al, ICA_SLAVE_IMR
  766. and al, 11111110b ; RTC is slave line 0
  767. out ICA_SLAVE_IMR, al
  768. ;; Set time-of-day to 32768 Hz and periodic frequency 1024 Hz
  769. mov al, CMOS_StatusA
  770. out CMOS_addr, al
  771. mov al, 00100110b
  772. out CMOS_data, al
  773. ;; Enable PI interrupt in CMOS
  774. mov al, CMOS_StatusB
  775. out CMOS_addr, al
  776. in al, CMOS_data
  777. or al, 01000000b ; Enable PI interrupt
  778. out CMOS_data, al
  779. ;; Mark timer-in-use flag active
  780. mov rtc_wait_flag, 1; Show wait is active
  781. ;; All OK, return, enabling interrupts
  782. pop ds
  783. xor ah, ah ; AH = 0, CF = OK
  784. sti
  785. retf 2
  786. int15_83_stop: cli
  787. ;; Disable PI interrupt in CMOS
  788. mov al, CMOS_StatusB
  789. out CMOS_addr, al
  790. in al, CMOS_data
  791. and al, 10111111b ; Disable PI interrupt
  792. out CMOS_data, al
  793. ;; Clear the in-use flag, undocumented PC notes that
  794. ;; things will go horribly wrong if this call is used
  795. ;; at the wrong time!
  796. mov rtc_wait_flag, 0
  797. sti
  798. xor ax, ax ; and CF=0
  799. retf 2
  800. int15_83_inuse: pop ds
  801. jmp int15_fail
  802. ;
  803. ; Int 15h function 86h
  804. ; Wait given number of uSeconds. Quick events will change
  805. ; rtc_wait_flag when done...
  806. ;
  807. int15_86: push ds
  808. push es
  809. push bx
  810. mov ax, BIOS_VAR_SEGMENT
  811. mov ds, ax ; load up DS to point to BIOS data
  812. ;; We use the INT 15/83 function to update our rtc_wait_flag
  813. ;; when the requested number of micro-seconds has elapsed
  814. mov bx, OFFSET rtc_wait_flag
  815. mov ax, BIOS_VAR_SEGMENT
  816. mov es, ax
  817. mov ax, 8300h
  818. push ax ; Push fake flags
  819. push cs
  820. call int15_83 ; Do INT15/83
  821. jc int15_86_inuse ; Wait not available
  822. ;; Loop until rtc interrupt routine updates bit7 of
  823. ;; our supplied user flag.
  824. int15_wait: test rtc_wait_flag, 080h ; check for end of wait
  825. jz int15_wait
  826. ;; Clear the in-use flag
  827. mov rtc_wait_flag, 0
  828. ;; And return CF=0 (from test) to show completed OK
  829. pop bx
  830. pop es
  831. pop ds
  832. retf 2
  833. ;; Error exit, return with CF=1 (from jc)
  834. int15_86_inuse: pop bx
  835. pop es
  836. pop ds
  837. retf 2
  838. ;
  839. ; Int 15h function 89h
  840. ; Switch to virtual (protected) mode
  841. ; See At Tech ref BIOS1 listing (11/15/85) p 5-173 and following
  842. ;
  843. int15_89:
  844. BOP %BIOS_CASSETTE_IO ; handles ica and a20 line
  845. jc int15_89_exit ; no prot mode
  846. MOV word ptr [SI+38h],0ffffh ; seg limit
  847. MOV byte ptr [SI+3ch],0fh ; cs seg hi
  848. MOV word ptr [SI+3ah],0 ; cs seg lo
  849. MOV byte ptr [SI+3dh],10011011b ; cpl0 code access code
  850. MOV word ptr [SI+3eh],0 ; reserved
  851. ;LGDT [SI+8]
  852. DB 0fh,1,54h,8
  853. ;LIDT [SI+16]
  854. DB 0fh,1,5ch,16
  855. MOV AX,1
  856. ;LMSW AX
  857. DB 0fh,1,0f0h
  858. DB 0eah
  859. ; jump far to prot cs:vmode...
  860. DW offset vmode+0e000h
  861. DW 38h
  862. vmode:
  863. MOV AX,18h
  864. MOV DS,AX
  865. MOV AX,20h
  866. MOV ES,AX
  867. MOV AX,28h
  868. MOV SS,AX
  869. POP BX ; get return address
  870. ADD SP,4 ; get rid of cs and flags
  871. db 6ah,30h ; push new (prot mode) cs
  872. PUSH BX ; push return offset
  873. RETF
  874. int15_89_exit:
  875. retf 2
  876. ifndef GISP_SVGA
  877. ORG 1A6Eh
  878. crt_char_gen:
  879. DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; /* 0 */
  880. DB 07Eh, 081h, 0A5h, 081h, 0BDh, 099h, 081h, 07Eh ; /* 1 */
  881. DB 07Eh, 0FFh, 0DBh, 0FFh, 0C3h, 0E7h, 0FFh, 07Eh ; /* 2 */
  882. DB 06Ch, 0FEh, 0FEh, 0FEh, 07Ch, 038h, 010h, 000h ; /* 3 */
  883. DB 010h, 038h, 07Ch, 0FEh, 07Ch, 038h, 010h, 000h ; /* 4 */
  884. DB 038h, 07Ch, 038h, 0FEh, 0FEh, 07Ch, 038h, 07Ch ; /* 5 */
  885. DB 010h, 010h, 038h, 07Ch, 0FEh, 07Ch, 038h, 07Ch ; /* 6 */
  886. DB 000h, 000h, 018h, 03Ch, 03Ch, 018h, 000h, 000h ; /* 7 */
  887. DB 0FFh, 0FFh, 0E7h, 0C3h, 0C3h, 0E7h, 0FFh, 0FFh ; /* 8 */
  888. DB 000h, 03Ch, 066h, 042h, 042h, 066h, 03Ch, 000h ; /* 9 */
  889. DB 0FFh, 0C3h, 099h, 0BDh, 0BDh, 099h, 0C3h, 0FFh ; /* 10 */
  890. DB 00Fh, 007h, 00Fh, 07Dh, 0CCh, 0CCh, 0CCh, 078h ; /* 11 */
  891. DB 03Ch, 066h, 066h, 066h, 03Ch, 018h, 07Eh, 018h ; /* 12 */
  892. DB 03Fh, 033h, 03Fh, 030h, 030h, 030h, 070h, 0F0h ; /* 13 */
  893. DB 07Fh, 063h, 07Fh, 063h, 063h, 067h, 0E6h, 0C0h ; /* 14 */
  894. DB 099h, 05Ah, 03Ch, 0E7h, 0E7h, 03Ch, 05Ah, 099h ; /* 15 */
  895. DB 080h, 0E0h, 0F8h, 0FEh, 0F8h, 0E0h, 080h, 000h ; /* 16 */
  896. DB 002h, 00Eh, 03Eh, 0FEh, 03Eh, 00Eh, 002h, 000h ; /* 17 */
  897. DB 018h, 03Ch, 07Eh, 018h, 018h, 07Eh, 03Ch, 018h ; /* 18 */
  898. DB 066h, 066h, 066h, 066h, 066h, 000h, 066h, 000h ; /* 19 */
  899. DB 07Fh, 0DBh, 0DBh, 07Bh, 01Bh, 01Bh, 01Bh, 000h ; /* 20 */
  900. DB 03Eh, 063h, 038h, 06Ch, 06Ch, 038h, 0CCh, 078h ; /* 21 */
  901. DB 000h, 000h, 000h, 000h, 07Eh, 07Eh, 07Eh, 000h ; /* 22 */
  902. DB 018h, 03Ch, 07Eh, 018h, 07Eh, 03Ch, 018h, 0FFh ; /* 23 */
  903. DB 018h, 03Ch, 07Eh, 018h, 018h, 018h, 018h, 000h ; /* 24 */
  904. DB 018h, 018h, 018h, 018h, 07Eh, 03Ch, 018h, 000h ; /* 25 */
  905. DB 000h, 018h, 00Ch, 0FEh, 00Ch, 018h, 000h, 000h ; /* 26 */
  906. DB 000h, 030h, 060h, 0FEh, 060h, 030h, 000h, 000h ; /* 27 */
  907. DB 000h, 000h, 0C0h, 0C0h, 0C0h, 0FEh, 000h, 000h ; /* 28 */
  908. DB 000h, 024h, 066h, 0FFh, 066h, 024h, 000h, 000h ; /* 29 */
  909. DB 000h, 018h, 03Ch, 07Eh, 0FFh, 0FFh, 000h, 000h ; /* 30 */
  910. DB 000h, 0FFh, 0FFh, 07Eh, 03Ch, 018h, 000h, 000h ; /* 31 */
  911. DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; /* space */
  912. DB 030h, 078h, 078h, 030h, 030h, 000h, 030h, 000h ; /* ! */
  913. DB 06Ch, 06Ch, 06Ch, 000h, 000h, 000h, 000h, 000h ; /* " */
  914. DB 06Ch, 06Ch, 0FEh, 06Ch, 0FEh, 06Ch, 06Ch, 000h ; /* # */
  915. DB 030h, 07Ch, 0C0h, 078h, 00Ch, 0F8h, 030h, 000h ; /* $ */
  916. DB 000h, 0C6h, 0CCh, 018h, 030h, 066h, 0C6h, 000h ; /* % */
  917. DB 038h, 06Ch, 038h, 076h, 0DCh, 0CCh, 076h, 000h ; /* & */
  918. DB 060h, 060h, 0C0h, 000h, 000h, 000h, 000h, 000h ; /* ' */
  919. DB 018h, 030h, 060h, 060h, 060h, 030h, 018h, 000h ; /* ( */
  920. DB 060h, 030h, 018h, 018h, 018h, 030h, 060h, 000h ; /* ) */
  921. DB 000h, 066h, 03Ch, 0FFh, 03Ch, 066h, 000h, 000h ; /* * */
  922. DB 000h, 030h, 030h, 0FCh, 030h, 030h, 000h, 000h ; /* + */
  923. DB 000h, 000h, 000h, 000h, 000h, 030h, 030h, 060h ; /* , */
  924. DB 000h, 000h, 000h, 0FCh, 000h, 000h, 000h, 000h ; /* - */
  925. DB 000h, 000h, 000h, 000h, 000h, 030h, 030h, 000h ; /* . */
  926. DB 006h, 00Ch, 018h, 030h, 060h, 0C0h, 080h, 000h ; /* / */
  927. DB 07Ch, 0C6h, 0CEh, 0DEh, 0F6h, 0E6h, 07Ch, 000h ; /* 0 */
  928. DB 030h, 070h, 030h, 030h, 030h, 030h, 0FCh, 000h ; /* 1 */
  929. DB 078h, 0CCh, 00Ch, 038h, 060h, 0CCh, 0FCh, 000h ; /* 2 */
  930. DB 078h, 0CCh, 00Ch, 038h, 00Ch, 0CCh, 078h, 000h ; /* 3 */
  931. DB 01Ch, 03Ch, 06Ch, 0CCh, 0FEh, 00Ch, 01Eh, 000h ; /* 4 */
  932. DB 0FCh, 0C0h, 0F8h, 00Ch, 00Ch, 0CCh, 078h, 000h ; /* 5 */
  933. DB 038h, 060h, 0C0h, 0F8h, 0CCh, 0CCh, 078h, 000h ; /* 6 */
  934. DB 0FCh, 0CCh, 00Ch, 018h, 030h, 030h, 030h, 000h ; /* 7 */
  935. DB 078h, 0CCh, 0CCh, 078h, 0CCh, 0CCh, 078h, 000h ; /* 8 */
  936. DB 078h, 0CCh, 0CCh, 07Ch, 00Ch, 018h, 070h, 000h ; /* 9 */
  937. DB 000h, 030h, 030h, 000h, 000h, 030h, 030h, 000h ; /* : */
  938. DB 000h, 030h, 030h, 000h, 000h, 030h, 030h, 060h ; /* ; */
  939. DB 018h, 030h, 060h, 0C0h, 060h, 030h, 018h, 000h ; /* < */
  940. DB 000h, 000h, 0FCh, 000h, 000h, 0FCh, 000h, 000h ; /* = */
  941. DB 060h, 030h, 018h, 00Ch, 018h, 030h, 060h, 000h ; /* > */
  942. DB 078h, 0CCh, 00Ch, 018h, 030h, 000h, 030h, 000h ; /* ? */
  943. DB 07Ch, 0C6h, 0DEh, 0DEh, 0DEh, 0C0h, 078h, 000h ; /* @ */
  944. DB 030h, 078h, 0CCh, 0CCh, 0FCh, 0CCh, 0CCh, 000h ; /* A */
  945. DB 0FCh, 066h, 066h, 07Ch, 066h, 066h, 0FCh, 000h ; /* B */
  946. DB 03Ch, 066h, 0C0h, 0C0h, 0C0h, 066h, 03Ch, 000h ; /* C */
  947. DB 0F8h, 06Ch, 066h, 066h, 066h, 06Ch, 0F8h, 000h ; /* D */
  948. DB 0FEh, 062h, 068h, 078h, 068h, 062h, 0FEh, 000h ; /* E */
  949. DB 0FEh, 062h, 068h, 078h, 068h, 060h, 0F0h, 000h ; /* F */
  950. DB 03Ch, 066h, 0C0h, 0C0h, 0CEh, 066h, 03Eh, 000h ; /* G */
  951. DB 0CCh, 0CCh, 0CCh, 0FCh, 0CCh, 0CCh, 0CCh, 000h ; /* H */
  952. DB 078h, 030h, 030h, 030h, 030h, 030h, 078h, 000h ; /* I */
  953. DB 01Eh, 00Ch, 00Ch, 00Ch, 0CCh, 0CCh, 078h, 000h ; /* J */
  954. DB 0E6h, 066h, 06Ch, 078h, 06Ch, 066h, 0E6h, 000h ; /* K */
  955. DB 0F0h, 060h, 060h, 060h, 062h, 066h, 0FEh, 000h ; /* L */
  956. DB 0C6h, 0EEh, 0FEh, 0FEh, 0D6h, 0C6h, 0C6h, 000h ; /* M */
  957. DB 0C6h, 0E6h, 0F6h, 0DEh, 0CEh, 0C6h, 0C6h, 000h ; /* N */
  958. DB 038h, 06Ch, 0C6h, 0C6h, 0C6h, 06Ch, 038h, 000h ; /* O */
  959. DB 0FCh, 066h, 066h, 07Ch, 060h, 060h, 0F0h, 000h ; /* P */
  960. DB 078h, 0CCh, 0CCh, 0CCh, 0DCh, 078h, 01Ch, 000h ; /* Q */
  961. DB 0FCh, 066h, 066h, 07Ch, 06Ch, 066h, 0E6h, 000h ; /* R */
  962. DB 078h, 0CCh, 0E0h, 070h, 01Ch, 0CCh, 078h, 000h ; /* S */
  963. DB 0FCh, 0B4h, 030h, 030h, 030h, 030h, 078h, 000h ; /* T */
  964. DB 0CCh, 0CCh, 0CCh, 0CCh, 0CCh, 0CCh, 0FCh, 000h ; /* U */
  965. DB 0CCh, 0CCh, 0CCh, 0CCh, 0CCh, 078h, 030h, 000h ; /* V */
  966. DB 0C6h, 0C6h, 0C6h, 0D6h, 0FEh, 0EEh, 0C6h, 000h ; /* W */
  967. DB 0C6h, 0C6h, 06Ch, 038h, 038h, 06Ch, 0C6h, 000h ; /* X */
  968. DB 0CCh, 0CCh, 0CCh, 078h, 030h, 030h, 078h, 000h ; /* Y */
  969. DB 0FEh, 0C6h, 08Ch, 018h, 032h, 066h, 0FEh, 000h ; /* Z */
  970. DB 078h, 060h, 060h, 060h, 060h, 060h, 078h, 000h ; /* [ */
  971. DB 0C0h, 060h, 030h, 018h, 00Ch, 006h, 002h, 000h ; /* \ */
  972. DB 078h, 018h, 018h, 018h, 018h, 018h, 078h, 000h ; /* ] */
  973. DB 010h, 038h, 06Ch, 0C6h, 000h, 000h, 000h, 000h ; /* ^ */
  974. DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh ; /* _ */
  975. DB 030h, 030h, 018h, 000h, 000h, 000h, 000h, 000h ; /* ` */
  976. DB 000h, 000h, 078h, 00Ch, 07Ch, 0CCh, 076h, 000h ; /* a */
  977. DB 0E0h, 060h, 060h, 07Ch, 066h, 066h, 0DCh, 000h ; /* b */
  978. DB 000h, 000h, 078h, 0CCh, 0C0h, 0CCh, 078h, 000h ; /* c */
  979. DB 01Ch, 00Ch, 00Ch, 07Ch, 0CCh, 0CCh, 076h, 000h ; /* d */
  980. DB 000h, 000h, 078h, 0CCh, 0FCh, 0C0h, 078h, 000h ; /* e */
  981. DB 038h, 06Ch, 060h, 0F0h, 060h, 060h, 0F0h, 000h ; /* f */
  982. DB 000h, 000h, 076h, 0CCh, 0CCh, 07Ch, 00Ch, 0F8h ; /* g */
  983. DB 0E0h, 060h, 06Ch, 076h, 066h, 066h, 0E6h, 000h ; /* h */
  984. DB 030h, 000h, 070h, 030h, 030h, 030h, 078h, 000h ; /* i */
  985. DB 00Ch, 000h, 00Ch, 00Ch, 00Ch, 0CCh, 0CCh, 078h ; /* j */
  986. DB 0E0h, 060h, 066h, 06Ch, 078h, 06Ch, 0E6h, 000h ; /* k */
  987. DB 070h, 030h, 030h, 030h, 030h, 030h, 078h, 000h ; /* l */
  988. DB 000h, 000h, 0CCh, 0FEh, 0FEh, 0D6h, 0C6h, 000h ; /* m */
  989. DB 000h, 000h, 0F8h, 0CCh, 0CCh, 0CCh, 0CCh, 000h ; /* n */
  990. DB 000h, 000h, 078h, 0CCh, 0CCh, 0CCh, 078h, 000h ; /* o */
  991. DB 000h, 000h, 0DCh, 066h, 066h, 07Ch, 060h, 0F0h ; /* p */
  992. DB 000h, 000h, 076h, 0CCh, 0CCh, 07Ch, 00Ch, 01Eh ; /* q */
  993. DB 000h, 000h, 0DCh, 076h, 066h, 060h, 0F0h, 000h ; /* r */
  994. DB 000h, 000h, 07Ch, 0C0h, 078h, 00Ch, 0F8h, 000h ; /* s */
  995. DB 010h, 030h, 07Ch, 030h, 030h, 034h, 018h, 000h ; /* t */
  996. DB 000h, 000h, 0CCh, 0CCh, 0CCh, 0CCh, 076h, 000h ; /* u */
  997. DB 000h, 000h, 0CCh, 0CCh, 0CCh, 078h, 030h, 000h ; /* v */
  998. DB 000h, 000h, 0C6h, 0D6h, 0FEh, 0FEh, 06Ch, 000h ; /* w */
  999. DB 000h, 000h, 0C6h, 06Ch, 038h, 06Ch, 0C6h, 000h ; /* x */
  1000. DB 000h, 000h, 0CCh, 0CCh, 0CCh, 07Ch, 00Ch, 0F8h ; /* y */
  1001. DB 000h, 000h, 0FCh, 098h, 030h, 064h, 0FCh, 000h ; /* z */
  1002. DB 01Ch, 030h, 030h, 0E0h, 030h, 030h, 01Ch, 000h ; /* { */
  1003. DB 018h, 018h, 018h, 000h, 018h, 018h, 018h, 000h ; /* | */
  1004. DB 0E0h, 030h, 030h, 01Ch, 030h, 030h, 0E0h, 000h ; /* } */
  1005. DB 076h, 0DCh, 000h, 000h, 000h, 000h, 000h, 000h ; /* ~ */
  1006. DB 000h, 010h, 038h, 06Ch, 0C6h, 0C6h, 0FEh, 000h ; /* Delta */
  1007. endif ; GISP_SVGA
  1008. ORG 1E6Eh
  1009. time_of_day:
  1010. BOP %BIOS_TIME_OF_DAY
  1011. IRET
  1012. ORG2 TIMER_INT_OFFSET
  1013. ; The usual int8 handler modified for optimum performance.
  1014. ; - stays in Intel code (no BOP)
  1015. ; - keeps interrupts off when not needed
  1016. ; - calls int 1c directly
  1017. ;
  1018. push ds ; save some registers
  1019. push ax
  1020. mov ax, BIOS_VAR_SEGMENT
  1021. mov ds, ax
  1022. ; inc time counters
  1023. ; check for 24 hours, wrap point
  1024. .386
  1025. inc dword ptr ds:[TIMER_COUNT]
  1026. cmp dword ptr ds:[TIMER_COUNT], 0001800b0h
  1027. .286
  1028. jz i8v1
  1029. ; check for floppy motor
  1030. dec byte ptr ds:[MOTOR_COUNT]
  1031. jz i8v2 ; costly outb happens 1/256 timer tics...
  1032. ; Check for dummy_int in int1c vector
  1033. .386
  1034. cmp dword ptr ds:[BIOS_USER_TIMER*4], (BIOS_ROM_SEGMENT*10000h)+DUMMY_INT_OFFSET
  1035. .286
  1036. jnz i8v3
  1037. i8v0: ; send eoi
  1038. mov al, ICA_EOI
  1039. out ICA_MASTER_CMD, al
  1040. ; restore the stack and return
  1041. pop ax
  1042. pop ds
  1043. iret
  1044. ; handle 24-hour wrap
  1045. i8v1: .386
  1046. mov dword ptr ds:[TIMER_COUNT], 0
  1047. .286
  1048. mov byte ptr ds:[TIMER_OVFL], 1 ; 24 hour wrap, set OVFL bit
  1049. ; handle the floppy motor stuff
  1050. i8v2: and byte ptr ds:[MOTOR_STATUS], 0f0h
  1051. mov al, 0ch
  1052. push dx
  1053. mov dx, 03f2h
  1054. out dx, al
  1055. jmp i8v4 ; n.b. dx already pushed
  1056. ; Call user's timer handler (rare)
  1057. i8v3: push dx
  1058. i8v4: int BIOS_USER_TIMER
  1059. pop dx
  1060. jmp i8v0
  1061. ;For old SoftPC's (that dont like 486 instructions) we put the old slow code
  1062. ; in as well, and they use the BOP
  1063. ORG2 OLD_TIMER_INT_OFFSET
  1064. STI ;to let timer interrupt itself.
  1065. ;Save current state just like the real thing, so that
  1066. ;user timer routines know exactly which registers are
  1067. ;saved and which aren't.
  1068. PUSH DS
  1069. PUSH AX
  1070. PUSH DX
  1071. ;Now off to our code
  1072. BOP %BIOS_TIMER_INT
  1073. CLI ;to prevent interrupts until the IRET.
  1074. ;Non Specific End-Of-Interrupt
  1075. MOV AL,20h
  1076. OUT 20h,AL
  1077. ;Restore saved state
  1078. POP DX
  1079. POP AX
  1080. POP DS
  1081. ;Any lower priority interrupts should occur before the IRET
  1082. IRET
  1083. ;; The illegal Intel instruction handler
  1084. ORG2 ILL_OP_INT_OFFSET
  1085. BOP %BIOS_ILL_OP_INT
  1086. IRET
  1087. ;Software int's called from base, keyboard break, print screen, timer int
  1088. ; If one of the following three ORG's are changed, then SAS.H must also be
  1089. ; changed to reflect the new values.
  1090. ORG2 KEYBOARD_BREAK_INT_OFFSET
  1091. INT BIOS_KEYBOARD_BREAK
  1092. BOP %BIOS_CPU_QUIT
  1093. ORG2 PRINT_SCREEN_INT_OFFSET
  1094. INT BIOS_PRINT_SCREEN
  1095. BOP %BIOS_CPU_QUIT
  1096. ORG2 USER_TIMER_INT_OFFSET
  1097. INT BIOS_USER_TIMER
  1098. BOP %BIOS_CPU_QUIT
  1099. ORG2 DUMMY_INT_OFFSET
  1100. IRET
  1101. ; Called by the macintosh host to paste into the keyboard type-ahead buffer.
  1102. ; Called with AH=5, CL=scan code, and CH=ascii character.
  1103. ORG2 BIOS_PASTE_OFFSET
  1104. INT BIOS_KEYBOARD_IO ; call BIOS keyboard function
  1105. BOP %BIOS_CPU_QUIT
  1106. ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Print screen
  1107. ORG 1f54h
  1108. print_screen:
  1109. STI
  1110. PUSH AX
  1111. PUSH BX
  1112. PUSH CX
  1113. PUSH DX
  1114. PUSH DS
  1115. ;::::::::::::::::::::::::::::::::: Setup DS to point to BIOS data area
  1116. MOV AX,BIOS_VAR_SEGMENT
  1117. MOV DS,AX
  1118. ;::::::::::::::::::::::::::::::: Print screen already in progress ????
  1119. CMP BYTE PTR DS:[100H],1
  1120. JE end_print
  1121. ;::::::::::::::::::::::::::::::::::::::::::::::: Set print screen busy
  1122. MOV BYTE PTR DS:[100h],1
  1123. ;:::::::::::::::::::::::::::::::::::::::::::::::::::: Get video status
  1124. MOV AH,15
  1125. INT 10H
  1126. MOV CH,AH ;No of columns
  1127. ;:::::::::::::::::::::::::::::::::: Setup no. of columns/rows to print
  1128. MOV CL,BYTE PTR DS:[084h] ; No. of rows to print is rows in current mode
  1129. ;::::::::::::::::::::::::::::::::::: Print line feed / carriage return
  1130. CALL print_crlf
  1131. ;:::::::::::::::::::::::::::::::::::::::::: Get current cursor postion
  1132. PUSH CX
  1133. MOV AH,3
  1134. INT 10H
  1135. POP CX
  1136. ;::::::::::::::::::::::::::::::::::::::::::::::::: Save cursor postion
  1137. PUSH DX ;save current cursor postion
  1138. XOR DH,DH ;current row being processed
  1139. start_print_col:
  1140. XOR DL,DL ;current column being processed
  1141. ;::::::::::::::::::::::::::::::::::::::::::::::: Start printing screen
  1142. start_print_row:
  1143. ;:::::::::::::::::::::::::::::::::::::::::::::::::: Set cursor postion
  1144. PUSH DX ;save current row,column
  1145. MOV AH,2
  1146. INT 10H
  1147. ;::::::::::::::::::::::::::::::::::: Read character at current postion
  1148. MOV AH,8
  1149. INT 10H
  1150. ;::::::::::::::::::::::::::::::::::::::::::::::::::::: Print character
  1151. OR al,al
  1152. JNZ print_char
  1153. MOV AL,20H
  1154. print_char:
  1155. XOR DX,DX
  1156. XOR AH,AH
  1157. INT 17H
  1158. ;:::::::::::::::::::::::::::::::::::::::::::: Check for printer errors
  1159. POP DX ;Restore current row,column
  1160. AND AH,25H
  1161. JZ cont2
  1162. MOV BYTE PTR DS:[100H],0FFH
  1163. JMP short exit_print
  1164. ;::::::::::::::::::::::::::::::::::::::::::: Move to mext print column
  1165. cont2:
  1166. INC DL ;Inc current column
  1167. CMP DL,CH ;Current col compared to no. of cols
  1168. JB start_print_row
  1169. ;:::::::::::::::::::::::::::::::::::::::::: End of column, print CR/LF
  1170. CALL print_crlf
  1171. ;:::::::::::::::::::::::::::::::::::::::::::::::::: More rows to print
  1172. INC DH ;Inc current row
  1173. CMP DH,CL ;Current row compared to no. of rows
  1174. JBE start_print_col
  1175. MOV BYTE PTR DS:[0100H],0
  1176. ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Exit print
  1177. exit_print:
  1178. ;:::::::::::::::::::::::::::::::::::::; Restore orginal cursor postion
  1179. POP DX
  1180. MOV AH,2
  1181. INT 10H
  1182. ;:::::::::::::::::::::::::::::::::::::::::::::::::::: Tidy up and exit
  1183. end_print:
  1184. POP DS
  1185. POP DX
  1186. POP CX
  1187. POP BX
  1188. POP AX
  1189. IRET
  1190. ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Print CR/LF
  1191. print_crlf:
  1192. PUSH DX
  1193. XOR DX,DX
  1194. MOV AX,0DH
  1195. INT 17H
  1196. XOR DX,DX
  1197. MOV AX,0AH
  1198. INT 17H
  1199. POP DX
  1200. RET
  1201. ORG2 START_OFFSET
  1202. start_addr:
  1203. JMP reset_ref
  1204. date:
  1205. DB "07/03/95"
  1206. org 01ffeh
  1207. bios_tail:
  1208. DB MODEL_BYTE
  1209. code ENDS
  1210. END