⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fahrenheit.asm

📁 介绍用Java解析网络数据的三种特殊方法
💻 ASM
字号:

; Centigrade (Celsius) to Fahrenheit
; calculation and vice-versa.
; (not very accurate, since using
; integer divide, it may not work
; for some values as well...).

; This program has no input/output from
; the user, so in order to see the result
; it maybe useful to select "Variables"
; from "View" menu of the emulator.

; Another way to see the output is to
; use PRINT_NUM procedure from "emu8086.inc",
; see "Part 5" in tutorials.
; (since we get result in AL, you should use
; CBW instruction before printing out,
; because PRINT_NUM prints a signed number
; in AX register).

#MAKE_COM#


ORG 100h

JMP start

tc DB 10    ; t Celsius.
tf DB 0     ; t Fahrenheit.

result1 DB ?   ; result in Fahrenheit.
result2 DB ?   ; result in Celsius.

start:

; convert Celsius to Fahrenheit according
; to this formula: f = c * 9 / 5 + 32

MOV CL, tc
MOV AL, 9
IMUL CL
MOV CL, 5
IDIV CL
ADD AL, 32
MOV result1, AL

; convert Fahrenheit to Celsius according
; to this formula: c = (f - 32) * 5 / 9

MOV CL, tf
SUB CL, 32
MOV AL, 5
IMUL CL
MOV CL, 9
IDIV CL
MOV result2, AL

RET

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -