Screen03 再度確認

とりあえずこつこつと以下なあたりを掘削の方向。

        mov r0,#9
        bl FindTag

        ldr r1,[r0]
        lsl r1,#2
        sub r1,#8
        add r0,#8

        mov r2,#0
        mov r3,#0
        bl DrawString

loop$:
        b loop$

つうかこれ、テキストに以下な記述がありますね。

This code simply uses our FindTag method to find the 9th tag (cmdline) and then calculates its length and passes the command and the length to the DrawString method, and tells it to draw the string at 0,0.

Lesson 8 Screen03 より引用
とりあえずどっちから読んだ方が良いのかな。DrawString からかな。

掘削着手

残り 30m なのでどこまで行けるやら。つうか文脈てきに r0 が文字列な先頭アドレスで、r1 が文字列長、みたいな形になってます。

        mov string,r0
        mov x,r2
        mov x0,x
        mov y,r3
        mov length,r1

あるいは呼び出し元の操作が上に引用している通りの以下なんですが

        ldr r1,[r0]
        lsl r1,#2
        sub r1,#8
        add r0,#8

これは一体何をしているのやら。
あ、4 Your Wish is My Command Line な節にそれっぽい記載がありますね。曰く

5. The end of the list of tags always contains 2 words which are 0.
6. Every tag's size in bytes is a mutliple of 4.
7. Each tag starts with the size of the tag in words in the tag, including this number.
8. This is followed by a half word containing the tag's number. These are numbered from 1 in the order above ('core' is 1, 'cmdline' is 9).

Lesson 8 Screen03 より引用
あら? word size っていくつなの? 32bit ですよね、多分。
んーと、r0 の 4byte 先を r1 が指す状態にして 8 を引いてるのかな。
もう少しテキストきちんと見る必要がある模様。ちょい時間切れです。