How to represent octal numbers in Assembly?

后端 未结 2 928
一生所求
一生所求 2020-12-21 07:04

For example for hexadecimal numbers we can use 0x98398 or 8790h.

How can octal numeric constants be written? Does this work?



        
2条回答
  •  时光说笑
    2020-12-21 07:39

    Depends on the assembler, but most of the assemblers including NASM allow 0o, o standing for octal. Just like you use 0x where x stands for Hexadecimal.

        mov     ax,310q         ; octal 
        mov     ax,310o         ; octal again 
        mov     ax,0o310        ; octal yet again 
        mov     ax,0q310        ; octal yet again 
    

    Source of information: Here .

    Again it's not 0o or the syntax above for all assemblers. It might vary by assemblers , but NASM does indeed use the above-mentioned syntax as you can see the link provided for more information. If you have other assemblers in mind, check out their manuel like for FASM: Here . GAS: Here

提交回复
热议问题