中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » “坐享宏”汇编的多行结构控制块!
作者:
标题: “坐享宏”汇编的多行结构控制块! 上一主题 | 下一主题
本是
银牌会员





积分 2201
发帖 789
注册 2005-1-27
状态 离线
『楼 主』:  “坐享宏”汇编的多行结构控制块!

“坐享宏”汇编的多行结构控制块!CALL name (p1,p2,p3,...)!!!

如果有人感兴趣,可以上传SIT.INC宏库、进一步解释和写教程。

;---------------------------------------------------------------------------
;  *改进说明*
;   ========
; 0. 程序调用"多行控制结构体"宏,实现高级语言程序控制结构,甚至有类似C语言的
;    break,continue语句,从此汇编语言也能缩进嵌套,直观明了!
; 1. 程序实现参数的PUSH/POP/CALL三合一宏,方便调用,如:
;    PPC .,es,ax,bx,si         ;=PUSH 多参数同行!
;    PPC -,es,ax,bx,si         ;=POP  顺序同对应的PUSH,不再需要颠倒!
;    PPC drawPoint,x,y,color   ;=CALL drawPoint(x,y,color) 参数顺序直观!
;    PPC drawBox,ax,bx,<[bp+6]>;  可直接用寄存器/子程序参数
;---------------------------------------------------------------------------
;   *函数参数表*                                 +----标题栏有/无
;   ============                                 |+---  对话框/按钮
;1. ConfCanc  (切换按钮焦点)                     ||+--  有焦点/无焦点
;2. ShowStr0  (显示字符串)    ;(x,y,d,s,c)       ^^^        ^   ^
;3. DrawDiaBut(画对话框/按钮) ;(x,y,w,h,f) flag=0bdfB       1 / 0
;4. DrawPoint (画点)          ;(x,y,c)
;5. DrawRectF (画框/横/竖线)  ;(x,y,w,h,c)
;6. seekFnt   (搜索小字库字模);(a,f) f=1:Asc,2:hz;AX返回0FFFFh/字模地址
;
; d=dis字间距  s=strPtr字符串  c=color颜色  w=width宽度  h=height高度
; f=flag标志(含义各异)         a=ASCII字符(20h--7Eh或汉字)
;---------------------------------------------------------------------------
;***回车键执行,其它键切换按钮焦点***
;   e-mail:lmayylxt@pub.sz.jsinfo.net
;   本是   2007.1.8
; 鸣谢:
;   1.SIT.INC"多行控制结构体"宏由Davidson Corry附在SIT程序包,本是仅
;     精减其中部分宏名及变量名等,使之更简短,方便阅读理解;
;     改原宏名及变量名起始符_(甚至___)为更便于输入的.;
;     增加PUSH/POP/CALL三合一宏,以方便保护/恢复现场及用栈传参的子程序CALL;
;   2.DIALOG原始程序见本论坛(http://www.cn-dos.net/forum/viewthread.php?tid=22279&fpage=2),经精减修正并结构化处理
;---------------------------------------------------------------------------

include sit.inc

.286
code  segment
  assume  cs:code,ds:code
  org 100h
start:
  mov ax,12h   ;init graph
  int 10h      ;set display mode in al

;regs set once for program
  mov dx,3CEh ;port 3CEh, EGA graphic index
  mov ax,0205h
  out dx,ax   ; al = 5, mode
  mov al,08h
  out dx,al   ; al = 8, data bit mask
;make background
  inc dx
  mov al,0FFh
  out dx,al
  push 0A000h ;graph video buffer seg
  pop es
  xor di,di   ;ofs
  mov ax,303h ;cyan
  mov cx,80*480/2
  repz stosw  ;CLS to make cyan background

  ppc DrawDiaBut,220,120,200,100,110B
  ppc ShowStr0,226,126,00,<offset warn_T>,0Fh ;警告
  ppc ShowStr0,258,156,00,<offset exit_M>,00 ;您确定要退出系统吗?

  call xf1
  call ConfCanc

  ppc DrawDiaBut,0,456,640,25,010B
  ppc DrawDiaBut,2,458, 40,20,010B
  ppc ShowStr0,8,462,03,<offset startB>,00 ;开始

  .loop
    mov ah,00h
    int 16h ;  get keybd char in al, ah=scan
    .if <cmp ah,1Ch>,nz ;CR
      call ConfCanc
    .else
      .break <cmp flag,1>,z
    .endif
  .lend
  mov ax,3 ;closeGraph
  int 10h  ;set display mode in al
  mov ah,4Ch
  int 21h  ;terminate with al=return code



warn_T db '警 Warning 告',0
exit_M db '您确定要退出系统吗?',0
confiB db '确定',0
canceB db '取消',0
startB db '开始',0


ascORhz dw -1
zflag db 0
ShowStr0 proc near ;(X,Y,Dis,msgPtr,Color) bp+4
  push bp
  mov bp,sp
  sub sp,4 ;x[bp-2],y[bp-4],cols[bp-6],
  pusha
  .loop
    mov si,[bp+10]
    mov al,[si]
    mov ascORhz,1
    mov cols__1,8   ;
    .break <or al,al>,z
    call setzflag
    .if <cmp zflag,0>,e
      call modiMem
      ppc seekFnt,ax,bx;1;asc;2;hz
      .if <cmp ax,0FFFFh>,nz
        mov si,ax ;ShowChr:
        mov ax,[bp+4]
        mov [bp-2],ax
        mov ax,[bp+6]
        mov [bp-4],ax
        mov cx,12
        .loop
          push cx
        db 0B9h
        cols__ db 12,00;mov cx,12;8;;
        lods__ db 0ADh  ;w/AC;b ;lodsw;;
          xchg ah,al    ;
          .loop
            shl ax,1      ;
            .if ,c
              ppc DrawPoint,<[bp-2]>,<[bp-4]>,<[bp+12]>
            .endif
            inc word ptr[bp-2]
          .nextcx
          pop cx
          inc word ptr[bp-4]
          mov ax,[bp+4]
          mov [bp-2],ax
        .nextcx
      .endif
    .endif
    mov ax,ascORhz
    add word ptr[bp+10],ax ;ascORhz
    db 0B8h
  cols__1 db 12,00  ;mov ax,12;8
    add ax,[bp+8]
    add word ptr[bp+4],ax
  .lend
  popa
  add sp,4
  pop bp
  ret 10
ShowStr0 endp

setzflag proc near
  .if <cmp al,' '>,ae
    .if <cmp al,'?>,a
      mov ah,[si+1]
      .if <cmp ah,'?>,a
        inc ascORhz ;HZ
      .else
        mov zflag,1
      .endif
    .else
      .if <cmp al,'~'>,a ;else ASC
        mov zflag,1
      .endif
    .endif
  .else
    mov zflag,1
  .endif
  ret
setzflag endp

modiMem proc near
  .if <cmp al,'~'>,be
    xor ah,ah
  .endif
  mov cx,ascORhz
  push cx
  mov bx,4
  .loop
    add bx,4
  .nextcx
  mov cols__1,bl
  mov cols__, bl
  pop cx
  mov bx,cx
  add cl,0ABh
  mov lods__,cl
  ret
modiMem endp

xflag db 0
seekFnt proc near ;(Chr,flag) flag=1:asc,2:hz;AX=0FFFFh:not found,else:fntDataOfs
  push bp
  mov bp,sp
  ppc ., bx,cx,dx,si
  mov si,offset ascFnt
  mov cx,offset ascFntEnd
  .if <cmp byte ptr [bp+6],2>,e
    mov si,offset hzFnt
    mov cx,offset hzFntEnd
  .endif
  sub cx,si
  mov ax,[bp+4]
  push cs
  pop ds
  .loop
    .if <cmp ax,[si]>,e
      mov xflag,1
      .break
    .else
      mov xflag,0
    .endif
    push cx
    mov cx,[bp+6]
    dec cx ;1:asc,2:hz
    mov dx,13
    shl dx,cl
    pop cx
    add si,dx ;rec len:asc:13/hz:26
    sub cx,dx
  .until <cmp cx,dx>,b
  .if <cmp xflag,0>,e
    mov ax,0FFFFh
  .else
    mov dx,[bp+6] ;1:asc,2:hz
    add si,dx;skip chr for fnt data
    mov ax,si
  .endif
  ppc -,bx,cx,dx,si
  pop bp
  ret 4
seekFnt endp


flag db 0h
ConfCanc proc near
        ;flag=1  0
  mov al,flag
  xor ah,ah
  xor al,1   ;0  1
  ppc DrawDiaBut,240,180,61,22,ax
  ppc ShowStr0,254,184,08,<offset confiB>,00 ;确定

  xor al,1   ;1  0
  ppc DrawDiaBut,340,180,61,22,ax
  ppc ShowStr0,354,184,08,<offset canceB>,00 ;取消
xf1:
  xor flag,1
  ret
ConfCanc endp


DrawDiaBut proc near ;(x,y,width,height,BDFflag) bp+4
  push bp                              ;b <----- 1=Banner,0=no banner
  mov bp,sp                            ; ^d <--- 1=Dialog,0=button
  ppc ., ax,bx,cx                      ;  ^f <-- 1=Focus, 0=non-focus

  ppc DrawRectF,<[bp+4]>,<[bp+6]>,<[bp+8]>,<[bp+10]>,07 ;main win

  mov ax,[bp+10];h-3
  sub ax,3
  mov bx,[bp+6];y+1
  inc bx
  mov cx,[bp+4];x+1
  inc cx
  ppc DrawRectF,cx,bx,1,ax,0Fh;left | white

  mov ax,[bp+8];w-3
  sub ax,3;y+1;x+1;same as last FUN
  ppc DrawRectF,cx,bx,ax,1,0Fh;upper -- white

  mov ax,[bp+10];h-2
  dec ax
  dec ax;y+1;same as last FUN
  mov cx,[bp+4];x+w-1-1;;;
  add cx,[bp+8]
  dec cx
  dec cx;;;
  ppc DrawRectF,cx,bx,1,ax,08h;right | grey

  mov ax,[bp+8];w-2
  dec ax
  dec ax
  mov bx,[bp+6];y+h-2
  add bx,[bp+10]
  dec bx
  dec bx
  mov cx,[bp+4];x+1
  inc cx
  ppc DrawRectF,cx,bx,ax,1,08;bottom -- gray

  mov xflag,0
  .while <cmp xflag,1>,nz
    mov al,byte ptr [bp+12]
    .if <test al,0010B>,nz
      .if <test al,0100B>,nz
        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
        ppc DrawRectF,cx,bx,ax,20,01;blue banner
      .endif
    .else
      .break <test al,0001B>,z
      mov ax,[bp+10];h-1
      dec ax
      ppc DrawRectF,<[bp+4]>,<[bp+6]>,1,ax,00;left | black

      mov ax,[bp+8];w-1
      dec ax
      ppc DrawRectF,<[bp+4]>,<[bp+6]>,ax,1,00;top -- black
    .endif
    call BRbr
    mov xflag,1 ;run once!
  .wend
  ppc -,ax,bx,cx
  pop bp
  ret 10
DrawDiaBut  endp

BRbr proc near
  mov ax,[bp+4];x+w-1;noBanner
  add ax,[bp+8]
  dec ax
  ppc DrawRectF,ax,<[bp+6]>,1,<[bp+10]>,00;right | black

  mov ax,[bp+6];y+h-1
  add ax,[bp+10]
  dec ax
  ppc DrawRectF,<[bp+4]>,ax,<[bp+8]>,1,00;bottom -- black
  ret
BRbr endp

DrawRectF proc near ;(x,y,width,height,color) bp+4
  push bp    ;draw RectangleFilled/hLine(if w=1)/vLine(if h=1)
  mov bp,sp
  pusha
  .loop
    mov ax,[bp+4]
    mov dx,[bp+8]
    .loop
      ppc DrawPoint,ax,<[bp+6]>,<[bp+12]> ;word ptr
      inc ax ;x
      dec dx ;hLen
    .until ,z
    inc word ptr[bp+6]  ;y
    dec word ptr[bp+10] ;vLen
  .until ,z
  popa
  pop bp
  ret 10
DrawRectF endp

DrawPoint proc near ;(x,y,color)
  push bp
  mov bp,sp
  pusha
  push 0A000h ;es=segm
  pop es
  mov ax,[bp+6]
  shl ax,4
  mov bx,ax
  shl ax,2
  add ax,bx
  mov bx,[bp+4]
  mov cl,bl
  shr bx,3
  add bx,ax  ;bx=offs
  mov al,80h
  and cl,7
  shr al,cl  ;mask to proper bit within a byte
  mov dx,3CFh
  out dx,al ; port 3CEh, EGA graphic index;  al = 8, data bit mask
  mov ah,es:[bx]
  mov al,[bp+8]
  mov es:[bx],al
  popa
  pop bp
  ret 6
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,0CC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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 2007-1-22 at 05:36 AM ]

   此帖被 +26 点积分         点击查看详情   
