
SPARC LT ディスプレイ表示
0x29ac 番地からは、ソフトウェアトラップテストに先立ち、本体ディスプレイにテストメッセージを表示します。
上位ルーチン
29ac sethi 20000 , %l1 l1 = 0x20000
29b0 srl %l1, 4, %l1 l1 = l1 >> 4
29b4 or %g0, 100, %l2 l2 = 0x100
29b8 sta %l1, [%l2], 4 CTPR = 0x2000, asi = 4: 100H
29bc or %g0, 1, %l1 l1 = 1
29c0 or %g0, 200, %l2 l2 = 0x200
29c4 sta %l1, [%l2], 4 CXR = 1, asi = 4: 200H
29c8 or %g0, 0, %l2 l2 = 0
29cc sethi 10000000 , %l1
29d0 or %l1, 1, %l1 l1 = 0x10000001, MMU Enable
29d4 sta %l1, [%l2], 4 SCR = l1, asi = 4: 0H
29d8 or %g0, 0, %g7 g7 = 0
29dc call 50a0 set VRAM page table
29e0 NOP0x29ac から 0x29e0 番地で、CTPR を 0x2000、CXR を 1 に設定し、SCR の設定により MMU を有効にします。0x50a0 番地のサブルーチンで VRAM 領域のページテーブルを構成します。
29e4 sethi 400000 , %o6 o6 = 0x400000
29e8 call 5620 setup font
29ec NOP0x29e4 番地で、o6 に 0x400000 を設定し、0x5620 番地のサブルーチンでフォントを設定します。
29f0 sethi f0020000 , %l0 idprom
29f4 lda [%l0], 2f , %l1
29f8 sethi ff0000 , %l2
29fc and %l1, %l2, %l2
2a00 sethi eb0000 , %l3
2a04 subcc %l2, %l3, %g0
2a08 beq 2a24 type eb
2a0c NOP
; type ec or ed
2a10 sethi 400000 , %o6 o6 = 0x400000
2a14 call 5790 set display width in byte
2a18 NOP
2a1c ba 2a30
2a20 NOP
; type eb
2a24 sethi 400000 , %o6 o6 = 0x400000
2a28 call 57b8 set display width in byte
2a2c NOP0x29f0 番地で、idprom を調べ、ID タイプに応じて、0x5790 または 0x57b8 番地のサブルーチンで、バイト単位の画面横画素数を設定します。
2a30 add %g7, 1, %g7 g7++
2a34 sethi f0007000 , %o0
2a38 or %o0, 327, %o0 o0 = 0x(f000)7327 "Testing ... "
2a3c call 4cf0 display message
2a40 NOP
0x2a30 番地で、画面行位置 g7 をインクリメントし、o0 レジスタにテストメッセージのアドレスを設定し、0x4cf0 番地のディスプレイ表示サブルーチンを呼びます。
以下、各サブルーチンの動作を詳しく調べていきます。
VRAM ページテーブル設定
50a0 or %g0, %l0, %i0 i0 = l0
50a4 sethi 20000 , %l0
50a8 or %l0, 40, %l0 l0 = 0x20040
50ac sethi 3000 , %l1
50b0 or %l1, 101, %l1 l1 = 0x3101
50b4 sta %l1, [%l0], 20 [0x000020040] = 0x3101
50b8 sethi 31000 , %l0 l0 = 0x31000
50bc sethi 3000 , %l1
50c0 or %l1, 201, %l1 l1 = 0x3201
50c4 sta %l1, [%l0], 20 [0x000031000] = 0x3201
50c8 sethi f0020000 , %l0 l0 = 0xf0020000, idprom
50cc lda [%l0], 2f , %l1 l1 = [0xff0020000]
50d0 sethi ff0000 , %l2
50d4 and %l1, %l2, %l2 l2 = l1 & 0xff0000
50d8 sethi eb0000 , %l3 l3 = 0xeb0000
50dc subcc %l2, %l3, %g0
50e0 beq 5120 type eb
50e4 NOP
; type ec or ed
50e8 sethi e0000000 , %l1
50ec or %l1, e, %l1 l1 = 0xe00000e
50f0 sethi 32000 , %l0 l0 = 0x32000
50f4 or %g0, 0, %l2 l2 = 0
50f8 add %l1, %l2, %l3 l3 = l1 + l2
50fc sta %l3, [%l0], 20 [0x0,l0] = l3
5100 add %l0, 4, %l0 l0 = l0 + 4
5104 add %l2, 100, %l2 l2 = l2 + 0x100
5108 sethi 2000 , %l3 l3 = 0x2000
510c subcc %l2, %l3, %g0
5110 blt 50f8 l2 < 0x2000
5114 NOP
5118 ba 5150
511c NOP
; type eb
5120 sethi d0000000 , %l1
5124 or %l1, e, %l1 l1 = 0xd00000e
5128 sethi 32000 , %l0 l0 = 0x32000
512c or %g0, 0, %l2 l2 = 0
5130 add %l1, %l2, %l3 l3 = l1 + l2
5134 sta %l3, [%l0], 20 [0x0,l0] = l3
5138 add %l0, 4, %l0 l0 = l0 + 4
513c add %l2, 100, %l2 l2 = l2 + 0x100
5140 sethi 10000 , %l3 l3 = 0x10000
5144 subcc %l2, %l3, %g0
5148 blt 5130 l2 < 0x10000
514c NOP
5150 or %g0, %i0, %l0 l0 = i0
5154 or %g0, %i1, %l1 l1 = i1
5158 or %g0, %i2, %l2 l2 = i2
515c or %g0, %i3, %l3 l3 = i3
5160 jmp %o7, 8, %g0 return
5164 NOP0x50a0 番地のサブルーチンは、レベル 2 テーブル書き込み読み出しテストの最初に設定している、ページテーブルの後半と同じです。下図に示す、VRAM アクセス用ページテーブルを構成します。仮想アドレス 0x10000000 番地に物理アドレス 0xe 0000 0000 の VRAM 領域が割り当てられます。

