《Programming from the Ground Up》閱讀筆記:p19-p48

codists發表於2024-07-07

《Programming from the Ground Up》學習第2天,p19-p48總結,總計30頁。

一、技術總結

1.object file

p20, An object file is code that is in the machine's language, but has not been completely put together。

之前在很多地方都看到object file這個概念,但都沒有看到起定義,這次終於搞清楚了——object檔案就是包含機器語言的檔案。

2.組合語言實現求最大值

#PURPOSE: This program finds the maximum number of a
#         set of data items.

#VARIABLES: The registers have the following uses:
#
# %edi - Holds the index of the data item being examined
# %ebx - Largest data item found
# %eax - Current data item
#
# The following memory locations are used:
#
# data_items - contains the item data. A 0 is used
#              to terminate the data
#
.section .data
data_items:
  .long 3,67,34,222,45,75,54,34,44,33,22,11,66,0

  .section .text

  .global _start
_start:
  movl $0, %edi
  movl data_items(,%edi,4),%eax
  movl %eax, %ebx
start_loop:
  cmpl $0,%eax
  je loop_exit
  incl %edi
  movl data_items(,%edi,4),%eax
  cmpl %ebx, %eax
  jle start_loop

  movl %eax, %ebx
  jmp start_loop
loop_exit:
  movl $1,%eax
  int $0x81

這裡作者花了大量的篇幅做解釋,但個人覺得在“使用哪種暫存器,為什麼使用這種暫存器?”這點上作者沒有解釋清楚,可能會在後面介紹,先繼續往下讀。

二、英語總結

1.overwhelm

(1)over-: above, higher in power, above normal...

(2)whelm: turn upside down。

vt. to cause sb to feel strong emotion。

2.diligence

(1)dis-:apart。

(2)*leg-: to collect, gather。

以上兩個組合起來的意思是“to pick out, select”, u. the quality of working carefully and with a lot of effort。

3.tinker

vi. to make small change to sth。tinker around with sth和tinker with sth意思一樣。

4.process vs processing

A process is a series of steps taken to achieve something, such as the process of making cake.

  1. Gather ingredients
  2. Mix ingredients
  3. Bake
  4. Decorate cake

Processing is when you do things to a substance in order to change it. For example: the processing of oil into gasoline.
process的意思是“步驟”,processing的意思是“處理”。

三、其它

工作中一位很合得來的同事過完這個月就離職了,有點捨不得。這位同事平時說話溫和,情緒穩定,做事沉穩,中正平和,在工作上算得上是一位良好的合作者,祝他未來一切順遂。

四、參考資料

1. 程式設計

(1)Jonathan Bartlett,《Programming From The Ground Up》:https://book.douban.com/subject/1787855/

2. 英語

(1)Etymology Dictionary:https://www.etymonline.com

(2) Cambridge Dictionary:https://dictionary.cambridge.org

歡迎搜尋及關注:程式設計人(a_codists)

相關文章