menu "Manux Kernel Configuration"

    menu "Memory Configuration"

        config AS_RAM_START
            hex "Set the system ram start address"
            default 0x2000
            range 0x0000 0xFFFF
            help
                "The address where the system ram starts"

        config COMMON_KERNEL_WORKSPACE
            hex "Set the kernel workspace start address"
            default 0x2000
            range 0x0000 0xFFFF
            help
                "The address where the kernel workspace starts. The workspace holds important kernel variables and data structures."

        config COMMON_STACK_BASE
            hex "Set the stack base start address"
            default 0x3000
            range 0x0000 0xFFFF
            help
                "The address where kernel and user stacks are defined from, kernel stack BASE+0x7FF, shell stack BASE+0x3FF"
            
        
        config COMMON_USER_STACK
            hex "Set the user stack start address"
            default 0xFFFF
            range 0x0000 0xFFFF
            help
                "The userland stack start, grows downwards. Usually top of the memory"

        config COMMON_REGISTER_SP
            hex "Initial SP value"
            default COMMON_USER_STACK
            range 0x0000 0xFFFF
            help
                "Initial SP value to boot the kernel"

        config COMMON_SHELL_AREA
            hex "Shell start address"
            default 0x3800
            range 0x0000 0xFFFF
            help
                "Shell/init is loaded there"
        
        config COMMON_USER_AREA
            hex "Where userland programs loaded to"
            default 0x5000
            range 0x0000 0xFFFF
            help
                "The address where all userland programs are loaded, except for shell"

        config COMMON_PIH_AREA
            hex "Where PIH is located"
            default 0x4F00
            range 0x0000 0xFFFF
            help
                "The address where the Program Info Header(PIH) is located, usually before user area. Requires 256 bytes of free memory."


        menu "Heap Configuration"

            config CC_ENABLE_HEAP
                bool "Enable the kernel heap"
                default n
                help
                    "Enable the kernel heap"

            config CC_HEAP_SIZE
                depends on CC_ENABLE_HEAP
                hex "Set the kernel heap size (B)"
                default 0x1000
                range 0x0000 0xFFFF
                help
                    "The size of the kernel heap"

            config CC_HEAP_ADDRESS
                depends on CC_ENABLE_HEAP
                hex "Set the kernel heap address"
                default 0xF000
                range 0x0000 0xFFFF
                help
                    "The address of the kernel heap"

        endmenu

    endmenu

    menu "z88dk Options"
        config CC_ENABLE_STDIO
            bool "Enable z88dk's stdio"
            default y
            help
                "Enable z88dk's stdio. May be required for some programs."

        config CC_CRT_MODEL
            hex "Set the data compression model"
            default 1
            range 0 3
            help
                "Data compression model used for ROM data. See the z88dk documentation for more information."

        config COMMON_CRT_ENABLE_RST
            hex "Set the rst vector bitmask"
            default 0x96
            range 0x00 0xff
            help
                "0x02 = RST 0x08, 0x04 = RST 0x10, etc.."

    endmenu

    menu "Kernel Options"
        config COMMON_CRT_ORG_CODE
            hex "Set the kernel start address."
            default 0x0000
            range 0x0000 0xFFFF
            help
                "The address where the kernel starts. Note: 4 bytes are reserved for syscall vector(JP Callee + 1 align byte)."

        config COMMON_CRT_ORG_BSS
            hex "Set the kernel bss start address."
            default 0x2A00
            range 0x0000 0xFFFF
            help
                "The address where the kernel bss starts."

        config COMMON_CRT_ORG_DATA
            int "Set the kernel data start address."
            default -1
            range -1 65535
            help
                "The address where the kernel data starts."

        config COMMON_CLK_FREQ
            hex "Set the clock frequency"
            default 1000
            help
                "The clock frequency in kHz"

    endmenu

    menu "Drivers"
        menu "TTY"
            config COMMON_STDIO_PORT
                hex "Set the TTY(stdio) port"
                default 0x81
                range 0x00 0xFF
                help
                    "The TTY port which is used by the TTY driver for serial communication"
        endmenu
    endmenu

    menu "Target"
        config COMMON_TARGET_BEMU80
            bool "Build for the bemu80 emulator target"
            default y
            help
                "Build for the bemu80 emulator target. This is the default target."
    endmenu

endmenu
