string - Access data on the stack -
i'm planning write program in assembly searches substring in string , writes words contain substring. example:
string: "adgfh asdsd zxc dbasdas"
substring: "as"
output: "asdsd dbasdas"
the idea use 1 register (dx) , stack store data. i'm pushing string , substring stack. main question - possible access data under top element in stack without popping data? want use dx remember spaces between words , compare each letter in string 1st letter in string, , if it's same letter increment pointer in both string , substring point @ next letter in words , redo comparing...etc.
yes, can access items on stack because stack memory. if in 16 bit mode, can not use dx
that, need bx
, si
, di
or bp
. example:
mov bx, sp mov bl, ss:[bx+10]
note need ss
segment override except bp
. in 32 bit mode can use esp
directly, such as:
mov dl, [esp+10]
ps: that's strange project first program ;)
Comments
Post a Comment