![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-15 00:22 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS开发编程 & 发展交流 (开发室) » Post a self-written assembly language imitation of a Windows dialog box |
| Printable Version 15,200 / 51 |
| Floor1 pick | Posted 2006-08-02 22:30 |
| 新手上路 Posts 4 Credits 16 | |
|
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; *Program Description* ;=============================================================================================== ; ; ; Dialog boxes are composed of lines and rectangles. A standard Windows dialog box uses 5 colors, namely: ; #D4D0C8, #0E296E, #FFFFFF, #808080, #404040. Among them, #D4D0C8 is the main color of the dialog box, ; #0E296E is the title bar color, and the other three colors are the colors used for the dialog box border. The dialog box border is mainly used to create ; dialog box 3D effect. ; ; Since this program uses the 640*480*16 color display mode, the 5 colors required by the standard Windows program cannot be obtained, so similar colors are used for replacement. ; ; I searched the Internet for a long time for relevant information on the 640*480*16 color mode, but finally did not find detailed information. ; I wrote a draw point function (DrawPointb in the program), but there is a problem when drawing a rectangle with this function. When the color number is odd, it is normal. If the color number is even, the rectangle will not be displayed correctly. The draw point function used in this program is found on the Internet, but this function also has a problem, that is, the speed is very slow. If you use it to fill the entire screen with points, it will take a long time. So the large background in the program is drawn in the way I understand, and the others use the DrawPoint function. If anyone has more detailed information about the 640*480*16 color display mode, don't forget to tell me. ; ; The way of displaying Chinese characters is a bit different from that of displaying with C language. Because in real mode, the maximum capacity of each segment is 64K, and the font file is more than 100K, so the font file cannot be read into at one time. The method I use is to open the font file, then move the pointer each time a Chinese character is displayed, move the pointer to the corresponding dot matrix, then read the dot matrix information of one character into memory until the string is displayed. ; ; If the program is to run on bare metal, the dot matrix information of the Chinese characters to be displayed needs to be extracted from the font library. The subroutine for displaying Chinese characters also needs to be modified accordingly. ; ; Due to time constraints, there are basically no comments. The functions of each function: ; ; 1. ConfirmTCan (change the button from confirmed state to canceled state) ; 2. CanTConfirm (change the button from canceled state to confirmed state) ; 3. ShowHanZi (Chinese character display subroutine) ; 4. DrawDialog (dialog box display subroutine) ; 5. DrawButtonNoSelected (draw an unselected button) ; 6. DrawButtonOnSelected (draw a selected button) ; 7. DrawRect (rectangle drawing subroutine) ; 8. DrawPoint (point drawing subroutine) ; ; ************Tab key or arrow key to control button focus change****************************** ; ; e-mail:westdatas@163.com OICQ:19820914 ; Nirvana 2006.8.1 ;============================================================================================== .286 data segment flag db 0h words db ''Warning'',0 words0 db ''Are you sure you want to exit the system?'',0 words1 db ''OK'',0 words2 db ''Cancel'',0 words3 db ''Start'',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 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 Attachments dialog.rar (107.53 KiB) |
|
| Floor2 070 | Posted 2006-08-03 00:31 |
| 高级用户 Posts 218 Credits 663 From 福建 | |
|
Great! Take a screenshot for you
But didn't clear the screen at the end You can use VESA display mode, you are proficient in assembly, you should understand this http://www.cn-dos.net/forum/viewthread.php?tid=6205&fpage=1&highlight=VESA Using assembly alone is too much work, it is suggested to use ASM+C, but then the speed and size... [ Last edited by 070 on 2006-8-3 at 01:24 ] |
|
| Floor3 profree | Posted 2006-08-04 15:09 |
| 中级用户 Posts 132 Credits 478 | |
|
That's amazing, assembly language is really difficult
|
|
| Floor4 070 | Posted 2006-08-04 15:39 |
| 高级用户 Posts 218 Credits 663 From 福建 | |
|
Assembly is not too difficult, just the amount of work is extremely large
|
|
| Floor5 electronixtar | Posted 2006-08-05 11:02 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Awesome!
|
|
| Floor6 jizhouhao | Posted 2006-08-09 10:50 |
| 新手上路 Posts 3 Credits 6 | |
| Floor7 profree | Posted 2006-08-09 18:20 |
| 中级用户 Posts 132 Credits 478 | |
|
I know nothing about assembly language at all. I've read many books, but just can't get started. What should I do?
|
|
| Floor8 070 | Posted 2006-08-10 19:29 |
| 高级用户 Posts 218 Credits 663 From 福建 | |
|
Reading "80x86 Assembly Language Programming"
|
|
| Floor9 brglng | Posted 2006-08-11 20:59 |
| 银牌会员 Posts 466 Credits 1,200 From 上海 | |
|
Can this program be made into a 32-bit protected mode one?
|
|
| Floor10 mornsmile | Posted 2006-08-16 06:39 |
| 初级用户 Posts 23 Credits 147 | |
|
It's easy to get tired when looking at assembly code.
|
|
| Floor11 本是 | Posted 2006-09-01 18:02 |
| 银牌会员 Posts 790 Credits 2,227 | |
|
;Originally an improved DIALOG1.ASM:
;--------------------------------------------------------------------------- ; *Improvement Instructions* ; ========== ; 0. The program type is changed from .EXE to .COM; ; 1. Through the use of code macros, the subroutine calls are intuitive and convenient, easy to call, compare, and modify; ; 2. By calculating the flag, the original ConfirmTCan/CancelTCon subroutines are merged into one ConfCanc; ; 3. Simplify the test key value code, the Enter key executes, and other keys switch the button focus; ; 4. Improve the drawPoint subroutine, change the regs setting that is performed every time a point is written to only once at the beginning of the program, and cancel it when restoring regs; ; 5. Through the focus flag parameter, the original separate subroutines are merged into one drawButton; ; 6. The button focus of drawButton is only represented by an outer solid frame (the inner dashed frame is canceled). ; ;--------------------------------------------------------------------------- ; To be improved: ; ========== ; 1. Use an efficient horizontal/vertical line drawing program to replace the relevant code (such as drawRect for drawing solid frames); ; 2. Improve the Chinese character writing code; ; 3. Establish small Chinese character font patterns and Western character font patterns code; ; 4. Establish a unified character display subroutine (automatically identify Chinese and Western characters) ; 5. Establish a start button function menu (Run/Help/Quit) ; ;--------------------------------------------------------------------------- ; Functions and call parameter tables: ; ==== ==== ====== ;1. ConfCanc (Switch button state: OK/Cancel) ;2. ShowHanZi (Display Chinese character) ;(X,Y,Dis,WordsPtr,ZiKuPtr,Color) bp+4 ;3. DrawDialog (Display dialog box) ;(x,y,width,height) bp+4 ;4. DrawButton (Draw button: not/selected);(x,y,width,height,OnOffFlag) bp+4 ;5. DrawRect (Draw rectangle) ;(x,y,width,height,color) bp+4 ;6. DrawPoint (Draw point) ;(x,y,color) bp+4 ; ;--------------------------------------------------------------------------- ;***Enter key to execute, other keys switch button focus*** ; e-mail:lmayylxt@pub.sz.jsinfo.net ; Ben Shi 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 ;Warning call ShowHanZi pux 00h,<offset hzk>,<offset exit_M>,12,156,258 ;Are you sure you want to exit the system? call ShowHanZi pux 00h,<offset hzk>,<offset confiB>,20,184,254 ;OK call ShowHanZi pux 00h,<offset hzk>,<offset canceB>,20,184,354 ;Cancel call ShowHanZi pux 00h,<offset hzk>,<offset startB>,15,462,8 ;Start 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 'Warning',0 exit_M db 'Are you sure you want to exit the system?',0 confiB db 'OK',0 canceB db 'Cancel',0 startB db 'Start',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 ;OK call ShowHanZi xor al,1 ;1 0 pux ax,22,61,180,340 call DrawButton pux 00h,<offset hzk>,<offset canceB>,20,184,354 ;Cancel 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,y,handle,24 dup(0) for fontData pusha mov dx, mov ax,3D00h ; open file, al=mode,name@ds:dx int 21h mov ,ax jnc shzNextC mov word ptr,1 shzExitZz: jmp shzExit shzNextC: mov si, mov ax, 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 cx,24 ;12*2 mul dx mov cx,dx mov dx,ax mov bx, 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, int 21h ; read file, bx=file handle; cx=bytes to ds:dx buffer pop ds xor si,si mov bx, mov ax, mov ,ax mov ax, mov ,ax mov cx,12 shzNextRow: push cx mov cx,12 mov dx,8000h ;mask shzNextCol: mov ax, xchg ah,al test ax,dx jz shzNotDraw pux <>,<>,<> call DrawPoint ;(x,y,color) shzNotDraw: inc word ptr shr dx,1 loop shzNextCol pop cx add si,2 inc word ptr mov ax, mov ,ax loop shzNextRow add word ptr,2 mov ax, add word ptr,ax jmp shzNextC shzExit: mov ah,3Eh mov bx, 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,<>,<>,<>,<> call DrawRect ;(x,y,width,height,color) bp+4 ;///blue banner/// mov ax, sub ax,6 mov bx, add bx,3 mov cx, add cx,3 pux 01h,20,ax,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 ;///Left white/// mov ax, sub ax,3 mov bx, inc bx mov cx, inc cx pux 0Fh,ax,1,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 ;///upper white/// mov ax, sub ax,3 mov bx, inc bx mov cx, inc cx pux 0Fh,1,ax,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 ;///right gray/// mov ax, sub ax,2 mov bx, inc bx mov cx, add cx, dec cx ;sub ax,1 pux 08h,ax,1,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 ;///right black/// mov ax, add ax, dec ax ;sub ax,1 pux 00h,<>,1,<>,ax call DrawRect ;(x,y,width,height,color) bp+4 ;///bottom gray/// mov ax, sub ax,2 mov bx, add bx, sub bx,2 mov cx, inc cx pux 08h,1,ax,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 ;///bottom black/// mov ax, add ax, dec ax ;sub ax,1 pux 00h,1,<>,ax,<> 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,<>,<>,<>,<> call DrawRect ;(x,y,width,height,color) bp+4 ;///Left white/// mov ax, sub ax,3 mov bx, inc bx mov cx, inc cx pux 0Fh,ax,1,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 ;///upper white/// mov ax, sub ax,3 mov bx, inc bx mov cx, inc cx pux 0Fh,1,ax,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 ;///right gray/// mov ax, sub ax,2 mov bx, inc bx mov cx, add cx, dec cx ;sub ax,1 pux 08h,ax,1,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 ;///bottom gray/// mov ax, sub ax,2 mov bx, add bx, sub bx,2 mov cx, inc cx pux 08h,1,ax,bx,cx call DrawRect ;(x,y,width,height,color) bp+4 cmp byte ptr ,0 jz notSelected ;;;solid ;///Left Black/// mov ax, dec ax pux 00h,ax,1,<>,<> call DrawRect ;(x,y,width,height,color) bp+4 ;///Top Black/// mov ax, dec ax pux 00h,1,ax,<>,<> call DrawRect ;(x,y,width,height,color) bp+4 ;///right black/// mov ax, add ax, dec ax ;sub ax,1 pux 00h,<>,1,<>,ax call DrawRect ;(x,y,width,height,color) bp+4 ;///bottom black/// mov ax, add ax, dec ax ;sub ax,1 pux 00h,1,<>,ax,<> 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, mov dx, DrawLineH: pux <word ptr>,<word ptr>,ax call DrawPoint ;(x,y,color) inc ax dec dx jnz DrawLineH inc word ptr dec word ptr 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, shl ax,04h mov bx,ax shl ax,02h add ax,bx mov bx, 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: mov al, mov es:,al popa pop bp ret 06 DrawPoint endp code ends end start Attachments DIALOG1.RAR (3.7 KiB) DIALOG1.jpg (10.88 KiB) |
|
| Floor12 本是 | Posted 2006-09-03 11:34 |
| 银牌会员 Posts 790 Credits 2,227 | |
|
;---------------------------------------------------------------------------
; *Improvement Instructions* ; ======== ; 0. The program type is changed from .EXE to .COM; ; 1. Subroutine calls are made intuitive and convenient through the use of code macros, easy to call, compare, and modify; ; 2. The original ConfirmTCan/CancelTCon subroutines are merged into one ConfCanc through flag calculation; ; 3. Simplify the test key value code, enter key executes, other keys switch button focus; ; 4. Improve the drawPoint subroutine, change the regs setting that was performed every time a point was written to only be performed once at the beginning of the program, and cancel it when restoring regs; ; 5. Through the focus flag parameter, the original separate subroutines are merged into one drawButton; ; 6. The button focus of drawButton is only indicated by the outer solid frame (the inner dashed frame is canceled). ; 7. Separated from the large HZK12, built-in small Chinese character library and ASCII character library, established seekHZfnt/seekASCfnt subroutines, search small character library, and in the showMsg subroutine respectively SEEK and display Chinese/English characters; ; 8. Establish horizontal line hLine/vertical line vLine subroutines to replace DrawRect calls with width/height 1; ; 9. Separate drawRect (draw frame)/drawBevel (draw three-dimensional edge) from DrawDialog/DrawButton (the original draw solid rectangle DrawRect is renamed DrawRectF); drawBevel distinguishes single/double-layer three-dimensional side lines; ;10. Corrected the calculation error of the right three-dimensional side line. ;11. The meaning of the dis distance parameter in the ShowMsg subroutine has changed: the default for Chinese characters is 12, the default for characters is 8, the word spacing is dis, not the original default value of 0, and the word spacing is purely controlled by dis, which is convenient for unifying the effect of ShowMsg; ;--------------------------------------------------------------------------- ;Function roles and call parameter tables: ; ==== ==== ====== ;1. ConfCanc (switch button state: OK/Cancel) ;2. ShowMsg (display string) ;(X,Y,Dis,MsgPtr,Color) bp+4 ;3. DrawDialog(display dialog box) ;(x,y,width,height) bp+4 ;4. DrawButton(draw button: not/selected);(x,y,width,height,OnOffFlag) bp+4 ;5. DrawRectF (draw solid rectangle) ;(x,y,width,height,color) bp+4 ;6. DrawPoint (draw point) ;(x,y,color) bp+4 ;7. DrawRect (draw rectangle frame) ;(x,y,width,height,color) bp+4 ;8. DrawBevel (draw three-dimensional edge) ;(x,y,width,height,DblSglFlag) bp+4 ;9. hLine (draw horizontal line) ;(x,y,w,color) bp+4 ;10.vLine (draw vertical line) ;(x,y,h,color) bp+4 ;11.seekHZfnt (search Chinese characters in small character library);(hzChr) bp+4 AX returns character model offset address or 0FFFFh ;12.seekASCfnt(search characters in small character library);(AscChr) bp+4 AX returns character model offset address or 0FFFFh ;--------------------------------------------------------------------------- ;***Enter key executes, other keys switch button focus*** ; e-mail:lmayylxt@pub.sz.jsinfo.net ; Ben Shi 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 ;Warning call ShowMsg pux 00h,<offset exit_M>,00,156,258 ;Are you sure you want to exit the system? 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 ;Start 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 'Are you sure you want to exit the system?',0 confiB db 'OK',0 canceB db 'Cancel',0 startB db 'Start',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 ;OK call ShowMsg ; xor al,1 ;1 0 pux ax,22,61,180,340 call DrawButton pux 00h,<offset canceB>,06,184,354 ;Cancel 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,y pusha smsNextC: mov si, mov al, 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, 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 mov ax,12 jmp short smsNex1 smsNex: mov ax,8 smsNex1: inc word ptr add ax, add word ptr,ax jmp smsNextC smsExit: popa add sp,4 pop bp ret 10 ShowMsg endp ShowHZ: mov si,ax mov ax, mov ,ax mov ax, mov ,ax mov cx,12 shzNextRow: push cx mov cx,12 mov dx,8000h ;mask shzNextCol: mov ax, xchg ah,al test ax,dx jz shzNotDraw pux <>,<>,<> call DrawPoint ;(x,y,color) shzNotDraw: inc word ptr shr dx,1 loop shzNextCol pop cx add si,2 inc word ptr mov ax, mov ,ax loop shzNextRow jmp smsNex2 ShowASC: mov si,ax mov ax, mov ,ax mov ax, mov ,ax mov cx,12 sasNextRow: push cx mov cx,8 mov dx,80h ;mask sasNextCol: mov ax, test ax,dx jz sasNotDraw pux <>,<>,<> call DrawPoint ;(x,y,color) sasNotDraw: inc word ptr shr dx,1 loop sasNextCol pop cx inc si inc word ptr mov ax, mov ,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,<>,<>,<>,<> call DrawRectF ;(x,y,width,height,color) bp+4 ;///blue banner/// mov ax,;w-6 sub ax,6 mov bx,;y+3 add bx,3 mov cx,;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,<>,<>,<>,<> 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,<>,<>,<>,<> call DrawRectF ;(x,y,width,height,color) bp+4 ;///white/grey/black edges/// pux 0,<>,<>,<>,<> call drawBevel cmp byte ptr ,0 jz notSelected ;///solid focus box/// pux 00h,,,<>,<> 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, mov bx, mov cx, pux ax,<>,cx,bx call hLine; up----------- pux ax,<>,cx,bx call vLine;left| mov cx, add cx, dec cx pux ax,<>,cx,bx call hLine;bottom----------- mov bx, add bx, dec bx pux ax,<>,<>,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,;x+1 inc ax mov bx,;y+1 inc bx mov cx,;w-3 dec cx dec cx dec cx pux 0Fh,cx,bx,ax call hLine; up----------- mov ax,;x+1 inc ax mov bx,;y+1 inc bx mov dx,;h-3 dec dx dec dx dec dx pux 0Fh,dx,bx,ax call vLine;left| mov ax,;x+1 inc ax mov bx,;y+h-2 add bx, dec bx dec bx mov cx,;w-2 dec cx dec cx pux 8,cx,bx,ax call hLine;bottom----------- cmp byte ptr ,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,;x+w-2 add ax, dec ax dec ax;;; mov bx,;y+1 inc bx mov dx,;h-2 dec dx dec dx pux 8,dx,bx,ax call vLine;right | cmp byte ptr ,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, mov dx, DrawLineH: pux <>,<>,ax call DrawPoint ;(x,y,color) inc ax dec dx jnz DrawLineH inc word ptr dec word ptr 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, mov bx, mov dx, mov cx, 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, mov bx, mov dx, mov cx, 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, shl ax,04h mov bx,ax shl ax,02h add ax,bx mov bx, 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: mov al, mov es:,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, push cs pop ds seekHZagn: cmp ax, 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, xor ah,ah push cs pop ds seekASCnext: cmp ax, 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,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 Ben Shi on 2006-9-3 at 11:44 ] Attachments DIALOG2.RAR (7.15 KiB) dialog2.jpg (16.15 KiB) |
|
| Floor13 本是 | Posted 2006-09-04 11:07 |
| 银牌会员 Posts 790 Credits 2,227 | |
|
Attachments DIALOG3.RAR (8.67 KiB) |
|
| Floor14 zyl910 | Posted 2006-09-04 21:30 |
| 中级用户 Posts 126 Credits 282 | |
|
No need to input ASCII small character sets, there are interrupt calls to obtain the fonts from the video card ROM.
|
|
| Floor15 本是 | Posted 2006-09-04 23:52 |
| 银牌会员 Posts 790 Credits 2,227 | |
|
Thanks for the reminder!
Maybe the 12X8 dot matrix font is a non-standard font. |
|
| 1 2 3 4 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |