Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Two 8086 program wanted

sramskumarsramskumar Member Posts: 2
I want 8086 assembly language program to find any given sub-string in a string. And also I want 8086 assembly language program that multiplies
two four digit packed BCD numbers.


Comments

  • blipblip Member Posts: 756
    This looks suspiciously like homework!
  • sramskumarsramskumar Member Posts: 2
    : This looks suspiciously like homework!
    : Yes. But can you help me ?

  • blipblip Member Posts: 756
    The string handling should be in some older thread somewhere. As for the BCD multiplication, didn't your teacher teach you how to do it?
  • ChojinChojin Member Posts: 39
    : I want 8086 assembly language program to find any given sub-string in a string. And also I want 8086 assembly language program that multiplies
    : two four digit packed BCD numbers.
    :
    :
    :
    yep this smells like homework :) , i think there is an algorithm for multipling the to values , but if there isnt then you have to convert the two values for a normal number :
    ex; imagine that the letters are a digit in your number ::

    abcd = a* 10^3 + b* 10^2 + c* 10^1+ d* 10^0

    after converting the two number you just have to use it normal ,
    for separat the digits use the "and" and "shr"

    shame on you :(



  • korkor Member Posts: 198
    : : I want 8086 assembly language program to find any given sub-string in a string. And also I want 8086 assembly language program that multiplies
    : : two four digit packed BCD numbers.
    : :
    : :
    : :
    : yep this smells like homework :) , i think there is an algorithm for multipling the to values , but if there isnt then you have to convert the two values for a normal number :
    : ex; imagine that the letters are a digit in your number ::
    :
    : abcd = a* 10^3 + b* 10^2 + c* 10^1+ d* 10^0
    :
    : after converting the two number you just have to use it normal ,
    : for separat the digits use the "and" and "shr"
    :
    : shame on you :(
    :
    :
    :
    :

    Not quite sure about the 8086, but I know pentiums will do packed bcd math with a single instruction. You might want to look at that.
  • brain_insidebrain_inside Member Posts: 40
    : I want 8086 assembly language program to find any given sub-string in a string. And also I want 8086 assembly language program that multiplies
    : two four digit packed BCD numbers.
    :
    :
    :

    Here is a NASM source which should work (don't know how to write it in MASM 'cause I never used it):

    [code]
    FindSubstr:

    ; Finds substring at DS:SI in string ES:DI
    ; Returns CX = position in string or FFFF if not found

    push bx
    push bp
    mov bx,di
    mov dx,si
    mov bp,di
    push di
    .l1:
    cmp Byte [si],0 ; end of substring reached?
    je .Found
    cmp Byte [es:di],0 ; end of searched string?
    je .NotFound
    cmpsb
    je .l1 ; compare until not equal
    inc bp
    mov di,bp ; go forward one byte
    mov si,dx ; reset substring pointer to start
    jmp .l1
    .Found:
    mov cx,di
    pop di
    sub cx,di
    pop bp
    pop bx
    ret
    .NotFound:
    add sp,2
    pop bp
    pop bx
    mov cx,0ffffh
    ret
    [/code]

    HTH.
  • Andre YoungAndre Young USAMember Posts: 0

    __ | http://forcoder.org | free ebooks and video tutorials about [ Visual Basic .NET Visual Basic Perl MATLAB Java C++ PL/SQL C Python Delphi JavaScript PHP Swift Ruby Scratch Objective-C C# Assembly Go R Lisp Prolog Crystal Fortran Awk ML Scala VBScript Scheme Transact-SQL Dart SAS Julia Logo Apex Hack COBOL D Alice Kotlin Bash ABAP Ada LabVIEW F# Lua Rust Clojure FoxPro Erlang ] ______________

Sign In or Register to comment.