News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Need HLEP plz

Started by starlight, January 07, 2010, 07:08:53 AM

Previous topic - Next topic

starlight

Hi all, I'm an electric engineer and I have this one course about the 8086 & 8088 software and hardware. For the software part I've been asked by my prof. to do a simple calculator similar to the one in windows that only add and sub two numbers using Easy Code. So, I wrote the code for addtion first and checked. I chose fisrt number works fine, after I push + button , I should be able to choose the second number, but that's not the case. I'm really new to Easy Code and I would appreciate any help and here is my code.

.Const

.Data?
edit1 HANDLE ?
sum DWord ?
ans DWord ?
num1 DWord ?
num2 DWord ?

.Data

.Code

Window1Procedure Proc Private hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
.If uMsg == WM_CREATE
      Invoke GetWindowItem, hWnd, IDC_WINDOW1_EDIT1
      Mov edit1, Eax

     .ElseIf uMsg == WM_COMMAND
        LoWord wParam
        .If Ax == IDC_WINDOW1_BUTTON1
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 1D
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf


          .ElseIf Ax == IDC_WINDOW1_BUTTON2
           HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 2D
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

          .ElseIf Ax == IDC_WINDOW1_BUTTON3
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 3D
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

           .ElseIf Ax == IDC_WINDOW1_BUTTON4
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 4D
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

         .ElseIf Ax == IDC_WINDOW1_BUTTON5
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 5D
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

          .ElseIf Ax == IDC_WINDOW1_BUTTON6
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 6D
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

          .ElseIf Ax == IDC_WINDOW1_BUTTON7
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 7D
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

          .ElseIf Ax == IDC_WINDOW1_BUTTON8
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 8D
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

          .ElseIf Ax == IDC_WINDOW1_BUTTON9
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 9D
                 Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

          .ElseIf Ax == IDC_WINDOW1_BUTTON10
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Eax, 0
                Mov num1, Eax
          Invoke String, num1, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON11
          HiWord wParam
            .If Ax == BN_CLICKED

          .If Ax == IDC_WINDOW1_BUTTON1
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 1D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON2
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 2D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans           
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON3
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 3D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON4
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 4D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON5
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 5D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON6
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 6D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON7
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 7D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON8
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 8D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON9
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 9D
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
            .EndIf

     .ElseIf Ax == IDC_WINDOW1_BUTTON10
          HiWord wParam
            .If Ax == BN_CLICKED
            Mov Ebx, 0
                Mov num2, Ebx
          Invoke String, num2, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans
             .EndIf
       .EndIf
.EndIf



     .ElseIf Ax == IDC_WINDOW1_BUTTON13
          HiWord wParam
            .If Ax == BN_CLICKED
                Mov Eax, num1
                Add Eax, num2
                Mov sum, Eax

          Invoke String, sum, Addr ans, ecDecimal
          Invoke SetText, edit1, Addr ans

            .EndIf
  .EndIf

.ElseIf uMsg == WM_CLOSE
Invoke IsModal, hWnd
.If Eax
Invoke EndModal, hWnd, IDCANCEL
Return TRUE
.EndIf
.EndIf
Return FALSE
Window1Procedure EndP


Ramon Sala

Hi starlight,

Could you send the whole project to me ([email protected])? I'll try to find the problem. Thanks.

Regards,

Ramon
Greetings from Catalonia

starlight


Ramon Sala

Hi starlight,

I sent the project, now working fine, to your email address.

Regards.
Greetings from Catalonia

starlight

Thank you sir very much, but i'm sorry to inform that i didn't receive any messages, I double checked the inbox and spam. if you kindly resend it to [email protected] .
thank you again.

Ramon Sala

Greetings from Catalonia