[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/ *
* COPYRIGHT : GPL - S e e C O P Y I N G i n t h e t o p l e v e l d i r e c t o r y
* PROJECT : ReactOS V i r t u a l D O S M a c h i n e
* FILE : command. S
* PURPOSE : DOS3 2 c o m m a n d . c o m f o r N T V D M
* PROGRAMMERS : Hermes B e l u s c a - M a i t o ( h e r m e s . b e l u s c a @sfr.fr)
* /
/ /
/ / See h t t p : / / w w w . g a n i n o . c o m / g a m e s / s c r i p t s / d o s - 6 . 0 % 2 0 s o u r c e % 2 0 c o d e % 3 F / d e v / s m a r t d r v / u m b l o a d . a s m
/ / and h t t p s : / / b o o k s . g o o g l e . f r / b o o k s ? i d =rtmJgtfaxz8C & p g =PA256 & l p g =PA256 & d q =int + 2 1 + 4 b + p r o g r a m + e x e c + b l o c k & s o u r c e =bl & o t s =OfAF7qFwfl & s i g =PrW73CE1dzFm3rwrTsYZkC77U4Y & h l =en & s a =X & r e d i r _ e s c =y #v = o n e p a g e & q = i n t % 2021 % 2 0 4 b % 2 0 p r o g r a m % 2 0 e x e c % 2 0 b l o c k & f =false
/ /
/* INCLUDES *******************************************************************/
# include < a s m . i n c >
# include " a s m x t r a s . i n c "
# include < i s v b o p . i n c >
2015-12-16 17:28:59 +00:00
/ / # define N D E B U G
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/* DEFINES ********************************************************************/
# define M A X _ P A T H 2 6 0
# define D O S _ C M D L I N E _ L E N G T H 1 2 7
# define D O S _ V E R S I O N H E X ( 0 0 0 5 ) / / M A K E W O R D ( 5 , 0 0 )
# define N T D O S _ V E R S I O N H E X ( 3 2 0 5 ) / / M A K E W O R D ( 5 , 5 0 )
# define S Y S T E M _ P S P H E X ( 0 8 )
# define B O P . b y t e H E X ( C 4 ) , H E X ( C 4 ) ,
/ / # define B O P _ S T A R T _ D O S H E X ( 2 C )
# define B O P _ C M D H E X ( 5 4 )
/**** PSP MEMBERS ****/
# define P S P _ V A R ( x ) e s : [ x ]
# define P S P H E X ( 0 0 0 0 )
# define P a r e n t P s p H E X ( 0 0 1 6 ) / / w o r d
# define E n v B l o c k H E X ( 0 0 2 C ) / / w o r d
# define C m d L i n e L e n H E X ( 0 0 8 0 ) / / b y t e
# define C m d L i n e S t r H E X ( 0 0 8 1 ) / / b y t e [ D O S _ C M D L I N E _ L E N G T H ]
/**** DATA stored inside the stack ****/
# define C m d L i n e B a s e S t a c k / / C o m m a n d l i n e f o r t h e p r o g r a m t o b e s t a r t e d
# define P g m N a m e [ C m d L i n e + ( 1 + D O S _ C M D L I N E _ L E N G T H ) ]
/ / WARNING! U s i n g t h e V A L ( x ) m a c r o d o e s n ' t w o r k w i t h G C C / G A S ( b e c a u s e i t i n s e r t s
/ / a s p u r i o u s s p a c e i n f r o n t o f t h e p a r a m e t e r w h e n t h e m a c r o i s e x p a n d e d ) .
/ / So t h a t : ' V A L ( f o o ) ' i s e x p a n d e d t o : ' \ f o o ' , i n s t e a d o f ' \ f o o ' a s o n e w o u l d e x p e c t .
/* NEXT_CMD structure */
STRUCT( N E X T _ C M D , 2 )
FIELD_ D E C L ( E n v B l o c k S e g , w o r d , 0 )
FIELD_ D E C L ( E n v B l o c k L e n , w o r d , 0 )
FIELD_ D E C L ( C u r D r i v e , w o r d , 0 )
FIELD_ D E C L ( N u m D r i v e s , w o r d , 1 )
FIELD_ D E C L ( C m d L i n e S e g , w o r d , 0 )
FIELD_ D E C L ( C m d L i n e O f f , w o r d , 0 )
FIELD_ D E C L ( U n k n o w n 0 , w o r d , 2 )
FIELD_ D E C L ( E x i t C o d e , w o r d , 3 )
FIELD_ D E C L ( U n k n o w n 1 , w o r d , 4 )
FIELD_ D E C L ( U n k n o w n 2 , l o n g , 5 )
FIELD_ D E C L ( C o d e P a g e , w o r d , 6 )
FIELD_ D E C L ( U n k n o w n 3 , w o r d , 7 )
FIELD_ D E C L ( U n k n o w n 4 , w o r d , 8 )
FIELD_ D E C L ( A p p N a m e S e g , w o r d , 0 )
FIELD_ D E C L ( A p p N a m e O f f , w o r d , 0 )
FIELD_ D E C L ( A p p N a m e L e n , w o r d , 0 )
FIELD_ D E C L ( F l a g s , w o r d , 0 )
ENDS( N E X T _ C M D )
/* DOS_EXEC_PARAM_BLOCK structure */
STRUCT( D O S _ E X E C _ P A R A M _ B L O C K , 2 )
FIELD_ D E C L ( E n v S e g , w o r d , 0 ) / / U s e p a r e n t ' s e n v i r o n m e n t ( o u r s )
FIELD_ D E C L ( C m d L i n e O f f , w o r d , O F F ( C m d L i n e ) )
FIELD_ D E C L ( C m d L i n e S e g , w o r d , 0 )
FIELD_ D E C L ( F c b1 O f f , w o r d , O F F ( F c b1 ) )
FIELD_ D E C L ( F c b1 S e g , w o r d , 0 )
FIELD_ D E C L ( F c b2 O f f , w o r d , O F F ( F c b2 ) )
FIELD_ D E C L ( F c b2 S e g , w o r d , 0 )
ENDS( D O S _ E X E C _ P A R A M _ B L O C K )
/* RESIDENT CODE AND DATA *****************************************************/
.code16
/ / .org HEX( 0 1 0 0 )
ASSUME C S : . t e x t , D S : . t e x t , E S : . t e x t
/* CODE *******************************/
EntryPoint :
jmp M a i n
.align 2
ResidentMain :
/ *
* Relocate o u r s t a c k .
* Our l o c a l s t a c k i s b i g e n o u g h f o r h o l d i n g t h e c o m m a n d l i n e a n d t h e p a t h
* to t h e e x e c u t a b l e t o s t a r t , p l u s a f u l l D O S _ R E G I S T E R _ S T A T E a n d f o r o n e p u s h a 1 6 - b i t .
*
* FIXME : enlarge i t f o r p u s h i n g t h e n e e d e d L o a d & E x e c d a t a .
* /
cli
mov a x , d s
mov s s , a x
mov b p , o f f s e t B a s e S t a c k
lea s p , [ b p + ( 1 + D O S _ C M D L I N E _ L E N G T H ) + M A X _ P A T H + 2 5 5 ]
sti
/* Resize ourselves */
mov b x , s p / / G e t s i z e i n b y t e s . . .
/ / sub b x , o f f s e t P S P _ V A R ( P S P )
add b x , H E X ( 0 F ) / / ( f o r r o u n d i n g t o t h e n e x t p a r a g r a p h )
shr b x , 4 / / . . . t h e n t h e n u m b e r o f p a r a g r a p h s
mov a h , H E X ( 4 A )
int H E X ( 2 1 )
/* Check whether we need to start the 32-bit command interpreter */
BOP B O P _ C M D , H E X ( 1 0 ) / / C h e c k w h e t h e r w e w e r e s t a r t e d f r o m a n e w c o n s o l e ( S e s s i o n I d ! = 0 )
test a l , a l / / a n d w e a r e n o t r e e n t e r i n g ( 3 2 - b i t p r o c e s s s t a r t i n g a 1 6 - b i t p r o c e s s ) .
jz R u n
cmp w o r d p t r O l d P a r e n t P s p , S Y S T E M _ P S P / / C h e c k w h e t h e r o u r p a r e n t i s S Y S T E M
je R u n
2015-12-16 17:28:59 +00:00
# ifndef N D E B U G
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/********************************/
mov d x , o f f s e t M s g 1
mov a h , H E X ( 0 9 )
int H E X ( 2 1 )
/********************************/
2015-12-16 17:28:59 +00:00
# endif
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
BOP B O P _ C M D , H E X ( 0 A ) / / S t a r t 3 2 - b i t C O M S P E C
jnc Q u i t
/* Loop for new commands to run */
Run :
/* Initialize the NextCmd structure */
mov w o r d p t r F I E L D ( N e x t C m d , E n v B l o c k S e g ) , d s
mov w o r d p t r F I E L D ( N e x t C m d , E n v B l o c k L e n ) , 0 / / F I X M E
mov w o r d p t r F I E L D ( N e x t C m d , C m d L i n e S e g ) , d s
mov w o r d p t r F I E L D ( N e x t C m d , C m d L i n e O f f ) , o f f s e t C m d L i n e
mov w o r d p t r F I E L D ( N e x t C m d , A p p N a m e S e g ) , d s
mov w o r d p t r F I E L D ( N e x t C m d , A p p N a m e O f f ) , o f f s e t P g m N a m e
/* Wait for the next command */
2015-12-16 17:28:59 +00:00
# ifndef N D E B U G
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/********************************/
mov d x , o f f s e t M s g 2
mov a h , H E X ( 0 9 )
int H E X ( 2 1 )
/********************************/
2015-12-16 17:28:59 +00:00
# endif
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/ / FIXME : Initialize m e m o r y w i t h s t r u c t u r e f o r h o l d i n g C m d L i n e e t c . . .
/ / mov d s , s e g N e x t C m d
mov d x , o f f s e t N e x t C m d
BOP B O P _ C M D , H E X ( 0 1 )
/* Quit if we shell-out */
jc Q u i t
/* Initialize the DosLoadExec structure */
/ / mov w o r d p t r F I E L D ( D o s L o a d E x e c , E n v S e g ) , 0
mov w o r d p t r F I E L D ( D o s L o a d E x e c , C m d L i n e S e g ) , d s
mov w o r d p t r F I E L D ( D o s L o a d E x e c , F c b1 S e g ) , d s
mov w o r d p t r F I E L D ( D o s L o a d E x e c , F c b2 S e g ) , d s
/* Run the command */
mov d s , w o r d p t r F I E L D ( N e x t C m d , A p p N a m e S e g )
mov d x , w o r d p t r F I E L D ( N e x t C m d , A p p N a m e O f f )
/ / mov e s , s e g D o s L o a d E x e c
mov b x , o f f s e t D o s L o a d E x e c
pusha / / S a v e t h e r e g i s t e r s i n c a s e s t u f f g o w r o n g
/ / FIXME : Save a l s o S S ! !
mov a x , H E X ( 4 B 0 0 )
int H E X ( 2 1 )
popa / / R e s t o r e t h e r e g i s t e r s
/ / FIXME : Restore a l s o S S ! !
/ * Retrieve a n d s e t i t s e x i t c o d e . A l s o d e t e c t w h e t h e r
* we n e e d t o c o n t i n u e o r w h e t h e r w e n e e d t o q u i t . * /
/ / xor a x , a x
/ / mov a h , H E X ( 4 D )
mov a x , H E X ( 4 D 0 0 )
int H E X ( 2 1 )
/* Send exit code back to NTVDM */
mov d x , a x
BOP B O P _ C M D , H E X ( 0 B )
/* If we don't shell-out, go and get a new app! */
jc R u n
mov a l , H E X ( 0 0 ) / / E R R O R _ S U C C E S S
Quit :
mov b l , a l / / S a v e A L i n B L
2015-12-16 17:28:59 +00:00
# ifndef N D E B U G
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/********************************/
cmp a l , H E X ( 0 A )
jne X X X X
mov d x , o f f s e t M s g 3
mov a h , H E X ( 0 9 )
int H E X ( 2 1 )
XXXX :
/********************************/
2015-12-16 17:28:59 +00:00
# endif
# ifndef N D E B U G
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/* Say bye-bye */
/ / mov d s , s e g Q u i t M s g
mov d x , o f f s e t Q u i t M s g
mov a h , H E X ( 0 9 )
int H E X ( 2 1 )
2015-12-16 17:28:59 +00:00
# endif
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/* Restore our old parent PSP */
mov a x , w o r d p t r O l d P a r e n t P s p
mov P S P _ V A R ( P a r e n t P s p ) , a x
mov a l , b l / / R e s t o r e A L f r o m B L
Exit :
/* Return to caller (with possible error code in AL) */
mov a h , H E X ( 4 C )
int H E X ( 2 1 )
int 3
/* Does not return */
/* DATA *******************************/
2015-12-16 17:28:59 +00:00
# ifndef N D E B U G
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
QuitMsg :
.ascii " Bye b y e ! " , C R , L F , " $ "
/********************************/
Msg1 : .ascii " Starting COMSPEC...", CR, LF, "$ "
Msg2 : .ascii " Waiting for new command...", CR, LF, "$ "
Msg3 : .ascii " Bad environment!", CR, LF, "$ "
/********************************/
2015-12-16 17:28:59 +00:00
# endif
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
OldParentPsp : .word 0
CurrentPsp : .word 0
/ / BOP_ C M D , H E X ( 0 1 ) " G e t a n e w a p p t o s t a r t " s t r u c t u r e
VAR_ S T R U C T ( N e x t C m d , N E X T _ C M D )
/ / DOS I N T 2 1 h , A H =4Bh " L o a d a n d E x e c u t e " s t r u c t u r e
VAR_ S T R U C T ( D o s L o a d E x e c , D O S _ E X E C _ P A R A M _ B L O C K )
/ / Blank F C B b l o c k s n e e d e d f o r D O S I N T 2 1 h , A H =4Bh
Fcb1 :
.byte 0
.space 1 1 , ' '
.space 2 5 , 0
Fcb2 :
.byte 0
.space 1 1 , ' '
.space 2 5 , 0
/ / The s t a c k r e s i d e s a t t h e e n d o f t h e r e s i d e n t c o d e + d a t a
/ / and i t o v e r w r i t e s t h e t r a n s i e n t p a r t .
BaseStack :
/* TRANSIENT CODE AND DATA ****************************************************/
/* DATA *******************************/
2015-12-16 17:28:59 +00:00
# ifndef N D E B U G
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
WelcomeMsg :
.ascii " ReactOS D O S 3 2 C o m m a n d " , C R , L F , \
" Copyright ( C ) R e a c t O S T e a m 2 0 1 5 " , C R , L F , " $ "
2015-12-16 17:28:59 +00:00
# endif
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
VerErrMsg :
.ascii " Incorrect D O S v e r s i o n " , C R , L F , " $ "
/* CODE *******************************/
.align 2
Main :
/* Setup segment registers */
mov a x , c s / / c s c o n t a i n s t h e P S P s e g m e n t o n e n t r y
mov d s , a x
mov e s , a x
/ / mov f s , a x
/ / mov g s , a x
/ * Stack i s s e t t o c s : F F F E d o w n t o c s : 0 9 x x b y t h e D O S .
* We w i l l n e e d t o r e l o c a t e i t b e f o r e w e r e s i z e o u r s e l v e s . * /
/ *
* Verify D O S v e r s i o n :
* - Check w h e t h e r w e a r e o n D O S 5 + ( s u b j e c t t o S E T V E R ) ;
* - If s o , c h e c k o u r r e a l D O S v e r s i o n a n d s e e
* whether w e a r e r u n n i n g o n N T V D M ( v e r s i o n 5 . 5 0 ) .
* /
mov a x , H E X ( 3 0 0 0 )
int H E X ( 2 1 )
cmp a x , D O S _ V E R S I O N / / A H : A L c o n t a i n s m i n o r : m a j o r v e r s i o n n u m b e r
jne V e r E r r
mov a x , H E X ( 3 3 0 6 )
int H E X ( 2 1 )
cmp b x , N T D O S _ V E R S I O N / / B H : B L c o n t a i n s m i n o r : m a j o r v e r s i o n n u m b e r
je C o n t i n u e
VerErr :
/* Display wrong version error message and exit */
/ / mov d s , s e g V e r E r r M s g
mov d x , o f f s e t V e r E r r M s g
mov a h , H E X ( 0 9 )
int H E X ( 2 1 )
jmp E x i t
Continue :
/* Save our PSP */
mov w o r d p t r C u r r e n t P s p , c s
/ *
* The D O S w a y :
*
* mov a h , H E X ( 5 1 ) / / D O S 2 + i n t e r n a l , o r H E X ( 6 2 ) s i n c e D O S 3 +
* int H E X ( 2 1 )
* mov w o r d p t r C u r r e n t P s p , b x
* /
/* Save our old parent PSP */
mov a x , P S P _ V A R ( P a r e n t P s p )
mov w o r d p t r O l d P a r e n t P s p , a x
/* Give us shell privileges: set our PSP as our new parent */
mov a x , w o r d p t r C u r r e n t P s p
mov P S P _ V A R ( P a r e n t P s p ) , a x
2015-12-16 17:28:59 +00:00
# ifndef N D E B U G
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/* Say hello */
/ / mov d s , s e g W e l c o m e M s g
mov d x , o f f s e t W e l c o m e M s g
mov a h , H E X ( 0 9 )
int H E X ( 2 1 )
2015-12-16 17:28:59 +00:00
# endif
[NTVDM]
- Add support for DOS VDM reentry, i.e. the fact that a DOS app can start a 32-bit app, which in turn can start another DOS app, ad infinitum...
CORE-9711 CORE-9773 #resolve
- Add a small COMMAND.COM which is, for now, completely included in NTVDM. This COMMAND.COM is needed in order to support reentrancy. The fact that I chose to put it inside NTVDM is that any user can use instead his/her own COMMAND.COM, while retaining the possibility to perform VDM reentrancy (on Windows, if you remove the COMMAND.COM in windows\system32 and replace it with your own, you will break VDM reentrancy on windows' ntvdm).
CORE-5221 #resolve #comment I choose for the moment an internal COMMAND.COM, but you can recompile NTVDM to use it externally instead.
Global remarks:
- Quite a few DPRINTs were added for diagnostic purposes (since DOS reentrancy is a new feature), to be sure everything behaves as expected when being used with a large panel of applications. They will be removed when everything is OK.
- Support for current directories and 16/32-bit environment translation (in ntvdm + basevdm-side) remain to be implemented.
Other changes:
- Improve a bit the VDM shutdown code by gathering it at one place (there's still room for other improvements).
- Add suppport for properly pausing/resuming NTVDM.
- Bufferize some console events before dispatching.
Have fun ;^)
svn path=/trunk/; revision=69204
2015-09-12 20:09:25 +00:00
/* Jump to resident code */
jmp R e s i d e n t M a i n
.endcode16
END
/* EOF */