ときどきの雑記帖 RE* (新南口)
わしらは怪しい探検隊
ジェットスクランダー
次回お目見え(マジンガーZ@東京MX)
ERROR FREE 世界のトップ企業がこぞって採用した MIT博士のミスを減らす秘訣
という本を読んだのだけど 筆者の主張そのものはともかく それを補強する部分に違和感が。
例えば
p164
過去の執着への回避
過去への執着という思考に陥るのを防ぐには、環境の変化と自社の戦略を定期的に検証する必要がある。 これについては歴史の中に西ローマ帝国と東ローマ帝国(ビザンチン帝国)という分かりやすい例がある。 ローマ帝国が分かれてできた2つの国にはまったく異なる運命が待っていた。 西ローマ帝国は100年ももたずにゲルマン民族の侵入によって滅亡したが、東ローマ帝国は 1000年も続いた。何が彼らの失敗と成功を分けたのだろうか。経済力の面で東ローマ帝国は西ローマ帝国に勝っていたが、それ以外で両国の運命を分けた最大の理由は、 西ローマ帝国が好戦的で、その政策に国民が耐えられるか、それが国益にかなうかどうかを考えようとする 人がいなかったことだ。
これに対し東ローマ帝国は宗教によって国を統治した。国教に定められた東方正教会の教義は厳格だったが、 法律は非常にシンプルで、みだりに外征することもなく、リーダーは国民の利益を重視し、 意思決定も効率的に行われ、状況の変化にも臨機応変に対応した。その結果、東ローマ帝国は 異民族の侵入を食い止めて1000年以上も存続した。
似たような例は中国にもある。秦は厳格な刑罰と法律によって国を統治し戦争に明け暮れたが、 周は礼をもって国を治めた。その結果、秦はわずか15年で滅亡し、周は800年以上も存続した。
という記述があるのだけど、 「あれ、そうだっけ?」 と疑問符が数個頭上に浮かんだ。
ほかにも
p36 図表1-4
ヨーロッパの帝国・王朝の存続期間 | ||
---|---|---|
東ローマ帝国 | 395-1453 | 1058 |
西ローマ帝国 | 395-476 | 81 |
神聖ローマ帝国 | 962-1806 | 844 |
共和制ローマ | B.C.509-A.D.27 | 482 |
ホラズム・シャー朝 | 1077-1231 | 154 |
オスマン帝国 | 1299-1922 | 623 |
サーマーン朝 | 875-999 | 124 |
セルジューク朝 | 1037-1194 | 157 |
グプタ朝 | 320-550頃 | 230 |
イギリス | 1707- | (315) *イングランド王国とスコットランド王国統合から |
大英帝国 | 1600-1997 | 397 *東インド会社設立から香港返還まで |
という表があって 「ヨーロッパ」とは? と思ったし、 分裂前の帝政ローマがないのはなぜなのかとか イギリスが2個あるとか 大英帝国の終わりをそこにしたわけは何かとか。
ヨーロッパとは別に中国の王朝の図表もあるのだけど
p37 図表1-5
中国の王朝の存続期間 | ||
---|---|---|
夏 | B.C.2100-B.C.1600 | 500 |
商 | B.C.1600-B.C.1046 | 554 |
周 | B.C.1100頃-B.C.256 | 844 |
秦 | B.C.221-B.C.206 | 15 |
漢 | B.C.202-A.D.220 | 422 |
晋 | 265-420 | 155 |
唐 | 618-907 | 289 |
宋 | 960-1279 | 319 |
元 | 1271-1368 | 97 |
明 | 1368-1644 | 276 |
清 | 1616-1912 | 296 |
漢は新で分割されないの?とか 隋がないのはなぜ?とか 最初の二つを勘定に入れるのはどうかとか 周の存続期間はそれでいいのかとか 宋(北宋)の期間に南宋のそれも含めるのはいいとしても 普(西晋)と東晋をまとめていいのかとか。
諸々引っかかるところの多い本だった (たぶん本筋以外のところで)。
新刊近刊
Go
という本を見かけた。
たぶんこれの翻訳だろう。 と思った翌日くらいにこの記事が出た。
Gの遺伝子
ゴルゴの遺伝子を宿す天才少女ファネットが主役のスピンオフ、コラージュビジュアルも | マイナビニュース
さいとう・たかを「ゴルゴ13」スピンオフシリーズの第2弾「Gの遺伝子 少女ファネット」1巻が、本日5月30日に発売された。
とりあえず第1話オススメ😄
そういえば
カーニハン大先生の
の翻訳本はまだなんだろうか。
May GNU Spotlight
5月分。 gawk 5.2.2とgrep 3.11もある。
lessとdiffutilsが気になるな。
Learn x86-64 assembly by writing a GUI from scratch (2020)
- Learn x86-64 assembly by writing a GUI from scratch (2020) | Hacker News
- Learn x86-64 assembly by writing a GUI from scratch : r/programming
- Learn x86-64 assembly by writing a GUI from scratch
I am by no means an expert in assembly or in X11. I just hope to provide an entertaining, approachable article, something a beginner can understand. Something I wished I had found when I was learning those topics. If you spot an error, please open a Github issue!
面白そうなことをやっているなあと眺めてみた。
イベントループがこれで
; Poll indefinitely messages from the X11 server with poll(2).
; @param rdi The socket file descriptor.
; @param esi The window id.
; @param edx The gc id.
poll_messages:
static poll_messages:function
push rbp
mov rbp, rsp
sub rsp, 32
%define POLLIN 0x001
%define POLLPRI 0x002
%define POLLOUT 0x004
%define POLLERR 0x008
%define POLLHUP 0x010
%define POLLNVAL 0x020
mov DWORD [rsp + 0*4], edi
mov DWORD [rsp + 1*4], POLLIN
mov DWORD [rsp + 16], esi ; window id
mov DWORD [rsp + 20], edx ; gc id
.loop:
mov rax, SYSCALL_POLL
lea rdi, [rsp]
mov rsi, 1
mov rdx, -1
syscall
cmp rax, 0
jle die
cmp DWORD [rsp + 2*4], POLLERR
je die
cmp DWORD [rsp + 2*4], POLLHUP
je die
mov rdi, [rsp + 0*4]
call x11_read_reply
jmp .loop
add rsp, 32
pop rbp
ret
それを呼び出すのがここ (プログラム全体では他にもいろいろある)。
_start:
global _start:function
call x11_connect_to_server
mov r15, rax ; Store the socket file descriptor in r15.
mov rdi, rax
call x11_send_handshake
mov r12d, eax ; Store the window root id in r12.
call x11_next_id
mov r13d, eax ; Store the gc_id in r13.
call x11_next_id
mov r14d, eax ; Store the font_id in r14.
mov rdi, r15
mov esi, r14d
call x11_open_font
mov rdi, r15
mov esi, r13d
mov edx, r12d
mov ecx, r14d
call x11_create_gc
call x11_next_id
mov ebx, eax ; Store the window id in ebx.
mov rdi, r15 ; socket fd
mov esi, eax
mov edx, r12d
mov ecx, [root_visual_id]
mov r8d, 200 | (200 << 16) ; x and y are 200
%define WINDOW_W 800
%define WINDOW_H 600
mov r9d, WINDOW_W | (WINDOW_H << 16)
call x11_create_window
mov rdi, r15 ; socket fd
mov esi, ebx
call x11_map_window
mov rdi, r15 ; socket fd
call set_fd_non_blocking
mov rdi, r15 ; socket fd
mov esi, ebx ; window id
mov edx, r13d ; gc id
call poll_messages
; The end.
mov rax, SYSCALL_EXIT
mov rdi, 0
syscall
MID$
前回ちょっと触れたけど
というKindle本があって。
この本は発売後すぐに購入していたのだけど、 商品のページにある目次を見ると
付録A 誰がN-BASICのマニュアルを書いたのか
付録B もう1つのN-BASIC【NEC製N-BASIC】の謎を探る
付録C あり得たPC-8001を夢想する
付録D 究極のPC-8001改良パソコンとしてのパソピア
付録E BUBCOM80という謎の機種
付録F アスキー教の終焉・NEC98帝国の終焉
付録G 電源の型番PCX-01-PWSは後継機でどう変わったのか
付録H RAMのアクセスタイム
付録I PC-80S31はPC-8001mkIIの周辺機器なのかという問題
付録J PC-8001の電源ユニットの取り付け向きとノイズフィルタの謎
付録K 初代PC-8001の基板・同じ番号でも中身が違う
付録M N-BASICと互換性があるμPD7904Gと3S-BASIC
付録N 2つのPC-8001回路図の謎
付録O PCXナンバーの謎 PC-9801はPCX-04なのか?
付録P NEC PCシリーズへの京セラの関与が始まった時期の推定
付録Q PC-8011は少なくとも回路が異なる2バージョン存在する
付録R なぜPC-8001はインテリジェントFDなのかという考察
付録R2 なぜPC-8001はインテリジェントFDなのかという考察【別解】
付録R3 なぜPC-8001はインテリジェントFDなのかという考察【別解その2】
付録S なぜPC-8001にはCPUを変更するオプションがないのか
付録T PC-8801-16とMZ-2000とTRS-80 MODEL 16
付録U 君はいくつ知っているか・1983年のPC-8001周辺機器リスト
付録V PC-8001専用アタッシュケース
付録W ついに発見された片面40トラック仕様とPC-8031-1W/2Wの研究
付録X PC-8031での容量倍増方法の実在
付録Y PC-8001+2HDドライブの可能性
付録Z インテリジェントミニフロッピーディスクユニットの内蔵CPU問題
付録AA N-BASICのルーツを探る
付録AB 非公式N-BASIC 1.3
とあるのに、手元のものでは付録Wまでしか存在していなかった。 買った後に更新されたのかと思ったが(本文を読んでいてもいつのバージョンで追加された といった注釈が結構あるし)、ページの発行日付は 買ったときから変わっていない(たぶん)。
どういうことかと調べてみると
Kindle本を更新(アップデート)する方法〜著者側・読者側|電子書籍出版ラボ
コンテンツと端末の管理からはKindle側(amazon側)でアナウンスされているものしか更新することができません。
Kindle出版の著者がアップデートしたと告知していても、アップデートの表示がされていないことが多いです。 その場合は次のカスタマーサービスに連絡します。
内容は更新されていてもこの「アップデートの告知」などがなかったようだ。 そこでカスタマーサービスに連絡して更新してもらったところ 無事に付録ABまであるバージョンになった。
しかし、商品のページの発行日は初版の日付のままっぽいし、 目次の違いに気がつかなかったら手元のものは古いままだったということですかい。
閑話休題。
この本を読み返していたら N-BASICに影響を与えた(というかベースになった?)のが TRS-80 Leve lII BASICという話があって、 それではと調べてみると
TRS-80 Leve lII BASIC
Level II BASIC, introduced in mid-1978, was licensed from Microsoft and is required to use the expansion bus and disk drives. Radio Shack always intended for Level I BASIC to be a stopgap until Level II was ready, and the first brochure for the Model I in January 1978 mentioned that Level II BASIC was “coming soon”. It is an abridged version of the 16K Extended BASIC, since the Model I has 12 KB of ROM space. According to Bill Gates, “It was a sort of intermediate between 8K BASIC and Extended BASIC. Some features from Extended BASIC such as descriptive errors and user defined functions were not included, but there were double precision variables and the PRINT USING statement that we wanted to get in. The entire development of Level II BASIC took about four weeks from start to finish.”
(略)
Microsoft also marketed an enhanced BASIC called Level III BASIC written by Bill Gates,[74] on cassette tape. The cassette contains a “Cassette File” version on one side and a “disk file” version on the second side for disk system users (which was to be saved to disk).[75] Level III BASIC adds most of the functions in the full 16 KB version of BASIC plus many other TRS-80 specific enhancements. Many of Level III BASIC’s features are included in the TRS-80 Model III’s Level II BASIC and disk BASIC.
そしてそのLevel III BASICのマニュアルをみると Level IIにはなかった MID# StatementがLevel IIIで追加されているのがわかる。
https://archive.org/details/Level_III_BASIC_Reference_Card_1979_Microsoft/page/n13/mode/2up p.14
MID$(string1,n[,m])=string2 On the left side of an MID$(K$,1,8)=L$ equation, replace a portion of string1 with string2, starting at position n, for m characters
https://www.classic-computers.org.nz/system-80/software-manuals/manuals-level-3-BASIC.pdf p.54
NEW MID$ CAPABILITY
In Level II Basic, the MID$ function is used to return a substring of a given string. The example program in your Level II Manual (see page 5/6) returns the “exchange” or first three numbers of a phone number.
In LEVEL III BASIC, MID$ can be used on the left side of an assignment statement as well as the right side. This allows you to use MID$ to replace a portion of one string with another string.
The format of MID$ on the left side of an equation is:
MID$ (string1, n [,m]) = string2 | | | | | | | | | Replaceent string | | | Whole number (optional). | | | See below. | | Whole number. Position | | where replacement begins. | Such as A$ String function
The characters in stringl. beginning at position n, are replaced by the characters in string2. The m is optional; it refers to the number of characters from stnng2 that will be used in the replacement If m is omitted, all of string2 will be used
このLevel III BASICがMID$ Statementの初出で決まり?
Microsoft BASIC variant
並行してうぃきぺでいろいろ探していたらこういうのも見つかった。
The MS dialect is patterned on Digital Equipment Corporation’s BASIC-PLUS on the PDP-11, which Gates had used in high school.[2]
For machines with more memory, the 8 KB version added 31 additional statements and support for string variables and their related operations like MID$ and string concatenation.
Most of the core features in BASIC-68 and BASIC-69 were copied directly from BASIC-80.[original research?]
- Microsoft BASIC version information
- The History of the BASIC Programming Language
- BASIC Programming Language: History, Origin, and More - History-Computer
MID$ Statementはどうなってんだろう>BASIC-68 and BASIC-69
FORTRAN Compiler on IBM 704
E+2
関数名やら変数名なんかが入るらしい。
FLOVAR BCD 1A(0000 A( INTERNAL FLOATING PT. 4F10390
MS9500 STO G STORE IN G, AND 4F14111
TSX FLCNIX,4 * GO MAKE FLOCON ENTRY. 4F14112
ORA FLOVAR CREATE INTERNAL FLO-PT VARIABLE, 4F14113
EXITR SLW E+2 SAVE VARIABLE IN E+2, 4F14114
LXD EXIT,4 RESTORE THE C(XR4), AND 4F14115
TRA 2,4 * RETURN TO MAIN ROUTINE. 4F14116
FIXVAR BCD 1I(0000 I( INTERNAL FIXED PT. VARIABLE. 4F10394
MS9506 ALS 18 STORE IN THE 4F14045 ???
STO G DECREMENT OF G, AND 4F14046
TSX FXCNIX,4 * GO MAKE FIXCON ENTRY. 4F14047
ORA FIXVAR CREATE INTERNAL FXD-PT VARIABLE,AND 4F14048
TXI EXITR,0 GO TAKE EXITR. 4F14049
HOLCNT BCD 1H(0000 WORKING STORAGE USED BY C3300. 4F10288
HOLL STZ CHSAVE CLEAR CHSAVE 4F13708
CAL HOLCNT GET CURRENT H(+I WORD 4F13709
SLW E+2 4F13710
E | tag? |
E+1 | operator |
E+2 | function / variable name |
E+3 | COEFFICIENT 1 |
E+4 | SUBSCRIPT 1 |
E+5 | COEFFICIENT 2 |
E+6 | SUBSCRIPT 2 |
E+7 | COEFFICIENT 3 |
E+8 | SUBSCRIPT 3 |
E+9 | |
E+10 | |
E+11 | ADDENDS |
E+12 | ADDENDS |
E+13 | ADDENDS |
Hugoメモ
落ち着かないなあ。
あす31日、上野の森美術館で開幕する特別展「恐竜図鑑−失われた世界の想像/創造」の内覧会に伺いました。太古の世界を支配した恐竜たち。その圧倒的な迫力、そして大きな謎。私たち人間のイマジネーションを刺激し、創作への意欲を駆り立てる存在ですね。→(続https://t.co/xBCDL9miBq pic.twitter.com/1xFltlr3F1
— 美術展ナビ (@art_ex_japan) May 30, 2023
始まったわけだけど、客の入りはどうなんだろうか (あまり混んでいると行きづらい)
コンビニで知らない小学生に「うぉーカッケー!」と言われたTシャツ。 pic.twitter.com/IZ6j0X1Jus
— おちょごさん (@chogo2009) May 31, 2023
— ねこがいる文具店万年堂 (@nyannendo) May 30, 2023
どこにあるのだろうとbioを見たら小諸のようだ。 行けなくもないか?