用java數十行搞定的程序,用匯編要100多行。。。
而且還不支持異常處理,崩潰啊。。。
不過對於彙編基本的數據處理啥的還是有幫助的,
上程序,win32彙編
.model small .586p .data remind_msg_1 db "please input the first number",0ah,0dh,"$" number_1 db 5 ;數字字符串緩衝區1 db ? db 5 dup(?) db "$" number_value_1 dw ?,"$" remind_msg_2 db "please input the second number",0ah,0dh,"$" number_2 db 5 ;數字字符串緩衝區2 db ? db 5 dup(?) db "$" number_value_2 dw ?,"$" change_line_msg db 0ah,0dh,"$" count db ?,"$";循環數目 factor dw ?,"$";乘數因子 temp_result dw ?,"$" result dw ?,"$" .code change_line proc near push dx push ax lea dx,change_line_msg mov ah,09h int 21h pop ax pop dx ret change_line endp;換行 calc_factor proc near push cx push ax push dx push bx dec cx xor ax,ax mov ax,1 xor bx,bx mov bx,10 sub_c: cmp cx,0 jz sub1 mul bx dec cx jmp sub_c sub1: push si lea si,factor mov word ptr[si],ax pop si pop bx pop dx pop ax pop cx ret calc_factor endp;計算乘數,最後結果放在factor中,參數需要cx sub_mul proc near pusha xor bx,bx mov bl,al lea si,factor mov ax,word ptr[si] mul bx lea si,temp_result mov word ptr[si],ax popa ret sub_mul endp;兩個數分別放在al,factor中,求最後結果放在temp_result中 add_ proc near pusha lea si,temp_result mov ax,word ptr[si] lea si,result mov bx,word ptr[si] add bx,ax mov word ptr[si],bx popa ret add_ endp;把result+temp_result放到result中 .startup lea dx,remind_msg_1 mov ah,09h int 21h;print info lea dx,number_1 mov ah,0ah int 21h;input first number call change_line lea dx,remind_msg_2 mov ah,09h int 21h;print info lea dx,number_2 mov ah,0ah int 21h;input second number call change_line ;調用multi的準備工作 xor cx,cx lea si,result mov word ptr[si],cx lea si,number_1+1 xor cx,cx xor bx,bx mov cl,byte ptr [si];cl中放了這個長度 calc_1: lea si,number_1+2 mov al,byte ptr[si][bx] sub al,30h call calc_factor call sub_mul;結果在temp_result中 call add_ inc bx loop calc_1;完成以後結果在result中 lea si,result mov ax,word ptr[si] lea si,number_value_1 mov word ptr[si],ax;存儲了第一個數字的結果 ;調用multi的準備工作 xor cx,cx lea si,result mov word ptr[si],cx lea si,number_2+1 xor cx,cx xor bx,bx mov cl,byte ptr [si];cl中放了這個長度 calc_2: lea si,number_2+2 mov al,byte ptr[si][bx] sub al,30h call calc_factor call sub_mul;結果在temp_result中 call add_ inc bx loop calc_2;完成以後結果在result中 lea si,result mov ax,word ptr[si] lea si,number_value_2 mov word ptr[si],ax;存儲了第一個數字的結果 lea si,number_value_1 mov ax,word ptr[si] lea si,number_value_2 mov bx,word ptr[si] xor dx,dx add ax,bx mov bx,10000 div bx mov bx,dx mov dl,al add dl,30h mov ah,02h int 21h; xor dx,dx mov ax,bx mov bx,1000 div bx mov bx,dx mov dl,al add dl,30h mov ah,02h int 21h; xor dx,dx mov ax,bx mov bx,100 div bx mov bx,dx mov dl,al add dl,30h mov ah,02h int 21h; xor dx,dx mov ax,bx mov bx,10 div bx mov bx,dx mov dl,al add dl,30h mov ah,02h int 21h mov dl,bl add dl,30h mov ah,02h int 21h mov ax,4c00h int 21h end
前言 導入地址表鉤取的方法容易實現但是存在缺陷,若需要鉤取的函數不存在導入地址表中,那麼我們就無法進行鉤取,出現以下幾種情況時,導入函數是不會存儲在導入地址表中的。 延遲加載:當導入函數還沒調用時,導入函數還未寫入到導入地址表中。
1. 前言 前文實現“代碼可視化”需要了解的前置知識-編譯器前端介紹了編譯器前端知識並附帶了小練習,本文將繼續介紹編譯器中端相關的知識,還是概念+練習的學習方式。中間代碼是用來進行程序分析和實現代碼可視化的關鍵數據,瞭解其生成和優化方式能
說在前面: 什麼是pyc文件? pyc是一種二進制文件,是由py文件經過編譯後,生成的文件,是一種byte code,py文件變成pyc文件後,加載的速度有所提高,pyc 文件是 Python 編譯過的字節碼文件。它是 Python 程
最近復現了兩個棧溢出漏洞的cve,分別是CVE-2017-9430和CVE-2017-13089,簡單記錄一下real wrold中的棧溢出漏洞學習。目前,棧溢出漏洞主要出現在iot固件中,linux下的已經很少了,所以這兩個洞都是17年,
併發和並行的含義 目標都是最大化CPU的使用率 並行(parallel) : 指在同一時刻,有多條指令在多個處理器上同時執行。 所以無論從微觀還是 從宏觀來看,二者都是一起執行的。 併發(concurrency):指在同一時刻只能
前言 爲啥要寫這個呢,因爲寫程序也7-8年了,有一些感悟,想寫下來,雖然這個命題有點大,但是呢,我覺得並不誇張,下面進入正題。 打好基礎 其實就是學東西不管學什麼基礎纔是重要的,比如寫程序有的人會說能用就行,可是我覺
不知道你是否使用過IDA的條件斷點呢?在IDA進階使用中,它的很多功能都有大作用,比如:ida-trace來跟蹤調用流程。同時IDA的斷點功能也十分強大,配合IDA-python的輸出語句能夠大殺特殺! 那麼本文就介紹一下這個功能點,使用z
背景介紹 應用安裝包的體積影響着用戶下載量、安裝時長、用戶磁盤佔用量等多個方面,據Google Play統計,應用體積每增加6MB,安裝的轉化率將下降1%。 安裝包的體積受諸多方面影響,針對dex、資源文件、so文件都有不同的優化策略,在
1)編碼 消息長度(short int-->2個字節) + 消息編號(short int--》2個字節) + 消息體 2)Protobuf協議文檔 (1)syntax="proto3"; (2)命名格式
背景 v4 中使用了鏈表存儲了不同大小的內存塊的方式進行內存池的實現(參考這篇v4內存複用機制),實際測試中發現內存浪費比較嚴重,因此如何設計出使用效率高,操作簡潔的內存池就成了 v5 的一個任務。 使用 make 使用 go 原生的內存分
Java有8種基本數據類型,每種基本數據類型都提供了一種對應的包裝類型,從 Java 5 開始引入了自動裝箱/拆箱機制,使得二者可以相互轉換。 原始類型: boolean,char,byte,short,int,long,float,do
繼續運行 ?* 回憶上次內容 上次使用shell環境中的命令 命令 作用 c
前言 作爲表格產品的典型應用場景之一,幾乎所有的行業都會存在類 Excel 報表開發這樣的應用場景,而在這些應用場景中,經常會遇見下面的這些痛點: 報表數據往往來自多個不同的數據源,需要報表系統能夠同時連接多個數據源,並融合不同的數據格式
本文分享自華爲雲社區《GaussDB SQL基本語法示例-CASE表達式》,作者:Gauss松鼠會小助手2。 一、前言 SQL是用於訪問和處理數據庫的標準計算機語言。GaussDB支持SQL標準(默認支持SQL2、SQL3和SQL4的主要
1、【價格調整】MaxCompute 存儲服務單價調整MaxCompute 按量付費存儲單價由梯度定價統一下調整爲月固定單價,中小規模企業數據倉庫存儲成本最高降四成。價格調整內容2021/1/10日起,MaxCompute 數據存儲服務由階