Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 30.05.2016, 11:13   #1
Валентина90
Новичок
Джуниор
 
Регистрация: 30.05.2016
Сообщений: 2
Печаль Помогите с ассемблером, пожалуйста))

Задача «Калькулятор»
Используя шаблоны программ каталога «Tutorial», написать и отладить линейную программу, которая позволяет ввести с клавиатуры два целых числа и вывести на экран сумму, разность, произведение и частное этих чисел.
Операции ввода и вывода необходимо выполнять с элементами интерфейса. (Например, «Введите первое число….)

Шаблон: https://drive.google.com/file/d/0B3j...ew?usp=sharing
Валентина90 вне форума Ответить с цитированием
Старый 30.05.2016, 11:32   #2
Serge_Bliznykov
Старожил
 
Регистрация: 09.01.2008
Сообщений: 26,229
По умолчанию

файлик numbers.asm небольшой, его можно и на форум выложить:
Код:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

;                 Build this with the "Project" menu using
;                        "Console Assemble & Link"

comment * «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

This demo shows how to perform simple addition using registers and assembler
instructions in the first example. The second example shows how to compare
a memory variable to an immediate number and branch to different labels
depending on how large the number is. Branching logic in assembler is very
simple and compact code.

««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« *

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model
    option casemap :none                    ; case sensitive
 
    include \masm32\include\windows.inc     ; always first
    include \masm32\macros\macros.asm       ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc

  ; ------------------------------------------------
  ; Library files that have definitions for function
  ; exports and tested reliable prebuilt code.
  ; ------------------------------------------------
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib

    .code                       ; Tell MASM where the code starts

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

start:                          ; The CODE entry point to the program

    call main                   ; branch to the "main" procedure

    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

main proc

    LOCAL var1:DWORD            ; space for a DWORD variable
    LOCAL str1:DWORD            ; a string handle for the input data

  ; test the MOV and ADD instructions

    mov eax, 100                ; copy the IMMEDIATE number 100 into the EAX register
    mov ecx, 250                ; copy the IMMEDIATE number 250 into the ECX register
    add ecx, eax                ; ADD EAX to ECX
    print str$(ecx)             ; show the result at the console
    print chr$(13,10,13,10)

  ; ----------------------------------------
  ; The two following macros can be combined
  ; once you are familiar with how they work
  ; ----------------------------------------
 ;     mov str1, input("Enter a number : ")
 ;     mov var1, sval(str1)        ; convert the result to a signed integer

    mov var1, sval(input("Enter a number : "))

    cmp var1, 100               ; compare the variable to the immediate number 100
    je equal                    ; jump if var1 is equal to 100 to "equal"
    jg bigger                   ; jump if var1 is greater than 100 to "bigger"
    jl smaller                  ; jump if var1 is less than 100 to "smaller"

  equal:
    print chr$("The number you entered is 100",13,10)
    jmp over

  bigger:
    print chr$("The number you entered is greater than 100",13,10)
    jmp over

  smaller:
    print chr$("The number you entered is smaller than 100",13,10)

  over:

    ret

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start                       ; Tell MASM where the program ends
Serge_Bliznykov вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
помогите с Ассемблером help_me_plz Помощь студентам 2 27.09.2015 21:26
Помогите пожалуйста с Ассемблером!!! Даниэль Вайскр Помощь студентам 0 04.06.2014 19:06
помогите с ассемблером GIO Помощь студентам 1 11.12.2007 13:12