フォントデータ展開
5620 sethi fffffc00 , %g1
5624 add %g1, 398, %g1 g1 = 0xffffff98 -0x68
5628 save %o6, %g1, %o6 o6 = o6 - 0x68 o6 = 0x3fff98
562c sethi 38000 , %o0 o0 = 0x38000
5630 ld [%o0 + 300], %o0 o0 = [0x38300] character generator address
5634 sethi f0007800 , %o1
5638 or %o1, 248, %o1 o1 = 0x(f000)7a48 run
563c or %g0, f0, %o2 o2 = 0xf0 num of char
5640 sethi f0007800 , %o3
5644 or %o3, 338, %o3 o3 = 0x(f000)7b38 index
5648 sethi f0007c00 , %o4
564c or %o4, 284, %o4 o4 = 0x(f000)7e84 left pattern
5650 sethi f0007c00 , %o5
5654 or %o5, 35c, %o5 o5 = 0x(f000)7f5c right pattern
5658 call 57e0 extract font
565c NOP 0x5620 番地のサブルーチンは、出力レジスタに下記の値を設定し、0x57e0 番地のサブルーチンを呼びます。save 命令と restore 命令で、レジスタを保護しています。
o0:フォントパターンを格納するアドレス
o1:パターンを切り替える位置を指定するビット列 run
o2:総キャラクタ数
o3:パターンのインデックス index
o4:フォントの左 8 ビットのパターン
o5:フォントの右 4 ビットのパターン
57e0 sethi fffffc00 , %g1
57e4 add %g1, 3b8, %g1 g1 = 0xffffffb8 ;-0x48
57e8 save %o6, %g1, %o6 o6 = o6 - 0x48 ;0x3fff50
57ec st %i2, [%i6 + 4c] [0x3fffe4] = i2 ;num of char
57f0 st %i4, [%i6 + 54] [0x3fffec] = i4 ;left pattern
57f4 st %i5, [%i6 + 58] [0x3ffff0] = i5 ;right pattern
57f8 or %g0, 14, %o0 o0 = 0x14 ;height of char
57fc stb %o0, [%i6 - 1] [0x3fff97] = 20(byte)
5800 sth %g0, [%i0] [i0] = 0(half word) ;top of char
5804 add %i0, 2, %i0 i0 += 2 ;2
5808 ld [%i6 + 4c], %o1 o1 = [0x3fffe4] ;0xf0
580c sub %o1, 1, %o2 o2 = o1 - 1
5810 sll %o2, 10, %o3 o3 = o2 << 16
5814 sra %o3, 10, %o3 o3 = o3 >> 16
5818 or %g0, %o3, %i5 i5 = o3 ;char code
581c subcc %i5, ffffffff, %g0
5820 beq 5910 i5 == 0xffffffff
5824 NOP
5828 ldub [%i1], %l7 l7 = [i1](byte) ;0x80
582c add %i1, 1, %i1 i1++ ;0xf0007a49
5830 or %g0, 7, %i4 i4 = 7 ;bit pos
5834 subcc %i4, ffffffff, %g0
5838 beq 58fc i4 == -1
583c NOP
5840 andcc %l7, 80, %g0
5844 beq 58a8 l7 bit 7 == 0
5848 NOP
584c ldub [%i3], %l6 l6 = [i3](byte) ;run
5850 add %i3, 1, %i3 i3++
5854 ld [%i6 + 54], %o1 o1 = [0x3fffec] ;left pattern
5858 ldub [%o1 + %l6], %o2 o2 = [o1 + l6](byte);XXXXXXXX
585c sll %o2, 8, %o3 o3 = o2 << 8 ;XXXXXXXX00000000
5860 sll %o3, 10, %o4 o4 = o3 << 16 ;XXXXXXXX0000000000000000
5864 srl %o4, 10, %o4 o4 = o4 >> 16 ;XXXXXXXX00000000
5868 or %g0, %o4, %i2 i2 = o4 ;XXXXXXXX00000000
586c srl %l6, 1, %o5 o5 = l6 >> 1
5870 ld [%i6 + 58], %o7 o7 = 0xf0007f5c ;right pattern
5874 ldub [%o7 + %o5], %l0 l0 = [o7 + o5](byte)
5878 or %g0, %l0, %l5 l5 = l0 ;YYYYZZZZ
587c andcc %l6, 1, %g0
5880 beq 5894 (l6 & 1) == 0
5884 NOP
5888 sll %l5, 4, %l1 l1 = l5 << 4 ;YYYYZZZZ0000
588c ba 5898
5890 NOP
5894 or %g0, %l5, %l1 l1 = l5 ;YYYYZZZZ
5898 and %l1, f0, %l2 l2 = l1 & 0xf0 ;YYYY0000 or ZZZZ0000
589c or %i2, %l2, %i2 i2 = l2 | i2 ;XXXXXXXXYYYY0000 or XXXXXXXXZZZZ0000
58a0 sll %i2, 10, %i2 i2 = i2 << 16
58a4 srl %i2, 10, %i2 i2 = i2 >> 16
58a8 sth %i2, [%i0] [i0] = i2(half word);set char gen
58ac add %i0, 2, %i0 i0 = i0 + 2
58b0 ldsb [%i6 - 1], %l4 l4 = [i6 - 1](byte) ;height
58b4 sub %l4, 1, %l4 l4--
58b8 sll %l4, 18, %l4 l4 = l4 << 24
58bc sra %l4, 18, %l4 l4 = l4 >> 24
58c0 stb %l4, [%i6 - 1] [i6 - 1] = l4(byte)
58c4 orcc %g0, %l4, %g0
58c8 bne 58e0 l4 != 0
58cc NOP
58d0 sth %g0, [%i0] [i0] = 0(half word) ;top of char
58d4 add %i0, 2, %i0 i0 = i0 + 2
58d8 or %g0, 14, %o1 o1 = 20
58dc stb %o1, [%i6 - 1] [i6 - 1] = 20(byte)
58e0 sll %l7, 1, %l7 l7 = l7 << 1 ;next run
58e4 and %l7, ff, %l7 l7 = l7 & 0xff
58e8 sub %i4, 1, %i4 i4--
58ec sll %i4, 10, %i4 i4 = i4 << 16
58f0 sra %i4, 10, %i4 i4 = i4 >> 16
58f4 ba 5834
58f8 NOP
58fc sub %i5, 1, %i5 i5-- ;next char
5900 sll %i5, 10, %i5 i5 = i5 << 16
5904 sra %i5, 10, %i5 i5 = i5 >> 16
5908 ba 581c
590c NOP
5910 jmp %i7, 8, %g0 return
5914 restore %g0, %g0, %g00x57e0 番地からは、圧縮されているフォントパターンを展開します。英数字は、縦方向に同じ形状パターンが繰り返されることが多い特徴があるので、これを利用して、ランレングス風の形式でフォントデータが ROM に格納されています。
7a48 80 00 08 01 50 82 00 09 aa d0 run " !"#"
7a52 ff df 0d db b0 e7 ff 0d 78 00 run "$%&'"
7a5c fc 3f 0f c3 f0 0f ff 00 45 10 run "()*+"
7a66 00 0d 78 05 00 00 1b 0d 5a b0 run ",-./"
7a70 f8 1f 0f c0 30 f9 fd 0f fd f0 run "0123"
7a7a d5 79 0a f9 f0 f7 cf 0f db 70 run "4567"
7a84 e7 e7 0f 3e f0 06 db 00 36 d7 run "89:;"
7a8e 87 df 00 15 40 07 df 0f bd 50 run "<=>?"
7a98 1f df 85 6f b0 73 c7 07 c1 f0 run "@ABC"
7aa2 78 0f 06 bc b0 6b c3 07 c7 f0 run "DEFG"
7aac 61 83 06 00 30 60 00 7f ef f0 run "HIJK"
7ab6 60 0b 07 26 b0 7f f7 07 c1 f0 run "LMNO"
7ac0 73 83 07 c1 fe 73 ff 07 7f 70 run "PQRS"
7aca 70 03 06 00 f0 72 69 06 7f 10 run "TUVW"
7ad4 7f 7f 07 b0 30 7a af 0a 00 50 run "XYZ["
7ade aa d5 0a 00 50 fc 00 00 00 0a run "\]^_"
7ae8 eb 00 00 7e 70 f7 8f 00 78 f0 run "`abc"
7af2 e7 8f 00 76 f0 d1 83 00 73 fb run "defg"
7afc f7 03 05 60 30 56 01 fe 7f f0 run "hijk"
7b06 c0 03 00 70 30 07 03 00 78 f0 run "lmno"
7b10 07 8f 18 78 f1 87 83 00 7f f0 run "pqrs"
7b1a 2e 0f 00 60 70 07 55 00 66 90 run "tuvw"
7b24 07 ff 00 75 5f 87 ff 0d 3c b0 run "xyz{"
7b2e 80 00 0d 3c b0 00 fc 00 00 00 run "|}~ " 0x7a48 番地からは、ASCII コード順に、20 ビット(2 バイト半)毎、パターンの切り替わりを示すビットパターンが格納されています。
「 」 は 0x80000、「!」は 0x80150、「"」は 0x82000、「#」は 0x9aad0 です。
7b38 00 index " "
7b39 01 00 01 00 index "!"
7b3d 02 00 index """
7b3f 03 04 05 06 02 07 08 09 00 index "#"
7b48 01 0a 0b 0c 0d 09 0e 0a 0f 04 0d 07 10 01 00 index "$"
7b57 11 12 13 14 15 01 16 17 18 19 1a 00 index "%"
7b63 1b 1c 1d 1c 1e 0e 1f 20 21 1a 22 23 24 00 index "&"
7b71 16 1e 01 16 25 26 00 index "'"
7b78 27 28 29 15 1b 01 1b 15 29 28 27 00 index "("
7b84 2a 25 2b 16 2c 01 2c 16 2b 25 2a 00 index ")"
7b90 2d 01 0d 2e 02 00 02 2e 0d 01 2d 00 index "*"
7b9a 01 2f 01 00 index "+"
7ba0 16 1e 01 16 25 26 index ","
7ba6 00 2f 00 index "-"
7ba9 16 1e 16 00 index "."
7bad 30 27 28 15 01 16 25 2a 31 00 index "/"
7bb7 1b 1c 32 33 34 35 36 37 2c 00 index "0"
7bc1 38 01 2c 1e 39 01 0b 00 index "1"
7bc9 37 10 1a 3a 27 28 15 01 16 25 3b 2f 00 index "2"
7bd6 1c 3c 3d 3e 30 3f 0f 40 3f 30 3e 41 10 37 00 index "3"
7be5 28 29 42 43 32 44 23 2f 28 00 index "4"
7bef 40 26 45 10 46 3f 30 3e 47 34 0a 00 index "5"
7bfb 1b 16 25 2a 31 48 49 4a 47 4b 10 37 00 index "6"
7c08 4c 23 41 4d 27 4e 28 4f 15 38 01 50 00 index "7"
7c15 2d 32 34 36 51 01 52 32 34 36 2d 00 index "8"
7c21 1c 53 3d 47 4a 54 24 30 27 28 1b 55 00 index "9"
7c2e 16 1e 16 00 16 1e 16 00 index ":"
7c36 16 1e 16 00 16 1e 01 16 25 26 index ";"
7c40 00 30 56 1b 1e 57 1e 1b 56 30 00 index "<"
7c4b 07 00 07 00 index "="
7c4f 31 58 1e 59 5a 59 1e 58 31 00 index ">"
7c59 2d 0a 5b 5c 27 28 15 01 16 00 16 00 index "?"
7c65 1c 0b 5d 47 5e 5f 60 61 31 2a 23 62 00 index "@"
7c72 01 52 63 32 64 0b 5c 65 3e 66 00 index "A"
7c7d 67 68 69 22 6a 69 47 69 6b 00 index "B"
7c87 40 6c 6d 45 31 45 3b 6e 1c 00 index "C"
7c91 67 1a 69 47 41 22 6f 00 index "D"
7c99 07 70 2a 35 10 35 2a 3b 2f 00 index "E"
7ca3 07 70 2a 35 10 35 2a 57 00 index "F"
7cac 40 6c 6d 45 31 71 47 72 5d 73 1c 00 index "G"
7cb8 74 47 2f 47 74 00 index "H"
7cbe 0a 01 0a 00 index "I"
7cc2 0a 01 50 58 2a index "J"
7cc9 00 75 22 76 09 77 57 78 79 7a 7b 1a 7c 7d 00 index "K"
7cd6 57 2a 3b 2f 00 index "L"
7cdb 7e 7c 4a 7f 80 81 82 83 00 index "M"
7ce4 84 85 86 87 88 89 8a 8b 8c 8d 8e 3e 8f 00 index "N"
7cf2 2d 53 5c 72 47 65 70 36 2d 00 index "O"
7cfc 6a 34 5d 34 90 2a 57 00 index "P"
7d04 2d 53 5c 72 47 70 91 0a 2c 37 92 index "Q"
7d0e 5a 00 67 22 69 68 93 78 79 7a 7b 1a 7c 7d 00 index "R"
7d1e 4c 5d 85 94 55 1e 59 56 3f 3e 69 6a 00 index "S"
7d2b 2f 8a 01 0a 00 index "T"
7d30 7d 85 4b 0b 0a 00 index "U"
7d36 95 41 35 96 16 2c 50 00 index "V"
7d3e 97 98 99 9a 9b 9c 9d 9e 02 00 index "W"
7d48 7d 85 70 9f 36 51 01 52 32 53 5c 3e 66 00 index "X"
7d56 7d 85 70 36 51 01 2d 00 index "Y"
7d5e 23 5c 27 28 15 01 16 25 a0 23 00 index "Z"
7d69 0f 01 0f 00 index "["
7d6d 31 2a 25 16 01 15 28 27 00 index "\"
7d76 78 16 78 00 index "]"
7d7a 50 2c a1 a2 69 00 index "^"
7d80 a3 00 index "_"
7d82 4f 15 01 59 15 00 index "`"
7d88 1c 1d 33 a4 a5 34 5b a6 00 index "a"
7d91 45 31 a7 31 48 49 4a 47 a8 a9 aa 00 index "b"
7d9d 0a 46 5c 31 4b 34 0a 00 index "c"
7da5 30 3f 30 ab ac 3d 47 4a ad ae 00 index "d"
7db0 2d 34 47 2f 31 2a 73 1c 00 index "e"
7db9 29 af 16 0a 16 1e 00 index "f"
7dc0 b0 ac 69 a2 b1 31 07 23 72 b2 07 10 index "g"
7dcc 26 2a 94 2a 90 5b 34 b3 00 index "h"
7dd5 01 00 1e 01 0a 00 index "i"
7d5b 27 00 a4 27 5c 34 9f 37 2c index "j"
7d64 31 a7 31 1a 76 09 78 57 78 79 7a 7b b4 00 index "k"
7b72 1e 01 0a 00 index "l"
7b76 b5 b6 0d b7 00 index "m"
7b7b b8 b9 34 b3 00 index "n"
7e00 1c 53 3d 47 4b 9f 37 00 index "o"
7e08 ba bb 7c 47 41 bc 93 31 bd index "p"
7e11 00 be bf 3d 47 a8 c0 4c 30 c1 index "q"
7e1b 00 c2 c3 c4 2a 57 00 index "r"
7e22 3c 34 70 58 1e 59 56 5c 34 10 00 index "s"
7e2d 50 16 07 16 c5 c6 59 00 index "t"
7e35 b3 34 5b 24 00 index "u"
7e3a 7d 85 70 36 51 01 00 index "v"
7e41 c7 98 9c c8 02 00 index "w"
7e47 c9 4b 9f ca 2c 1b cb 53 3d cc 00 index "x"
7e52 74 85 70 36 51 01 50 16 cd 57 94 index "y"
7e5d 00 2f 7c ce 29 1b 2c 2b cf a8 2f 00 index "z"
7e69 56 15 28 15 1b 15 28 15 56 00 index "{"
7e73 01 index "|"
7e74 58 16 25 16 2c 16 25 16 58 00 index "}"
7e7e d0 d1 d2 d3 d4 00 index "~"0x7b38 番地からは、フォントパターンのインデックスが格納されています。
7e84 00 06 19 03 06 1f 0c 7f 33 66 1f 3f 66 66 3e 07 pattern 0x00
7e94 3f 38 44 45 39 03 0c 19 1a 32 61 07 0f 18 1e 77 pattern 0x10
7ea4 63 61 61 3f 1e 18 10 00 01 03 30 1c 0e 0f 76 7f pattern 0x20
7eb4 00 60 11 10 30 30 18 1f 02 36 40 30 1f 20 40 00 pattern 0x30
7ec4 0f 60 05 09 21 20 31 60 67 6f 70 70 1f 00 00 01 pattern 0x40
7ed4 04 0d 0b 11 3f 3c 01 78 38 07 01 39 20 30 67 6f pattern 0x50
7ee4 6c 67 0f 09 10 20 e0 ff 60 60 7f ff 10 20 18 fe pattern 0x60
7ef4 30 61 20 18 f0 f0 63 6c 7c 6e 67 63 60 f0 e0 59 pattern 0x70
7f04 4d 4e 44 e4 c0 60 70 78 58 4c 46 47 43 41 40 e0 pattern 0x80
7f14 37 38 23 7f 70 e0 19 fe 66 76 77 33 37 3b 3b 38 pattern 0x90
7f24 18 1b 31 ff 03 1c 1e e0 70 78 4f 0f 31 39 1e 04 pattern 0xa0
7f34 1f 3f 40 79 f1 dd 6e ef 27 79 ef 71 70 f0 0f 11 pattern 0xb0
7f44 38 00 73 34 38 0c 0e ff 3b f8 1d 0b f1 08 41 38 pattern 0xc0
7654 1c 3e 36 67 43 00 00 00 pattern 0xd0
7f5c 00 83 6f cc 00 8c e6 0c 86 c8 80 0c 22 c0 8c 00 pattern 0x00
7f6c 6e 8e 60 0c 88 00 00 ee 60 8c c8 80 00 c2 ce 6e pattren 0x20
7f7c c4 88 80 c6 8c e4 e4 80 00 0c 60 c0 08 ec c6 2a pattren 0x40
7f8c ae e0 84 f0 8c 88 62 40 4f 66 fe 00 00 08 e7 76 pattern 0x60
7f9c 66 6f 72 22 22 22 2a e3 84 90 0e 0f 22 44 4c 88 pattern 0x80
7fac 20 8f cc e0 6c 86 e6 7c 20 2e ec e7 8c 8c 80 2e pattern 0xa0
7fbc ef 8c c2 47 4f 08 f0 c2 26 cc 80 00 00 00 00 00 pattern 0xc0
7fcc 00 00 00 00
7fd0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
7fe0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
7ff0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000x7e94 番地からは、左側 8 ドット分のフォントパターンが格納されています。0x7f5c 番地からは、右側 4 ドット分のフォントパターンが格納されています。
run for "!"
0x80150 1000 0000 0001 0101 0000
index for "!"
01 00 01 00
Left pattern for "!"
f0007e84 00 ........ index #00
f0007e86 06 .....XX. index #01
Right pattern for "!"
f0007f5c 00 ........ index #00/01
top 000 ............
1 060 .....XX.....
2 060 .....XX.....
3 060 .....XX.....
4 060 .....XX.....
5 060 .....XX.....
6 060 .....XX.....
7 060 .....XX.....
8 060 .....XX.....
9 060 .....XX.....
10 060 .....XX.....
11 060 .....XX.....
12 000 ............
13 000 ............
14 060 .....XX.....
15 060 .....XX.....
16 000 ............
17 000 ............
18 000 ............
19 000 ............
20 000 ............ 「!」を例に、フォントパターンの展開を説明します。「!」の run は、0x80150 です。20 ビットの各ビットが 1 ラインに対応します。run の ビットが 1 の時、インデックスが示すパターンに変更します。ビットが 0 の時は、前のパターンを繰り返します。
run の MSB(ビット 19)は 1 なので、最初のインデックス 1 に対応するパターンとして、左側 0x06、右側 0x0 のパターンが 1 ライン目のフォントパターンになります。
run のビット 18 から 9 までは、0 なので、2 ライン目から 11 ライン目は、同じパターン 0x060 が繰り返されます。
run のビット 8 は、1 なので、インデックス 0 のパターン 0x000 が 12 ライン目のパターンになります。
この様に、run のビットが 1 になるたびに、インデックスを更新し、新たなフォントパターンを設定します。
フォントの最上部 top は、常に 0 が設定されます。
スクリーン変数設定
5660 or %g0, 2, %o0 o0 = 2
5664 sethi 38000 , %o1 o1 = 0x38000
5668 st %o0, [%o1 + 354] [0x38354] = 2
566c or %g0, 480, %o2 o2 = 0x480
5670 sethi 38000 , %o3 o3 = 0x38000
5674 st %o2, [%o3 + 344] [0x38344] = 1152 screen width
5678 or %g0, 384, %o4 o4 = 0x384
567c sethi 38000 , %o5 o5 = 0x38000
5680 st %o4, [%o5 + 348] [0x38348] = 900 screen height
5684 or %g0, 38, %o7 o7 = 0x38
5688 sethi 38000 , %l0 l0 = 0x38000
568c st %o7, [%l0 + 34c] [0x3834c] = 56 row offset
5690 or %g0, 40, %l1 l1 = 0x40
5694 sethi 38000 , %l2 l3 = 0x38000
5698 st %l1, [%l2 + 350] [0x38350] = 64 column offset
569c or %g0, 50, %l3 l3 = 0x50
56a0 sethi 38000 , %l4 l4 = 0x38000
56a4 st %l3, [%l4 + 374] [0x38374] = 80 column
56a8 or %g0, 22, %l5 l5 = 0x23
56ac sethi 38000 , %l6 l6 = 0x38000
56b0 st %l5, [%l6 + 368] [0x38368] = 34 row
56b4 sethi 10000000 , %l7 l7 = 0x10000000
56b8 sethi 38000 , %i0 i0 = 0x38000
56bc st %l7, [%i0 + 2b0] [0x382b0] = 0x10000000 vram
56c0 sethi 38000 , %i1 i1 = 0x38000
56c4 st %g0, [%i1 + 2b4] [0x382b4] = 0
56c8 sethi 38000 , %i2 i2 = 0x38000
56cc st %g0, [%i2 + 2b8] [0x382b8] = 0
56d0 sethi 38000 , %i3
56d4 or %i3, 2ac, %i3 i3 = 0x382ac
56d8 sethi 38000 , %i4 i4 = 0x38000
56dc st %i3, [%i4 + 2a8] [0x382a8] = 0x382ac
56e0 sethi 38000 , %i5
56e4 or %i5, 298, %i5 i5 = 0x38298
56e8 sethi 38000 , %o0 o0 = 0x38000
56ec st %i5, [%o0 + 2c0] [0x382c0] = 0x38298
56f0 or %g0, 2, %o1 o1 = 2
56f4 sethi 38000 , %o2 o2 = 0x38000
56f8 st %o1, [%o2 + 2e0] [0x382e0] = 2
56fc sethi 38000 , %o3 o3 = 0x38000
5700 st %g0, [%o3 + 2e8] [0x382e8] = 0
5704 sethi 38000 , %o4 o4 = 0x38000
5708 st %g0, [%o4 + 2ec] [0x382ec] = 0
570c or %g0, c, %o5 o5 = 0xc
5710 sethi 38000 , %o7 o7 = 0x38000
5714 st %o5, [%o7 + 2d0] [0x382d0] = 12 char width
5718 or %g0, 16, %l0 l0 = 0x16
571c sethi 38000 , %l1 l1 = 0x38000
5720 st %l0, [%l1 + 2d4] [0x382d4] = 22 char hight
5724 sethi 38000 , %l2
5728 or %l2, 2e0, %l2 l2 = 0x382e0
572c sethi 38000 , %l3 l3 = 0x38000
5730 st %l2, [%l3 + 2dc] [0x382dc] = 0x382e0
5734 sethi 38000 , %l4
5738 or %l4, 2cc, %l4 l4 = 0x382cc
573c sethi 38000 , %l5 l5 = 0x38000
5740 st %l4, [%l5 + 2f4] [0x382f4] = 0x382cc
5744 sethi 38000 , %l6 l6 = 0x38000
5748 st %g0, [%l6 + 2f8] [0x382f8] = 0
574c sethi 38000 , %l7 l7 = 0x38000
5750 st %g0, [%l7 + 2fc] [0x382fc] = 0
5754 sethi 38000 , %i0 i0 = 0x38000
5758 st %g0, [%i0 + 320] [0x38320] = 0
575c or %g0, 18, %i1 i1 = 0x18
5760 sethi 38000 , %i2 i2 = 0x38000
5764 st %i1, [%i2 + 31c] [0x3831c] = 24
5768 sethi 38000 , %i3 i3 = 0x38000
576c st %g0, [%i3 + 324] [0x38324] = 0
5770 or %g0, 1, %i4 i4 = 1
5774 sethi 38000 , %i5 i5 = 0x38000
5778 st %i4, [%i5 + 328] [0x38328] = 1
577c or %g0, 1, %o0 o0 = 1
5780 sethi 38000 , %o1 o1 = 0x38000
5784 st %o0, [%o1 + 338] [0x38338] = 1
5788 jmp %i7, 8, %g0 return
578c restore %g0, %g0, %g00x5660 番地からは、各種スクリーンパラメータを設定します。全ては分かりませんが、0x38344 番地が画面の横画素数、0x38374 番地が画面の横文字数などと推測されます。
; type ec or ed, display width in byte
5790 sethi fffffc00 , %g1
5794 add %g1, 3c0, %g1 g1 = 0xffffffc0 ;-0x40
5798 save %o6, %g1, %o6 o6 = o6 - 0x40 ;0x3fffc0
579c sethi 38000 , %o0 o0 = 0x38000
57a0 ld [%o0 + 344], %o0 o0 = [0x38344] ;1152
57a4 srl %o0, 3, %o1 o1 == o0 >> 3 ;1152 / 8
57a8 sethi 38000 , %o2 o2 = 0x38000
57ac st %o1, [%o2 + 2ac] [0x382ac] = o1
57b0 jmp %i7, 8, %g0 return
57b4 restore %g0, %g0, %g0
; type eb
57b8 sethi fffffc00 , %g1
57bc add %g1, 3c0, %g1 g1 = 0xffffffc0 ;-0x40
57c0 save %o6, %g1, %o6 o6 = o6 - 0x40
57c4 sethi 38000 , %o0 o0 = 0x38000
57c8 ld [%o0 + 344], %o0 o0 = [0x38344] ;1152
57cc sethi 38000 , %o1 o1 = 0x38000
57d0 st %o0, [%o1 + 2ac] [0x382ac] = o0
57d4 jmp %i7, 8, %g0 return
57d8 restore %g0, %g0, %g00x5790 番地からは、画面の横画素数を 8 で割り、バイト数に変換し 0x38344 番地に設定します。
文字列表示
4cf0 or %g0, %o7, %l5 l5 = o7
4cf4 or %g0, %o0, %l0 l0 = o0, message
4cf8 sethi f0020000 , %l2
4cfc lda [%l2], 2f , %l1 idprom
4d00 sethi ff0000 , %l2
4d04 and %l1, %l2, %l2
4d08 sethi eb0000 , %l3
4d0c subcc %l2, %l3, %g0
4d10 beq 4d64 type eb
4d14 NOP
; type ec or ed
4d18 or %g0, 39, %l1 l1 = 0x39
4d1c or %g0, 1, %l2 l2 = 1
4d20 add %g7, 1, %g7 g7++
4d24 or %g0, %l2, %o0 o0 = l2, column
4d28 or %g0, %g7, %o1 o1 = g7, row
4d2c sethi 400000 , %o6 o6 = 0x400000
4d30 call 5a48
4d34 NOP
4d38 or %g0, %l0, %o0 o0 = l0, message
4d3c or %g0, %l2, %o1 o1 = l2, column
4d40 sethi 400000 , %o6 o6 = 0x400000
4d44 call 5918
4d48 NOP
4d4c add %l2, 1, %l2 l2++
4d50 subcc %l1, %l2, %g0
4d54 bne 4d24 l1 != l2
4d58 NOP
4d5c ba 4da8
4d60 NOP4da8 or %g0, %l5, %o7 o7 = l5
4dac jmp %o7, 8, %g0 return
4db0 NOP
7327 54 65 73 74 69 6e 67 20 2e 2e 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00
"Testing ... " 0x4cf0 番地からは、文字列表示ルーチンです。o0 レジスタに、文字列データの先頭アドレスを設定します。
0x7327 番地には、"Testing ... " という null 終端の文字列が格納されています。文字列の長さは 57 バイト(0x39)です。l1 レジスタと l2 レジスタで、文字数をカウントしています。g7 レジスタは、画面表示の行位置です。
0x4d24 から 0x4d34 番地で、o0 レジスタに桁位置、o1 レジスタに行位置を設定し、0x5a48 番地のサブルーチンを呼びます。
0x4d38 から 0x4d48 番地で、o0 レジスタに文字列データアドレス、o1 レジスタに桁位置を設定し、0x5918 番地のサブルーチンを呼びます。
5a48 sethi fffffc00 , %g1
5a4c add %g1, 3c0, %g1 g1 = 0xffffffc0 ;-0x40
5a50 save %o6, %g1, %o6 o6 = o6 - 0x40 ;0x3fffc0
5a54 st %i0, [%i6 + 44] [0x400044] = i0 ;column
5a58 st %i1, [%i6 + 48] [0x400048] = i1 ;row
5a5c sethi 38000 , %o0 o0 = 0x38000
5a60 sth %g0, [%o0 + 314] [0x38314] = 0(half word)
5a64 ld [%i6 + 44], %o1 o1 = [0x400044] ;column
5a68 orcc %g0, %o1, %g0
5a6c bge 5a80 o1 >= 0
5a70 NOP
5a74 or %g0, 0, %o2 o2 = 0
5a78 ba 5ab0
5a7c NOP
5a80 ld [%i6 + 44], %o2 o2 = [0x400044] ;column
5a84 sethi 38000 , %o3 o3 = 0x38000
5a88 ld [%o3 + 374], %o3 o3 = [0x38374] ;80
5a8c subcc %o2, %o3, %g0
5a90 bcs 5aac o2 < 80
5a94 NOP
5a98 sethi 38000 , %o2 o2 = 0x38000
5a9c ld [%o2 + 374], %o2 o2 = [0x38374] ;80
5aa0 sub %o2, 1, %o2 o2--
5aa4 ba 5ab0
5aa8 NOP
5aac ld [%i6 + 44], %o2 o2 = [0x400044] ;column
5ab0 sethi 38000 , %o4 o4 = 0x38000
5ab4 st %o2, [%o4 + 304] [0x38304] = o2
5ab8 ld [%i6 + 48], %o5 o5 = [0x400048] ;row
5abc orcc %g0, %o5, %g0
5ac0 bge 5ad4 o5 >= 0
5ac4 NOP
5ac8 or %g0, 0, %o7 o7 = 0
5acc ba 5b04
5ad0 NOP
5ad4 ld [%i6 + 48], %o7 o7 = [0x400048] ;row
5ad8 sethi 38000 , %l0 l0 = 0x38000
5adc ld [%l0 + 368], %l0 l0 = [0x38368] ;34
5ae0 subcc %o7, %l0, %g0
5ae4 bcs 5b00 o7 < 34
5ae8 NOP
5aec sethi 38000 , %o7 o7 = 0x38000
5af0 ld [%o7 + 368], %o7 o7 = [0x38368] ;34
5af4 sub %o7, 1, %o7 o7--
5af8 ba 5b04
5afc NOP
5b00 ld [%i6 + 48], %o7 o7 = [0x400048] ;row
5b04 sethi 38000 , %l1 l1 = 0x38000
5b08 st %o7, [%l1 + 308] [0x38308] = o7
5b0c jmp %i7, 8, %g0 return
5b10 restore %g0, %g0, %g0 0x5a48 番地のサブルーチンでは、文字表示位置の調整を行います。
0x5a88 番地の st 命令、0x38314 番地にショートワード(2 バイト)の 0 を書き込みます。これは、後の 0x5b14 番地のサブルーチン内で使用します。
0x5a64 から 0x5ab4 番地で、桁位置を調べ、負なら 0 に、80 以上なら 79 に丸め、0x38304 番地に保存します。
0x5ab8 から 0x5b08 番地で、行位置を調べ、負なら 0に、34 以上なら 33 に丸め、0x38308 番地に保存します。
5918 sethi fffffc00 , %g1
591c add %g1, 398, %g1 g1 = 0xffffff98 ;-0x68
5920 save %o6, %g1, %o6 o6 = o6 - 0x68 ;0x3fff98
5924 sll %i1, 10, %o0 o0 = i1 << 16, column
5928 sra %o0, 10, %o0 o0 = o0 >> 16
592c or %g0, %o0, %i1 i1 = o0
5930 sub %i1, 1, %i1 i1--
5934 sll %i1, 10, %i1 i1 = i1 << 16
5938 sra %i1, 10, %i1 i1 = i1 >> 16
593c subcc %i1, ffffffff, %g0
5940 beq 59a8 i1 == -1
5944 NOP
5948 ldsb [%i0], %i5 i5 = [i0] i5 = ascii code
594c add %i0, 1, %i0 i0++
5950 sub %i5, 20, %i5 i5 = i5 - 0x20
5954 sll %i5, 18, %i5 i5 = i5 << 24
5958 sra %i5, 18, %i5 i5 = i5 >> 24
595c orcc %g0, %i5, %g0
5960 blt 59a0 i5 < 0
5964 NOP
5968 or %g0, %i5, %o0 o0 = i5 o0 = code
596c sll %o0, 1, %o0 o0 = o0 << 1 o0 = code * 2
5970 or %g0, %o0, %o1 o1 = o0 o1 = code * 2
5974 sll %o1, 2, %o1 o1 = o1 << 2 o1 = code * 8
5978 add %o0, %o1, %o0 o0 = o0 + o1 o0 = code * 10
597c sll %o1, 2, %o1 o1 = o1 << 2 o1 = code * 32
5980 add %o0, %o1, %o0 o0 = o0 + o1 o0 = code * 42
5984 sethi 38000 , %o2 o2 = 0x38000
5988 ld [%o2 + 300], %o2 o2 = [0x38300] font pattern
598c add %o2, %o0, %o0 o0 = o2 + o0 char pattern address
5990 sethi 38000 , %o1 o1 = 0x38000
5994 ld [%o1 + 31c], %o1 o1 = [0x3831c] ;24
5998 call 5b14
599c NOP
59a0 ba 5930
59a4 NOP
59a8 jmp %i7, 8, %g0 return
59ac restore %g0, %g0, %g0 0x5918 番地のサブルーチンでは、o0 レジスタで指定された文字列を表示します。表示される文字は、先頭から o1 レジスタで指定された文字数分です。呼び出し側では、o0 は固定で、o1 を 1 から 57 までインクリメントしながら、このサブルーチンを呼んでいます。"T"、”Te”、”Tes"、のように、一文字ずつ増やしながら繰り返し上書きで文字列を表示しています。
0x5948 番地で、i5 レジスタに ASCII コードを読み出し、0x20 引くことで文字コードに変換します。
0x5968 から 0x5980 番地で、文字コードを 42 倍します。一文字のフォントパターンは 2 バイト x 21 列で 42 バイトになるので、フォントパターンのオフセットを計算していることになります。最初の文字 "T" の ASCII コードは 0x54、文字コードは 0x34、パターンアドレスのオフセット は 0x888 になります。
0x598c から 0x5998 番地で、o0 レジスタに表示文字のパターンのアドレスを設定し、o1 レジスタに 0x3831c 番地から読み出した値 24 を設定し、0x5b14 番地のサブルーチンを呼びます。
5b14 sethi fffffc00 , %g1
5b18 add %g1, 390, %g1 g1 = 0xffffff90 ;-0x70
5b1c save %o6, %g1, %o6 o6 = o6 - 0x70 ;0x3fff28
5b20 st %i0, [%i6 + 44] [0x3fffdc] = i0 ;char pattern
5b24 st %i1, [%i6 + 48] [0x3fffe0] = i1 ;24
5b28 sethi 38000 , %o0 o0 = 0x38000
5b2c ldsh [%o0 + 314], %o0 o0 = [0x38314]
5b30 orcc %g0, %o0, %g0
5b34 bne 5ba8 o0 != 0
5b38 NOP
5b3c sethi 38000 , %o0 o0 = 0x38000
5b40 ld [%o0 + 304], %o0 o0 = [0x38304] ;o0 = x
5b44 sll %o0, 2, %o0 o0 = o0 << 2 ;o0 = x * 4
5b48 or %g0, %o0, %o1 o1 = o0 ;o1 = x * 4
5b4c sll %o1, 1, %o1 o1 = o1 << 1 ;o1 = x * 8
5b50 add %o0, %o1, %o0 o0 = o0 + o1 ;o0 = x * 12
5b54 sethi 38000 , %o2 o2 = 0x38000
5b58 ld [%o2 + 350], %o2 o2 = [0x38350] ;64
5b5c add %o2, %o0, %o3 o3 = o2 + o0 ;o3 = x * 12 + 64
5b60 sethi 38000 , %o4 o4 = 0x38000
5b64 st %o3, [%o4 + 2c4] [0x382c4] = o3 ;x pos
5b68 sethi 38000 , %o5 o5 = 0x38000
5b6c ld [%o5 + 308], %o5 o5 = [0x38308] ;o5 = y
5b70 sll %o5, 1, %o5 o5 = o5 << 1 ;o5 = y * 2
5b74 or %g0, %o5, %o7 o7 = o5 ;o7 = y * 2
5b78 sll %o7, 1, %o7 o7 = o7 << 1 ;o7 = y * 4
5b7c add %o5, %o7, %o5 o5 = o5 + o7 ;o5 = y * 6
5b80 sll %o7, 2, %o7 o7 = o7 << 2 ;o7 = y * 16
5b84 add %o5, %o7, %o5 o5 = o5 + o7 ;o5 = y * 22
5b88 sethi 38000 , %l0 l0 = 0x38000
5b8c ld [%l0 + 34c], %l0 l0 = [0x3834c] ;56
5b90 add %l0, %o5, %l1 l1 = l0 + l5 ;l0 = y * 22 + 56
5b94 sethi 38000 , %l2 l2 = 0x38000
5b98 st %l1, [%l2 + 2c8] [0x382c8] = l1 ;y pos
5b9c or %g0, 1, %l3 l3 = 1
5ba0 sethi 38000 , %l4 l4 = 0x38000
5ba4 sth %l3, [%l4 + 314] [0x38314] = 1(half word)
5ba8 ld [%i6 + 44], %l5 l5 = [0x3fffdc] ;char pattern
5bac sethi 38000 , %l6 l6 = 0x38000
5bb0 st %l5, [%l6 + 2e4] [0x382e4] = l5 ;char pattern
5bb4 add %o6, 60, %o0 o0 = o6 + 0x60 ;0x3fff88
5bb8 sethi 38000 , %l7
5bbc or %l7, 2c0, %l7 l7 = 0x382c0
5bc0 ld [%l7], %i0 i0 = [0x382c0] ;0x38298
5bc4 ld [%l7 + 4], %i2 i2 = [0x382c4] ;x pos
5bc8 st %i0, [%o0] [0x3fff88] = i0 ;0x38298
5bcc ld [%l7 + 8], %i0 i0 = [0x382c8] ;y pos
5bd0 st %i2, [%o0 + 4] [0x3fff8c] = i2 ;x pos
5bd4 st %i0, [%o0 + 8] [0x3fff90] = i0 ;y pos
5bd8 ld [%i6 + 48], %o1 o1 = [0x3fffe0] ;24
5bdc sethi 38000 , %o2
5be0 or %o2, 2f4, %o2 o2 = 0x382f4
5be4 or %g0, 1, %o3 o3 = 1
5be8 call 5ce0
5bec NOP
ok +dis
5bf0 jmp %i7, 8, %g0 return
5bf4 restore %g0, %g0, %g0 0x5b14 番地のサブルーチンに進みます。
0x5b3c から 0x5b64 番地は、0x38304 番地に格納された桁位置を 12 倍し、0x38350 番地に格納されたオフセット値 64 を加え、画面上の横画素位置 に変換します。横画素位置は、0x382c4 番地に保存されます。
0x5b68 から 0x5b98 番地は、0x38308 番地に格納された行位置を 22 倍し、0x3834c 番地に格納されたオフセット値 54 を加え、画面上の縦画素位置に変換します。縦画素位置は、0x382c8 番地に保存されます。
0x5b88 から 0x5ba4 番地で、0x38314 番地に 1 をセットします。このフラグが呼び出し側で 0 にリセットされるまで、このサブルーチンの、縦横画素位置の計算がスキップされます。
0x5ba8 番地からの処理で、0x382e4 番地に文字パターンアドレス、0x3fff8c 番地に横画素位置、0x3fff90 番地に縦画素位置を設定します。
下記のレジスタを設定し 0x5ce0 番地のサブルーチンを呼びます。
o1 レジスタ:24
o2 レジスタ:0x382f4
o3 レジスタ:1
o4 レジスタ:0x38000
5ce0 sethi fffffc00 , %g1
5ce4 add %g1, 388, %g1 g1 = 0xffffff88 -0x78
5ce8 save %o6, %g1, %o6 o6 = o6 - 0x78 0x3ffeb0
5cec st %i1, [%i6 + 48] [0x3fff70] = i1 24
5cf0 st %i2, [%i6 + 4c] [0x3fff74] = i2 0x382f4
5cf4 sth %i3, [%i6 + 52] [0x3fff78] = i3(half word) 1
5cf8 st %i4, [%i6 + 54] [0x3fff7a] = i4 0x38000
5cfc st %g0, [%i6 - 18] [0x3fff10] = 0
5d00 ld [%i6 + 48], %o0 o0 = [0x3fff70] 24
5d04 sra %o0, 1, %o1 o1 = o0 >> 1 12
5d08 and %o1, f, %o2 o2 = o1 & 0xf 12
5d0c st %o2, [%i6 + 48] [0x3fff70] = o2
5d10 ld [%i0], %o3 o3 = [0x3fff88] 0x38298
5d14 ld [%o3 + 10], %o4 o4 = [0x382a8] 0x382ac
5d18 or %g0, %o4, %i3 i3 = o4 0x382ac
5d1c ld [%i3], %l7 l7 = [0x382ac] 1152 / 8
5d20 ld [%i3 + c], %o1 o1 = [0x382b4] 0
5d24 ld [%i0 + 8], %o5 o5 = [0x3fff90] y pos
5d28 add %o1, %o5, %o1 o1 = o1 + o5
5d2c sll %o1, 10, %o1 o1 = o1 << 16
5d30 sra %o1, 10, %o1 o1 = o1 >> 16
5d34 ld [%i3], %o0 o0 = [0x382ac] 1152 / 8
5d38 sll %o0, 10, %o0 o0 = o0 << 16
5d3c sra %o0, 10, %o0 o0 = o0 >> 16
5d40 call 6580 multiply o0 = o1 * o0, vram offset
5d44 NOP 0x5ec0 番地のサブルーチンに進みます。
o1 レジスタに縦画素位置を、o0 レジスタに画面横のバイト数を設定し、0x6580 のサブルーチンで、乗算し VRAM の表示行先頭のオフセットアドレスを求めます。
0x3fff70 番地に、値 12 を設定します。
6580 wry %o1, %g0, %g0 Y = o1, 0x64
6584 andcc %g0, %g0, %o4 o4 = 0
6588 sethi f0006400 , %o5
658c or %o5, 210, %o5 o5 = 0x(f000)6610
6590 mulscc %o4, %o0, %o4 1
6594 mulscc %o4, %o0, %o4 2
6598 mulscc %o4, %o0, %o4 3
659c mulscc %o4, %o0, %o4 4
65a0 mulscc %o4, %o0, %o4 5
65a4 mulscc %o4, %o0, %o4 6
65a8 mulscc %o4, %o0, %o4 7
65ac mulscc %o4, %o0, %o4 8
65b0 mulscc %o4, %o0, %o4 9
65b4 mulscc %o4, %o0, %o4 10
65b8 mulscc %o4, %o0, %o4 11
65bc mulscc %o4, %o0, %o4 12
65c0 mulscc %o4, %o0, %o4 13
65c4 mulscc %o4, %o0, %o4 14
65c8 mulscc %o4, %o0, %o4 15
65cc mulscc %o4, %o0, %o4 16
65d0 mulscc %o4, %o0, %o4 17
65d4 mulscc %o4, %o0, %o4 18
65d8 mulscc %o4, %o0, %o4 19
65dc mulscc %o4, %o0, %o4 20
65e0 mulscc %o4, %o0, %o4 21
65e4 mulscc %o4, %o0, %o4 22
65e8 mulscc %o4, %o0, %o4 23
65ec mulscc %o4, %o0, %o4 24
65f0 mulscc %o4, %o0, %o4 25
65f4 mulscc %o4, %o0, %o4 26
65f8 mulscc %o4, %o0, %o4 27
65fc mulscc %o4, %o0, %o4 28
6600 mulscc %o4, %o0, %o4 29
6604 mulscc %o4, %o0, %o4 30
6608 jmp %o5, %g0, %g0
660c mulscc %o4, %o0, %o4 31
6610 sub %g0, %o0, %o5 o5 = - o0
6614 mulscc %o4, %o5, %o4 32
6618 mulscc %o4, %g0, %o4 33
661c bge 6628
6620 rdy %g0, %g0, %o0 o0 = Y
6624 subcc %o4, ffffffff, %g0
6628 jmp %o7, 8, %g0 return
662c or %g0, %o4, %o1 o1 = o40x6580 番地のサブルーチンは、o0 と o1 の積を求め、o0 に下位 32 ビット、o1 に上位 32 ビットを返します。CY7C601 には整数乗算命令がないので、mulscc 命令を 33 回呼ぶことにより 32 ビット整数の積を求めます。
5d48 ld [%i3 + 4], %o7 o7 = [0x382b0] 0x10000000
5d4c add %o7, %o0, %l0 l0 = o7 + o0 vram address
5d50 ld [%i3 + 8], %l1 l1 = [0x382b4] 0
5d54 ld [%i0 + 4], %l2 l2 = [0x3fff8c] x pos
5d58 add %l1, %l2, %l3 l3 = l1 + l2
5d5c sra %l3, 3, %o0 o0 = l3 >> 3 x pos / 8
5d60 add %l0, %o0, %o1 o1 = l0 + o0 vram
5d64 and %o1, fffffffe, %o2 o2 = o1 & 0xfffffffe
5d68 or %g0, %o2, %i4 i4 = o2 vram
5d6c ld [%i3 + 8], %o3 o3 = [0x382b4] 0
5d70 ld [%i0 + 4], %o4 o4 = [0x3fff8c] x pos
5d74 add %o3, %o4, %o5 o5 = o3 + o4 x pos
5d78 and %o5, f, %o7 o7 = o5 & 0xf x pos & 0xf
5d7c or %g0, %o7, %l6 l6 = o7
5d80 ld [%i6 + 4c], %l0 l0 = [0x3fff74] 0x382f4
5d84 ld [%l0], %l1 l1 = [0x382f4] 0x382cc
5d88 or %g0, %l1, %i3 i3 = 0x382cc
5d8c ld [%i3 + 4], %i2 i2 = [0x382d0] 12
5d90 ld [%i3 + 8], %i1 i1 = [0x382d4] 22
5d94 ld [%i3 + 10], %i3 i3 = [0x382dc] 0x382e0
5d98 ld [%i3 + 4], %i5 i5 = [0x382e4] 0x888
5d9c ba 63c0
5da0 NOP 0x5d48 番地からの処理では、表示先の VRAM アドレスを求めます。
VRAM の開始アドレス 0x1000000 に、行先頭アドレスを加えます。さらに、桁位置を 8 で割りバイト数に変換して加えることで、VRAM アドレスを求めます。以下の様に、レジスタを設定し、0x63c0 番地に分岐します。
i1:一文字の縦画素数 22
i2:一文字の横画素数 12
i3:0x382e0
i4:表示位置のVRAM アドレス
i5:文字パターンのアドレス0x888
l6:横画素位置の下位 4 ビット
63c0 ld [%i6 + 48], %o0 o0 = [0x3fff70]
63c4 subcc %o0, f, %g0
63c8 bhi 6424 o0 > 0xf
63cc sll %o0, 2, %o0 o0 = o0 * 4
63d0 sethi f0006000 , %o1
63d4 or %o1, 3e4, %o1 o1 = 0x(f000)63e4
63d8 ld [%o0 + %o1], %o0
63dc jmp %o0, %g0, %g0
63e0 NOP
63e4 .word f0005eb8
63e8 .word f0006424
63ec .word f0006424
63f0 .word f0006260
63f4 .word f0006424
63f8 .word f0005da4
63fc .word f0006424
6400 .word f0006424
6404 .word f0006424
64f8 .word f0006424
64fc .word f0006424
6410 .word f0006424
6414 .word f00060f0
6418 .word f0006424
641c .word f0006424
6420 .word f0005fdc
6424 jmp %i7, 8, %g0 return
6428 restore %g0, %g0, %g0
0x63c0 番地からは、i6 レジスタの示すアドレス + 48 番地のデータに基づき、0x63e4 番地からのアドレステーブルを選択し、ジャンプします。この時点で、i6 レジスタは、 0x3fff28 なので、0x3fff70 番地の値 12 により、ジャンプ先は0xf00060f0 となります。
60f0 add %l6, %i2, %o5 o5 = l6 + i2
60f4 subcc %o5, 10, %g0
60f8 bhi 6158 o5 > 16
60fc NOP
; x & 0xf + i2 <= 16
6100 sethi fc00 , %o0
6104 or %o0, 3f0, %o0 o0 = 0xfff0
6108 sra %o0, %l6, %o1 o1 = o0 >> l6
610c xor %o1, ffffffff, %o2 o2 = ~o1, mask
6110 st %o2, [%i6 - c] save mask
6114 lduh [%i4], %o0 read vram
6118 ld [%i6 - c], %o1 o1 = mask
611c and %o0, %o1, %o2 o2 = o0 & o1
6120 st %o2, [%i6 - 4] save vram
6124 lduh [%i5], %o3 o3 = pattern
6128 srl %o3, %l6, %o4 o4 = o3 >> l6
612c ld [%i6 - 4], %o5 restore vram
6130 or %o5, %o4, %o7 o7 = o5 | o4
6134 sth %o7, [%i4] write vram
6138 add %i5, 2, %i5 i5 = i5 + 2
613c add %i4, %l7, %i4 i4 = i4 + l7, next line
6140 sub %i1, 1, %i1 i1--
6144 orcc %g0, %i1, %g0
6148 bne 6114 i1 != 0
614c NOP
6150 ba 6258
6154 NOP
; x & 0xf + i2 > 16
6158 or %g0, 10, %o0 o0 = 16
615c sub %o0, %l6, %o1 o1 = 16 - l6
6160 or %g0, %o1, %l5 l5 = o1
6164 andcc %i4, 3, %g0
6168 bne 61c8 i4 & 3 != 0
616c NOP
6170 sethi fc00 , %o0
6174 or %o0, 3f0, %o0 o0 = 0xfff0
6178 sll %o0, %l5, %o1 o1 = o0 << l5
617c xor %o1, ffffffff, %o2 o2 = ~o1, mask
6180 st %o2, [%i6 - c] save mask
6184 ld [%i4], %o0 read vram
6188 ld [%i6 - c], %o1 o1 = o2, mask
618c and %o0, %o1, %o2 o2 = o0 & o1
6190 st %o2, [%i6 - 4] save vram
6194 lduh [%i5], %o3 o3 = pattern
6198 sll %o3, %l5, %o4 o4 = o3 << l5
619c ld [%i6 - 4], %o5 restore vram
61a0 or %o5, %o4, %o7 o7 = o5 | o4
61a4 st %o7, [%i4] write vram
61a8 add %i5, 2, %i5 i5 = i5 + 2
61ac add %i4, %l7, %i4 i4 = i4 + l7, next line
61b0 sub %i1, 1, %i1 i1--
61b4 orcc %g0, %i1, %g0
61b8 bne 6184 i1 != 0
61bc NOP
61c0 ba 6258
61c4 NOP
; VRAM address i4 not word aligned
61c8 sethi fc00 , %o0
61cc or %o0, 3f0, %o0 o0 = 0xfff0
61d0 sra %o0, %l6, %o1 o1 = o0 >> l6
61d4 xor %o1, ffffffff, %o2 o2 = ~o1, left mask
61d8 st %o2, [%i6 - c] save left mask
61dc sethi fc00 , %o3
61e0 or %o3, 3f0, %o3 o3 = 0xfff0
61e4 sll %o3, %l5, %o4 o4 = o3 << l5
61e8 xor %o4, ffffffff, %o5 o5 = ~o4, right mask
61ec st %o5, [%i6 - 10] save right mask
61f0 lduh [%i5], %o0 pattern
61f4 st %o0, [%i6 - 8] save pattern
61f8 add %i5, 2, %i5 i5 = i5 + 2
61fc lduh [%i4], %o2 read vram
6200 ld [%i6 - c], %o3 left mask
6204 and %o2, %o3, %o4 o4 = o2 & o3
6208 st %o4, [%i6 - 4] save vram
620c ld [%i6 - 8], %o5 restore pattern
6210 srl %o5, %l6, %o7 o7 = o5 >> l6
6214 ld [%i6 - 4], %l0 restore vram
6218 or %l0, %o7, %l1 l1 = l0 | o7
621c sth %l1, [%i4] write vram
6220 lduh [%i4 + 2], %l2 read vram + 2
6224 ld [%i6 - 10], %l3 right mask
6228 and %l2, %l3, %o0 o0 = l2 & l3
622c st %o0, [%i6 - 4] save vram
6230 ld [%i6 - 8], %o1 restore pattern
6234 sll %o1, %l5, %o2 o2 = o1 << l5
6238 ld [%i6 - 4], %o3 restore vram
623c or %o3, %o2, %o4 o4 = o3 | o2
6240 sth %o4, [%i4 + 2] write vram + 2
6244 add %i4, %l7, %i4 i4 = i4 + l7, next line
6248 sub %i1, 1, %i1 i1--
624c orcc %g0, %i1, %g0
6250 bne 61f0 i1 != 0
6254 NOP
6258 ba 6424 return
625c NOP 0x60f0 番地からの処理は、横画素位置の下位 4 ビット i6 の値に応じて 2 つに分岐します。
12 ビット分のマスクデータを横画素位置に応じてシフトし o1 に設定します。
VRAM からデータを読み出し、マスクとアンドは、横画素位置の下位 4 ビットに応じて、マスクパターン 0xfff0 をシフトし反転します。VRAM からハーフワード(16 ビット)のデータを読み出し、マスクで元のデータを消し、文字パターンを書き込みます。
i2 には一文字の横画素数 12 が設定されているので、以下の様にマスクが設定されます。
l6 l6+i2 mask vram org font cram
0 12 0x000f VVVV PPP0 PPPV
4 16 0xf000 VVVV PPP0 VPPP
8 20 0xff000fff VVVVVVVV PPP0 VVPPPVVV
12 24 0xfff000ff VVVVVVVV PPP0 VVVPPPVV Type eb の時
Type eb の場合、以下のコードが実行されます。
57b8 sethi fffffc00 , %g1
57bc add %g1, 3c0, %g1 g1 = 0xffffffc0 ;-0x40
57c0 save %o6, %g1, %o6 o6 = o6 - 0x40 ;0x3fffc0
57c4 sethi 38000 , %o0 o0 = 0x38000
57c8 ld [%o0 + 344], %o0 o0 = [0x38344] ;1152
57cc sethi 38000 , %o1 o1 = 0x38000
57d0 st %o0, [%o1 + 2ac] [0x382ac] = o0
57d4 jmp %i7, 8, %g0 return
57d8 restore %g0, %g0, %g04d64 or %g0, 39, %l1 l1 = 0x39
4d68 or %g0, 1, %l2 l2 = 1
4d6c add %g7, 1, %g7 g7++
4d70 or %g0, %l2, %o0 o0 = l2
4d74 or %g0, %g7, %o1 o1 = g7
4d78 sethi 400000 , %o6 o6 = 0x40000
4d7c call 5a48
4d80 NOP
4d84 or %g0, %l0, %o0 o0 = l0
4d88 or %g0, %l2, %o1 o1 = l2
4d8c sethi 400000 , %o6 o6 = 0x400000
4d90 call 59b0
4d94 NOP
4d98 add %l2, 1, %l2 l2++
4d9c subcc %l1, %l2, %g0
4da0 bne 4d70 l1 != l2
4da4 NOP
4da8 or %g0, %l5, %o7 o7 = l5
4dac jmp %o7, 8, %g0 return
4db0 NOP59b0 sethi fffffc00 , %g1
59b4 add %g1, 398, %g1 g1 = 0xffffff98
59b8 save %o6, %g1, %o6 o6 = o6 + g1
59bc sll %i1, 10, %o0 o0 = i1 << 16
59c0 sra %o0, 10, %o0 o0 = o0 >> 16
59c4 or %g0, %o0, %i1 i1 = o0
59c8 sub %i1, 1, %i1 i1--
59cc sll %i1, 10, %i1 i1 = i1 << 16
59d0 sra %i1, 10, %i1 i1 = i1 >> 16
59d4 subcc %i1, ffffffff, %g0
59d8 beq 5a40 i1 == 0xffffffff
59dc NOP
59e0 ldsb [%i0], %i5 i5 = [i0](byte), i5 = ASCII code
59e4 add %i0, 1, %i0 i0++
59e8 sub %i5, 20, %i5 i5 -= 0x20
59ec sll %i5, 18, %i5 i5 = i5 << 24
59f0 sra %i5, 18, %i5 i5 = i5 >> 24
59f4 orcc %g0, %i5, %g0
59f8 blt 5a38 i5 < 0
59fc NOP
5a00 or %g0, %i5, %o0 o0 = i5 o0 = char
5a04 sll %o0, 1, %o0 o0 = o0 << 1 o0 = char * 2
5a08 or %g0, %o0, %o1 o1 = o0 o1 = char * 2
5a0c sll %o1, 2, %o1 o1 = o1 << 2 o1 = char * 8
5a10 add %o0, %o1, %o0 o0 = o0 + o1 o0 = char * 10
5a14 sll %o1, 2, %o1 o1 = o1 << 2 o1 = char * 32
5a18 add %o0, %o1, %o0 o0 = o0 + o1 o0 = char * 42
5a1c sethi 38000 , %o2
5a20 ld [%o2 + 300], %o2 o2 = 0x38300
5a24 add %o2, %o0, %o0 o0 = o2 + o0
5a28 sethi 38000 , %o1 o1 = 0x38000
5a2c ld [%o1 + 31c], %o1 o1 = [0x3831c] ;24
5a30 call 5bf8
5a34 NOP
5a38 ba 59c8
5a3c NOP
5a40 jmp %i7, 8, %g0 return
5a44 restore %g0, %g0, %g05bf8 sethi fffffc00 , %g1
5bfc add %g1, 390, %g1 g1 = 0xffffff90
5c00 save %o6, %g1, %o6 o6 = o6 + g1
5c04 st %i0, [%i6 + 44] [i6 + 0x44] = i0
5c08 st %i1, [%i6 + 48] [i6 + 0x48] = i1
5c0c sethi 38000 , %o0 o0 = 0x38000
5c10 ldsh [%o0 + 314], %o0 o0 = [0x38314]
5c14 orcc %g0, %o0, %g0
5c18 bne 5c8c o0 != 0
5c1c NOP
5c20 sethi 38000 , %o0 o0 = 0x38000
5c24 ld [%o0 + 304], %o0 o0 = [0x38304] o0 = x
5c28 sll %o0, 2, %o0 o0 = o0 << 2 o0 = x * 4
5c2c or %g0, %o0, %o1 o1 = o0 o1 = x * 4
5c30 sll %o1, 1, %o1 o1 = o1 << 2 o1 = x * 16
5c34 add %o0, %o1, %o0 o0 = o0 + o1 o0 = x * 20
5c38 sethi 38000 , %o2 o2 = 0x38000
5c3c ld [%o2 + 350], %o2 o2 = [0x38350] ;64
5c40 add %o2, %o0, %o3 o3 = o2 + o0
5c44 sethi 38000 , %o4 o4 = 0x38000
5c48 st %o3, [%o4 + 2c4] [0x382c4] = o3
5c4c sethi 38000 , %o5 o5 = 0x38000
5c50 ld [%o5 + 308], %o5 o5 = [0x38308] o5 = y
5c54 sll %o5, 1, %o5 o5 = o5 << 1 o5 = y * 2
5c58 or %g0, %o5, %o7 o7 = o5 o7 = y * 2
5c5c sll %o7, 1, %o7 o7 = o7 << 1 o7 = y * 4
5c60 add %o5, %o7, %o5 o5 = o5 + o7 o5 = y * 6
5c64 sll %o7, 2, %o7 o7 = o7 << 2 o7 = y * 16
5c68 add %o5, %o7, %o5 o5 = o5 + o7 o5 = y * 22
5c6c sethi 38000 , %l0 l0 = 0x38000
5c70 ld [%l0 + 34c], %l0 l0 = [0x3834c] ;56
5c74 add %l0, %o5, %l1 l1 = l0 + l5
5c78 sethi 38000 , %l2 l2 = 0x38000
5c7c st %l1, [%l2 + 2c8] [0x382c8] = l1
5c80 or %g0, 1, %l3 l3 = 1
5c84 sethi 38000 , %l4 l4 = 0x38000
5c88 sth %l3, [%l4 + 314] [0x38314] = 1
5c8c ld [%i6 + 44], %l5
5c90 sethi 38000 , %l6 l6 = 0x38000
5c94 st %l5, [%l6 + 2e4] [0x382e4] = l5
5c98 add %o6, 60, %o0 o0 = o0 + 0x60
5c9c sethi 38000 , %l7
5ca0 or %l7, 2c0, %l7 l7 = 0x382c0
5ca4 ld [%l7], %i0 i0 = [0x382c0] ;38298
5ca8 ld [%l7 + 4], %i2 l2 = [0x283c4] ;
5cac st %i0, [%o0] [o0] = i0
5cb0 ld [%l7 + 8], %i0 i0 = [0x382c8] ;
5cb4 st %i2, [%o0 + 4] [o0 + 4] = i2
5cb8 st %i0, [%o0 + 8] [o0 + 8] = i0
5cbc ld [%i6 + 48], %o1 o1 = [0x38048]
5cc0 sethi 38000 , %o2
5cc4 or %o2, 2f4, %o2 o2 = 0x382f4
5cc8 or %g0, 1, %o3 o3 = 1
5ccc call 642c
5cd0 NOP
5cd4 jmp %i7, 8, %g0 return
5cd8 restore %g0, %g0, %g0642c sethi fffffc00 , %g1
6430 add %g1, 390, %g1 g1 = 0xffffff90
6434 save %o6, %g1, %o6 o6 = o6 + g1
6438 st %i1, [%i6 + 48] [i6 + 0x48] = i1
643c st %i2, [%i6 + 4c] [i6 + 0x4c] = i2
6440 sth %i3, [%i6 + 52] [i6 + 0x52] = i3(half word)
6444 ld [%i6 + 48], %o0 o0 = [i6 + 0x48]
6448 sra %o0, 1, %o1 o1 = o0 >> 1
644c and %o1, f, %o2 o2 = o1 & 0xf
6450 st %o2, [%i6 + 48] [i6 + 0x48] = o2
6454 ld [%i0], %o3 o3 = [i0]
6458 ld [%o3 + 10], %o4 o4 = [o3 + 0x10]
645c or %g0, %o4, %i3 i3 = o4
6460 ld [%i3], %l7 l7 = [i3]
6464 ld [%i3 + c], %o1 o1 = [i3 + 0xc]
6468 ld [%i0 + 8], %o5 o5 = [i0 + 8]
646c add %o1, %o5, %o1 o1 = o1 & o5
6470 sll %o1, 10, %o1 o1 = o1 << 16
6474 sra %o1, 10, %o1 o1 = o1 >> 16
6478 ld [%i3], %o0 o0 = [i3]
647c sll %o0, 10, %o0 o0 = o0 << 16
6480 sra %o0, 10, %o0 o0 = o0 >> 16
6484 call 6580 multiply o0 = o1 * o0
6488 NOP
648c ld [%i3 + 4], %o7
6490 add %o7, %o0, %l0 l0 = o7 + o0
6494 ld [%i3 + 8], %l1
6498 ld [%i0 + 4], %l2
649c add %l1, %l2, %l3 l3 = l1 + l2
64a0 sll %l3, 10, %l4 l4 = l3 << 16
64a4 sra %l4, 10, %l4 l4 = l4 >> 16
64a8 sll %l4, 3, %l5 l5 = l4 << 3
64ac sra %l5, 3, %o0 o0 = l5 >> 3
64b0 add %l0, %o0, %o1 o1 = l0 + o0
64b4 or %g0, %o1, %i4 i4 = o1
64b8 ld [%i6 + 4c], %o2
64bc ld [%o2], %o3
64c0 or %g0, %o3, %i3 i3 = o3
64c4 ld [%i3 + 4], %i2
64c8 ld [%i3 + 8], %i1
64cc ld [%i3 + 10], %i3
64d0 ld [%i3 + 4], %i5
64d4 sethi ffff0000 , %o4
64d8 or %o4, f, %o4 o4 = 0xfffff000
64dc st %o4, [%i6 - 8]
64e0 lduh [%i4], %o0
64e4 ld [%i6 - 8], %o1
64e8 and %o0, %o1, %o2 o2 = o0 & o1
64ec st %o2, [%i6 - 4]
64f0 lduh [%i5], %o3
64f4 ld [%i6 - 4], %o4
64f8 or %o4, %o3, %o5 o5 = o4 | o3
64fc sth %o5, [%i6 - c]
6500 add %i5, 2, %i5 i5 = i5 + 2
6504 or %g0, 0, %l6 l6 = 0
6508 subcc %l6, c, %g0
650c bcc 655c
6510 NOP
6514 sethi 8000 , %o0 o0 = 0x8000
6518 sra %o0, %l6, %o1 o1 = o0 >> l6
651c sth %o1, [%i6 - a]
6520 lduh [%i6 - a], %o2
6524 lduh [%i6 - c], %o3
6528 andcc %o3, %o2, %g0
652c beq 6544
6530 NOP
6534 or %g0, ff, %o0 o0 = 0xff
6538 stb %o0, [%i4]
653c ba 6548
6540 NOP
6544 stb %g0, [%i4]
6548 add %l6, 1, %l6 l6++
654c add %i4, 1, %i4 i4++
6550 subcc %l6, c, %g0
6554 bcs 6514 l6 < 0xc
6558 NOP
655c sub %i4, c, %i4 i4 = i4 - 0xc
6560 add %i4, %l7, %i4 i4 = i4 + l7
6564 sub %i1, 1, %i1 i1--
6568 orcc %g0, %i1, %g0
656c bne 64e0 i1 != 0
6570 NOP
6574 jmp %i7, 8, %g0 return
6578 restore %g0, %g0, %g0