hi
im a newbie in assembly.im yet learning 16 bit dos assembly using interrupts.i want to know how can i cause the pc to restart. i am writing a program which is put in autoexec.bat and restarts the pc if the user enters a wrong password.
any help

Madhur
Posted on 2003-04-12 11:13:13 by madhur_ahuja
You'll have to write a value to somewhere in RAM and then execute a far jump to address FFFF:FFF0h(BIOS bootstrap start).

Give me a little time I will find out how and write where and what you write.
Posted on 2003-04-12 13:37:55 by x86asm
this should work:

push 0ffffh
push 0fff0h
retf

unless i got the order backwards of the pushes, but i think that should be right. this doesn't use interrupts, however. it's the implementation of what x86asm suggested.

one thing i do caution you on is that it would be very easy to bypass your program during start up. (hit F8 or F5 when it says "booting ms-dos")

or even CTRL+PAUSE very quickly and rapidly when autoexec loads.
Posted on 2003-04-12 22:45:38 by jademtech
A better solution would be to hack this into your IO.SYS directly. You should have this check before processing CONFIG.SYS and before loading DBLSPACE.BIN, DRVSPACE.BIN or anything of the like.
Posted on 2003-04-13 04:55:54 by Sephiroth3
Or alternately, you could change the boot loader to load your program first, which in turn calls io.sys (it's probably easier than modifying your io.sys, especially if you're new to assembly). Of course, you will not have access to DOS interrupts if you do this... so you're basically writing a mini-boot menu (without the menu) :tongue:

to do this sort of thing, i suggest you look up information on os development and bootloaders/boot menus
Here's one source:
http://www.mega-tokyo.com/os/os-faq.html
Posted on 2003-04-13 09:58:30 by jademtech
I posted the wrong address buddy, my mistake the correct address is
F000:FFF0h
so when the address which is placed on the 20-bit address bus is FFFF0h, which is 16 bytes below the max of 1MByte addressable space whici is correct since upon power on all x86 CPU's start executing at this address.
Posted on 2003-04-13 13:08:52 by x86asm
hm... yeah, i thought that address looked a bit suspicious :p

the opcode here is always a jmp AFAIK.

so the revised code i gave should be:

push f000h
push fff0h
retf

(assuming the address is right, now, but at least it has a jmp :tongue: )
Posted on 2003-04-13 14:28:12 by jademtech

hm... yeah, i thought that address looked a bit suspicious :p

the opcode here is always a jmp AFAIK.

so the revised code i gave should be:

push f000h
push fff0h
retf

(assuming the address is right, now, but at least it has a jmp :tongue: )


Well you could have told instead of making me look like an idiot LOL! ;)
Posted on 2003-04-13 17:31:36 by x86asm
hmm... well you caught your mistake first, so now i look like an idiot :grin:
Posted on 2003-04-13 20:06:56 by jademtech
Guys, restart or reboot?

R db 0xEA
e dw 0
b dw 0xFFFF


Jump far to FFFF:0000.
Posted on 2003-04-13 20:20:09 by realvampire
Those are the same addresses...

address=shl(seg,4)+offset

so f000:fff0 -> f000*10h+fff0=ffff0

and similarly, ffff:0000 -> ffff*10h+0->ffff0

:grin:
Posted on 2003-04-13 20:48:38 by jademtech
What is RetF? is it 0xC3 ? I know Ret is Jump to address on Top of Stact, But Retf ?:confused:

...., Alpha.
Posted on 2003-04-14 03:24:45 by realvampire
mov al,0FEh
out 64h,al

--- the proper way to reset.
Posted on 2003-04-14 04:30:54 by f0dder

mov al,0FEh
out 64h,al

--- the proper way to reset.


The port map please..., Why all bit is set? and why the Bit Zephiro are not set ?
Posted on 2003-04-14 06:25:22 by realvampire
"zephiro"? :P

It's a command to the keyboard controller to make it pulse the RESET pin of your CPU. It's the best and most accurate form of hardware reset you can do via software.
Posted on 2003-04-14 06:34:56 by f0dder

"zephiro"? :P

It's a command to the keyboard controller to make it pulse the RESET pin of your CPU. It's the best and most accurate form of hardware reset you can do via software.


And why didnt YOU say it earlier instead of making me look like an idiot ? ;)
Posted on 2003-04-14 07:04:25 by x86asm
Zephiro is Zero.
So, by zero-ing Bit zero at port 0x64 we are restarting the Computer are we ?:stupid:
Posted on 2003-04-14 07:07:21 by realvampire
No.
By sending the byte 0xFE to port 0x64, we are resetting the computer (only when you have port access, of course - under windows, you will use ExitWindowsEx, of course after getting the SE_SHUTDOWN_NAME privilege if the application is running under NT).
Posted on 2003-04-14 07:10:18 by f0dder

What is RetF? is it 0xC3 ? I know Ret is Jump to address on Top of Stact, But Retf ?:confused:

...., Alpha.


retf is return far.
Posted on 2003-04-14 09:17:50 by jademtech
which means 16bit segment, 16bit offset pushed on stack (16bit realmode) or 16bit selector, 32bit offset (32bit pmode).
Posted on 2003-04-14 09:52:51 by f0dder