// Deprecated N1: use N2 for new programs.
asm {
    ; GET a URL using the server network mailbox. Print status and byte count.
    wait_ready:
    NREADY A
    CMP A, 1
    JZ submit
    SLEEP 1
    JMP wait_ready
    submit:
    NHTTP A, 0, 0x100, 0, 0
    CMP A, 1
    JNZ failed
    wait_response:
    NSTATUS B
    CMP B, 1
    JNZ received
    SLEEP 1
    JMP wait_response
    received:
    NLEN C
    CMP C, 4096
    JLE copy_response
    MOV C, 4096
    copy_response:
    NRESULT D, 0x200, C
    CMP B, 2
    JNZ failed
    OUT "HTTP status: ", D
    OUT "Copied bytes: ", C
    HLT
    failed:
    OUT "Network request failed."
    HLT
    ORG 0x100
    DB "https://example.org/", 0
}
