Esempio n. 1
0
        private void AssembleLine()
        {
            Byte[] b = new Byte[3];
            UInt16 i, addr;
            int    n;

            // Get address
            try
            {
                addr = Convert.ToUInt16(txtAddr.Text.Trim(), 16);
            }
            catch
            {
                MessageBox.Show("Error: Invalid address");
                return;
            }

            // Assemble line
            if (txtLine.Text.Trim() == "")
            {
                return;
            }

            n = asm.AsmLine(txtLine.Text, b, addr);

            // Check for errors
            if (n == -1)
            {
                MessageBox.Show("Error: " + asm.ErrMsg, "Line ASM error");
            }
            else
            {
                // Write assembled instruction to memory
                for (i = 0; i < n; i++)
                {
                    mem.DebugWrite((UInt16)(addr + i), b[i]);
                }

                // Update display
                lbList.Items.Add(dasm.Disassemble(addr));
                addr        += (UInt16)n;
                txtAddr.Text = string.Format("{0:X4} ", addr);
                txtLine.Text = "";
            }
        }
Esempio n. 2
0
 private void GetInput()
 {
     mem.DebugWrite(EditAddress, Convert.ToByte(txtInput.Text.Trim(), 16));
     update();
 }