dikyi 0 Report post Posted March 30, 2007 Minta bantuan dari pakar-pakar programing macam mana nak selesai soalan di bawah ini :-Write an 8086 assembly language program that will compute:2.0 * log10 X for x = 0.1, 1.0, 10.0, 100.5, 1000.0, and six other values using a loop.All values are in the single-precision (short real) format Quote Share this post Link to post Share on other sites
Stranger 0 Report post Posted March 30, 2007 aku xbrape tau sgt ASM ni,tp klu ko pki MSVC++, ko write dlu program dlm C/C++,then execute in Debug mode,pastu ko hit ALT + 8, nnt ade output dlm ASM (disassembly)... Quote Share this post Link to post Share on other sites
dikyi 0 Report post Posted March 30, 2007 aku xbrape tau sgt ASM ni,tp klu ko pki MSVC++, ko write dlu program dlm C/C++,then execute in Debug mode,pastu ko hit ALT + 8, nnt ade output dlm ASM (disassembly)...Sape yg tahu bantule aku, aku setakat buat programing calculator aku tau la sebab dalam emulator tu ada sample....yg log tu takde. Kot-kot sape yg ade sample yg seakan-akan pos le kat sini boleh aku buat panduan. Quote Share this post Link to post Share on other sites
Stranger 0 Report post Posted April 1, 2007 Ni 32 bit, yg 8086 16 bit, so aku xtau lh compile ke x...;                                Aku wt pki MASM32 (www.masm32.com) ;                            Build this with the "Project" menu using ;                                  "Console Assemble & Link"     .486                                                  ; create 32 bit code     .model flat, stdcall                                  ; 32 bit memory model     option casemap :none                                  ; case sensitive     include D:\masm32\include\windows.inc                  ; always first     include D:\masm32\macros\macros.asm                    ; MASM support macros         include D:\masm32\include\masm32.inc     include D:\masm32\include\kernel32.inc     include D:\masm32\include\msvcrt.inc         includelib D:\masm32\lib\masm32.lib     includelib D:\masm32\lib\kernel32.lib     includelib D:\masm32\lib\msvcrt.lib                    ; import CRT (C run-time) library     ConstantCalculation  proto : DWORD     UserInputCalculation proto : BYTE         .data         double            REAL8      ?         two              REAL4      2.0         _0point1          REAL4      0.1         _1point0          REAL4      1.0         _10point0        REAL4      10.0         _100point5        REAL4      100.5         _1000point0      REAL4      1000.0         format1          db          "2.0 x log10 (%f) =  %f", 10, 0         format2          db          "%s", 0     .code                                                  ; Tell MASM where the code starts start:                                                    ; The CODE entry point to the program     Invoke ConstantCalculation, 1     Invoke ConstantCalculation, 2     Invoke ConstantCalculation, 3     Invoke ConstantCalculation, 4     Invoke ConstantCalculation, 5     Invoke UserInputCalculation, 0     print chr$ (10, 174, 174, 174, 174, 32, 99, 111, 100, 101, 100, 32, 98, 121, 32, 83, 116, 114, 97, 110, 103, 101, 114, 32,  175, 175, 175, 175, 10)     exit ConstantCalculation proc SelectCase : DWORD     LOCAL  Log10What : REAL8     finit                                                  ; Initialize the FPU     cmp    SelectCase, 1     jne    Case2     fld    _0point1                                        ; st(0) = _0point1     fst    Log10What                                      ; Store real number     jz    ExecuteNextStatement     Case2:     cmp    SelectCase, 2     jne    Case3     fld    _1point0                                        ; st(0) = _1point0     fst    Log10What                                      ; Store real number     jz    ExecuteNextStatement     Case3:     cmp    SelectCase, 3     jne    Case4     fld    _10point0                                      ; st(0) = _10point0     fst    Log10What                                      ; Store real number     jz    ExecuteNextStatement     Case4:     cmp    SelectCase, 4     jne    Case5     fld    _100point5                                      ; st(0) = _100point5     fst    Log10What                                      ; Store real number     jz    ExecuteNextStatement     Case5:     fld    _1000point0                                    ; st(0) = _1000point0     fst    Log10What                                      ; Store real number     ExecuteNextStatement:   ; "log10()" & "printf()" expects a REAL8 datatype, so convert     fstp  double                                          ; Store real number(double) and pop "st(0)"     push  dword ptr [double + 4]     push  dword ptr [double    ]     call  crt_log10     fld    st(0)     fmul  two     ffree  st(1)     fstp  double       ; print result     INVOKE crt_printf, SADD("2.0 x log10 (%6.1f) =  %1.5f", 10), Log10What,  double     ret ConstantCalculation endp UserInputCalculation proc void : BYTE     LOCAL i      : DWORD                                  ; Loop     LOCAL String : DWORD     LOCAL d      : REAL8     mov    i, 0                                            ; Initialize i to 0     print  chr$(10, 10)         gelung:                                                ; Loop     finit       mov    String, input("Input real number : ")     push  String     call  crt_atof     fst    d                                              ; Store real number (d)     push  dword ptr [d + 4]     push  dword ptr [d    ]     call  crt_log10     fmul  two     fst    double                                          ; Store real number (double)   ; print result     INVOKE crt_printf, ADDR format1, d,  double     print  chr$(10)     add    i, 1     cmp    i, 5     jne    gelung                                          ; Byk sgt reserved word, pki BM lg sng:)     ret UserInputCalculation endp end start                                                  ; Tell MASM where the program ends Quote Share this post Link to post Share on other sites
Stranger 0 Report post Posted April 1, 2007 Oppss, lupe lak, 8086 mne ade FPU, so mmg xbleh compile...Klu nk bja FPU, g kat http://www.ray.masmcode.com/fpu.html Quote Share this post Link to post Share on other sites
dikyi 0 Report post Posted April 1, 2007 Oppss, lupe lak, 8086 mne ade FPU, so mmg xbleh compile...Klu nk bja FPU, g kat http://www.ray.masmcode.com/fpu.htmlWalaubagaimanapun terima kasih atas keprihatinan anda. Sekurang-kurangnya aku boleh nampak ape yg nak di buat. Quote Share this post Link to post Share on other sites
Paralys3r 0 Report post Posted April 7, 2007 tiada fpu instr yg directly kira log X. tapi kita ada arahan fyl2x untuk kira y*log2 X. Awak boleh guna formula nilogb X = log2 X/ log2 bso dalam kes awak,log X = log2 X/log2 10y*log X = y*log2 X/log2 10arahan fyl2x boleh dapatkan y*log2 X dan log2 10 adalah constant, boleh kira sendiri. Tapi kalau nak jugak, boleh guna fldl2t (load log2 10 constant into fpu stack).pengiraan dalam fpu stack dalam dep. kalau awak store ke memory (4 bytes), ia akan automatik ubah ke single prec. Quote Share this post Link to post Share on other sites
encik pot pet 0 Report post Posted April 19, 2007 dari yg aku faham, sebenarnya kes awak ni lagi complex. oleh kerana 8086 takde fpu, terpaksa guna cpu register and instruction utk emulate calculation yg menggunakan floating point. nak belajar tu, boleh check floating point function library zaman dulu.aku malas lak nak google pasal benda tu, tapi aku biasa gunakan big number library mcm Miracl - http://indigo.ie/~mscott/ yg emulate processor 32bit utk calculate nombor bersaiz ribuan bit. Quote Share this post Link to post Share on other sites