#include <cstdlib>
#include <iostream>
#include <fstream>

//converts hex into base10
unsigned long convertHexToIntBase10(char* inputHex)
{
    unsigned long hexValue = std::strtoul(inputHex, 0, 16);
    return hexValue;
}

int main(int argc, char* argv[])
{
    if(argc < 3){
        std::cerr << "Usage: MemoryPageListHex [Low Memory Adress] [High Memory Adress] in 4k Pages i.e. MemoryPageListHex 1bae50 1bb0e7 for 0x1bae50148 to 0x1bb0e7fe8" << std::endl;
        return 0;
    }
    auto lowAdr = convertHexToIntBase10(argv[1]);
    auto highAdr = convertHexToIntBase10(argv[2]);
    std::ofstream myfile;
    myfile.open ("MemoryAdress4k.txt");
    for (auto i=lowAdr; i<highAdr; i++){
        myfile << std::hex << "0x" << i << " ";
    }
    myfile.close();
    return 0;
}