Shop OBEX P1 Docs P2 Docs Learn Events
PNut_v33? - Page 2 — Parallax Forums

PNut_v33?

2»

Comments

  • cgraceycgracey Posts: 14,154
    edited 2019-11-19 10:08
    evanh wrote: »
    Question: How to do a RES like declaration for hubram within an ORGH block?

    PS: I can just hard code the addresses if there isn't a solution.

    if you ORGH ahead, it fills memory with $00 bytes which will be downloaded. You could also do:
    dat	orgh
    
    label_a	long	0[$1000]
    label_b	word	0[$100]
    label_c	byte	0[$400]
    

    Anything you do like that fills memory with values and will be downloaded.
  • roglohrogloh Posts: 5,787
    edited 2019-11-19 10:28
    Is there somewhere the different ORG/ORGH and RES stuff is documented? I don't really know how to use the ORGH part, though I tend to know what ORG/RES does from P1.
  • cgraceycgracey Posts: 14,154
    rogloh wrote: »
    Is there somewhere the different ORG/ORGH and RES stuff is documented? I don't really know how to use the ORGH part, though I tend to know what ORG/RES does from P1.

    In the instructions.txt file, there is some explanation at the end:
    -----
    notes
    -----
    
    A symbol declared under ORGH will return its hub address when referenced.
    
    A symbol declared under ORG will return its cog address when referenced,
    but can return its hub address, instead, if preceded by '@':
    
        COGINIT #0,#@newcode
    
    
    For immediate-branch and LOC address operands, "#" is used before the
    address. In cases where there is an option between absolute and relative
    addressing, the assembler will choose absolute addressing when the branch
    crosses between cog and hub domains, or relative addressing when the
    branch stays in the same domain. Absolute addressing can be forced by
    following "#" with "\".
    
        CALLPA/CALLPB/DJZ..JNXRL/JNATN/JNQMT   - rel_imm9/ind_reg20
        JMP/CALL/CALLA/CALLB/CALLD             - abs_imm20/rel_imm20/ind_reg20
        LOC                                    - abs_imm20/rel_imm20
    
    
    If a constant larger than 9 bits is desired in an instruction, use "##",
    instead of "#" to invoke AUGS/AUGD:
    
    	AND     address,##$FFFFF
    	DJNZ	reg,##far_away
    
    
    The following assembler directives exist:
    
        ORGH    {hub_address}
    
        Set hub mode and an optional address to fill to with $00 bytes.
    
    
        ORG     {cog_address {,cog_address_limit}}
    
        Set cog mode with optional cog address and limit. Defaults to $000,$200.
        If $200..$3FF used for cog address, LUT range selected. Doesn't generate
        any data.
    
    
        ORGF    cog_address
    
        Fill to cog_address with $00 bytes. Must be in cog mode.
    
    
        RES     {cog_registers}
    
        Reserve cog registers. Defaults to 1. Doesn't generate any data. Must be
        in cog mode.
    
    
        FIT     {cog_address}
    
        Make sure cog code fits within cog address.
    
    
        ALIGNW/ALIGNL
    
        Align to next word/long in hub. Must be in hub mode.
    
    
        BYTE    data{[count]}{,data{[count]}...}
        WORD    data{[count]}{,data{[count]}...}
        LONG    data{[count]}{,data{[count]}...}
    
        Generate byte/word/long data with optional repeat count.
    

  • Thanks Chip.
Sign In or Register to comment.