评分人:【 AlwaysInherit 分数: +2  时间:2007-1-9 05:43
评分人:【 electronixtar 分数: +23  时间:2007-1-10 08:51
评分人:【 429499381 分数: +1  时间:2007-1-18 18:57




my major is english----my love is dos----my teacher is the buddha----my friends--how about U
2007-1-9 05:31
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
electronixtar
铂金会员





积分 7493
发帖 2672
注册 2005-9-2
状态 离线
『第 2 楼』:  

偶对 本是 兄的敬佩犹如滔滔江水啊~~~可惜偶菜鸟一个,友情顶了~~

2007-1-10 08:52
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
本是
银牌会员





积分 2201
发帖 789
注册 2005-1-27
状态 离线
『第 3 楼』:  

RE electronixtar:
   不敢当!(按中国人的习惯) Thank you.(按西方人的习惯)

“改进说明”中的1.有改动如下:
; 1. 程序实现方便堆栈传参的.PUSH/.POP/.CALL宏,方便调用,如:
;    .PUSH es,ax,bx,si              ;多参数同行,节省源程序空间!(入栈序:si,bx,ax,es)
;    .POP  es,ax,bx,si              ;对应的入出栈同序,便于复制!(出栈序:si,bx,ax,es)
;    .P0P  si,bx,ax,es              ;保留按原序出栈.           (出栈序:si,bx,ax,es)
;    .CALL drawPoint,cx,dx,<[bp+6]> ;参数顺序直观,与DECLARE申明同序!
;                                   ;可直接用寄存器/子程序参数 (入栈序:[bp+6],dx,cx)
更加方便直观!

