Skip Navigation

wonderingwanderer

@wonderingwanderer.sopuli.xyz.ap.tdpl.io

4 Posts332 Comments0 Memberships

Joined July 2026

  • If humans colonize deep space, it would make sense to adopt metric time.

    The further we go from Earth and our Sun, the more Earth-based timekeeping begins to break down and becomes less useful as a concept, especially as generations pass. What matters it to Proxima Centauri how many times the Earth has revolved around its local star?

    Metric time would provide a universal standard that doesn't depend on any reference to particular rotations and orbits of planets/star systems. Then each system and planet can have their own local timekeeping units, and metric time can enable easy conversions between them.

    Using atomic clocks and taking seconds as the primary unit, here's what that could look like:

    1 interstellar second = 1 earth second 1 decasecond = 10 earth seconds 1 hectosecond = 1⅔ earth minutes (1 interstellar minute)

    1 kilosecond = 16⅔ earth minutes 10 kiloseconds = 2.777 earth hours (1 interstellar hour) 100 kiloseconds = 1.157407 earth days (1 interstellar day)

    1 megasecond = 11.57407 earth days (1 interstellar week) 10 megaseconds = 16.534391 earth weeks (1 interstellar month) 100 megaseconds = 38.58024691 earth months (1 interstellar year)

    1 gigasecond = 31.709791983764 earth years (1 interstellar decade) 10 gigaseconds = 1 interstellar century 100 gigaseconds = 1 interstellar millenium

  • Help with nandgame: stack machine function calls

    cross-posted from: https://sopuli.xyz/post/45002077

    If this isn't the right community for this post, let me know and I'll move it somewhere else. I'm working my way through nandgame, and I'm stuck on the "call" macro in the function calls section of the stack machine unit. These are the instructions: image image I was stuck on it for a while, so I looked up the solution and am going off the one given here (it's the only one I could find). So far, I haven't gotten it to work. At first, it was giving me syntax errors because the labels weren't defined, so I replaced A = [LABEL] with label [LABEL] followed by A = [CONST], according to the specified calling convention. It also gave me a similar syntax error for TEMP_ADDR, which is never specified in the instructions, so I assigned it 0x7f00. So here is what I end up with (all in Assembly): (note: the stack pointer, SP, is defined by a shared constant SP = 0) Test code:

     
    init.stack
    call functionName 0
    stop
    
    function FunctionName 0
    push.value x42
    return

    Macro: call

     
    # Assembler code
    ## Push the current ARGS and LOCALS on the stack
    push.static ARGS
    push.static LOCALS
    
    ## Push the return address.
    push.value after
    
    ## Set ARGS to point to the start of the arguments
    A = SP
    D = *A
    A = argumentCount
    D = D - A
    A = 3
    D = D - A
    label ARGS
    A = 1
    *A = D
    
    ## Jump to functionName.
    goto functionName
    
    ## Set return address:
    label after
    
    ## Restore ARGS and LOCALS from the stack
    A = ARGS
    D = *A
    label TEMP_ADDR
    A = 0x7f00
    *A = D
    pop.D
    label LOCALS
    A = 2
    *A = D
    pop.D
    A = ARGS
    *A = D
    
    ## Push RETVAL.
    label RETVAL
    A = 6
    D = *A
    push.D

    Macro: function

     
    # Assembler code
    ## Define a label functionName
    label functionName
    
    ## Set LOCALS to the current SP
    A = SP
    D = *A
    label LOCALS
    A = 2
    *A = D
    
    ## Advance SP by localsCount
    A = localsCount
    D = A
    A = SP
    D = D + *A
    *A = D

    Macro: return

     
    # Assembler Code
    ## Pop the top value into RETVAL
    pop.D
    label RETVAL
    A = 6
    *A = D
    
    ## Set SP to LOCALS
    label LOCALS
    A = 2
    D = *A
    A = SP
    *A = D
    
    # Pop the return address and jump to it
    pop.D
    A = D
    JMP

    Note: functionName, argumentsCount, and localsCount are all listed as placeholders above the relevant macro, but it doesn't describe how to define these. I'm guessing that comes in a later unit. The code block for the call macro gives me a red bar for each line with a placeholder, but this doesn't happen for the function macro which also includes placeholders. In any case, this doesn't seem to get in the way of the program as it still runs smoothly. So as it is, when I run it, everything seems to work as intended. This is the result when it reaches the stop macro (infinite loop): image Which looks like it's doing everything it's supposed to do. But when I click "Check solution", this is what it says: image ("Expected SP (RAM address 0) to be hex 101. (Was 104)") Which is strange, because in the computer section you can clearly see that the SP content is hex 0101. So I don't know what's going wrong. I stepped through the program tick by tick, and the only place SP ever reaches 104 is after the function macro, when it runs push.value x42, after which it runs the return macro which begins with pop.D, reducing SP back to 103. Could it be the evaluator is assessing the value of SP at the end of the code block, instead of where it runs the stop macro? So perhaps I could try replacing stop with a jump to the end, followed by stop... Now that I think of that, I think it might work. I'm still going to post this though, because I already went through all the trouble. And in case it doesn't work, if anyone else has any ideas please share them! I can expand the rest of the macros if need be, but they already passed the evaluation so they're all working according to specs. Thanks in advance! Edit: I thought for sure that would work. I changed the test code block to this:

     
    init.stack
    call functionName 0
    A = end
    JMP
    
    function FunctionName 0
    push.value x42
    return
    label end
    stop

    The program runs exactly as it's supposed to, except now the stop loop is at the end of the code. The computer output still looks the same, except now the program counter loops between 60 and 61 at the end (as expected). But the evaluator is still giving me the same error! I'm stumped... Edit 2: added annotations to code blocks to make it easier to read

  • Help with nandgame: stack machine function calls

    cross-posted from: https://sopuli.xyz/post/45002077

    If this isn't the right community for this post, let me know and I'll move it somewhere else. I'm working my way through nandgame, and I'm stuck on the "call" macro in the function calls section of the stack machine unit. These are the instructions: image image I was stuck on it for a while, so I looked up the solution and am going off the one given here (it's the only one I could find). So far, I haven't gotten it to work. At first, it was giving me syntax errors because the labels weren't defined, so I replaced A = [LABEL] with label [LABEL] followed by A = [CONST], according to the specified calling convention. It also gave me a similar syntax error for TEMP_ADDR, which is never specified in the instructions, so I assigned it 0x7f00. So here is what I end up with (all in Assembly): (note: the stack pointer, SP, is defined by a shared constant SP = 0) Test code:

     
    init.stack
    call functionName 0
    stop
    
    function FunctionName 0
    push.value x42
    return

    Macro: call

     
    # Assembler code
    ## Push the current ARGS and LOCALS on the stack
    push.static ARGS
    push.static LOCALS
    
    ## Push the return address.
    push.value after
    
    ## Set ARGS to point to the start of the arguments
    A = SP
    D = *A
    A = argumentCount
    D = D - A
    A = 3
    D = D - A
    label ARGS
    A = 1
    *A = D
    
    ## Jump to functionName.
    goto functionName
    
    ## Set return address:
    label after
    
    ## Restore ARGS and LOCALS from the stack
    A = ARGS
    D = *A
    label TEMP_ADDR
    A = 0x7f00
    *A = D
    pop.D
    label LOCALS
    A = 2
    *A = D
    pop.D
    A = ARGS
    *A = D
    
    ## Push RETVAL.
    label RETVAL
    A = 6
    D = *A
    push.D

    Macro: function

     
    # Assembler code
    ## Define a label functionName
    label functionName
    
    ## Set LOCALS to the current SP
    A = SP
    D = *A
    label LOCALS
    A = 2
    *A = D
    
    ## Advance SP by localsCount
    A = localsCount
    D = A
    A = SP
    D = D + *A
    *A = D

    Macro: return

     
    # Assembler Code
    ## Pop the top value into RETVAL
    pop.D
    label RETVAL
    A = 6
    *A = D
    
    ## Set SP to LOCALS
    label LOCALS
    A = 2
    D = *A
    A = SP
    *A = D
    
    # Pop the return address and jump to it
    pop.D
    A = D
    JMP

    Note: functionName, argumentsCount, and localsCount are all listed as placeholders above the relevant macro, but it doesn't describe how to define these. I'm guessing that comes in a later unit. The code block for the call macro gives me a red bar for each line with a placeholder, but this doesn't happen for the function macro which also includes placeholders. In any case, this doesn't seem to get in the way of the program as it still runs smoothly. So as it is, when I run it, everything seems to work as intended. This is the result when it reaches the stop macro (infinite loop): image Which looks like it's doing everything it's supposed to do. But when I click "Check solution", this is what it says: image ("Expected SP (RAM address 0) to be hex 101. (Was 104)") Which is strange, because in the computer section you can clearly see that the SP content is hex 0101. So I don't know what's going wrong. I stepped through the program tick by tick, and the only place SP ever reaches 104 is after the function macro, when it runs push.value x42, after which it runs the return macro which begins with pop.D, reducing SP back to 103. Could it be the evaluator is assessing the value of SP at the end of the code block, instead of where it runs the stop macro? So perhaps I could try replacing stop with a jump to the end, followed by stop... Now that I think of that, I think it might work. I'm still going to post this though, because I already went through all the trouble. And in case it doesn't work, if anyone else has any ideas please share them! I can expand the rest of the macros if need be, but they already passed the evaluation so they're all working according to specs. Thanks in advance! Edit: I thought for sure that would work. I changed the test code block to this:

     
    init.stack
    call functionName 0
    A = end
    JMP
    
    function FunctionName 0
    push.value x42
    return
    label end
    stop

    The program runs exactly as it's supposed to, except now the stop loop is at the end of the code. The computer output still looks the same, except now the program counter loops between 60 and 61 at the end (as expected). But the evaluator is still giving me the same error! I'm stumped... Edit 2: added annotations to code blocks to make it easier to read