Free2Code
 
Time: 2009-01-06, 02:01am
Parameters
Subject: Parameters  ·  Posted: 2005-11-06, 12:35am
Rank: ? (3)
Member #: 25665
hi
how do you can make some program that you can use a parameters list que you compiled it and use it in the dos prompt
like

c:>\program param1 param2

hope you can help me
thanks

 
  Reply to this ·  Post link ·  Top
Subject: Re: Parameters  ·  Posted: 2006-10-12, 11:17am
Rank: ? (5)
Member #: 28723
hi,

in 16bit assembly ( .model tiny, .com program) the param is stored at address 82h. the byte at offset 80h contains the length of the param ( 1 byte for carriage return included ), 81h contains a space ( 20h) value.
here is a short example how i get a filename from the param area:

Code:
  1. ---------------------------------------
  2. ; get param filename
  3. ;-------------------------------------------
  4. ; param area starts at 80h
  5. ; 1. byte length
  6. ; 2.nd blank
  7. b05_get_file:
  8. xor cx,cx
  9. xor bx,bx
  10. mov bl,080h
  11. mov al,[bx]
  12. cmp al,0
  13. ja b05_ok
  14. print err_parm ; length= 0-> error message
  15. jmp b00_exit
  16. b05_ok:
  17. mov cl,al
  18. dec cx  ; sub 1 byte for carriage return
  19. lea di,e_dat ; variable to store filename ( predefined with zeroes 
  20. mov si,082h ; param starts at 82
  21. rep movsb ; copy param to variable filename
  22. ret


 
  Reply to this ·  Post link ·  Top

Pages: 1

Please login or register to post a reply.

icons