# Class: com.pnfsoftware.jeb.core.units.code.asm.render.GenericCodeFormatter

A base formatter used by the [INativeCodeUnit](INativeCodeUnit). Plugins implementing a processor may override some public and protected methods to customize their disassembly.

## Constructor: GenericCodeFormatter


## Constructor: GenericCodeFormatter
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`

Description: FOR TESTING ONLY

## Static Field: MNEMONIC_RIGHT_PADDING_LENGTH_DEFAULT
Type: `int`

Constant value: `10`

## Protected Method: addPrefix
- parameter: `insn`, type: `InsnType`
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandGeneric`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Protected Method: addSuffix
- parameter: `insn`, type: `InsnType`
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandGeneric`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Method: createItemIdForAddress
- parameter: `address`, type: `long`
- return type: `long`


## Method: createItemIdForDefaultRegister
- parameter: `regCode`, type: `long`
- return type: `long`

Description: Default method to retrieve item id of a register. By default, Bitsize and bitstart are ignored.
parameter: regCode: Code Register, see [RegisterUtil](RegisterUtil) for details
return: createItemIdForRegister with filtered register based on pure id.

## Method: createItemIdForImmediate
- parameter: `insnAddress`, type: `long`
- parameter: `opndIndexGlobal`, type: `int`
- return type: `long`


## Method: createItemIdForMnemonic
- parameter: `insn`, type: `InsnType`
- return type: `long`


## Method: createItemIdForRegister
- parameter: `regCode`, type: `long`
- return type: `long`


## Method: formatAddress
- parameter: `address`, type: `long`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Method: formatAddress
- parameter: `address`, type: `long`
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandGeneric`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`

Description: Format an address regarding [#getDefaultAddressFormatter()](#getDefaultAddressFormatter())
parameter: address: address to represent
parameter: opnd: optional; IFF address is a relative address
parameter: out: 

## Method: formatDataDeclarator
- parameter: `size`, type: `int`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Method: formatImm
- parameter: `address`, type: `long`
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandSized`
- parameter: `value`, type: `long`
- parameter: `opndIndexGlobal`, type: `int`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Method: formatInstruction
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`

Description: Displays only pure assembly code: Mnemonic and Operands, without address and bytecode.
parameter: address: 
parameter: insn: 
parameter: out: 

## Protected Method: formatMnemonic
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`
- parameter: `prependPrefix`, type: `boolean`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Method: formatOperand
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.IInstructionOperand`
- parameter: `opndIndexGlobal`, type: `int`
- parameter: `opndDepth`, type: `int`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`

Description: Generic operand formatter. Can be overridden, although not recommended. If the processor uses custom instructions, that is, instructions that are neither [IInstructionOperandGeneric](IInstructionOperandGeneric) or [IInstructionOperandCMA](IInstructionOperandCMA), the processor should override this method.
parameter: address: 
parameter: insn: 
parameter: opnd: 
parameter: opndIndexGlobal: 
parameter: opndDepth: 
parameter: out: 

## Protected Method: formatOperands
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Protected Method: formatPrefix
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`
- return type: `int`


## Protected Method: formatRegister
- parameter: `regValue`, type: `long`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Method: formatRelativeAddress
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandGeneric`
- parameter: `address`, type: `long`
- parameter: `out`, type: `com.pnfsoftware.jeb.core.output.code.CodeDocumentPart`


## Method: generateExtraComment
- parameter: `insnAddress`, type: `long`
- parameter: `instruction`, type: `InsnType`
- return type: `java.lang.CharSequence`

Description: Generate an optional string that will be displayed at the line instruction. The default implementation returns null.
parameter: insnAddress: address
parameter: instruction: instruction. Can be null if no instruction is defined at this address.
return: 

## Method: generateExtraMethodComment
- parameter: `address`, type: `long`
- return type: `java.lang.String`

Description: Generate an optional string that will be prepended to a function header comment. The default implementation returns null.
parameter: address: function address
return: 

## Method: generateExtraSectionHeader
- parameter: `segment`, type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`
- return type: `java.lang.String`


## Method: generateExtraSegmentHeader
- parameter: `segment`, type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`
- return type: `java.lang.String`


## Method: generateHeader
- return type: `java.lang.String`

Description: Generate the disassembly header. The default implementation returns the boilerplate line "Code Disassembly".
return: 

## Protected Method: generateMnemonic
- parameter: `address`, type: `long`
- parameter: `insn`, type: `InsnType`
- return type: `java.lang.String`


## Method: getArrayElementPerLine
- return type: `int`

Description: The default implementation returns 10. Can be overridden.
return: a number \>= 1

## Method: getBestClassIdForAddress
- parameter: `address`, type: `long`
- return type: `com.pnfsoftware.jeb.core.output.ItemClassIdentifiers`


