4 title CP
/DOS VioWrtCharStrAtt mapper
6 vioxxx
segment byte public 'vio'
7 assume
cs:vioxxx
,ds:nothing
,es:nothing
,ss:nothing
9 ; ************************************************************************* *
11 ; * MODULE: viowrtcharstratt Write character string with attribute
13 ; * FILE NAME: wchstra.asm
17 ; * push@ dword char_str
21 ; * push@ dword attribute
22 ; * push word vio handle
23 ; * call viowrtcharstr
26 ; * MODULES CALLED: BIOS int 10h
28 ; *************************************************************************
30 public viowrtcharstratt
36 full_scr_err equ
0001h
37 error_bvs_parameter equ
0002h
42 handle dw ?
; vio handle
43 attr dd ?
; attribute pointer
44 column dw ?
; column number
45 row dw ?
; starting position for output
46 lngth dw ?
; length of the string
47 addr dd ?
; string to be written (pointer)
50 viowrtcharstratt proc
far
51 Enter viowrtcharstratt
; push registers
54 sub ax,ax ; Start with clean error condition
55 mov dx,[bp].column
; get column number
56 cmp dl,80 ; check for upper boundry
57 jg error
; branch if illegal number
59 mov ax,[bp].row
; get row number
60 cmp al,25 ; check for upper boundry
61 jg error
; branch if illegal number
64 pushal
; Save registers in case int 10h
66 int 10h
; Set start cursor position
69 lds si,[bp].attr
; Set up attribute in BL
70 mov bl,byte ptr ds:[si]
71 lds si,[bp].addr
; DS:SI is pointer to string
73 ; ****************************
74 ; cmp bl,15 ; ** assume good attribute! **
75 ; jg error ; ****************************
77 top: mov al,byte ptr [si]
78 mov ah,09h ; set write char/attrib function code
79 mov cx,1 ; write only one character
80 pushal
; Save registers in case int 10h
82 int 10h
; Output one character
84 popal
; restore registers
88 cmp dl,80 ; Handle end of line condition
92 cmp dh,25 ; Handle end of screen condition
94 mov ax,full_scr_err
; Error in AX
98 pushal
; Save registers in case int 10h
100 int 10h
; Increment cursor position
103 cmp di,0 ; check if complete string is written
104 jne top
; else, go and write next character
106 sub ax,ax ; set no error code
108 error: mov ax,error_bvs_parameter
113 viowrtcharstratt endp