1.

Solve : push pop?

Answer»

Ok. so i have heard of a WAY to "push" stuff into ram and "pop" it back out ... leaving a computers hard drive untouched (i think this falls in to the field of computer forensics)... the catch is you must push them on in the reverse order of how you want to pop them off.... any info on this topic would be appreciated.Push and Pop are features (commands) in Assembly programming language (the language of the Gods) and I'm sure there are other references to it. As you will see from the following LIFO is the sequence you mention (extract from this site.)

"The Stack
The stack is a place where data is TEMPORARILY stored. The SS and SP registers point to that place like this: SS:SP So the SS register is the segment and the SP register CONTAINS the offset. There are a few INSTRUCTIONS that make use of the stack. POP and PUSH are the most basic ones. PUSH can "push" a value on the stack and POP can retrieve that value from the stack. It works like this:

MOV AX,1234H
PUSH AX
MOV AH,09
INT 21H
POP AX

The final value of AX will be 1234h. First we load 1234h into AX, then we push that value to the stack. We now store 9 in AH, so AX will be 0934h and execute an INT. Then we pop the AX register. We retreive the pushed value from the stack. So AX contains 1234h again. Another example:

MOV AX, 1234H
MOV BX, 5678H
PUSH AX
POP BX

The final values will be: AX=1234h BX=1234h. We pushed the AX to the stack and we popped that value in BX.
As in the first program, you have to define a stack segment. It is easy done by the instruction .stack that will create a stack of 1024 bytes. Yes, there's more about the stack than just this. The stack usses a LIFO system (Last In First Out) Another example:

MOV AX,1234H
MOV BX,5678H
PUSH AX
PUSH BX
POP AX
POP BX

The values: AX=5678h BX=1234h First the value 1234h was pushed after that the value 5678h was pushed to the stack. Acording to LIFO 5678h comes of first, so AX will pop that value and BX will pop the next.
How does the stack look in memory? Well, it "grows" downwards in memory. When you push a word (2 bytes) for example, the word will be stored at SS:SP and SP will be decreased to times. So in the beginning SP points to the top of the stack and (if you don't pay attention) it can grow so big downwards in memory that it overwrites the source code. MAJOR system crash is the result."

Good luckVery usefull info. Now, how do we do it with dos? first of all i know that this is a hardware specific task, second of all i dont know $#!t.

heres my theory: set some binary code as a variable (variables are stored on ram right?) then find the start point and finesse the pointer on the HD to that sector


^^^^ COMPLETE GUESSSorry - my knowledge of pushing and popping in dos is limited to the PUSHD and POPD commands which, as you will know, are used in changing default directories. Perhaps someone else will take up this topic.

Good luck.@dusty, maybe the debug command? there should be a way to put those assmebly statements into a file or something and pass to debug..not sure, but the idea is there.
Push and Pop are programming terms related to a stack (which is a data structure present in many programming languages, not just assembly). So I'm reading through this thread thinking you might need something else entirely?

But what exactly is it you want to do? Because In order for anything to run on a computer it needs to be loaded into memory aka RAM. That means a script your running is loaded in memory, programs you execute is loaded into memory, etc. So what do you want to load into memory?this is something similar to what i had in mind (but its java)

Quote

public class Stack
extends Vector

The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with five operations that allow a vector to be treated as a stack. The usual push and pop operations are provided, as well as a method to peek at the top item on the stack, a method to test for whether the stack is empty, and a method to search the stack for an item and discover how far it is from the top.

When a stack is first created, it contains no items.
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Stack.html

the only problem is you need the JVM installed on your machineTheHamelinPiper, I think perhaps your ideas are running way ahead of your understanding...
So you are looking for the stack data structure specifically then.
I don't think the cmd shell is advanced enough for this (I might be wrong though).
Maybe you should look in to Windows PowerShell. This is the replacement for the old cmd shell and it supports much more advanced operations and utilizes a C# like syntax (which in turn is similar to Java).the stack class in Java is considered a legacy class. ie its old.
anyway, the concept of stack class , a higher level view of it, is just simply arrays.
most modern prog languages provide arrays,(not batch though) and corresponding methods that allow array manipulation.Quote
TheHamelinPiper, I think perhaps your ideas are running way ahead of your understanding...

yes.


Discussion

No Comment Found