## Protected Method: getCachedBooleanProperty
- parameter: `propname`, type: `java.lang.String`
- return type: `boolean`

Description: Convenience method to retrieve and cache \(for 5 second\) a code unit's property.
parameter: propname: code unit's property name
return: the property value \(on failure: false\)

## Protected Method: getCachedIntegerProperty
- parameter: `propname`, type: `java.lang.String`
- return type: `int`

Description: Convenience method to retrieve and cache \(for 5 second\) a code unit's property.
parameter: propname: code unit's property name
return: the property value \(on failure: 0\)

## Protected Method: getCachedStringProperty
- parameter: `propname`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Convenience method to retrieve and cache \(for 5 second\) a code unit's property.
parameter: propname: code unit's property name
return: the property value \(on failure: the empty string\)

## Method: getCodeUnit
- return type: `com.pnfsoftware.jeb.core.units.INativeCodeUnit<InsnType>`


## Protected Method: getCountOfFormattedOperands
- parameter: `insn`, type: `InsnType`
- return type: `int`


## Method: getDataSeparator
- return type: `java.lang.String`

Description: The default implementation returns the comma string. Can be overridden.
return: 

## Method: getDefaultAddressFormatter
- return type: `com.pnfsoftware.jeb.core.units.code.asm.render.AddressFormatter`


## Method: getDefaultNumberFormatter
- return type: `com.pnfsoftware.jeb.core.units.code.asm.render.NumberFormatter`


## Method: getEndianness
- return type: `com.pnfsoftware.jeb.util.io.Endianness`


## Method: getInlineCommentString
- return type: `java.lang.String`

Description: The default implementation returns a semi\-column string. Can be overridden.
return: 

## Method: getLabelPrefix
- return type: `java.lang.String`

Description: Get the assembly label prefix. Can be overridden.
return: 

## Method: getLabelSuffix
- return type: `java.lang.String`

Description: Can be overridden.
return: 

## Method: getMemory
- return type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`


## Method: getMemoryAccessPrefix
- return type: `java.lang.String`

Description: The default implementation returns the opening square bracket. Can be overridden.
return: 

## Method: getMemoryAccessSegmentInfo
- parameter: `insn`, type: `InsnType`
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.IInstructionOperand`
- return type: `java.lang.String`

Description: The default implementation returns the empty string. Can be overridden.
parameter: insn: 
parameter: opnd: 
return: 

## Method: getMemoryAccessSizeInfo
- parameter: `insn`, type: `InsnType`
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.asm.processor.IInstructionOperandSized`
- return type: `java.lang.String`

Description: Can be overridden.
parameter: insn: 
parameter: opnd: 
return: 

## Method: getMemoryAccessSuffix
- return type: `java.lang.String`

Description: The default implementation returns the closing square bracket. Can be overridden.
return: 

## Method: getMnemonicRightPaddingLength
- return type: `int`


## Method: getMultiLineCommentBegin
- return type: `java.lang.String`

Description: The default implementation returns "slash\-\*". Can be overridden.
return: 

## Method: getMultiLineCommentEnd
- return type: `java.lang.String`

Description: The default implementation returns "\*\-slash". Can be overridden.
return: 

## Method: getNumberFormatter
- parameter: `item`, type: `com.pnfsoftware.jeb.core.units.code.asm.items.INativeDataItem`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.render.NumberFormatter`


## Method: getNumberFormatter
- parameter: `opnd`, type: `com.pnfsoftware.jeb.core.units.code.IInstructionOperand`
- parameter: `createIfNone`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.render.NumberFormatter`


## Method: getOperandSeparator
- return type: `java.lang.String`

Description: Can be overridden.
return: 

## Method: getProcedureDefinitionEnd
- return type: `java.lang.String`

Description: 
return: 

## Method: getProcedureDefinitionStart
- return type: `java.lang.String`

Description: 
return: 

## Method: getRawDataDeclarator
- parameter: `bitsize`, type: `int`
- return type: `java.lang.String`

Description: The default implementation returns "dX". Can be overridden.
return: 

## Method: getRegisterName
- parameter: `registerIdentifier`, type: `long`
- return type: `java.lang.String`

Description: The default implementation returns "rX". Should be overridden.
parameter: registerIdentifier: 
return: a register name, never null \(on error, the implementation should return a default         safe string\)

## Method: isDoNotAttemptImmediateToAddressResolution
- return type: `boolean`


## Method: setCodeUnit
- parameter: `pbcu`, type: `com.pnfsoftware.jeb.core.units.INativeCodeUnit<InsnType>`


## Method: setDoNotAttemptImmediateToAddressResolution
- parameter: `doNotResolveImmAsAddr`, type: `boolean`


## Method: setMnemonicRightPaddingLength
- parameter: `length`, type: `int`


