|
pick
新手上路
积分 16
发帖 4
注册 2006-6-19
状态 离线
|
『楼 主』:
发一个汇编写的仿windows对话框
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; *程序说明*
;===============================================================================================
;
;
; 对话框是由线条和矩形组合而成,标准windows对话框一共使用了5种颜色,分别是:
; #D4D0C8,#0E296E,#FFFFFF,#808080,#404040.其中#D4D0C8是对话框主体颜色,
; #0E296E是标题栏颜色,其他三种颜色是对话框边框使用的颜色,对话框边框主要用于营
; 造对话框立体效果.
;
; 本程序由于使用的是640*480*16色显示模式,无法取到标准windows程序所需要的5种
; 颜色,所以使用相近的颜色进行替换.
;
; 我在网上找了好久关于640*480*16色模式的相关资料,最终还是没有找到详细的资料.
; 自己写了一个画点函数(程序中的DrawPointb),但是使用这个函数画矩形时有点问题,当颜色
; 号是奇数时正常,如果颜色号是偶数时,矩形将不能正确显示.本程序中使用的画点函数是在网
; 上找的,不过这个函数也有一点问题,就是速度非常慢,如果画点去添满整个屏幕,将使用好长的
; 时间.所以程序中的大背景是用我理解的那种方法画的,其他的都使用DrawPoint函数.如果谁
; 有比较详细的640*480*16色显示模式的相关资料,不要忘了告诉我.
;
; 汉字显示和用C语言显示的方式有点区别,因为在实模式下每个段最大容量是64K,而字库
; 文件有一百多K,所以不能一次将字库文件读入,我使用的方法是把字库文件打开,然后每显示
; 一个汉字,移动一次指针,将指针移动到响应的点阵然后读取一个字的点阵信息到内存,直到字符
; 串显示完毕.
;
; 如果程序要在裸机下运行,则需要将要显示的汉字的点阵信息从字库中提取出来.显示汉字
; 的子程序也要做相应的修改.
;
; 由于时间不是很宽裕,基本上没有写注释,各个函数的作用:
;
; 1.ConfirmTCan(按钮由确定状态变为取消状态)
; 2.CanTConfirm(按钮由取消状态变为确定状态)
; 3.ShowHanZi(显示汉字子程序)
; 4.DrawDialog(显示对话框子程序)
; 5.DrawButtonNoSelected(画一个未选中状态的按钮)
; 6.DrawButtonOnSelected(画一个选中状态的按钮)
; 7.DrawRect(画矩形子程序)
; 8.DrawPoint(画点子程序)
;
; ************Tab键或者方向键控制按钮焦点变换******************************
;
; e-mail:westdatas@163.com OICQ:19820914
; Nirvana 2006.8.1
;==============================================================================================
.286
data segment
flag db 0h
words db ''警告'',0
words0 db ''您确定要退出系统吗?'',0
words1 db ''确定'',0
words2 db ''取消'',0
words3 db ''开始'',0
hzk db ''HZK12'',0
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ax,12h
int 10h
mov ax,0A000h
mov es,ax
mov dx,03C4h
mov ax,0302h
out dx,ax
mov di,0
mov cx,38400
mov ax,0FFh
rep stosb
mov ax,100
push ax
mov ax,200
push ax
mov ax,120
push ax
mov ax,220
push ax
call DrawDialog
mov ax,22
push ax
mov ax,61
push ax
mov ax,180
push ax
mov ax,240
push ax
call DrawButtonNoSelected
mov ax,22
push ax
mov ax,61
push ax
mov ax,180
push ax
mov ax,340
push ax
call DrawButtonOnSelected
mov ax,25
push ax
mov ax,640
push ax
mov ax,456
push ax
mov ax,0
push ax
call DrawButtonNoSelected
mov ax,20
push ax
mov ax,40
push ax
mov ax,458
push ax
mov ax,2
push ax
call DrawButtonNoSelected
mov ax,0fh
push ax
mov ax,offset hzk
push ax
mov ax,offset words
push ax
mov ax,12
push ax
mov ax,126
push ax
mov ax,226
push ax
call ShowHanZi
mov ax,00h
push ax
mov ax,offset hzk
push ax
mov ax,offset words0
push ax
mov ax,12
push ax
mov ax,156
push ax
mov ax,258
push ax
call ShowHanZi
mov ax,00h
push ax
mov ax,offset hzk
push ax
mov ax,offset words1
push ax
mov ax,20
push ax
mov ax,184
push ax
mov ax,254
push ax
call ShowHanZi
mov ax,00h
push ax
mov ax,offset hzk
push ax
mov ax,offset words2
push ax
mov ax,20
push ax
mov ax,184
push ax
mov ax,354
push ax
call ShowHanZi
mov ax,00h
push ax
mov ax,offset hzk
push ax
mov ax,offset words3
push ax
mov ax,15
push ax
mov ax,462
push ax
mov ax,8
push ax
call ShowHanZi
WaitPress:
mov ah,00h
int 16h
cmp ah,01ch
jz DealEnter
cmp ah,04bh
jz DealDitKey
cmp ah,048h
jz DealDitKey
cmp ah,04dh
jz DealDitKey
cmp ah,050h
jz DealDitKey
cmp ah,0fh
jz DealDitKey
jmp WaitPress
DealEnter:
cmp flag,1
jz Exit
jmp WaitPress
DealDitKey:
cmp flag,1
jz CTC
call CanTConfirm
xor flag,1
jmp WaitPress
CTC:
call ConfirmTCan
xor flag,1
jmp WaitPress
Exit:
mov ax,4c01h
int 21h
ConfirmTCan proc
mov ax,22
push ax
mov ax,61
push ax
mov ax,180
push ax
mov ax,240
push ax
call DrawButtonNoSelected
mov ax,00h
push ax
mov ax,offset hzk
push ax
mov ax,offset words1
push ax
mov ax,20
push ax
mov ax,184
push ax
mov ax,254
push ax
call ShowHanZi
mov ax,22
push ax
mov ax,61
push ax
mov ax,180
push ax
mov ax,340
push ax
call DrawButtonOnSelected
mov ax,00h
push ax
mov ax,offset hzk
push ax
mov ax,offset words2
push ax
mov ax,20
push ax
mov ax,184
push ax
mov ax,354
push ax
call ShowHanZi
ret
ConfirmTCan endp
CanTConfirm proc
mov ax,22
push ax
mov ax,61
push ax
mov ax,180
push ax
mov ax,240
push ax
call DrawButtonOnSelected
mov ax,00h
push ax
mov ax,offset hzk
push ax
mov ax,offset words1
push ax
mov ax,20
push ax
mov ax,184
push ax
mov ax,254
push ax
call ShowHanZi
mov ax,22
push ax
mov ax,61
push ax
mov ax,180
push ax
mov ax,340
push ax
call DrawButtonNoSelected
mov ax,00h
push ax
mov ax,offset hzk
push ax
mov ax,offset words2
push ax
mov ax,20
push ax
mov ax,184
push ax
mov ax,354
push ax
call ShowHanZi
ret
CanTConfirm endp
ShowHanZi proc ;(X[bp+4],Y[bp+6],Dis[bp+8],WordsPtr[bp+10],ZiKuPtr[bp+12],Color[bp+14])
push bp
mov bp,sp
sub sp,30 ;x[bp-2],y[bp-4],handle[bp-6]
pusha
mov dx,[bp+12]
mov ax,3d00h
int 21h
mov [bp-6],ax
jnc shzNextC
mov word ptr[bp+12],1
shzExitZz:
jmp shzExit
shzNextC:
mov si,[bp+10]
mov ax,[si]
cmp al,0
jz shzExitZz
sub ax,0a1a1h
mov dl,ah
mov ah,94
mul ah
mov dh,0
add ax,dx
mov dx,24
mul dx
mov cx,dx
mov dx,ax
mov bx,[bp-6]
mov ax,4200h
int 21h
mov cx,24
push ds
mov ax,ss
mov ds,ax
mov ah,03fh
mov dx,bp
sub dx,30
mov bx,[bp-6]
int 21h
pop ds
mov si,0
mov bx,[bp+12]
mov ax,[bp+4]
mov [bp-2],ax
mov ax,[bp+6]
mov [bp-4],ax
mov cx,12
shzNextRow:
push cx
mov cx,12
mov dx,08000h
shzNextCol:
mov ax,[bp-30][si]
xchg ah,al
test ax,dx
jz shzNotDraw
push [bp+14]
push [bp-4]
push [bp-2]
call DrawPoint
shzNotDraw:
inc word ptr[bp-2]
shr dx,1
loop shzNextCol
pop cx
add si,2
inc word ptr[bp-4]
mov ax,[bp+4]
mov [bp-2],ax
loop shzNextRow
add word ptr[bp+10],2
mov ax,[bp+8]
add word ptr[bp+4],ax
jmp shzNextC
shzExit:
mov ah,03eh
mov bx,[bp-6]
int 21h
popa
add sp,30
pop bp
ret 12
ShowHanZi endp
DrawDialog proc ;(x [bp+4],y [bp+6],width [bp+8],height [bp+10])
push bp
mov bp,sp
push ax
;///////////////////////main window///////////////
mov ax,07h
push ax
mov ax,[bp+10]
push ax
mov ax,[bp+8]
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
push ax
call DrawRect
;/////////////////////////////////////////////////
;/////////////////////////blue banner/////////////
mov ax,01h
push ax
mov ax,20
push ax
mov ax,[bp+8]
sub ax,6
push ax
mov ax,[bp+6]
add ax,3
push ax
mov ax,[bp+4]
add ax,3
push ax
call DrawRect
;/////////////////////////////////////////////////
;///////////////////////Left white////////////////
mov ax,0fh
push ax
mov ax,[bp+10]
sub ax,3
push ax
mov ax,1
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;/////////////////////////////////////////////////
;//////////////////////upper white////////////////
mov ax,0fh
push ax
mov ax,1
push ax
mov ax,[bp+8]
sub ax,3
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;///////////////////////////////////////////////
;/////////////////////right gray////////////////
mov ax,08h
push ax
mov ax,[bp+10]
sub ax,2
push ax
mov ax,1
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
add ax,[bp+8]
sub ax,1
push ax
call DrawRect
;/////////////////////////////////////////////////
;/////////////////////right black/////////////////
mov ax,00h
push ax
mov ax,[bp+10]
push ax
mov ax,1
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
add ax,[bp+8]
sub ax,1
push ax
call DrawRect
;////////////////////////////////////////////////
;//////////////////////bottom gray///////////////
mov ax,08h
push ax
mov ax,1
push ax
mov ax,[bp+8]
sub ax,2
push ax
mov ax,[bp+6]
add ax,[bp+10]
sub ax,2
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;////////////////////////////////////////////////
;/////////////////////bottom black///////////////
mov ax,00h
push ax
mov ax,1
push ax
mov ax,[bp+8]
push ax
mov ax,[bp+6]
add ax,[bp+10]
sub ax,1
push ax
mov ax,[bp+4]
push ax
call DrawRect
pop ax
pop bp
ret 8
DrawDialog endp
DrawButtonNoSelected proc ;(x [bp+4],y [bp+6],width [bp+8],height [bp+10])
push bp
mov bp,sp
push ax
;///////////////////////main window///////////////
mov ax,07h
push ax
mov ax,[bp+10]
push ax
mov ax,[bp+8]
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
push ax
call DrawRect
;////////////////////////////////////////////////
;///////////////////////Left Black///////////////
mov ax,00h
push ax
mov ax,[bp+10]
dec ax
push ax
mov ax,1
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
push ax
call DrawRect
;/////////////////////////////////////////////////
;//////////////////////Top Black//////////////////
mov ax,00h
push ax
mov ax,1
push ax
mov ax,[bp+8]
dec ax
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
push ax
call DrawRect
;/////////////////////////////////////////////////
;///////////////////////Left white////////////////
mov ax,0fh
push ax
mov ax,[bp+10]
sub ax,3
push ax
mov ax,1
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;/////////////////////////////////////////////////
;//////////////////////upper white////////////////
mov ax,0fh
push ax
mov ax,1
push ax
mov ax,[bp+8]
sub ax,3
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;///////////////////////////////////////////////
;/////////////////////right gray////////////////
mov ax,08h
push ax
mov ax,[bp+10]
sub ax,2
push ax
mov ax,1
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
add ax,[bp+8]
sub ax,1
push ax
call DrawRect
;/////////////////////////////////////////////////
;/////////////////////right black/////////////////
mov ax,00h
push ax
mov ax,[bp+10]
push ax
mov ax,1
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
add ax,[bp+8]
sub ax,1
push ax
call DrawRect
;////////////////////////////////////////////////
;//////////////////////bottom gray///////////////
mov ax,08h
push ax
mov ax,1
push ax
mov ax,[bp+8]
sub ax,2
push ax
mov ax,[bp+6]
add ax,[bp+10]
sub ax,2
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;////////////////////////////////////////////////
;/////////////////////bottom black///////////////
mov ax,00h
push ax
mov ax,1
push ax
mov ax,[bp+8]
push ax
mov ax,[bp+6]
add ax,[bp+10]
sub ax,1
push ax
mov ax,[bp+4]
push ax
call DrawRect
pop ax
pop bp
ret 8
DrawButtonNoSelected endp
DrawButtonOnSelected proc ;(x [bp+4],y [bp+6],width [bp+8],height [bp+10])
push bp
mov bp,sp
push ax
;///////////////////////main window///////////////
mov ax,07h
push ax
mov ax,[bp+10]
push ax
mov ax,[bp+8]
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
push ax
call DrawRect
;////////////////////////////////////////////////
;///////////////////////Left Black///////////////
mov ax,00h
push ax
mov ax,[bp+10]
dec ax
push ax
mov ax,1
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
push ax
call DrawRect
;/////////////////////////////////////////////////
;//////////////////////Top Black//////////////////
mov ax,00h
push ax
mov ax,1
push ax
mov ax,[bp+8]
dec ax
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
push ax
call DrawRect
;/////////////////////////////////////////////////
;///////////////////////Left white////////////////
mov ax,0fh
push ax
mov ax,[bp+10]
sub ax,3
push ax
mov ax,1
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;/////////////////////////////////////////////////
;//////////////////////upper white////////////////
mov ax,0fh
push ax
mov ax,1
push ax
mov ax,[bp+8]
sub ax,3
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;///////////////////////////////////////////////
;/////////////////////right gray////////////////
mov ax,08h
push ax
mov ax,[bp+10]
sub ax,2
push ax
mov ax,1
push ax
mov ax,[bp+6]
inc ax
push ax
mov ax,[bp+4]
add ax,[bp+8]
sub ax,1
push ax
call DrawRect
;/////////////////////////////////////////////////
;/////////////////////right black/////////////////
mov ax,00h
push ax
mov ax,[bp+10]
push ax
mov ax,1
push ax
mov ax,[bp+6]
push ax
mov ax,[bp+4]
add ax,[bp+8]
sub ax,1
push ax
call DrawRect
;////////////////////////////////////////////////
;//////////////////////bottom gray///////////////
mov ax,08h
push ax
mov ax,1
push ax
mov ax,[bp+8]
sub ax,2
push ax
mov ax,[bp+6]
add ax,[bp+10]
sub ax,2
push ax
mov ax,[bp+4]
inc ax
push ax
call DrawRect
;////////////////////////////////////////////////
;/////////////////////bottom black///////////////
mov ax,00h
push ax
mov ax,1
push ax
mov ax,[bp+8]
push ax
mov ax,[bp+6]
add ax,[bp+10]
sub ax,1
push ax
mov ax,[bp+4]
push ax
call DrawRect
;////////////////////////////////////////////////
;/////////////////////Button left black/////////
mov ax,00h
push ax
mov ax,[bp+6]
add ax,4
inc ax
mov bx,ax
push bx
mov dx,[bp+4]
add dx,4
push dx
call DrawPoint
add bx,2
mov ax,[bp+10]
sub ax,7
shr ax,1
mov cl,al
dec cl
lop:
mov ax,00h
push ax
push bx
push dx
call DrawPoint
add bx,2
loop lop
;/////////////////////Button left black/////////
;////////////////////Button right black/////////
mov ax,00h
push ax
mov ax,[bp+6]
add ax,4
inc ax
mov bx,ax
push bx
mov dx,[bp+4]
add dx,[bp+8]
sub dx,5
push dx
call DrawPoint
add bx,2
mov ax,[bp+10]
sub ax,7
shr ax,1
mov cl,al
dec cl
lop1:
mov ax,00h
push ax
push bx
push dx
call DrawPoint
add bx,2
loop lop1
;///////////////////////////////////////////////
;////////////////////Button top black/////////
mov ax,00h
push ax
mov dx,[bp+6]
add dx,4
push dx
mov bx,[bp+4]
add bx,4
inc bx
push bx
call DrawPoint
add bx,2
mov ax,[bp+8]
sub ax,8
shr ax,1
mov cl,al
dec cl
mov ch,0
lop3:
mov ax,0h
push ax
push dx
push bx
call DrawPoint
add bx,2
loop lop3
;///////////////////////////////////////////////////
;////////////////////Button bottom black/////////
mov ax,00h
push ax
mov dx,[bp+6]
add dx,[bp+10]
sub dx,4
push dx
mov bx,[bp+4]
add bx,4
inc bx
push bx
call DrawPoint
add bx,2
mov ax,[bp+8]
sub ax,8
shr ax,1
mov cl,al
dec cl
mov ch,0
lop4:
mov ax,0h
push ax
push dx
push bx
call DrawPoint
add bx,2
loop lop4
;///////////////////////////////////////////////////
pop ax
pop bp
ret 8
DrawButtonOnSelected endp
;DrawBlackBorder proc ;(x,y,width,height,color) bp+4
DrawRect proc ;(x,y,width,height,color) bp+4
push bp
mov bp,sp
pusha
DrawLineV:
mov ax,[bp+4]
mov dx,[bp+8]
DrawLineH:
push word ptr[bp+12]
push word ptr[bp+6]
push ax
call DrawPoint
inc ax
dec dx
jnz DrawLineH
inc word ptr[bp+6]
dec word ptr[bp+10]
jnz DrawLineV
popa
pop bp
ret 10
DrawRect endp
DrawPoint proc near
push bp
mov bp,sp
pusha
mov ax,0a000h
mov es,ax
mov ax,[bp+06h]
shl ax,04h
mov bx,ax
shl ax,02h
add ax,bx
mov bx,[bp+04h]
mov cl,bl
shr bx,03h
add bx,ax ;offset=bx
mov ch,80h
and cl,07h
shr ch,cl ;mask=ch
;Set BMR(Bit Mask Register) - mask
mov dx,03ceh
mov al,08h
out dx,al
inc dx ;dx=03cfh
mov al,ch
out dx,al
;Load latch and Zero the pixel
sub al,al
xchg es:[bx],al
;Set MMR(Map Mask Register) - color
sub dx,0bh ;dx=03c4h
mov al,02h
out dx,al
mov al,[bp+08h]
inc dx ;dx=03c5h
out dx,al
;Set the pixel''s value;
mov es:[bx],ch
;Reset BMR - 0ffh
add dx,09h ;dx=03ceh
mov al,08h
out dx,al
inc dx ;dx=03cfh
mov al,0ffh
out dx,al
;Reset MMR - 0fh
sub dx,0bh ;dx=03c4h
mov al,02h
out dx,al
mov al,0fh
inc dx ;dx=03c5h
out dx,al
;
popa
pop bp
ret 06
DrawPoint endp
DrawPointb proc ;(x,y,color)
push bp
mov bp,sp
pusha
mov dx,03C4h
mov al,02h
out dx,al
mov dx,03c5h
mov al,[bp+8]
out dx,al
mov ax,0280h
mov dx,[bp+6]
mul dx
add ax,[bp+4]
adc dx,0
mov cx,8
div cx
mov di,00h
add di,ax
mov ax,0a000h
mov es,ax
mov cl,dl
mov al,7fh
ror al,cl
and es:[di],al
mov al,80h
shr al,cl
or es:[di],al
popa
pop bp
ret 6
DrawPointb endp
code ends
end start
附件
1: dialog.rar (2006-8-2 22:30, 107.53 K, 下载附件所需积分 1 点
,下载次数: 253)
|
|
2006-8-2 22:30 |
|
|
070
高级用户
苏醒的沉睡者
积分 659
发帖 217
注册 2003-2-15 来自 福建
状态 离线
|
|
2006-8-3 00:31 |
|
|
profree
中级用户
积分 478
发帖 132
注册 2003-7-2
状态 离线
|
|
2006-8-4 15:09 |
|
|
070
高级用户
苏醒的沉睡者
积分 659
发帖 217
注册 2003-2-15 来自 福建
状态 离线
|
『第
4 楼』:
汇编不算太难,就是工程量特大
|
好久没碰Dos,手都生了,赶紧回来练练.嘿嘿 |
|
2006-8-4 15:39 |
|
|
electronixtar
铂金会员
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第
5 楼』:
强人!
|
C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-8-5 11:02 |
|
|
jizhouhao
新手上路
积分 6
发帖 3
注册 2005-9-6
状态 离线
|
『第
6 楼』:
佩服,能够写这么多代码,了不起。
|
|
2006-8-9 10:50 |
|
|
profree
中级用户
积分 478
发帖 132
注册 2003-7-2
状态 离线
|
『第
7 楼』:
我对汇编一点也不懂,看了许多书,就是入不了门,怎么办啊?
|
|
2006-8-9 18:20 |
|
|
070
高级用户
苏醒的沉睡者
积分 659
发帖 217
注册 2003-2-15 来自 福建
状态 离线
|
『第
8 楼』:
看《80x86汇编语言程序设计》
|
好久没碰Dos,手都生了,赶紧回来练练.嘿嘿 |
|
2006-8-10 19:29 |
|
|
brglng
银牌会员
永遠的DOS~~~
积分 1200
发帖 466
注册 2005-2-1 来自 上海
状态 离线
|
|
2006-8-11 20:59 |
|
|
mornsmile
初级用户
积分 147
发帖 23
注册 2005-1-23
状态 离线
|
|
2006-8-16 06:39 |
|
|
本是
银牌会员
积分 2201
发帖 789
注册 2005-1-27
状态 离线
|
『第
11 楼』:
本是改进的DIALOG1.ASM
;本是改进的DIALOG1.ASM:
;---------------------------------------------------------------------------
; *改进说明*
; ========
; 0.程序类型由.EXE改为.COM;
; 1.通过使用代码宏让子程序调用直观方便,易调用、易比较、易修改;
; 2.通过flag的计算合并原ConfirmTCan/CancelTCon子程序为一ConfCanc;
; 3.简省测试键值代码,回车键执行,其它键切换按钮焦点;
; 4.改进drawPoint子程序,改变每次写点都进行的regs设置为只在程序开头进行一次,
; 恢复regs则取消;
; 5.通过焦点flag参数,原来的分立子程序合并为一drawButton;
; 6.drawButton按钮焦点只通过外实框表示(取消内虚框).
;
;---------------------------------------------------------------------------
; 将要改进:
; ========
; 1.使用高效的划水平/垂直线程序以替代相关(如画填实的框块drawRect)代码;
; 2.改进写汉字代码;
; 3.建立小汉字字模和西文字模代码;
; 4.建立统一的字符显示子程序(自动识别中西文)
; 5.建立开始按钮功能菜单(运行/帮助/退出)
;
;---------------------------------------------------------------------------
;各个函数的作用及调用参数表:
; ==== ==== ======
;1.ConfCanc (切换按钮状态:确定/取消)
;2.ShowHanZi (显示汉字) ;(X,Y,Dis,WordsPtr,ZiKuPtr,Color) bp+4
;3.DrawDialog(显示对话框) ;(x,y,width,height) bp+4
;4.DrawButton(画按钮:未/选中);(x,y,width,height,OnOffFlag) bp+4
;5.DrawRect (画矩形) ;(x,y,width,height,color) bp+4
;6.DrawPoint (画点) ;(x,y,color) bp+4
;
;---------------------------------------------------------------------------
;***回车键执行,其它键切换按钮焦点***
; e-mail:lmayylxt@pub.sz.jsinfo.net
; 本是 2006.9.1
;---------------------------------------------------------------------------
pux macro p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12
irp reg,<p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12>
ifnb <&®>
push &®
endif
endm
endm
pox macro p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1
irp reg,<p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>
ifnb <&®>
pop &®
endif
endm
endm
.286
code segment
assume cs:code,ds:code
org 100h
start:
mov ax,12h ;init graph
int 10h ;set display mode in al
;make background
push 0A000h ;graph video buffer seg
pop es
mov dx,3C4h ;enable planar write
mov ax,0302h;0011B:1/0 planars
out dx,ax ; port 3C4h, EGA sequencr index; al = 2, map mask register
xor di,di ;mov di,0
mov cx,38400 ;9600h
mov al,0FFh ;ax
rep stosb ;=CLS
mov dx,3C4h
mov ax,0F02h;1111B:3/2/1/0 planars
out dx,ax
mov dx,3CEh ;init vga regs for draw-subs
mov ax,0205h
out dx,ax ; port 3CEh, EGA graphic index; al = 5, mode
mov al,08h
out dx,al ; port 3CEh, EGA graphic index; al = 8, data bit mask
pux 100,200,120,220
call DrawDialog
pux 0,22,61,180,240
call DrawButton
pux 1,22,61,180,340
call DrawButton
pux 0,25,640,456,0
call DrawButton
pux 0,20,40,458,2
call DrawButton
pux 0Fh,<offset hzk>,<offset warn_T>,12,126,226 ;警告
call ShowHanZi
pux 00h,<offset hzk>,<offset exit_M>,12,156,258 ;您确定要退出系统吗?
call ShowHanZi
pux 00h,<offset hzk>,<offset confiB>,20,184,254 ;确定
call ShowHanZi
pux 00h,<offset hzk>,<offset canceB>,20,184,354 ;取消
call ShowHanZi
pux 00h,<offset hzk>,<offset startB>,15,462,8 ;开始
call ShowHanZi
WaitPress:
mov ah,00h
int 16h ; get keybd char in al, ah=scan
cmp ah,1Ch ; CR
jnz otherKeys
cmp flag,1
jz exit
jmp short jmpWP
otherKeys:
call ConfCanc
xor flag,1
jmpWP:
jmp short WaitPress
Exit:
mov ax,3 ;closeGraph
int 10h ;set display mode in al
mov ax,4C01h
int 21h ;terminate with al=return code
flag db 0h
warn_T db '警告',0
exit_M db '您确定要退出系统吗?',0
confiB db '确定',0
canceB db '取消',0
startB db '开始',0
hzk db 'HZK12',0
ConfCanc proc near
;flag=1 0
mov al,flag
xor ah,ah
xor al,1 ;0 1
pux ax,22,61,180,240
call DrawButton
pux 00h,<offset hzk>,<offset confiB>,20,184,254 ;确定
call ShowHanZi
xor al,1 ;1 0
pux ax,22,61,180,340
call DrawButton
pux 00h,<offset hzk>,<offset canceB>,20,184,354 ;取消
call ShowHanZi
ret
ConfCanc endp
ShowHanZi proc near ;(X,Y,Dis,WordsPtr,ZiKuPtr,Color) bp+4
push bp
mov bp,sp
sub sp,30 ;x[bp-2],y[bp-4],handle[bp-6],24 dup(0) for fontData
pusha
mov dx,[bp+12]
mov ax,3D00h ; open file, al=mode,name@ds:dx
int 21h
mov [bp-6],ax
jnc shzNextC
mov word ptr[bp+12],1
shzExitZz:
jmp shzExit
shzNextC:
mov si,[bp+10]
mov ax,[si]
or al,al ;cmp al,0
jz shzExitZz
sub ax,0A1A1h
mov dl,ah
mov ah,94
mul ah ; ax=reg*al
mov dh,0
add ax,dx
mov dx,24 ;12*2
mul dx
mov cx,dx
mov dx,ax
mov bx,[bp-6]
mov ax,4200h
int 21h ; move file ptr, bx=file handle; al=method, cx,dx=offset
mov cx,24
push ds
mov ax,cs;ss ;;cs for .COM, ss for .EXE
mov ds,ax
mov ah,3Fh
mov dx,bp
sub dx,30
mov bx,[bp-6]
int 21h ; read file, bx=file handle; cx=bytes to ds:dx buffer
pop ds
xor si,si
mov bx,[bp+12]
mov ax,[bp+4]
mov [bp-2],ax
mov ax,[bp+6]
mov [bp-4],ax
mov cx,12
shzNextRow:
push cx
mov cx,12
mov dx,8000h ;mask
shzNextCol:
mov ax,[bp-30][si]
xchg ah,al
test ax,dx
jz shzNotDraw
pux <[bp+14]>,<[bp-4]>,<[bp-2]>
call DrawPoint ;(x,y,color)
shzNotDraw:
inc word ptr[bp-2]
shr dx,1
loop shzNextCol
pop cx
add si,2
inc word ptr[bp-4]
mov ax,[bp+4]
mov [bp-2],ax
loop shzNextRow
add word ptr[bp+10],2
mov ax,[bp+8]
add word ptr[bp+4],ax
jmp shzNextC
shzExit:
mov ah,3Eh
mov bx,[bp-6]
int 21h ; close file, bx=file handle
popa
add sp,30
pop bp
ret 12
ShowHanZi endp
DrawDialog proc near ;(x,y,width,height) bp+4
push bp
mov bp,sp
push ax
;///main window///
pux 07h,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call DrawRect ;(x,y,width,height,color) bp+4
;///blue banner///
mov ax,[bp+8]
sub ax,6
mov bx,[bp+6]
add bx,3
mov cx,[bp+4]
add cx,3
pux 01h,20,ax,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
;///Left white///
mov ax,[bp+10]
sub ax,3
mov bx,[bp+6]
inc bx
mov cx,[bp+4]
inc cx
pux 0Fh,ax,1,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
;///upper white///
mov ax,[bp+8]
sub ax,3
mov bx,[bp+6]
inc bx
mov cx,[bp+4]
inc cx
pux 0Fh,1,ax,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
;///right gray///
mov ax,[bp+10]
sub ax,2
mov bx,[bp+6]
inc bx
mov cx,[bp+4]
add cx,[bp+8]
dec cx ;sub ax,1
pux 08h,ax,1,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
;///right black///
mov ax,[bp+4]
add ax,[bp+8]
dec ax ;sub ax,1
pux 00h,<[bp+10]>,1,<[bp+6]>,ax
call DrawRect ;(x,y,width,height,color) bp+4
;///bottom gray///
mov ax,[bp+8]
sub ax,2
mov bx,[bp+6]
add bx,[bp+10]
sub bx,2
mov cx,[bp+4]
inc cx
pux 08h,1,ax,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
;///bottom black///
mov ax,[bp+6]
add ax,[bp+10]
dec ax ;sub ax,1
pux 00h,1,<[bp+8]>,ax,<[bp+4]>
call DrawRect ;(x,y,width,height,color) bp+4
pop ax
pop bp
ret 8
DrawDialog endp
DrawButton proc near ;(x,y,width,height,flag) bp+4
push bp
mov bp,sp
push ax
;///main window///
pux 07h,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call DrawRect ;(x,y,width,height,color) bp+4
;///Left white///
mov ax,[bp+10]
sub ax,3
mov bx,[bp+6]
inc bx
mov cx,[bp+4]
inc cx
pux 0Fh,ax,1,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
;///upper white///
mov ax,[bp+8]
sub ax,3
mov bx,[bp+6]
inc bx
mov cx,[bp+4]
inc cx
pux 0Fh,1,ax,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
;///right gray///
mov ax,[bp+10]
sub ax,2
mov bx,[bp+6]
inc bx
mov cx,[bp+4]
add cx,[bp+8]
dec cx ;sub ax,1
pux 08h,ax,1,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
;///bottom gray///
mov ax,[bp+8]
sub ax,2
mov bx,[bp+6]
add bx,[bp+10]
sub bx,2
mov cx,[bp+4]
inc cx
pux 08h,1,ax,bx,cx
call DrawRect ;(x,y,width,height,color) bp+4
cmp byte ptr [bp+12],0
jz notSelected
;;;solid
;///Left Black///
mov ax,[bp+10]
dec ax
pux 00h,ax,1,<[bp+6]>,<[bp+4]>
call DrawRect ;(x,y,width,height,color) bp+4
;///Top Black///
mov ax,[bp+8]
dec ax
pux 00h,1,ax,<[bp+6]>,<[bp+4]>
call DrawRect ;(x,y,width,height,color) bp+4
;///right black///
mov ax,[bp+4]
add ax,[bp+8]
dec ax ;sub ax,1
pux 00h,<[bp+10]>,1,<[bp+6]>,ax
call DrawRect ;(x,y,width,height,color) bp+4
;///bottom black///
mov ax,[bp+6]
add ax,[bp+10]
dec ax ;sub ax,1
pux 00h,1,<[bp+8]>,ax,<[bp+4]>
call DrawRect ;(x,y,width,height,color) bp+4
notSelected:
pop ax
pop bp
ret 10
DrawButton endp
DrawRect proc near ;(x,y,width,height,color) bp+4
push bp
mov bp,sp
pusha
DrawLineV:
mov ax,[bp+4]
mov dx,[bp+8]
DrawLineH:
pux <word ptr[bp+12]>,<word ptr[bp+6]>,ax
call DrawPoint ;(x,y,color)
inc ax
dec dx
jnz DrawLineH
inc word ptr[bp+6]
dec word ptr[bp+10]
jnz DrawLineV
popa
pop bp
ret 10
DrawRect endp
DrawPoint proc near ;(x,y,color)
push bp
mov bp,sp
pusha
push 0A000h
pop es
mov ax,[bp+06h]
shl ax,04h
mov bx,ax
shl ax,02h
add ax,bx
mov bx,[bp+04h]
mov cl,bl
shr bx,03h
add bx,ax ;offset=bx
mov al,80h
and cl,07h
shr al,cl ;mask=al
mov dx,3CFh
out dx,al ; port 3CEh, EGA graphic index; al = 8, data bit mask
mov ah,es:[bx]
mov al,[bp+08h]
mov es:[bx],al
popa
pop bp
ret 06
DrawPoint endp
code ends
end start
[ Last edited by 本是 on 2006-9-1 at 18:08 ]
附件
1: DIALOG1.RAR (2006-9-1 18:02, 3.7 K, 下载附件所需积分 1 点
,下载次数: 106)
附件
2: DIALOG1.jpg (2006-9-1 18:07, 10.88 K, 下载附件所需积分 1 点
,下载次数: 22)
|
my major is english----my love is dos----my teacher is the buddha----my friends--how about U |
|
2006-9-1 18:02 |
|
|
本是
银牌会员
积分 2201
发帖 789
注册 2005-1-27
状态 离线
|
『第
12 楼』:
自带小字库显示中英文的dialog2!
;---------------------------------------------------------------------------
; *改进说明*
; ========
; 0.程序类型由.EXE改为.COM;
; 1.通过使用代码宏让子程序调用直观方便,易调用、易比较、易修改;
; 2.通过flag的计算合并原ConfirmTCan/CancelTCon子程序为一ConfCanc;
; 3.简省测试键值代码,回车键执行,其它键切换按钮焦点;
; 4.改进drawPoint子程序,改变每次写点都进行的regs设置为只在程序开头进行一次,
; 恢复regs则取消;
; 5.通过焦点flag参数,原来的分立子程序合并为一drawButton;
; 6.drawButton按钮焦点只通过外实框表示(取消内虚框).
;
; 7.脱离庞大的HZK12,内建小汉字库和ASCII字符库,建立seekHZfnt/seekASCfnt子程序,
; 搜索小字库,并在showMsg子程序分别SEEK和显示中/英文字符;
; 8.建立划水平hLine/垂直线vLine子程序,取代宽度/高度为1的DrawRect调用;
; 9.从DrawDialog/DrawButton中分离出drawRect(画框)/drawBevel(画立体边)(原来
; 画实矩形DrawRect改名DrawRectF);drawBevel区分单/双层立体边线;
;10.纠正了右侧立体边线的计算错误.
;11.ShowMsg子程序中的dis距离参数意义有变化:汉字默认12、字符默认8,此外的
;字间距为dis,而不是原来的默认值为0、字间距纯粹由dis控制,便于统一ShowMsg的效果;
;
;---------------------------------------------------------------------------
;各个函数的作用及调用参数表:
; ==== ==== ======
;1. ConfCanc (切换按钮状态:确定/取消)
;2. ShowMsg (显示字符串) ;(X,Y,Dis,MsgPtr,Color) bp+4
;3. DrawDialog(显示对话框) ;(x,y,width,height) bp+4
;4. DrawButton(画按钮:未/选中);(x,y,width,height,OnOffFlag) bp+4
;5. DrawRectF (画实矩形) ;(x,y,width,height,color) bp+4
;6. DrawPoint (画点) ;(x,y,color) bp+4
;7. DrawRect (画矩形框) ;(x,y,width,height,color) bp+4
;8. DrawBevel (画立体边) ;(x,y,width,height,DblSglFlag) bp+4
;9. hLine (画水平线) ;(x,y,w,color) bp+4
;10.vLine (画垂直线) ;(x,y,h,color) bp+4
;11.seekHZfnt (在小字库中搜索汉字);(hzChr) bp+4 AX返回字模偏移地址或0FFFFh
;12.seekASCfnt(在小字库中搜索字符);(AscChr) bp+4 AX返回字模偏移地址或0FFFFh
;---------------------------------------------------------------------------
;***回车键执行,其它键切换按钮焦点***
; e-mail:lmayylxt@pub.sz.jsinfo.net
; 本是 2006.9.1
;---------------------------------------------------------------------------
pux macro p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12
irp reg,<p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12>
ifnb <&®>
push &®
endif
endm
endm
pox macro p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1
irp reg,<p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>
ifnb <&®>
pop &®
endif
endm
endm
.286
code segment
assume cs:code,ds:code
org 100h
start:
mov ax,12h ;init graph
int 10h ;set display mode in al
;make background
push 0A000h ;graph video buffer seg
pop es
mov dx,3C4h ;enable planar write
mov ax,0302h;0011B:1/0 planars
out dx,ax ; port 3C4h, EGA sequencr index; al = 2, map mask register
xor di,di ;mov di,0
mov cx,38400 ;9600h
mov al,0FFh ;ax
rep stosb ;=CLS
mov dx,3C4h
mov ax,0F02h;1111B:3/2/1/0 planars
out dx,ax
;
;regs set once and for all in this program
mov dx,3CEh ;init vga regs for draw-subs
mov ax,0205h
out dx,ax ; port 3CEh, EGA graphic index; al = 5, mode
mov al,08h
out dx,al ; port 3CEh, EGA graphic index; al = 8, data bit mask
;
pux 100,200,120,220
call DrawDialog
pux 0Fh,<offset warn_T>,00,126,226 ;警告
call ShowMsg
pux 00h,<offset exit_M>,00,156,258 ;您确定要退出系统吗?
call ShowMsg
;
call xf1
call ConfCanc
call xf1
;
pux 0,25,640,456,0
call DrawButton
pux 0,20,40,458,2
call DrawButton
pux 00h,<offset startB>,03,462,8 ;开始
call ShowMsg
;
WaitPress:
mov ah,00h
int 16h ; get keybd char in al, ah=scan
cmp ah,1Ch ; CR
jnz otherKeys
cmp flag,1
jz exit
jmp short jmpWP
otherKeys:
call ConfCanc
call xf1
jmpWP:
jmp short WaitPress
Exit:
mov ax,3 ;closeGraph
int 10h ;set display mode in al
mov ax,4C01h
int 21h ;terminate with al=return code
xf1 proc near
xor flag,1
ret
xf1 endp
flag db 0
warn_T db '警告 Warning',0
exit_M db '您确定要退出系统吗?',0
confiB db '确定',0
canceB db '取消',0
startB db '开始',0
ConfCanc proc near
;flag=1 0
mov al,flag
xor ah,ah
xor al,1 ;0 1
pux ax,22,61,180,240
call DrawButton
pux 00h,<offset confiB>,06,184,254 ;确定
call ShowMsg
;
xor al,1 ;1 0
pux ax,22,61,180,340
call DrawButton
pux 00h,<offset canceB>,06,184,354 ;取消
call ShowMsg
ret
ConfCanc endp
;+4 6 8 10 12
ShowMsg proc near ;(X,Y,Dis,msgPtr,Color) bp+4
push bp
mov bp,sp
sub sp,4 ;x[bp-2],y[bp-4]
pusha
smsNextC:
mov si,[bp+10]
mov al,[si]
or al,al ;cmp al,0
jz smsExit
cmp al,' '
jb smsNex
cmp al,'?
ja smsIfHZ
cmp al,'~'
ja smsNex
jmp short smsASC
smsIfHZ:
mov ah,al
mov al,[si+1]
cmp al,'?
ja smsHZ
mov al,ah ;;;
smsASC:
xor ah,ah
push ax
call seekASCfnt
cmp ax,0FFFFh
jz smsNex
jmp showASC
smsHZ:
xchg ah,al ;;;
push ax
call seekHZfnt
cmp ax,0FFFFh
jz smsNex2
jmp showHZ
smsNex2:
inc word ptr[bp+10]
mov ax,12
jmp short smsNex1
smsNex:
mov ax,8
smsNex1:
inc word ptr[bp+10]
add ax,[bp+8]
add word ptr[bp+4],ax
jmp smsNextC
smsExit:
popa
add sp,4
pop bp
ret 10
ShowMsg endp
ShowHZ:
mov si,ax
mov ax,[bp+4]
mov [bp-2],ax
mov ax,[bp+6]
mov [bp-4],ax
mov cx,12
shzNextRow:
push cx
mov cx,12
mov dx,8000h ;mask
shzNextCol:
mov ax,[si]
xchg ah,al
test ax,dx
jz shzNotDraw
pux <[bp+12]>,<[bp-4]>,<[bp-2]>
call DrawPoint ;(x,y,color)
shzNotDraw:
inc word ptr[bp-2]
shr dx,1
loop shzNextCol
pop cx
add si,2
inc word ptr[bp-4]
mov ax,[bp+4]
mov [bp-2],ax
loop shzNextRow
jmp smsNex2
ShowASC:
mov si,ax
mov ax,[bp+4]
mov [bp-2],ax
mov ax,[bp+6]
mov [bp-4],ax
mov cx,12
sasNextRow:
push cx
mov cx,8
mov dx,80h ;mask
sasNextCol:
mov ax,[si]
test ax,dx
jz sasNotDraw
pux <[bp+12]>,<[bp-4]>,<[bp-2]>
call DrawPoint ;(x,y,color)
sasNotDraw:
inc word ptr[bp-2]
shr dx,1
loop sasNextCol
pop cx
inc si
inc word ptr[bp-4]
mov ax,[bp+4]
mov [bp-2],ax
loop sasNextRow
jmp smsNex
DrawDialog proc near ;(x,y,width,height) bp+4
push bp
mov bp,sp
push ax
;///main window///
pux 07h,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call DrawRectF ;(x,y,width,height,color) bp+4
;///blue banner///
mov ax,[bp+8];w-6
sub ax,6
mov bx,[bp+6];y+3
add bx,3
mov cx,[bp+4];x+3
add cx,3
pux 01h,20,ax,bx,cx ;x+3,y+3,w-6,20,1
call DrawRectF
;///white/grey/black edges///
pux 1,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call drawBevel ;(x,y,width,height,flag) bp+4
pop ax
pop bp
ret 8
DrawDialog endp
DrawButton proc near ;(x,y,width,height,flag) bp+4
push bp
mov bp,sp
push ax
;///main window///
pux 07h,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call DrawRectF ;(x,y,width,height,color) bp+4
;///white/grey/black edges///
pux 0,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call drawBevel
cmp byte ptr [bp+12],0
jz notSelected
;///solid focus box///
pux 00h,[bp+10],[bp+8],<[bp+6]>,<[bp+4]>
call DrawRect ;(x,y,width,height,color) bp+4
notSelected:
pop ax
pop bp
ret 10
DrawButton endp
drawRect proc near ;(x,y,w,h,color)
push bp
mov bp,sp
pux ax,bx,cx,dx
mov al,[bp+0Ch]
mov bx,[bp+4]
mov cx,[bp+6]
pux ax,<[bp+08h]>,cx,bx
call hLine; up-----------
pux ax,<[bp+0Ah]>,cx,bx
call vLine;left|
mov cx,[bp+0Ah]
add cx,[bp+06h]
dec cx
pux ax,<[bp+08h]>,cx,bx
call hLine;bottom-----------
mov bx,[bp+08h]
add bx,[bp+04h]
dec bx
pux ax,<[bp+0Ah]>,<[bp+06h]>,bx
call vLine;right |
pox dx,cx,bx,ax
pop bp
ret 10
drawRect endp
drawBevel proc near ;(x,y,w,h,f)
push bp
mov bp,sp
pux ax,bx,cx,dx
mov ax,[bp+4];x+1
inc ax
mov bx,[bp+6];y+1
inc bx
mov cx,[bp+8];w-3
dec cx
dec cx
dec cx
pux 0Fh,cx,bx,ax
call hLine; up-----------
mov ax,[bp+4];x+1
inc ax
mov bx,[bp+6];y+1
inc bx
mov dx,[bp+10];h-3
dec dx
dec dx
dec dx
pux 0Fh,dx,bx,ax
call vLine;left|
mov ax,[bp+4];x+1
inc ax
mov bx,[bp+6];y+h-2
add bx,[bp+10]
dec bx
dec bx
mov cx,[bp+8];w-2
dec cx
dec cx
pux 8,cx,bx,ax
call hLine;bottom-----------
cmp byte ptr [bp+12],0
jz DBskip1
dec ax;x
inc bx;y+h-1
inc cx;w
inc cx
pux 0,cx,bx,ax
call hLine;bottom-----------
DBskip1:
mov ax,[bp+4];x+w-2
add ax,[bp+8]
dec ax
dec ax;;;
mov bx,[bp+6];y+1
inc bx
mov dx,[bp+10];h-2
dec dx
dec dx
pux 8,dx,bx,ax
call vLine;right |
cmp byte ptr [bp+12],0
jz DBskip2
inc ax;x+w-1
dec bx;y
inc dx;h
inc dx
pux 0,dx,bx,ax
call vLine;right |
DBskip2:
pox dx,cx,bx,ax
pop bp
ret 10
drawBevel endp
DrawRectF proc near ;(x,y,width,height,color) bp+4
push bp
mov bp,sp
pusha
DrawLineV:
mov ax,[bp+4]
mov dx,[bp+8]
DrawLineH:
pux <[bp+12]>,<[bp+6]>,ax
call DrawPoint ;(x,y,color)
inc ax
dec dx
jnz DrawLineH
inc word ptr[bp+6]
dec word ptr[bp+10]
jnz DrawLineV
popa
pop bp
ret 10
DrawRectF endp
hLine proc near;(x,y,w,c)
push bp
mov bp,sp
pux ax,bx,cx,dx
mov al,[bp+10]
mov bx,[bp+4]
mov dx,[bp+6]
mov cx,[bp+8]
hLloop:
pux ax,dx,bx
call DrawPoint
inc bx
loop hLloop
pox dx,cx,bx,ax
pop bp
ret 8
hLine endp
vLine proc near;(x,y,h,c)
push bp
mov bp,sp
pux ax,bx,cx,dx
mov al,[bp+10]
mov bx,[bp+4]
mov dx,[bp+6]
mov cx,[bp+8]
vLloop:
pux ax,dx,bx
call DrawPoint
inc dx
loop vLloop
pox dx,cx,bx,ax
pop bp
ret 8
vLine endp
DrawPoint proc near ;(x,y,color)
push bp
mov bp,sp
pusha
push 0A000h
pop es
mov ax,[bp+06h]
shl ax,04h
mov bx,ax
shl ax,02h
add ax,bx
mov bx,[bp+04h]
mov cl,bl
shr bx,03h
add bx,ax ;offset=bx
mov al,80h
and cl,07h
shr al,cl ;mask=al
mov dx,3CFh
out dx,al ; port 3CEh, EGA graphic index; al = 8, data bit mask
mov ah,es:[bx]
mov al,[bp+08h]
mov es:[bx],al
popa
pop bp
ret 06
DrawPoint endp
seekHZfnt proc near ;(hzChr);OUT: FFFF=not found ;AX=HZfnt ptr
push bp
mov bp,sp
pux bx,cx,dx
mov si,offset hzfnt
mov cx,offset hzfntend
sub cx,si
mov ax,[bp+04h]
push cs
pop ds
seekHZagn:
cmp ax,[si]
je short seekHZyes
add si,26 ;hz rec len
sub cx,26
cmp cx,26
jae seekHZagn
mov ax,0FFFFh
jmp short seekHZno
seekHZyes:
inc si;skip HZ for fnt data
inc si
mov ax,si
seekHZno:
pox dx,cx,bx
pop bp
ret 2
seekHZfnt endp
hzfnt label byte
db '警',29h,20h,0FDh,0F0h,56h,0A0h,74h,40h,4,0A0h,0FFh,0F0h,0,0,3Fh,0C0h,0,0,3Fh,0C0h,20h,40h,3Fh,0C0h
db '告',12h,0,12h,40h,3Fh,0E0h,22h,0,42h,20h,0FFh,0F0h,0,0,1Fh,0C0h,10h,40h,10h,40h,1Fh,0C0h,10h,40h
db '您',14h,0,24h,0,2Fh,0F0h,71h,20h,0A5h,40h,29h,20h,33h,10h,20h,0,54h,40h,52h,0A0h,90h,90h,0Fh,80h
db '确',1,0,0F9h,0E0h,22h,40h,27h,0F0h,4Ch,90h,77h,0F0h,0D4h,90h,57h,0F0h,54h,90h,74h,90h,54h,0D0h,8,0A0h
db '定',4,0,2,0,7Fh,0F0h,40h,10h,0BFh,0C0h,4,0,24h,80h,27h,0C0h,24h,0,34h,0,4Ch,0,83h,0F0h
db '要',0,0,0FFh,0F0h,9,0,3Fh,0C0h,29h,40h,3Fh,0C0h,8,0,0FFh,0F0h,11h,80h,0Eh,0,5,80h,78h,60h
db '退',47h,0C0h,24h,40h,27h,0C0h,4,40h,7,0C0h,0E4h,0,25h,40h,24h,80h,26h,40h,24h,20h,50h,0,8Fh,0F0h
db '出',4,0,24h,40h,24h,40h,24h,40h,3Fh,0C0h,24h,40h,4,0,44h,20h,44h,20h,44h,20h,7Fh,0E0h,40h,20h
db '系',1,0C0h,7Eh,0,8,80h,11h,0,3Eh,0,8,40h,7Fh,0E0h,2,20h,13h,80h,22h,40h,42h,20h,86h,0
db '统',22h,0,21h,0,4Fh,0F0h,52h,0,0E4h,40h,2Fh,0E0h,42h,0A0h,0F2h,80h,2,80h,0F2h,90h,4,90h,18h,70h
db '吗',0,40h,0F7h,0E0h,90h,40h,92h,40h,92h,40h,93h,0F0h,90h,10h,0F0h,90h,8Fh,0D0h,0,20h,0,0A0h,0,40h
db '?',0,0,3Eh,0,63h,0,63h,0,6,0,0Ch,0,0Ch,0,0,0,0Ch,0,0Ch,0,0,0,0,0
db '取',8,0,0FCh,0,4Bh,0E0h,48h,20h,79h,20h,49h,40h,79h,40h,4Ch,80h,78h,80h,0C9h,40h,0Ah,20h,0Ch,10h
db '消',41h,0,25h,20h,13h,40h,81h,0,47h,0E0h,14h,20h,27h,0E0h,24h,20h,0C7h,0E0h,44h,20h,44h,0A0h,44h,60h
db '开',0,40h,7Fh,0E0h,8,80h,8,80h,8,0A0h,0FFh,0F0h,8,80h,8,80h,10h,80h,10h,80h,20h,80h,0C0h,80h
db '始',21h,0,21h,0,22h,40h,0FAh,20h,2Fh,0F0h,28h,10h,4Bh,0E0h,52h,20h,52h,20h,32h,20h,4Bh,0E0h,82h,20h
hzfntend label byte
seekASCfnt proc near ;(ascChr) AX=0FFFFh:not found,else:fntDataOfs
push bp
mov bp,sp
pux bx,cx,dx
mov si,offset ascfnt
mov cx,offset ascfntend
sub cx,si
mov ax,[bp+04h]
xor ah,ah
push cs
pop ds
seekASCnext:
cmp ax,[si]
je short seekASCyes
add si,13 ;asc rec len
sub cx,13
cmp cx,13
jae seekASCnext
mov ax,0FFFFh
jmp short seekASCno
seekASCyes:
inc si ;skip asc chr for asc fnt data
mov ax,si
seekASCno:
pox dx,cx,bx
pop bp
ret 2
seekASCfnt endp
ascfnt label byte
db ' ',0,0,0,0,0,0,0,0,0,0,0,0
db '!',0,18h,3Ch,3Ch,3Ch,18h,18h,0,18h,18h,0,0
db '"',0,66h,66h,22h,44h,0,0,0,0,0,0,0
db '#',0,36h,36h,7Fh,36h,36h,36h,7Fh,36h,36h,0,0
db '$',0,18h,7Eh,0D8h,0D8h,7Eh,1Bh,1Bh,7Eh,18h,0,0
db '%',0,7Fh,0DBh,76h,0Ch,18h,30h,6Eh,0DBh,0CEh,0,0
db '&',0,38h,6Ch,6Ch,38h,3Bh,7Eh,6Ch,66h,3Bh,0,0
db "'",0,18h,18h,8,10h,0,0,0,0,0,0,0
db '(',0Ch,18h,18h,30h,30h,30h,30h,30h,18h,18h,0Ch,0
db ')',30h,18h,18h,0Ch,0Ch,0Ch,0Ch,0Ch,18h,18h,30h,0
db '*',0,0,0,36h,1Ch,7Fh,1Ch,36h,0,0,0,0
db '+',0,0,0,18h,18h,7Eh,18h,18h,0,0,0,0
db ',',0,0,0,0,0,0,0,0,18h,18h,8,10h
db '-',0,0,0,0,0,7Fh,0,0,0,0,0,0
db '.',0,0,0,0,0,0,0,0,18h,18h,0,0
db '/',0,6,6,0Ch,0Ch,18h,18h,30h,30h,60h,60h,0
db '0',0,1Ch,36h,63h,67h,6Bh,73h,63h,36h,1Ch,0,0
db '1',0,18h,38h,78h,18h,18h,18h,18h,18h,7Eh,0,0
db '2',0,3Ch,66h,6,6,0Ch,18h,30h,62h,7Eh,0,0
db '3',0,3Ch,66h,6,6,1Ch,6,6,66h,3Ch,0,0
db '4',0,60h,60h,66h,66h,66h,7Fh,6,6,6,0,0
db '5',0,7Eh,60h,60h,7Ch,6,6,6,66h,3Ch,0,0
db '6',0,3Ch,66h,60h,60h,7Ch,66h,66h,66h,3Ch,0,0
db '7',0,7Eh,46h,6,0Ch,0Ch,18h,18h,30h,30h,0,0
db '8',0,3Ch,66h,66h,66h,3Ch,66h,66h,66h,3Ch,0,0
db '9',0,3Ch,66h,66h,66h,3Eh,6,6,66h,3Ch,0,0
db ':',0,0,0,0,18h,18h,0,0,18h,18h,0,0
db ';',0,0,0,0,18h,18h,0,0,18h,18h,8,10h
db '<',0,0,0Ch,18h,30h,60h,30h,18h,0Ch,0,0,0
db '=',0,0,0,0,7Eh,0,7Eh,0,0,0,0,0
db '>',0,0,30h,18h,0Ch,6,0Ch,18h,30h,0,0,0
db '?',0,3Ch,66h,6,6,0Ch,18h,0,18h,18h,0,0
db '@',0,7Ch,82h,9Ah,0AAh,0AAh,0AAh,9Eh,80h,7Ch,0,0
db 'A',0,10h,38h,6Ch,0C6h,0C6h,0FEh,0C6h,0C6h,0C6h,0,0
db 'B',0,0FCh,66h,66h,66h,7Ch,66h,66h,66h,0FCh,0,0
db 'C',0,3Ch,66h,0C0h,0C0h,0C0h,0C0h,0C0h,66h,3Ch,0,0
db 'D',0,0F8h,6Ch,66h,66h,66h,66h,66h,6Ch,0F8h,0,0
db 'E',0,0FEh,62h,60h,60h,78h,60h,60h,62h,0FEh,0,0
db 'F',0,0FEh,62h,60h,60h,78h,60h,60h,60h,0F0h,0,0
db 'G',0,3Ch,66h,0C0h,0C0h,0CEh,0C6h,0C6h,66h,3Eh,0,0
db 'H',0,0C6h,0C6h,0C6h,0C6h,0FEh,0C6h,0C6h,0C6h,0C6h,0,0
db 'I',0,78h,30h,30h,30h,30h,30h,30h,30h,78h,0,0
db 'J',0,1Eh,0Ch,0Ch,0Ch,0Ch,0Ch,0CCh,0CCh,78h,0,0
db 'K',0,0E6h,66h,6Ch,78h,70h,78h,6Ch,66h,0E6h,0,0
db 'L',0,0F0h,60h,60h,60h,60h,60h,62h,66h,0FEh,0,0
db 'M',0,82h,0C6h,0EEh,0FEh,0D6h,0C6h,0C6h,0C6h,0C6h,0,0
db 'N',0,0C6h,0C6h,0E6h,0F6h,0FEh,0DEh,0CEh,0C6h,0C6h,0,0
db 'O',0,7Ch,0C6h,0C6h,0C6h,0C6h,0C6h,0C6h,0C6h,7Ch,0,0
db 'P',0,0FCh,66h,66h,66h,7Ch,60h,60h,60h,0F0h,0,0
db 'Q',0,78h,0CCh,0CCh,0CCh,0CCh,0CCh,0ECh,0DCh,7Ch,6,0
db 'R',0,0FCh,66h,66h,66h,7Ch,78h,6Ch,66h,0E6h,0,0
db 'S',0,7Ch,0C6h,0C0h,0C0h,7Ch,6,6,0C6h,7Ch,0,0
db 'T',0,7Eh,5Ah,18h,18h,18h,18h,18h,18h,3Ch,0,0
db 'U',0,66h,66h,66h,66h,66h,66h,66h,66h,3Ch,0,0
db 'V',0,0C6h,0C6h,0C6h,0C6h,6Ch,6Ch,38h,38h,10h,0,0
db 'W',0,0C6h,0C6h,0C6h,0D6h,0D6h,0FEh,0FEh,6Ch,6Ch,0,0
db 'X',0,0C6h,0C6h,6Ch,6Ch,38h,6Ch,6Ch,0C6h,0C6h,0,0
db 'Y',0,0CCh,0CCh,0CCh,0CCh,78h,30h,30h,30h,30h,0,0
db 'Z',0,0FEh,0C6h,8Ch,18h,30h,60h,0C2h,0C6h,0FEh,0,0
db '[',3Ch,30h,30h,30h,30h,30h,30h,30h,30h,30h,3Ch,0
db '\',0,60h,60h,30h,30h,18h,18h,0Ch,0Ch,6,6,0
db ']',3Ch,0Ch,0Ch,0Ch,0Ch,0Ch,0Ch,0Ch,0Ch,0Ch,3Ch,0
db '^',10h,38h,6Ch,0C6h,0,0,0,0,0,0,0,0
db '_',0,0,0,0,0,0,0,0,0,0,7Fh,0
db '`',0,8,10h,18h,18h,0,0,0,0,0,0,0
db 'a',0,0,0,0,78h,0Ch,3Ch,6Ch,0CCh,76h,0,0
db 'b',0,0E0h,60h,60h,7Ch,66h,66h,66h,66h,0DCh,0,0
db 'c',0,0,0,0,78h,0CCh,0C0h,0C0h,0CCh,78h,0,0
db 'd',0,1Ch,0Ch,0Ch,7Ch,0CCh,0CCh,0CCh,0CCh,76h,0,0
db 'e',0,0,0,0,3Ch,66h,7Eh,60h,60h,3Ch,0,0
db 'f',0,1Ch,36h,30h,30h,78h,30h,30h,30h,78h,0,0
db 'g',0,0,0,0,76h,0CCh,0CCh,0CCh,0CCh,7Ch,0Ch,0F8h
db 'h',0,0E0h,60h,60h,7Ch,66h,66h,66h,66h,0E6h,0,0
db 'i',0,0,18h,0,38h,18h,18h,18h,18h,3Ch,0,0
db 'j',0,0,6,0,0Eh,6,6,6,6,66h,66h,3Ch
db 'k',0,0E0h,60h,60h,66h,6Ch,78h,78h,6Ch,0E6h,0,0
db 'l',0,38h,18h,18h,18h,18h,18h,18h,18h,3Ch,0,0
db 'm',0,0,0,0,0ECh,0FEh,0D6h,0D6h,0D6h,0D6h,0,0
db 'n',0,0,0,0,7Ch,66h,66h,66h,66h,66h,0,0
db 'o',0,0,0,0,3Ch,66h,66h,66h,66h,3Ch,0,0
db 'p',0,0,0,0,0DCh,66h,66h,66h,66h,7Ch,60h,0F0h
db 'q',0,0,0,0,76h,0CCh,0CCh,0CCh,0CCh,7Ch,0Ch,1Eh
db 'r',0,0,0,0,0DCh,76h,60h,60h,60h,0F0h,0,0
db 's',0,0,0,0,3Eh,60h,3Ch,6,6,7Ch,0,0
db 't',0,18h,18h,18h,18h,3Eh,18h,18h,1Ah,0Ch,0,0
db 'u',0,0,0,0,0CCh,0CCh,0CCh,0CCh,0CCh,76h,0,0
db 'v',0,0,0,0,0C6h,0C6h,0C6h,6Ch,38h,10h,0,0
db 'w',0,0,0,0,0C6h,0C6h,0D6h,0D6h,0FEh,6Ch,0,0
db 'x',0,0,0,0,0C6h,6Ch,38h,38h,6Ch,0C6h,0,0
db 'y',0,0,0,0,66h,66h,66h,66h,66h,3Eh,6,7Ch
db 'z',0,0,0,0,7Eh,46h,0Ch,18h,32h,7Eh,0,0
db '{',0Eh,18h,18h,18h,18h,70h,18h,18h,18h,18h,0Eh,0
db '|',18h,18h,18h,18h,18h,0,18h,18h,18h,18h,18h,0
db '}',70h,18h,18h,18h,18h,0Eh,18h,18h,18h,18h,70h,0
db '~',3Bh,6Eh,0,0,0,0,0,0,0,0,0,0
ascfntend label byte
code ends
end start
[ Last edited by 本是 on 2006-9-3 at 11:44 ]
附件
1: DIALOG2.RAR (2006-9-3 11:34, 7.15 K, 下载附件所需积分 1 点
,下载次数: 80)
附件
2: dialog2.jpg (2006-9-3 11:34, 16.15 K, 下载附件所需积分 1 点
,下载次数: 13)
|
my major is english----my love is dos----my teacher is the buddha----my friends--how about U |
|
2006-9-3 11:34 |
|
|
本是
银牌会员
积分 2201
发帖 789
注册 2005-1-27
状态 离线
|
『第
13 楼』:
源程序加了详细的中文注释!(附图同上楼)
;---------------------------------------------------------------------------
; *改进说明*
; ==========
; 0.程序类型由.EXE改为.COM;
; 1.通过使用代码宏让子程序调用直观方便,易调用、易比较、易修改;
;(请参考 *直观的函数调用* 一节)
; 2.通过flag的计算合并原ConfirmTCan/CancelTCon子程序为一ConfCanc;
; 3.简省测试键值代码,回车键执行,其它键切换按钮焦点;
; 4.改进drawPoint子程序,改变每次写点都进行的regs设置为只在程序开头进行一次,
;恢复regs则取消;
; 5.通过焦点flag参数,原来的分立子程序合并为一drawButton;
; 6.drawButton按钮焦点只通过外实框表示(取消内虚框).
;
; 7.脱离庞大的HZK12,内建小汉字库和ASCII字符库,建立seekFnt子程序,搜索小字库,
;并由showMsg子程序调用分别显示中/英文字符;
; 8.建立划线_Line子程序(flag=0:水平,1:垂直),取代宽度/高度为1的DrawRect调用;
; 9.从DrawDialog/DrawButton中分离出drawRect(画框)/drawBevel(画立体边)(原来
;画实矩形DrawRect改名DrawRectF);drawBevel区分单/双层立体边线;
;10.纠正了右侧立体边线的计算错误,立体感更强;
;11.ShowMsg子程序中的dis距离参数意义有变化:由默认的-12和-8,改为字间距,默认
;为0,便于ShowMsg统一效果;
;12.DrawButton子程序的参数flag改作按二进位设置:末位0/1表示未选/已选,次位0/1表
;示立体边厚度为1/2层;
;13.清屏以设置屏幕背景的程序段全面改写,不再需要位平面设置和恢复;
;14.源程序中加入详细汉语注释!!!
;
;---------------------------------------------------------------------------
; *函数参数表*
; ============
;1. ConfCanc (切换按钮焦点) 0:未选,1:选中
;2. ShowMsg (显示字符串) ;(x,y,d,m,c) +---+---+---+
;3. DrawDialog(显示对话框) ;(x,y,w,h)
;4. DrawButton(画按钮:未/选中);(x,y,w,h,f) flag=00B 01B 10B 11B
;5. DrawRectF (画实矩形) ;(x,y,w,h,c)
;6. DrawPoint (画点) ;(x,y,c) +---+---+---+
;7. DrawRect (画矩形框) ;(x,y,w,h,c)
;8. DrawBevel (画立体边) ;(x,y,w,h,f) flag=0:单层,1:双层
;10._Line (画水平/垂直线) ;(x,y,x,c) flag=0:水平,1:垂直
;11.seekFnt (搜索小字库) ;(a,f) flag=0:Asc,1:hz;AX返回0FFFFh/字模地址
;
; d=dis字间距 m=msgPtr字符串 c=color颜色 w=width宽度 h=height高度
; x=w/h宽或高 f=flag标志(含义各异) a=ASCII字符(20h--7Eh或汉字)
;
;---------------------------------------------------------------------------
; *直观的函数调用* ---- 堆栈传参的函数,易调用、易比较、易修改,只要用PUX宏!
; ================
; 1.PUX宏之后要倒放参数表(表达式参数要放在<>中),例如
; ;ShowMsg;(x,y,d,m,c)
; ; c m d y x
; pux 0Fh,<offset warn_T>,00,126,226 ;倒放参数表
; call ShowMsg ;表达式参数要放在<>中
; 2.宏参数中可直接使用子程序的参数也可计算后填入,例如
; ;drawBevel(x,y,w,h,f)
; ; f h w y x
; pux 1,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]> ;直接使用子程序的参数
; call drawBevel
; mov ax,[bp+8];w-6 ;计算后填入
; sub ax,6
; mov bx,[bp+6];y+3
; add bx,3
; mov cx,[bp+4];x+3
; add cx,3
; ;DrawRectF(x,y,w,h,c)
; ; c h w y x
; pux 01h,20,ax,bx,cx
; call DrawRectF
;
;---------------------------------------------------------------------------
;***回车键执行,其它键切换按钮焦点***
; e-mail:lmayylxt@pub.sz.jsinfo.net
; 本是 2006.9.3
;---------------------------------------------------------------------------
;堆栈压入宏
pux macro p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12
irp reg,<p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12>
ifnb <&®>
push &®
endif
endm
endm
;堆栈推出宏
pox macro p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1
irp reg,<p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>
ifnb <&®>
pop &®
endif
endm
endm
.286
code segment
assume cs:code,ds:code
org 100h
start:
mov ax,12h ;图形设备初始化
int 10h ;设置VGA12h模式640x480x16
;寄存器只设置一次以求高速
mov dx,3CEh ;图形控制器
mov ax,0205h
out dx,ax ;索引5:写模式
mov al,08h
out dx,al ;索引8:位屏蔽
inc dx
mov al,0FFh ;屏蔽值
out dx,al
push 0A000h ;图形视频段
pop es
xor di,di ;偏移=0
mov al,3 ;cyan青色
mov cx,80*480 ;8位字节
repz stosb ;清屏置青色背景
;
pux 100,200,120,220
call DrawDialog ;画对话框
pux 0Fh,<offset warn_T>,00,126,226
call ShowMsg ;显示"警告"
pux 00h,<offset exit_M>,00,156,258
call ShowMsg ;显示"您确定要退出系统吗?"
;
call xf1 ;flag置1
call ConfCanc ;切换按钮焦点
call xf1 ;flag置0
;
pux 10B,25,640,456,0
call drawButton ;画任务栏
pux 10B,20,40,458,2
call drawButton ;画[开始]按钮
pux 00h,<offset startB>,03,462,8 开始
call ShowMsg ;显示"开始"
;
WaitPress:
mov ah,00h
int 16h ;取键值入AL,扫描值入AH
cmp ah,1Ch
jnz otherKeys
cmp flag,1;是回车键:
jz exit ;是[取消]:退出
jmp short jmpWP
otherKeys:
call ConfCanc;是其它键:切换按钮焦点
call xf1
jmpWP:
jmp short WaitPress
Exit:
mov ax,3 ;关闭图形设备
int 10h ;VGA 3文本模式
mov ah,4Ch
int 21h ;带返回值AL中止程序
flag db 0 ;:取消,1:确定
xf1 proc near
xor flag,1
ret
xf1 endp
warn_T db '警告 Warning',0 ;中英文自动识别测试
exit_M db '您确定要退出系统吗?',0
confiB db '确定',0
canceB db '取消',0
startB db '开始',0
ShowMsg proc near ;(X,Y,Dis,msgPtr,Color) bp+4
push bp
mov bp,sp
sub sp,4 ;Xtmp[bp-2],Ytmp[bp-4]
pusha ;^局部变量1 ^局部变量2
smsNextC:
mov si,[bp+10]
mov al,[si];第1字节
or al,al ;是串尾0吗?
jz smsJExit;是:退出
cmp al,' ' ;否--
jb smsJNex ;小于空格:跳下一字符
cmp al,'?
ja smsIfHZ ;大于0A0h:是否汉字
cmp al,'~'
ja smsJNex ;大于7Eh=扩展ASCII字符:跳下一字符
jmp short smsASC ;跳ASCII字符
smsJExit:
jmp smsExit
smsJNex:
jmp smsNex
smsIfHZ:
mov ah,al ;存第1字节
mov al,[si+1];取第2字节
cmp al,'? ;测汉字
ja smsHZ ;是:跳
mov al,ah ;否:取回第1字节
smsASC:
xor ah,ah ;清高字节
pux 0,ax
call seekFnt;asc;搜索小字库
cmp ax,0FFFFh
jz smsNex ;未找到:跳下一字符
mov cols__,8 ;显示8列
mov lods__,0ACh;lodsB
mov dist__,8 ;jmp smsNex2
jmp short showCHR;ASC
smsHZ:
xchg ah,al ;高低字节换位
pux 1,ax
call seekFnt;hz;搜索小字库
cmp ax,0FFFFh
jz smsNex2 ;未找到:跳下一字符
mov cols__,12 ;显示12列
mov lods__,0ADh;lodsW
mov dist__,0 ;jmp smsNex
; jmp short showCHR;HZ
ShowChr: ;通用显示中西文字符
mov si,ax
mov ax,[bp+4] ;X初值
mov [bp-2],ax ;Xtmp=X暂存
mov ax,[bp+6] ;Y初值
mov [bp-4],ax ;Ytmp=Y暂存
mov cx,12 ;12像素行
shzNextRow:
push cx
db 0B9h
cols__ db 12h,00;mov cx,12;;
lods__ db 0ADh ;w/AC;b ;lodsw;;
xchg ah,al ;
shzNextCol:
shl ax,1 ;取当前列二进位到进位标志位
jnc shzNotDraw;背景点不写
pux <[bp+12]>,<[bp-4]>,<[bp-2]>
call DrawPoint;写前景点
shzNotDraw:
inc word ptr[bp-2] ;Xtmp=Xtmp+1 下一列
loop shzNextCol
pop cx
inc word ptr[bp-4] ;Ytmp=Ytmp+1 下一行
mov ax,[bp+4] ;取X
mov [bp-2],ax ;存入Xtmp
loop shzNextRow
db 0EBh ;jmp short smsNex2/smsNex
dist__ db 00h ;08h 按汉字/字符进行不同距离的跳转smsNex2/smsNex
smsNex2:
inc word ptr[bp+10] ;调整汉字串指针
mov ax,12 ;字间距基值12-12(汉字宽)=0
jmp short smsNex1
smsNex:
mov ax,8 ;字间距基值8-8(字符宽)=0
smsNex1:
inc word ptr[bp+10] ;调整字符串指针
add ax,[bp+8] ;附加字间距
add word ptr[bp+4],ax;调整下一字符的初始X位置
jmp smsNextC
smsExit:
popa
add sp,4
pop bp
ret 10
ShowMsg endp
seekFnt proc near ;(Chr,flag) flag=0:asc,1:hz
push bp ;AX=0FFFFh:未找到,字模偏移值
mov bp,sp
pux bx,cx,dx,si
mov si,offset ascFnt ;预设为ASC字模数据地址
mov cx,offset ascFntEnd
cmp byte ptr [bp+6],0
jz sFskipChng
mov si,offset hzFnt ;是汉字:改用汉字字模数据地址
mov cx,offset hzFntEnd
sFskipChng:
sub cx,si ;库长
mov ax,[bp+04h] ;取汉字到AX
push cs
pop ds
seekNext:
cmp ax,[si] ;比较小字库中的字符
je short seekYes ;找到
push cx ;调整小字库指针
mov cx,[bp+6]
mov dx,13 ;ASC记录长13=1+12
shl dx,cl ;HZ 记录长26=2+12*2
pop cx
add si,dx ;下一记录
sub cx,dx ;剩余库长
cmp cx,dx ;还有一个记录长度吗?
jae seekNext ;找下一个
mov ax,0FFFFh;不足
jmp short seekNo ;未找到
seekYes:
mov dx,[bp+6];取标志值
inc dx ;加1为字符宽度,=1:asc,2:hz
add si,dx;跳过字符取字模地址
mov ax,si;送入AX作返回值
seekNo:
pox si,dx,cx,bx
pop bp
ret 4
seekFnt endp
ConfCanc proc near
;flag=1 0
mov al,flag
xor ah,ah
xor al,1 ;0 1
pux ax,22,61,180,240
call DrawButton
pux 00h,<offset confiB>,06,184,254
call ShowMsg ;画[确定]按钮
;
xor al,1 ;1 0
pux ax,22,61,180,340
call DrawButton
pux 00h,<offset canceB>,06,184,354
call ShowMsg ;画[取消]按钮
ret
ConfCanc endp
DrawDialog proc near ;(x,y,width,height) bp+4
push bp
mov bp,sp
pux ax,bx,cx
pux 07h,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call DrawRectF ;主窗口
mov ax,[bp+8];w-6
sub ax,6
mov bx,[bp+6];y+3
add bx,3
mov cx,[bp+4];x+3
add cx,3
pux 01h,20,ax,bx,cx ;x+3,y+3,w-6,20,1
call DrawRectF ;主题栏
pux 1,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call drawBevel ;立体边
pox ax,bx,cx
pop bp
ret 8
DrawDialog endp
DrawButton proc near ;(x,y,width,height,flag) bp+4
push bp
mov bp,sp
push ax
pux 07h,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call DrawRectF ;主窗口
mov al,0
mov ah,byte ptr [bp+12] ;flag:......1.
test ah,00000010B
jz DBisZero;the bit is zero
inc al
DBisZero:
xor ah,ah
pux ax,<[bp+10]>,<[bp+8]>,<[bp+6]>,<[bp+4]>
call drawBevel ;立体边
mov ah,byte ptr [bp+12] ;flag:.......1
test ah,00000001B
jz DBisZero1;the bit is zero
pux 00h,[bp+10],[bp+8],<[bp+6]>,<[bp+4]>
call DrawRect ;实焦点框
DBisZero1: ;notSelected
pop ax
pop bp
ret 10
DrawButton endp
DrawRect proc near ;(x,y,w,h,color)
push bp
mov bp,sp
pux ax,bx,cx,dx
mov al,[bp+0Ch]
mov bx,[bp+4]
mov cx,[bp+6]
pux 0,ax,<[bp+08h]>,cx,bx
call _Line;上--
pux 1,ax,<[bp+0Ah]>,cx,bx
call _Line;左|
mov cx,[bp+0Ah]
add cx,[bp+06h]
dec cx
pux 0,ax,<[bp+08h]>,cx,bx
call _Line;下--
mov bx,[bp+08h]
add bx,[bp+04h]
dec bx
pux 1,ax,<[bp+0Ah]>,<[bp+06h]>,bx
call _Line;右 |
pox dx,cx,bx,ax
pop bp
ret 10
DrawRect endp
DrawBevel proc near ;(x,y,w,h,f)
push bp
mov bp,sp
pux ax,bx,cx,dx
mov ax,[bp+4];x+1
inc ax
mov bx,[bp+6];y+1
inc bx
mov cx,[bp+8];w-3
dec cx
dec cx
dec cx
pux 0,0Fh,cx,bx,ax
call _Line;上--白
mov dx,[bp+10];h-3
dec dx
dec dx
dec dx
pux 1,0Fh,dx,bx,ax
call _Line;左|白
mov bx,[bp+6];y+h-2
add bx,[bp+10]
dec bx
dec bx
mov cx,[bp+8];w-2
dec cx
dec cx
pux 0,8,cx,bx,ax
call _Line;下--灰
cmp byte ptr [bp+12],0
jz DBskip1
dec ax;x
inc bx;y+h-1
inc cx;w
inc cx
pux 0,0,cx,bx,ax
call _Line;下--黑
DBskip1:
mov ax,[bp+4];x+w-2
add ax,[bp+8]
dec ax
dec ax;;;
mov bx,[bp+6];y+1
inc bx
mov dx,[bp+10];h-2
dec dx
dec dx
pux 1,8,dx,bx,ax
call _Line;右 |灰
cmp byte ptr [bp+12],0
jz DBskip2
inc ax;x+w-1
dec bx;y
inc dx;h
inc dx
pux 1,0,dx,bx,ax
call _Line;右 |黑
DBskip2:
pox dx,cx,bx,ax
pop bp
ret 10
DrawBevel endp
DrawRectF proc near ;(x,y,width,height,color) bp+4
push bp
mov bp,sp
pusha
DrawLineV: ;列
mov ax,[bp+4]
mov dx,[bp+8]
DrawLineH: ;行
pux <[bp+12]>,<[bp+6]>,ax
call DrawPoint
inc ax
dec dx
jnz DrawLineH
inc word ptr[bp+6]
dec word ptr[bp+10]
jnz DrawLineV
popa
pop bp
ret 10
DrawRectF endp
_Line proc near;(x,y,h,c,f)
push bp
mov bp,sp
pux ax,bx,cx,dx
mov bl,43h
mov al,[bp+12]
or al,al
jz _Lskip
dec bl
_Lskip:
mov cs:_LhORv,bl
mov al,[bp+10]
mov bx,[bp+4]
mov dx,[bp+6]
mov cx,[bp+8]
_Lloop:
pux ax,dx,bx
call DrawPoint
_LhORv db 43h;inc dx;42h;vLine 列增1:纵线
loop _Lloop;inc bx;43h;hLine 行增1:横线
pox dx,cx,bx,ax
pop bp
ret 10
_Line endp
DrawPoint proc near ;(x,y,color)
push bp
mov bp,sp
pusha
push 0A000h
pop es
mov ax,[bp+06h]
shl ax,04h
mov bx,ax
shl ax,02h
add ax,bx ;y*80=y*(64+16)=y shl 6+y shl 4
mov bx,[bp+04h]
mov cl,bl
shr bx,03h;x/8
add bx,ax ;BX=偏移值
mov al,80h
and cl,07h
shr al,cl ;AL=屏蔽值
mov dx,3CFh;图形控制器
out dx,al ;索引8:设置位屏蔽值
mov ah,es:[bx] ;读旧值
mov al,[bp+08h];取色值
mov es:[bx],al ;置新值
popa
pop bp
ret 06
DrawPoint endp
hzFnt label byte
db '警',29h,20h,0FDh,0F0h,56h,0A0h,74h,40h,4,0A0h,0FFh,0F0h,0,0,3Fh,0C0h,0,0,3Fh,0C0h,20h,40h,3Fh,0C0h
db '告',12h,0,12h,40h,3Fh,0E0h,22h,0,42h,20h,0FFh,0F0h,0,0,1Fh,0C0h,10h,40h,10h,40h,1Fh,0C0h,10h,40h
db '您',14h,0,24h,0,2Fh,0F0h,71h,20h,0A5h,40h,29h,20h,33h,10h,20h,0,54h,40h,52h,0A0h,90h,90h,0Fh,80h
db '确',1,0,0F9h,0E0h,22h,40h,27h,0F0h,4Ch,90h,77h,0F0h,0D4h,90h,57h,0F0h,54h,90h,74h,90h,54h,0D0h,8,0A0h
db '定',4,0,2,0,7Fh,0F0h,40h,10h,0BFh,0C0h,4,0,24h,80h,27h,0C0h,24h,0,34h,0,4Ch,0,83h,0F0h
db '要',0,0,0FFh,0F0h,9,0,3Fh,0C0h,29h,40h,3Fh,0C0h,8,0,0FFh,0F0h,11h,80h,0Eh,0,5,80h,78h,60h
db '退',47h,0C0h,24h,40h,27h,0C0h,4,40h,7,0C0h,0E4h,0,25h,40h,24h,80h,26h,40h,24h,20h,50h,0,8Fh,0F0h
db '出',4,0,24h,40h,24h,40h,24h,40h,3Fh,0C0h,24h,40h,4,0,44h,20h,44h,20h,44h,20h,7Fh,0E0h,40h,20h
db '系',1,0C0h,7Eh,0,8,80h,11h,0,3Eh,0,8,40h,7Fh,0E0h,2,20h,13h,80h,22h,40h,42h,20h,86h,0
db '统',22h,0,21h,0,4Fh,0F0h,52h,0,0E4h,40h,2Fh,0E0h,42h,0A0h,0F2h,80h,2,80h,0F2h,90h,4,90h,18h,70h
db '吗',0,40h,0F7h,0E0h,90h,40h,92h,40h,92h,40h,93h,0F0h,90h,10h,0F0h,90h,8Fh,0D0h,0,20h,0,0A0h,0,40h
db '?',0,0,3Eh,0,63h,0,63h,0,6,0,0Ch,0,0Ch,0,0,0,0Ch,0,0Ch,0,0,0,0,0
db '取',8,0,0FCh,0,4Bh,0E0h,48h,20h,79h,20h,49h,40h,79h,40h,4Ch,80h,78h,80h,0C9h,40h,0Ah,20h,0Ch,10h
db '消',41h,0,25h,20h,13h,40h,81h,0,47h,0E0h,14h,20h,27h,0E0h,24h,20h,0C7h,0E0h,44h,20h,44h,0A0h,44h,60h
db '开',0,40h,7Fh,0E0h,8,80h,8,80h,8,0A0h,0FFh,0F0h,8,80h,8,80h,10h,80h,10h,80h,20h,80h,0C0h,80h
db '始',21h,0,21h,0,22h,40h,0FAh,20h,2Fh,0F0h,28h,10h,4Bh,0E0h,52h,20h,52h,20h,32h,20h,4Bh,0E0h,82h,20h
hzFntEnd label byte
;汉字字模的偶数字节低4位未用,所以总是0!
; 0123 4567 89AB ////- ;'~',3Bh,6Eh,10 dup(0)
;21 ..1. ...1 .... .... 00 ; 0123 4567
;21 ..1. ...1 .... .... 00 ;3B ..11 1.11
;22 ..1. ..1. 1... .... 40 ;6E .11. 111.
;FA 1111 1.1. ..1. .... 20 ; .... ....
;2F ..1. 1111 1111 .... F0 ; .... ....
;28 ..1. 1... ...1 .... 10 ;7E .111 111.
;4B .1.. 1.11 111. .... E0 ;46 .1.. .11.
;52 1..1 ..1. ..1. .... 20 ;0C .... 11..
;52 .1.1 ..1. ..1. .... 20 ;18 ...1 1...
;32 ..11 ..1. ..1. .... 20 ;32 ..11 ..1.
;4B .1.. 1.11 111. .... E0 ;7E .111 111.
;82 1... ..1. ..1. .... 20 ; .... ....
;'始',21h,00,21h,0,22h,40h ; .... ....
;0FAh,20h,2Fh,0F0h,28h,10h ;'z',0,0,0,0
; 4Bh,0E0h,52h,20h,52h,20h ;7Eh,46h,0Ch,18h,32h,7Eh
; 32h,20h,4Bh,0E0h,82h,20h ;0,0
ascFnt label byte
db ' ',0,0,0,0,0,0,0,0,0,0,0,0
db '!',0,18h,3Ch,3Ch,3Ch,18h,18h,0,18h,18h,0,0
db '"',0,66h,66h,22h,44h,0,0,0,0,0,0,0
db '#',0,36h,36h,7Fh,36h,36h,36h,7Fh,36h,36h,0,0
db '$',0,18h,7Eh,0D8h,0D8h,7Eh,1Bh,1Bh,7Eh,18h,0,0
db '%',0,7Fh,0DBh,76h,0Ch,18h,30h,6Eh,0DBh,0CEh,0,0
db '&',0,38h,6Ch,6Ch,38h,3Bh,7Eh,6Ch,66h,3Bh,0,0
db "'",0,18h,18h,8,10h,0,0,0,0,0,0,0
db '(',0Ch,18h,18h,30h,30h,30h,30h,30h,18h,18h,0Ch,0
db ')',30h,18h,18h,0Ch,0Ch,0Ch,0Ch,0Ch,18h,18h,30h,0
db '*',0,0,0,36h,1Ch,7Fh,1Ch,36h,0,0,0,0
db '+',0,0,0,18h,18h,7Eh,18h,18h,0,0,0,0
db ',',0,0,0,0,0,0,0,0,18h,18h,8,10h
db '-',0,0,0,0,0,7Fh,0,0,0,0,0,0
db '.',0,0,0,0,0,0,0,0,18h,18h,0,0
db '/',0,6,6,0Ch,0Ch,18h,18h,30h,30h,60h,60h,0
db '0',0,1Ch,36h,63h,67h,6Bh,73h,63h,36h,1Ch,0,0
db '1',0,18h,38h,78h,18h,18h,18h,18h,18h,7Eh,0,0
db '2',0,3Ch,66h,6,6,0Ch,18h,30h,62h,7Eh,0,0
db '3',0,3Ch,66h,6,6,1Ch,6,6,66h,3Ch,0,0
db '4',0,60h,60h,66h,66h,66h,7Fh,6,6,6,0,0
db '5',0,7Eh,60h,60h,7Ch,6,6,6,66h,3Ch,0,0
db '6',0,3Ch,66h,60h,60h,7Ch,66h,66h,66h,3Ch,0,0
db '7',0,7Eh,46h,6,0Ch,0Ch,18h,18h,30h,30h,0,0
db '8',0,3Ch,66h,66h,66h,3Ch,66h,66h,66h,3Ch,0,0
db '9',0,3Ch,66h,66h,66h,3Eh,6,6,66h,3Ch,0,0
db ':',0,0,0,0,18h,18h,0,0,18h,18h,0,0
db ';',0,0,0,0,18h,18h,0,0,18h,18h,8,10h
db '<',0,0,0Ch,18h,30h,60h,30h,18h,0Ch,0,0,0
db '=',0,0,0,0,7Eh,0,7Eh,0,0,0,0,0
db '>',0,0,30h,18h,0Ch,6,0Ch,18h,30h,0,0,0
db '?',0,3Ch,66h,6,6,0Ch,18h,0,18h,18h,0,0
db '@',0,7Ch,82h,9Ah,0AAh,0AAh,0AAh,9Eh,80h,7Ch,0,0
db 'A',0,10h,38h,6Ch,0C6h,0C6h,0FEh,0C6h,0C6h,0C6h,0,0
db 'B',0,0FCh,66h,66h,66h,7Ch,66h,66h,66h,0FCh,0,0
db 'C',0,3Ch,66h,0C0h,0C0h,0C0h,0C0h,0C0h,66h,3Ch,0,0
db 'D',0,0F8h,6Ch,66h,66h,66h,66h,66h,6Ch,0F8h,0,0
db 'E',0,0FEh,62h,60h,60h,78h,60h,60h,62h,0FEh,0,0
db 'F',0,0FEh,62h,60h,60h,78h,60h,60h,60h,0F0h,0,0
db 'G',0,3Ch,66h,0C0h,0C0h,0CEh,0C6h,0C6h,66h,3Eh,0,0
db 'H',0,0C6h,0C6h,0C6h,0C6h,0FEh,0C6h,0C6h,0C6h,0C6h,0,0
db 'I',0,78h,30h,30h,30h,30h,30h,30h,30h,78h,0,0
db 'J',0,1Eh,0Ch,0Ch,0Ch,0Ch,0Ch,0CCh,0CCh,78h,0,0
db 'K',0,0E6h,66h,6Ch,78h,70h,78h,6Ch,66h,0E6h,0,0
db 'L',0,0F0h,60h,60h,60h,60h,60h,62h,66h,0FEh,0,0
db 'M',0,82h,0C6h,0EEh,0FEh,0D6h,0C6h,0C6h,0C6h,0C6h,0,0
db 'N',0,0C6h,0C6h,0E6h,0F6h,0FEh,0DEh,0CEh,0C6h,0C6h,0,0
db 'O',0,7Ch,0C6h,0C6h,0C6h,0C6h,0C6h,0C6h,0C6h,7Ch,0,0
db 'P',0,0FCh,66h,66h,66h,7Ch,60h,60h,60h,0F0h,0,0
db 'Q',0,78h,0CCh,0CCh,0CCh,0CCh,0CCh,0ECh,0DCh,7Ch,6,0
db 'R',0,0FCh,66h,66h,66h,7Ch,78h,6Ch,66h,0E6h,0,0
db 'S',0,7Ch,0C6h,0C0h,0C0h,7Ch,6,6,0C6h,7Ch,0,0
db 'T',0,7Eh,5Ah,18h,18h,18h,18h,18h,18h,3Ch,0,0
db 'U',0,66h,66h,66h,66h,66h,66h,66h,66h,3Ch,0,0
db 'V',0,0C6h,0C6h,0C6h,0C6h,6Ch,6Ch,38h,38h,10h,0,0
db 'W',0,0C6h,0C6h,0C6h,0D6h,0D6h,0FEh,0FEh,6Ch,6Ch,0,0
db 'X',0,0C6h,0C6h,6Ch,6Ch,38h,6Ch,6Ch,0C6h,0C6h,0,0
db 'Y',0,0CCh,0CCh,0CCh,0CCh,78h,30h,30h,30h,30h,0,0
db 'Z',0,0FEh,0C6h,8Ch,18h,30h,60h,0C2h,0C6h,0FEh,0,0
db '[',3Ch,30h,30h,30h,30h,30h,30h,30h,30h,30h,3Ch,0
db '\',0,60h,60h,30h,30h,18h,18h,0Ch,0Ch,6,6,0
db ']',3Ch,0Ch,0Ch,0Ch,0Ch,0Ch,0Ch,0Ch,0Ch,0Ch,3Ch,0
db '^',10h,38h,6Ch,0C6h,0,0,0,0,0,0,0,0
db '_',0,0,0,0,0,0,0,0,0,0,7Fh,0
db '`',0,8,10h,18h,18h,0,0,0,0,0,0,0
db 'a',0,0,0,0,78h,0Ch,3Ch,6Ch,0CCh,76h,0,0
db 'b',0,0E0h,60h,60h,7Ch,66h,66h,66h,66h,0DCh,0,0
db 'c',0,0,0,0,78h,0CCh,0C0h,0C0h,0CCh,78h,0,0
db 'd',0,1Ch,0Ch,0Ch,7Ch,0CCh,0CCh,0CCh,0CCh,76h,0,0
db 'e',0,0,0,0,3Ch,66h,7Eh,60h,60h,3Ch,0,0
db 'f',0,1Ch,36h,30h,30h,78h,30h,30h,30h,78h,0,0
db 'g',0,0,0,0,76h,0CCh,0CCh,0CCh,0CCh,7Ch,0Ch,0F8h
db 'h',0,0E0h,60h,60h,7Ch,66h,66h,66h,66h,0E6h,0,0
db 'i',0,0,18h,0,38h,18h,18h,18h,18h,3Ch,0,0
db 'j',0,0,6,0,0Eh,6,6,6,6,66h,66h,3Ch
db 'k',0,0E0h,60h,60h,66h,6Ch,78h,78h,6Ch,0E6h,0,0
db 'l',0,38h,18h,18h,18h,18h,18h,18h,18h,3Ch,0,0
db 'm',0,0,0,0,0ECh,0FEh,0D6h,0D6h,0D6h,0D6h,0,0
db 'n',0,0,0,0,7Ch,66h,66h,66h,66h,66h,0,0
db 'o',0,0,0,0,3Ch,66h,66h,66h,66h,3Ch,0,0
db 'p',0,0,0,0,0DCh,66h,66h,66h,66h,7Ch,60h,0F0h
db 'q',0,0,0,0,76h,0CCh,0CCh,0CCh,0CCh,7Ch,0Ch,1Eh
db 'r',0,0,0,0,0DCh,76h,60h,60h,60h,0F0h,0,0
db 's',0,0,0,0,3Eh,60h,3Ch,6,6,7Ch,0,0
db 't',0,18h,18h,18h,18h,3Eh,18h,18h,1Ah,0Ch,0,0
db 'u',0,0,0,0,0CCh,0CCh,0CCh,0CCh,0CCh,76h,0,0
db 'v',0,0,0,0,0C6h,0C6h,0C6h,6Ch,38h,10h,0,0
db 'w',0,0,0,0,0C6h,0C6h,0D6h,0D6h,0FEh,6Ch,0,0
db 'x',0,0,0,0,0C6h,6Ch,38h,38h,6Ch,0C6h,0,0
db 'y',0,0,0,0,66h,66h,66h,66h,66h,3Eh,6,7Ch
db 'z',0,0,0,0,7Eh,46h,0Ch,18h,32h,7Eh,0,0
db '{',0Eh,18h,18h,18h,18h,70h,18h,18h,18h,18h,0Eh,0
db '|',18h,18h,18h,18h,18h,0,18h,18h,18h,18h,18h,0
db '}',70h,18h,18h,18h,18h,0Eh,18h,18h,18h,18h,70h,0
db '~',3Bh,6Eh,0,0,0,0,0,0,0,0,0,0
ascFntEnd label byte
code ends
end start
[ Last edited by 本是 on 2006-9-4 at 11:08 ]
附件
1: DIALOG3.RAR (2006-9-4 11:07, 8.67 K, 下载附件所需积分 1 点
,下载次数: 111)
|
my major is english----my love is dos----my teacher is the buddha----my friends--how about U |
|
2006-9-4 11:07 |
|
|
zyl910
中级用户
积分 282
发帖 126
注册 2006-5-17
状态 离线
|
『第
14 楼』:
没必要输入ASCII小字库吧
有取得显卡ROM中字体的中断调用
Quote: | --------V-101130-----------------------------
INT 10 - VIDEO - GET FONT INFORMATION (EGA, MCGA, VGA)
AX = 1130h
BH = pointer specifier
00h INT 1Fh pointer
01h INT 43h pointer
02h ROM 8x14 character font pointer
03h ROM 8x8 double dot font pointer
04h ROM 8x8 double dot font (high 128 characters)
05h ROM alpha alternate (9 by 14) pointer (EGA,VGA)
06h ROM 8x16 font (MCGA, VGA)
07h ROM alternate 9x16 font (VGA only) (see #00021)
11h (UltraVision v2+) 8x20 font (VGA) or 8x19 font (autosync EGA)
12h (UltraVision v2+) 8x10 font (VGA) or 8x11 font (autosync EGA)
Return: ES:BP = specified pointer
CX = bytes/character of on-screen font (not the requested font!)
DL = highest character row on screen
Note: for UltraVision v2+, the 9xN alternate fonts follow the corresponding
8xN font at ES:BP+256N
BUG: the IBM EGA and some other EGA cards return in DL the number of rows on
screen rather than the highest row number (which is one less).
SeeAlso: AX=1100h,AX=1103h,AX=1120h,INT 1F"SYSTEM DATA",INT 43"VIDEO DATA"
Format of alternate font table [array]:
Offset Size Description (Table 00021)
00h BYTE character to be replaced (00h = end of table)
01h N BYTEs graphics data for character, one byte per scan line |
|
|
人类存在的目的就是试图理解人类为何存在 |
|
2006-9-4 21:30 |
|
|
本是
银牌会员
积分 2201
发帖 789
注册 2005-1-27
状态 离线
|
『第
15 楼』:
谢谢提醒!
可能12X8的点阵字库是非标准字库吧。
|
my major is english----my love is dos----my teacher is the buddha----my friends--how about U |
|
2006-9-4 23:52 |
|
|