SETQ - Quick question for Chip

Chip,
Just wanted to confirm this is OK to do...
  if_e    setq    #len1-1
  if_ne   setq    #len2-1
          rdlong  cog0,hubptr

ie the setq may not be immediately before the rdlong

Comments

  • I think the first SETQ will never reach the RDLONG. From memory, even a NOP clears it. Same for ALTx instructions.
  • May as well also ask, can setq be set more than once and will the new setting overwrite the previous?
  • Cluso99 wrote: »
    ... will the new setting overwrite the previous?
    More accurately, it will be rearmed because the first SETQ value is already consumed.
  • If the 2nd SETQ gets cancelled, it looks like a NOP, making the RDLONG just read a single long, as if no SETQ was used.
  • So the SETQ must immediately precede the RD/WR/LONG.
    So no non-executed instructions can intervene. :(
  • Instead of
      if_e    setq    #len1-1
      if_ne   setq    #len2-1
              rdlong  cog0,hubptr
    
    you could use
      if_e    altd    zero,#len1-1
              setq    #len2-1
              rdlong  cog0,hubptr
    
    where "zero" is a cog register containg #0
  • I had to settle for
            if_ne   mov     reply,            #cog_len-1    ' set to copy whole cog (496 longs)
            if_e    mov     reply,            #cog_len80-1  ' set to copy 512 bytes (128 longs)       
                    setq    reply                           ' length -1
                    rdlong  cog_start0,       _hubdata      ' copy loaded code into cog
            if_ne   jmp     #$0                             ' NZ: execute loaded cog code
                    jmp     #$020                           ' Z:  execute loaded cog code from $080+
    
Sign In or Register to comment.