Thread: INT 15 to return memory size

  1. #46
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    baseaddr and length are supposed to be 64 bits wide, how do you expect to do that in 16 bit C(I'll give you a clue, those ints are 16 bit.)? In my opinion, this is one of the few screw ups in C, there is no way to define a variable of a specified width.

  2. #47
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by User Name: View Post
    baseaddr and length are supposed to be 64 bits wide, how do you expect to do that in 16 bit C(I'll give you a clue, those ints are 16 bit.)? In my opinion, this is one of the few screw ups in C, there is no way to define a variable of a specified width.
    Um, stdint.h?

  3. #48
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Kick ass! I've needed something like that a lot of times, never knew that existed. But he's using an old compiler, stdint.h is C99, will it support that?

  4. #49
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Probably not, though just because it is a 16-bit compiler does NOT mean that there aren't 32-bit ints. There where always long int which were supposed to be 32-bit wide, then there was a long long int which was actually ???48 bits wide -- it has been a while and I cannot recall at the moment. I just remember the long long was something screwy.

  5. #50
    Registered User
    Join Date
    Jun 2010
    Posts
    23
    I got the memory map to print out on the screen finally. I used a structure in my C code and passed it into the assembly like this:

    Code:
    memmap proc c arg1:word
    		
    		int 3
    		;mov 	di, arg1		;500h	;point this to structure
    		
    		push	es			;preserve contents of es
    		push 	ds			;push current data segment onto stack
    		pop 	es			;pop that segment into es for the int 15
    		
    		mov 	di, arg1	;[bp+6]		;500h	;point this to structure 
                    .
                    .
                    .
    now i just need to find the number of unused memory regions in the first megabyte of memory

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why doesn't this example work for me?
    By xixpsychoxix in forum C++ Programming
    Replies: 4
    Last Post: 03-24-2009, 08:25 PM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Alegro closes out on me
    By campsoup1988 in forum C++ Programming
    Replies: 8
    Last Post: 04-03-2006, 10:40 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 07:48 PM