implementing several secd opcodes