home *** CD-ROM | disk | FTP | other *** search
- page 63, 132
- title Texas Instruments Video Bios Driver for version 2.1A
- ;****************************************************************************
- ;***** Title: Texas Intruments Video Bios Driver *****
- ;***** Program written by: John S. Kent Date: 84.07.15 *****
- ;***** Description: This module must perform 10 functions on the TI *****
- ;***** video display. The functions are: *****
- ;***** al = 0 set crt mode al = 1 set screen attribute *****
- ;***** al = 2 display chr & advance al = 3 position cursor *****
- ;***** al = 4 clear screen al = 5 erase to end of line *****
- ;***** al = 6 erase to end of screen al = 7 cursor to new line *****
- ;***** al = 8 move cursor backwards al = 9 cursor on *****
- ;***** al = A cursor off *****
- ;***** *****
- ;***** Modifications: Date: *****
- ;***** Description: *****
- ;***** *****
- ;****************************************************************************
- ; SCCS information:
- ;@(#) tivideo.asm ver. 1.2 last update 85/11/06 16:35:56
- ;@(#) This source obtained from the s file on 85/11/06 at 16:36:24
- bs equ 08H
- lf equ 0AH
- cr equ 0DH
- spc equ 20H
-
- max_line equ 24D
- max_column equ 80D
-
- set_cursor_type equ 01H ;TI ROM bios function #'s
- set_cursor_pos equ 02H
- get_cursor_pos equ 03H
- write_tty equ 0EH
- write_block equ 11H
- clr_text_scrn equ 13H
- clr_graphics equ 14H
- set_scrn_attr equ 16H
-
- crt_rom_bios equ 49H
-
- normal_attr equ 00001100B ;TI attributes, green in low intensity
- reverse_attr equ 00010000B
- blink_attr equ 01000000B
- hi_inten_attr equ 00000111B
- cursor_mask equ 01100000B
- cursor_off_attr equ 00100000B
- cursor_on_mask equ 01000000B
- cursor_off_mask equ 10011111B
-
- intensity_bit equ 00000001B ;rmc attributes
- reverse_bit equ 00000010B
- blink_bit equ 00000100B
-
-
- ; Having only one segment, CODE, greatly simplifies matters
- ;
- cgroup group code
-
- code segment byte public 'code'
- assume cs:cgroup, ds:cgroup, es:cgroup, ss:cgroup
- ; Must be a .COM type of file to link with the runtime using RMCLNK
- ; Hence, there must be an org 0100H and the first location
- ; must be the first instruction to execute
- org 0100H
- ;
- ;
- ; Must be a far routine when linked using RMCLNK and the runtime
- ; is configured to call this instead of its own bios driver.
- ;
- bios_ifc proc far
- mov bl, al ;get function request #
- xor bh, bh ;clear out hi order
- add bx, bx ;convert to word offset
- call word ptr cs:[bx + jmp_tbl] ;call function
- ret
- bios_ifc endp
- ;
- ; Have the data stuff next to ease the assembler's calculation
- ; of addresses.
- ;
-
- cursor_save_pos dw ?
- clr_line db max_column dup(spc)
- ;
-
-
- ;----------------------------------------------------------------------------
- ;----- Routine: bios_ifc (John S. Kent) -----
- ;----- Function: Parses command (in al) to correct function request. -----
- ;----- Entry: al = function request # (0 - 0AH) -----
- ;----- Exit: None. -----
- ;----- Calls: functions indirectly via a table. -----
- ;----- Registers: All presumed to be destroyed. -----
- ;----- Notes: -----
- ;----------------------------------------------------------------------------
- jmp_tbl dw offset cgroup:set_mode, offset cgroup:set_attr
- dw offset cgroup:display_chr, offset cgroup:pos_cursor
- dw offset cgroup:clr_scrn, offset cgroup:erase_eol
- dw offset cgroup:clr_eos, offset cgroup:new_line
- dw offset cgroup:backspace, offset cgroup:cursor_on
- dw offset cgroup:cursor_off
- ;----------------------------------------------------------------------------
- ;----- Routine: set_mode (John S. Kent) -----
- ;----- Function: Sets screen size to various line & column sizes, -----
- ;----- color or black and white, border color, and default -----
- ;----- display page. (all of these are ignored since the TI -----
- ;----- does not support variable line & column sizes and does -----
- ;----- not distinguish between color & black & white and does -----
- ;----- not have a border color and has only 1 avtive page. -----
- ;----- Entry: al = 0, ah = 0 (40X25 bw), 1 (80X25 color), -----
- ;----- 2 (80X25 bw), 3 (80X25 color). dl = default display -----
- ;----- page & dh = default border color. -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All are assumed destroyed. -----
- ;----- Notes: -----
- ;----------------------------------------------------------------------------
- set_mode:
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: set_attr (John S. Kent) -----
- ;----- Function: Sets crt attribute for all characters to be displayed -----
- ;----- until this function is called again. -----
- ;----- Entry: al = 1, ah = attribute (XXXXXbri) -----
- ;----- b = blink, r = reverse, & i = alternate intensity. -----
- ;----- dh = background color, dl = foreground color, ch = -----
- ;----- border color. (dx & ch are ignored since TI does not -----
- ;----- support these attributes) -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All registers are assumed to be destroyed. -----
- ;----- Notes: -----
- ;----------------------------------------------------------------------------
- set_attr:
- mov bl, normal_attr ;TI attribute
- test ah, intensity_bit ;RMC attribute
- jnz set_attr_rev ;skip if normal intensity
-
- or bl, hi_inten_attr ;set hi intensity
-
- set_attr_rev:
- test ah, reverse_bit ;check for reverse
- jz set_attr_blnk ;skip if no reverse
-
- or bl, reverse_attr ;set reverse
-
- set_attr_blnk:
- test ah, blink_bit ;check for blink
- jz set_attr_bios ;skip if no
-
- or bl, blink_attr ;set blink
-
- set_attr_bios:
- mov ah, set_scrn_attr ;get bios function # (set attributes)
- int crt_rom_bios ;call ROM bios
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: display_chr (John S. Kent) -----
- ;----- Function: Display character on screen & advance cursor. -----
- ;----- Entry: al = 2, ah = character. -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All presumed to be destroyed. -----
- ;----- Notes: cr, lf, bs, and bell are implemented (cause action). -----
- ;----------------------------------------------------------------------------
- display_chr:
- xchg ah, al ;get character into al
- mov ah, write_tty ;write ascii teletype function #
- int crt_rom_bios ;call ROM bios
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: pos_cursor (John S. Kent) -----
- ;----- Function: move cursor location to specified line & column. -----
- ;----- Entry: al = 3, ah = active page (ignored), dh = line, -----
- ;----- dl = column. -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All presummed to be destroyed. -----
- ;----- Notes: line & column are assumed to be 0 relative. -----
- ;----------------------------------------------------------------------------
- pos_cursor:
- mov ah, set_cursor_pos ;get set cursor position function #
- xchg dh, dl ;TI needs line in dl
- int crt_rom_bios ;call ROM bios
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: clr_scrn (John S. Kent) -----
- ;----- Function: Clears then screen to spaces and "homes" the cursor. -----
- ;----- Entry: al = 4, ah = background color. -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All presumed to be destroyed. -----
- ;----- Notes: -----
- ;----------------------------------------------------------------------------
- clr_scrn:
- mov ah, get_cursor_pos ;save cursor position
- int crt_rom_bios ;call ROM bios, returns current in DX
- mov ah, clr_text_scrn ;get clear test screen function #
- push dx ;save dx, current position
- int crt_rom_bios ;call ROM bios
- mov ah, clr_graphics ;get clear graphics screen function #
- int crt_rom_bios ;call ROM bios
- pop dx ;restore dx
- mov ah, set_cursor_pos ;restore cursor position
- int crt_rom_bios ;call ROM bios
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: erase_eol (John S. Kent) -----
- ;----- Function: Erase to end of line. -----
- ;----- Entry: al = 5, ah = background color. -----
- ;----- Exit: dx = column & line of cursor. -----
- ;----- Calls: -----
- ;----- Registers: All presumed to de destroyed. -----
- ;----- Notes: -----
- ;----------------------------------------------------------------------------
- erase_eol:
- mov ah, get_cursor_pos ;get read cursor position function #
- int crt_rom_bios ;call ROM bios (returns dh = column, dl = line)
- push dx ;save column (dh) & row (dl)
- mov bx, offset clr_line ;point to blank line
- mov cx, length clr_line ;get blank line length
- xchg dh, dl ;put column in low order
- xor dh, dh ;clear out high order
- sub cx, dx ;reset length to just to end of line
- dec cx ;make count 1 relative
- mov dx, DS ;pass segment of block
- mov ah, write_block ;get write blk of chrs only func. #
- int crt_rom_bios ;call ROM, bios
- pop dx ;restore cursor column & row (dh, dl)
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: clr_eos (John S. Kent) -----
- ;----- Function: Clear to end of screen. Clears text screen only. -----
- ;----- Entry: al = 6, ah = background color (ignored). -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All presumed to be destroyed. -----
- ;----- Notes: -----
- ;----------------------------------------------------------------------------
- clr_eos:
- mov ah, get_cursor_pos ;set up to save cursor position
- int crt_rom_bios ;call ROM bios
- push dx ;save cursor position
-
- clr_eos_lop:
- call erase_eol ;clear current line (rets dx = col, ln)
- cmp dl, max_line ;check for end of screen
- jae clr_ret ;return if done
-
- mov ah, set_cursor_pos ;get set cursor position function #
- inc dl ;point to next row
- xor dh, dh ;clear entire line (column = 0)
- int crt_rom_bios ;call ROM bios
- jmp clr_eos_lop ;clear this new line
-
- clr_ret:
- mov ah, set_cursor_pos ;set up to reposition cursor
- pop dx ;restore cursor position
- int crt_rom_bios ;call ROM bios
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: new_line (John S. Kent) -----
- ;----- Function: Advance cursor to new line, scroll screen if -----
- ;----- necessary. -----
- ;----- Entry: al = 7. -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All presumed to be destroyed. -----
- ;----- Notes: -----
- ;----------------------------------------------------------------------------
- new_line:
- mov ax, write_tty shl 8 + cr ;set up to output carriage return
- int crt_rom_bios ;call ROM bios
- mov ax, write_tty shl 8 + lf ;set up to output line feed
- int crt_rom_bios ;call ROM bios
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: backspace (John S. Kent) -----
- ;----- Function: Move cursor back on column on the screen, if @ column -----
- ;----- 0 then move to column 80 of previous line, if @ line 0 -----
- ;----- then cursor remains on this line. (?????) -----
- ;----- Entry: al = 8 -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All presumed to be destroyed. -----
- ;----- Notes: -----
- ;----------------------------------------------------------------------------
- backspace:
- mov ax, write_tty shl 8 + bs ;set up to do back space
- int crt_rom_bios
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: cursor_on (John S. Kent) -----
- ;----- Function: Turns the cursor on (makes visable). -----
- ;----- Entry: al = 9 -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All presumed to be destroyed. -----
- ;----- Notes: Destroys the blink attribute of cursor. -----
- ;----------------------------------------------------------------------------
- cursor_on:
- mov ah, get_cursor_pos ;get read cursor position function #
- int crt_rom_bios ;returns cx = cursor type
- mov bx, cx ;get cursor attributes into tmp reg
- and bh, cursor_mask ;mask out unwanted bits
- cmp bh, cursor_off_attr ;check for cursor off
- jne cursor_on_ret ;return if already on
-
- mov ch, cursor_on_mask ;else turn on with no blink (how else?)
- mov ah, set_cursor_type ;get set cursor type function #
- int crt_rom_bios ;call ROM bios
-
- cursor_on_ret:
- ret
-
- ;----------------------------------------------------------------------------
- ;----- Routine: cursor_off (John S. Kent) -----
- ;----- Function: turn cursor off (make cursor invisiable). -----
- ;----- Entry: al = 0AH. -----
- ;----- Exit: None. -----
- ;----- Calls: -----
- ;----- Registers: All presumed to be destroyed. -----
- ;----- Notes: Destroys last cursor blink attributes. -----
- ;----------------------------------------------------------------------------
- cursor_off:
- mov ah, get_cursor_pos ;get read cursor position
- int crt_rom_bios ;call ROM bios
- and ch, cursor_off_mask ;turn cursor off
- or ch, cursor_off_attr ;
- mov ah, set_cursor_type ;get set cursor type
- int crt_rom_bios
- ret
- ;
- bios_patch equ this byte
- ; Adjust the following db so code ends is in same place as in the ibm bios
- db 175 dup (90H)
- ;
- ; Sccs information :
- db '@ #( ) (@)#@(#)' ;SCCS id.
- db 'tivideo.asm' ;Program name % M %.
- db ' ver. '
- db '1.2' ;version % I %.
- db ' 85/11/06 ' ;date % E %.
- db '16:35:56' ;time % U %.
- db '>' ;Ending indicator.
- ;align to same length as ibmvideo
- ; Should have an address value here of 01B1
- code ends
-
- stack segment byte stack 'stack'
-
- stack ends
-
- ; Entry point is bios_ifc
- end bios_ifc
- s
-