Forum: Mikrocontroller und Digitale Elektronik EMU8086 mit C-Konvetion


von Michel (biilaal)


Lesenswert?

Hallo liebe Leute,

ich muss eine EMU8086-Code schreiben. Ich muss den Haupt- und 
Unterprogramm schreiben aber mit C-Konvetion.

Die Aufgabenstellung lautet:
Fahrenheitwert = ((Celsiuswert.9)/5)+32

.data
  C dw ?
  F db ??

.
Ich habe versucht, es so zu lösen. Aber ich komme leider nicht aufs 
richtige Ergebnis.
Ich wäre für jede Hilfe sehr dankbar.
.data

      C    dw  -51
      F    db  ?,?
        divisor equ 5
; 
------------------------------------------------------------------------ 
--
.stack  16
; 
------------------------------------------------------------------------ 
--
.code
.startup

 mov ax,C
 push ax

 call upro

 mov F, ax


.exit


    upro:
    push bp
    mov bp, sp

    mov bx,9
    mov ax, [bp+4]
    imul bx
    mov bx, divisor
    idiv bx
    add ax, 32


    mov ah, 0
    mov Rest, ah
    mov ah, al
    pop bp
    ret

 END

von Jw E. (jweu3)


Lesenswert?

Sollte bei 16bit IDIV das Ergebnis nicht in AX, Rest in DX sein?
Falls ja, könnte upro so funktionieren:

upro:
push bp
mov bp, sp
mov bx,9
mov ax, [bp+4]
imul bx
mov bx, divisor
idiv bx
add ax, 32
pop bp
ret

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.