MCPcopy Create free account
hub / github.com/djhworld/simple-computer / Emit

Method Emit

asm/instructions.go:309–318  ·  view source on GitHub ↗
(labelResolver LabelResolver, symbolResolver SymbolResolver)

Source from the content-addressed store, hash-verified

307}
308
309func (i IN) Emit(labelResolver LabelResolver, symbolResolver SymbolResolver) ([]uint16, error) {
310 switch i.IoMode {
311 case DATA_MODE:
312 return []uint16{opINData + uint16(i.ToRegister)}, nil
313 case ADDRESS_MODE:
314 return []uint16{opINAddr + uint16(i.ToRegister)}, nil
315 default:
316 return nil, fmt.Errorf("unsupported io mode for IN instruction")
317 }
318}
319
320func (i IN) String() string {
321 result := fmt.Sprintf("IN %s, R%d", i.IoMode, i.ToRegister)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected