Re: I have a problem with my study



spamtrap@xxxxxxxxxx schrieb:

I read a program,but some of my program confuse me
what are these "push ds

Push DS on the stack.
Oh where is your stack?

sub ax,ax

Clear AX.

push ax "

Push the (empty) AX on the stack.

...

I don´t know why these both pushes are using.

prognam segment
main proc far
assume cs rognam

rognam?

start:
push ds
sub ax,ax
push ax
mov ch,4
rotate: mov cl,4
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
jl printit
add al,7h
printit:
mov dl,al
mov ah,2
int 21h

See Ralf Browns Interrupt List(RBIL).
http://www.pobox.com/~ralf
http://www.pobox.com/~ralf/files.html
ftp://ftp.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/

RBIL->inter61b.zip->Interrup.f:
--------D-2102-------------------------------
INT 21 - DOS 1+ - WRITE CHARACTER TO STANDARD OUTPUT
AH = 02h
DL = character to write
Return: AL = last character output (despite the official docs which state
nothing is returned) (at least DOS 2.1-7.0)
Notes: ^C/^Break are checked, and INT 23 executed if pressed
standard output is always the screen under DOS 1.x, but may be
redirected under DOS 2+
the last character output will be the character in DL unless DL=09h
on entry, in which case AL=20h as tabs are expanded to blanks
if standard output is redirected to a file, no error checks (write-
protected, full media, etc.) are performed
SeeAlso: AH=06h,AH=09h
-------------------------------------------------

Dirk

.



Relevant Pages

  • Re: bitcopy in delphi.
    ... > The pointer type can handle anything. ... Your code uses more stack space than mine. ... push ebx ... mov, edx ...
    (alt.comp.lang.borland-delphi)
  • Re: keyboard/mouse programming
    ... MOV,AX ... PUSH 0 ... Actually, if _all_ variables are on the stack or moved to it, then ... Well, this is small-c after all, a single ...
    (alt.lang.asm)
  • Re: Question about stack...
    ... MOV BP, SP ... Dealloc of locals is a simple `mov sp, ... I didn't even push anything on the stack and my value was ...
    (comp.lang.asm.x86)
  • Re: I have a problem with my study
    ... what are these "push ds ... sub ax,ax ... This sets up a return address on your stack. ... mov ax, @data ...
    (comp.lang.asm.x86)
  • Re: keyboard/mouse programming
    ... CALL mytest ... MOV,AX ... PUSH 0 ... Actually, if _all_ variables are on the stack or moved to it, then ...
    (alt.lang.asm)