改动后的SIT.INC宏库文件及DIALOG.ASM在附件中下载。

[ Last edited by 本是 on 2007-1-15 at 11:56 AM ]

附件 1: SITdialog.rar (2007-1-15 11:56, 10.05 K, 下载附件所需积分 1 点 ,下载次数: 11)


my major is english----my love is dos----my teacher is the buddha----my friends--how about U
2007-1-10 11:47
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
happyman06
初级用户




积分 52
发帖 19
注册 2006-9-2
状态 离线
『第 4 楼』:  狂顶!

绝对经典,感谢本是大哥的无私提供!再顶一下!

2007-1-10 12:19
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
本是
银牌会员





积分 2201
发帖 789
注册 2005-1-27
状态 离线
『第 5 楼』:  汇编也用 可嵌套多行结构体!!!

;;;;;; SIT.INC 坐享宏----汇编语言也用 可嵌套多行结构体
;基于Davidson Corry(4610 SW Lander,Seattle, WA  98116,(206) 935-0244)
;的SIT.INC, 是"多行控制结构体"宏, 实现高级语言程序控制结构,甚至有类似C语言
;的BREAK,CoNTiNUe语句,从此汇编语言也能缩进嵌套,直观明了!
;支持分支结构IF..ELSE..ELSEIF..ENDIF,
;    循环结构WHILE..WEND,LOOP..UNTIL/NEXTCX
;    循环体中可以用BREAK中断退出
;                  CNTNU/AGAIN/AGAINCX继续下一循环
;未设计FOR循环(可通过WHILE/UNTIL循环实现)
;    和多分支SWITCH/CASE(可通过ELSEIF实现).
;
;经苏州本是/罗明安改编
;     精减其中部分宏名及变量名等,使之更简短,方便阅读理解;
;     改原宏名及变量名起始符_(甚至___)为更便于输入的.;
;     增加.PUSH/.POP/.P0P/.CALL宏,以方便保护/恢复现场及用栈传参的.CALL;
;     成功添加大于128字节的跳转/循环支持!!!且扩展方便!

