Author Topic: Determining count of parameters on command line  (Read 9979 times)

Offline mik3ca

  • Jr. Member
  • *
  • Posts: 30
Determining count of parameters on command line
« on: January 16, 2021, 07:17:03 PM »
My goal is to allocate at least 64KB conventional memory from DOS to use with my program and for me to try to achieve that I'm writing my own TSR since Int 21h function 48h (allocate memory) doesn't give me much despite dos reporting 500+KB free.

I'm using nasm and writing code as follows to follow the DOS COM format:

Code: [Select]
org 100h
mov SI,80h
lodsb
;result in AL

Documents everywhere state that offset 80h in the DOS program segment prefix will reveal the number of bytes used on the command line after the program name but this does not seem to be the case because AL never returns the correct value.

What could I be doing wrong here?

Offline debs3759

  • Global Moderator
  • Full Member
  • *****
  • Posts: 224
  • Country: gb
    • GPUZoo
Re: Determining count of parameters on command line
« Reply #1 on: January 16, 2021, 07:53:44 PM »
Have you set the value of DS? You can't assume it will be the same as CS. Try

Code: [Select]
    org     100h
    push    cs
    pop     ds
    mov     si,80h
    lodsb
My graphics card database: www.gpuzoo.com

Offline mik3ca

  • Jr. Member
  • *
  • Posts: 30
Re: Determining count of parameters on command line
« Reply #2 on: January 17, 2021, 10:55:44 PM »
ok ill look into that