AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > 汇编语言

汇编源码--getseg_c

51自学网 http://www.wanshiok.com
; Name          getseg -- Get current Segment Values;;; Synopsis      getseg(pcs, pds, pes, pss, psi, pdi, psp, pflag);;;               unsigned *cs Pointer to where code segment address goes;               unsigned *ds Pointer to data segment;               unsigned *es Pointer to extra segment;               unsigned *ss Pointer to stack segment;               unsigned *si Pointer to si register;               unsigned *di Pointer to di register;               unsigned *sp Pointer to sp register;               unsigned *flag Returns flag;;; Returns       cs              value of Code segment;               ds              value of Data segment;               es              value of Extra segment;               ss              value of Stack segment;               si              value of SI register ****NOT RELIABLE****;               di              value of DI register;               sp              value of Stack Pointer;               flag            value of Flags register;;;pgroup  group    progprog    segment  byte public 'PROG' ; Combine with C 'PROG' program segment        assume   cs:pgroup        public   getseggetseg proc     near        push     bp                 ; Save the frame pointer        mov      bp,sp        mov      si,[bp + 04]       ; Get the values for the registers        mov      ax,[si]        mov      si,[bp + 06]        mov      bx, [si]        mov      si,[bp + 08]        mov      cx, [si]        mov      si,[bp + 10]        mov      dx,[si];==============================================================================        mov ax, cs                  ;Get value of code segment        mov bx, ds                  ;data segment        mov cx, es                  ;extra segment        mov dx, ss                  ;stack segment;==============================================================================uret:   mov      bp,sp              ; Now recover the values of the        mov      si,[bp + 04]       ; parameters        mov      [si],ax        mov      si, [bp + 06]        mov      [si], bx        mov      si, [bp + 08]        mov      [si], cx        mov      si, [bp + 10]        mov      [si], dx        mov      si, [bp + 12]        mov      [si], si        mov      si, [bp + 14]        mov      [si], di        mov      si, [bp + 16]        mov      [si], sp        mov      al, 00             ;zero out al        lahf                        ;load flag into ah        mov      si, [bp + 18]        mov      [si], ax        mov      ax,0               ; No errorquit:   pop      bp                 ; Get the original frame pointer.        retgetseg endpprog    ends        end

 

 

 
上一篇:汇编源码--getspace  下一篇:汇编源码--fxn