;    原来一旦出现大于128字节的跳转,就必须另开子程序,
;    现在只要让出错的语句用一个0(或其它非空参数)就行了!例如:
;      .loop           .loop ,,0
;      .break <or al,al>,z  改作 .break <or al,al>,z,0
;      .lend            .lend ,,0
;
    即可!!!

;     按简洁和标准的原则,结构体现改名如下:
;
;    (op=能引起标志变化的任何语句, cnd=跳转条件, long=非空为是,空为非)
;;分支
;.if op,cnd,long
;.else long
;.elif op,cnd,long
;.endif
;
;;当型循环
;.while op,cnd,long
;  .break op,cnd,long
;  .conti op,cnd,long
;.wend ,,long
;
;;到型循环
;.loop ,,long
;  .break op,cnd,long
;  .conti op,cnd,long
;.until op,cnd,long
;
;;到型循环
;.loop ,,long
;  .break op,cnd,long
;  .contx cnd ,long
;.untix cnd ,long
;
;;CASE多分支
;.if  op,cnd,long   ;case 1
;.elif op,cnd,long ;case 2
;.elif op,cnd,long ;case 3
;.else long          ;default
;.endif
;
;;FOR循环
;op1 ;初值
;.while op2,cnd,long
;      ;op2=终值判断
;  op3 ;步长运算
;
;.wend ,,long
;
;;FOR循环
;op1 ;初值
;.loop ,,long
;
;  op3 ;步长运算
;      ;op2=终值判断
;.until op2,cnd,long
;
;;复合循环
;.while op,cnd,long
;  .break op,cnd,long
;  .conti op,cnd,long
;.until op,cnd,long
;
;;空循环
;.loop ,,long
;  .break ...    ;不加中断语句
;.lend ,,long   ;即成死循环!!
;
;;===========================================================================
;上述参数表面复杂,实际上只要记住一句话就能搞定:
;
; 暗地不用餐, 否则独脚龙, 汝难玩,逗逗侬, 差差跳远比跳远!
;
; .endif            不用参数     ==>暗地      不用餐
; .else             独脚LONG     ==>否则      独脚龙
; .loop/.lend/.wend 逗逗LONG     ==>汝难玩    逗逗侬
; .contx/.untix     跳转LONG     ==>(你)差差  跳远
; 其它              比较跳转LONG ==>(我和你)  比跳远
;
;         LONG参数平时一概不管,只在距离大于128字节的跳转/循环处
;                 引起编译出错时,才需要添加!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
已更新3楼的附件,dialog.asm是使用结构宏体的MASM汇编源程序示范,
sit.inc是结构体宏定义文件。

[ Last edited by 本是 on 2007-1-13 at 06:06 AM ]



my major is english----my love is dos----my teacher is the buddha----my friends--how about U
2007-1-12 03:20
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
本是
银牌会员





积分 2201
发帖 789
注册 2005-1-27
状态 离线
『第 6 楼』:  

成功添加超128字节的长循环支持!!!
3楼、4楼已经更新!!!


[ Last edited by 本是 on 2007-1-13 at 06:08 AM ]



my major is english----my love is dos----my teacher is the buddha----my friends--how about U
2007-1-13 05:58
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
poor
初级用户





积分 160
发帖 36
注册 2006-12-23
状态 离线
『第 7 楼』:  

thank you   :)

2007-1-14 04:21
查看资料  发短消息 网志   编辑帖子  回复  引用回复
本是
银牌会员





积分 2201
发帖 789
注册 2005-1-27
状态 离线
『第 8 楼』:  

已修正长循环中对方向的支持。
已更新3楼附件!!!



my major is english----my love is dos----my teacher is the buddha----my friends--how about U
2007-1-15 11:55
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: