/usr/share/doc/HOWTO/ja-html/Linux-Assembly-4.html is in doc-linux-ja-html 2006.05.25-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>assembly & linux: ¥¢¥»¥ó¥Ö¥ê & Linux - ·ë²Ì - </TITLE>
<LINK HREF="Linux-Assembly-5.html" REL=next>
<LINK HREF="Linux-Assembly-3.html" REL=previous>
<LINK HREF="Linux-Assembly.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="Linux-Assembly-5.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Linux-Assembly-3.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Linux-Assembly.html#toc4">Ìܼ¡¤Ø</A>
<HR>
<H2><A NAME="s4">4. ¥¢¥»¥ó¥Ö¥ê & Linux - ·ë²Ì - </A></H2>
<P>Linux¥¢¥»¥ó¥Ö¥ê¥×¥í¥°¥é¥à¤ò½ñ¤¯¤È¤¤½¤³¤Ë¤Ï¿¤¯¤Î²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£¤Ï¤¸¤á¤Ë
¤É¤Î¥¢¥»¥ó¥Ö¥é¤ò»È¤¦¤«Áª¤Ù¤Þ¤¹¡£GAS(AS)¤ò»È¤¦¤Î¤¬¤è¤¤¤Ç¤·¤ç¤¦¡£gas¤Ï
¤Û¤È¤ó¤É¤ÎLinux¥Ç¥£¥¹¥È¥ê¥Ó¥å¡¼¥·¥ç¥ó¤Îɸ½à¤È¤Ê¤Ã¤Æ¤¤¤ë¥¢¥»¥ó¥Ö¥é¤Ç¤¹¡£
gas¤Î·çÅÀ¤Ïgas¤¬<CODE>AT&T-syntax</CODE>¤ò»È¤Ã¤Æ¤¤¤ë¤³¤È¤Ç¤¹¡£¤³¤ì¤Ï
<CODE>Intel-syntax</CODE>¤ÈÂ礤¯°ã¤Ã¤Æ¤¤¤Þ¤¹¡£
DOS¥æ¡¼¥¶¡¼¤Ï¤Û¤È¤ó¤É¤¬<CODE>Intel-syntax</CODE>¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£
<P><CODE>AT&T-syntax</CODE>¤Ë¤Ä¤¤¤Æ¤Î¤è¤ê¾ÜºÙ¤Ê¾ðÊó¤Ï
info¥Õ¥¡¥¤¥ë¤Ë¤¢¤ê¤Þ¤¹¡£¤³¤Îinfo¥Õ¥¡¥¤¥ë¤òhtml¥Õ¥©¡¼¥Þ¥Ã¥È¤ËÊÑ´¹¤·¤Þ¤·¤¿¡£
<P>Intel¸ß´¹¤Îsyntax¤ò»²¾È¤¹¤ë»þ¤Ïnasm¤Ç¥×¥í¥°¥é¥à¤ò½ñ¤¯¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
<P>
<H2><A NAME="ss4.1">4.1 NASM¤ÎÎã¤ò¤ß¤Æ¤ß¤Þ¤·¤ç¤¦¡§</A>
</H2>
<P>from the 80xxx-fidonet-area :
<PRE>
= deze bewaar ik : asm =================================================keepit=
from : james vahn 17-apr-97 15:20:22 1:346/15.1
to : jan wagemakers 2:292/8133.23
subj : nasm & linux
=======================================================================rem_asm=
</PRE>
<PRE>
* 80xxx ¤«¤é¤Î°úÍÑ
jw> ¥Ç¥â¤¬¤¢¤ê¤Þ¤¹¤¬¡¢¸«¤Æ¤¤¤ëÈϰϤǤÏc¥×¥í¥°¥é¥à¤«¤é¸Æ¤Ó½Ð¤¹¤è¤¦¤Ë
jw> ½ñ¤«¤ì¤Æ¤¤¤Þ¤¹¡£nasm¤Èlinux¤Ç 100% ¥¢¥»¥ó¥Ö¥ê¥×¥í¥°¥é¥à¤ò¤É¤Î¤è¤¦¤Ë
jw> ½ñ¤¯¤Î¤«ÃΤꤿ¤¤¤Ç¤¹¡£
¥Ð¥°¥Õ¥£¥Ã¥¯¥¹¤µ¤ì¤¿nasm-0.94¤ò»È¤Ã¤Æ¡¢¥½¡¼¥¹¤ò°Ê²¼¤Î¤è¤¦¤Ë¥¢¥»¥ó¥Ö¥ë¤·¤Þ¤¹¡£
nasm -f elf hello.asm
gcc hello.o -o hello
strip hello
³Ø¤Ö¤³¤È¤¬¤¿¤¯¤µ¤ó¤¢¤ê¤Þ¤¹ :-)
</PRE>
<P>
<P>
<HR>
<PRE>
;-------------nasm's standalone hello-world.asm for linux --------
section .text
extern puts
global main
main:
push dword msg ;stash the location of msg on the stack.
call puts ;call the 'puts' routine (libc?)
add esp, byte 4 ;clean the stack?
ret ;exit.
msg:
db "hello world!",0
</PRE>
<HR>
<PRE>
--- timed 1.01
* origin: james vahn (jvahn@short.circuit.com) (1:346/15.1)
===============================================================================
</PRE>
¤³¤ÎÎã¤Ç¤Ïputs¤Î¸Æ¤Ó½Ð¤·¤Ï²èÌ̤˥ƥ¥¹¥È¤òɽ¼¨¤¹¤ë¤Î¤Ë»È¤ï¤ì¤Þ¤¹¡£puts¤Ï
c¤«¤é¤Î¤â¤Î¤Ç¡¢Linux¤Ç¥í¡¼¥É¤µ¤ì¤ë¥é¥¤¥Ö¥é¥ê¤Îɸ½àɽ¼¨¤Ç¤¹¡£¤·¤«¤·
¥¢¥»¥ó¥Ö¥ê¤Ç¤³¤ì¤ò¹Ô¤¦ÊýË¡¤â¤¢¤ê¤Þ¤¹¡£<CODE>interrupts</CODE> ¤Ç¤¹¡£
Linux¥«¡¼¥Í¥ë¤Îº£¸å¤Î¥Ð¡¼¥¸¥ç¥ó¤ÇÊѹ¹¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¤Î¤Ç¤³¤Î³ä¤ê¹þ¤ß
(interrupts)¤ò»È¤¦¤Î¤Ï¤ª¾©¤á¤·¤Þ¤»¤ó¡£
<P>
<P>
<H2><A NAME="ss4.2">4.2 gas¤Î£²¤Ä¤ÎÎ㡧</A>
</H2>
<P>¥¢¥»¥ó¥Ö¥é.028¤«¤éÍ¥¤ì¤¿¥µ¥ó¥×¥ë¤ò<CODE>pieter de jong</CODE>»á¤¬½Ð¤·¤Þ¤·¤¿¡£
<P>Î㣱) puts¤Î¸Æ¤Ó½Ð¤·¤ò»È¤Ã¤¿Îã
<HR>
<PRE>
.text
message:
.ascii "hello world!\0"
.align 4
.globl main
main:
pushl %ebp
movl %esp,%ebp
#call ___main
pushl $message
call puts
addl $4,%esp
xorl %eax,%eax
movl %ebp,%esp
popl %ebp
ret
</PRE>
<HR>
¤È¤·¤Æ¡¢
<PRE>
as hello.s -o hello.o
gcc hello.o -o hello
</PRE>
¤È¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£
<P>
<P>Î㣲) <CODE>int 80h</CODE>¤ò»È¤¦
<P>
<HR>
<PRE>
.text
message:
.ascii "hello, world!\12\0"
.align 4
.globl _hw
_hw:
movl $4, %eax
movl $1, %ebx
movl $message, %ecx
movl $15, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80
</PRE>
<HR>
¤È¤·¤Æ¡¢
<PRE>
as hello.s -o hello.o
ld hello.o -e _hw -o hello
(_hw = ¥¨¥ó¥È¥ê¥Ý¥¤¥ó¥È)
</PRE>
¤È¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£
<P>
<P>
<H2><A NAME="ss4.3">4.3 GAS¤Ë¥Þ¥¯¥í¤òÄɲ乤롧</A>
</H2>
<P>changed on : 5 Jul 1997
<P>¥Þ¥¯¥í¤ò»È¤¦¤³¤È¤Ë¤è¤Ã¤Æ¥×¥í¥°¥é¥ß¥ó¥°¤ÎÊ£»¨¤µ¤ò¤¹¤¯¤Ê¤¯¤Ç¤¤Þ¤¹¡£¤¢¤ë
¥É¥¥å¥á¥ó¥È¤Ç¡¢GAS¤Ï¥Þ¥¯¥í¤ò²ò¼á¤Ç¤¤º¥¢¥»¥ó¥Ö¥ê¤Ç¥Þ¥¯¥í¤ò»È¤¦¤Ë¤ÏGASP¤ò
»È¤ï¤Í¤Ð¤Ê¤é¤Ê¤¤¤È¤¤¤¦¤³¤È¤òÆɤߤޤ·¤¿¡£
<P>¤·¤«¤·.. ¤¤¤¯¤Ä¤«¥Æ¥¹¥È¤·¤Æ¤ß¤¿¤ê<CODE>GNU-C info</CODE>¥Õ¥¡¥¤¥ë¤òÆɤó¤À¤È¤³¤í
GAS(as)¤ò»È¤Ã¤Æ¥¢¥»¥ó¥Ö¥ê¥×¥í¥°¥é¥à¤Ë¥Þ¥¯¥í¤ò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤¤ë¤³¤È¤ò
ȯ¸«¤·¤Þ¤·¤¿¡£
°Ê²¼¡¢»ä¤¬¹Ô¤Ã¤¿¥Æ¥¹¥È¤ò¾Ò²ð¤·¤Þ¤¹¡£GAS ¤È ¥Þ¥¯¥í ¤Î²ÄǽÀ¤ò»î¤ß¤Æ¤¤¤Þ¤¹
(ÌõÃí¡§<CODE>dummy.dummy</CODE>¤È¤¤¤¦¥Õ¥¡¥¤¥ë¤¬¤¢¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë¥×¥í¥°¥é¥à¤Ç¤¹)¡£
<P>
<CODE>test_fopen.s</CODE>¤Î¥½¡¼¥¹¡§
<HR>
<PRE>
.include "include.asm"
.globl main
main:
_print hallo # ¥¿¥¤¥È¥ëɽ¼¨
_open bestand mode # ¥Õ¥¡¥¤¥ë'dummy.dummy'¤ò³«¤¯
cmp $0,%eax # Success?
je file_error # ¤À¤á¡£¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤Îɽ¼¨
_close %eax # ¥Õ¥¡¥¤¥ë¤òÊĤ¸¤ë
_print bestaat # 'exist'¤Èɽ¼¨
jmp einde # ¥×¥í¥°¥é¥à½ªÎ»
file_error:
_print bestaat_niet # 'doesn't exist'¤Èɽ¼¨¤¹¤ë
einde:
ret # The End ;-)
hallo:
.string "Test Linux Program ;-) \n"
bestaat:
.string "The file dummy.dummy exists..."
bestaat_niet:
.string "The file dummy.dummy doesn't exist..."
bestand:
.string "dummy.dummy"
mode:
.string "r"
.END
</PRE>
<HR>
<P><CODE>include.asm</CODE>
<HR>
<PRE>
.MACRO _print message
# start _print message
pushl $\message
call puts
addl $4,%esp
# end _print message
.ENDM
.MACRO _open file mode
# start _open ¥Õ¥¡¥¤¥ë¥â¡¼¥É
pushl %ebp
movl %esp,%ebp
pushl $\mode
pushl $\file
call fopen
addl $8,%esp
movl %eax,-4(%ebp)
# %eax = ¥Õ¥¡¥¤¥ë¥Ï¥ó¥É¥ë
# - %eax = 0 ¤Ê¤é¥Õ¥¡¥¤¥ë¤Ï¤Ê¤¤
# - %eax >< 0 %eax ¤Ê¤é¥Õ¥¡¥¤¥ë¥Ï¥ó¥É¥ë
popl %ebp
# end _open ¥Õ¥¡¥¤¥ë¥â¡¼¥É
.ENDM
.MACRO _close filehandle
# start _close ¥Õ¥¡¥¤¥ë¥Ï¥ó¥É¥ë
pushl \filehandle
call fclose
addl $4,%esp
# end _close ¥Õ¥¡¥¤¥ë¥Ï¥ó¥É¥ë
.ENDM
</PRE>
<HR>
¤È¤·¤Æ¡¢¤³¤ì¤ò
<PRE>
as test_fopen.s -o test_fopen.o
gcc test_fopen.o -o test_fopen
</PRE>
¤Î¤è¤¦¤Ë¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£
<P>
<P>
<H2><A NAME="ss4.4">4.4 ncurses¤ò»È¤¦ </A>
</H2>
<P>1997ǯ7·î21Æü Êѹ¹¡§
<P>
Ncurses ¤Ï¥Æ¥¥¹¥È¥Ù¡¼¥¹¤ÎLinux¥×¥í¥°¥é¥à¤ò½ñ¤¯¤È¤¤Ë»È¤¦´Ø¿ô¤Î
¥é¥¤¥Ö¥é¥ê¤Ç¤¹¡£
<P>°Ê²¼¡¢¥Ô¥å¥¢¤Ê¥¢¥»¥ó¥Ö¥ê¥×¥í¥°¥é¥à¤«¤éncursees¤ò¤É¤Î¤è¤¦¤Ë¸Æ¤Ó½Ð¤¹¤«¸«¤ë
¤¿¤á¤Ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤òµó¤²¤Þ¤¹¡£¤Á¤ã¤ó¤È¤·¤¿¤â¤Î¤Ç¤Ï¤Ê¤¤¤«¤â¤·¤ì¤Þ¤»¤ó¤¬
Æ°ºî¤ò¤ß¤ë¤Ë¤Ï¤è¤¤¤È»×¤¤¤Þ¤¹ :-) ¡£
<P>
<CODE>sat_color.s</CODE>
<HR>
<PRE>
.include "/home/jan/assembler/include/ncurses.asm"
.globl main
main:
_initscr
_start_color
_init_pair $1,$2,$4
_init_pair $2,$0,$6
_init_pair $3,$3,$4
_init_pair $4,$4,$4 # Hide the flashing cursor
call cls # clear screen/init colors.
_use_pair $0x00000200 # 00 00(NORMAL) 02(PAIR) 00
_locate $1,$0
_printw $titel
_locate $46,$0
_printw $pd
_use_pair $0x00200100 # 00 20(BOLD) 01(PAIR) 00
_locate $32,$12
_printw $world
_use_pair $0x00200300 # 00 20(BOLD) 03(PAIR) 00
movl $0,%esi
lus:
movb tabel(%esi),%dl # %dl = X(%esi)
incl %esi
movb tabel(%esi),%cl # %cl = Y(%esi)
incl %esi
cmpb $242,%cl
jne n242_1
movl $0,%esi
jmp lus
n242_1:
movl %esi,%edi
redo:
movb tabel(%edi),%dh # %dh = X(%esi + 1)
incl %edi
movb tabel(%edi),%ch # %ch = Y(%esi + 1)
cmpb $242,%ch
jne n242_2
movl $0,%edi
jmp redo
n242_2:
movl $leeg,%ebp
call print_item
movl $linux,%ebp
movb %ch,%cl
movb %dh,%dl
call print_item
pushl $160000 # C : usleep(....);
call usleep # Wait-loop
addl $4,%esp
_refresh
jmp lus
_endwin
ret
print_item:
pushal
movzbl %cl,%eax
movzbl %dl,%ebx
_locate %ebx,%eax
_printw %ebp
popal
ret
cls:
_use_pair $0x00000200 # 00 00(NORMAL) 02(PAIR) 00
# Color of the first line
movb $0,%cl
movb $0,%dl
cls_lus:
movl $chr32,%ebp
call print_item
incb %dl
cmpb $79,%dl
jna cls_lus
pushal
_use_pair $0x00000400 # 00 00(NORMAL) 04(PAIR) 00
# Color of the rest of the screen
popal
xorb %dl,%dl
incb %cl
cmpb $25,%cl
jna cls_lus
ret
linux:
.string "Linux"
leeg:
.string " "
chr32:
.string " "
world:
.string "World Domination"
titel:
.string "sat_color.s - 1997 Jan Wagemakers -"
pd:
.string "Donated to the Public Domain :-)"
tabel:
.include "cirkel.dat"
.byte 242,242
.END
</PRE>
<HR>
(ÌõÃí¡§ÀèƬ¤Încurses.asm¤Î¥¤¥ó¥¯¥ë¡¼¥É¥Ç¥£¥ì¥¯¥È¥ê¤ÏŬÅö¤ËÊѹ¹¤·¤Æ²¼¤µ¤¤)
<P><CODE>cirkel.dat</CODE>
<HR>
<PRE>
.byte 72 , 12
.byte 71 , 13
.byte 69 , 15
.byte 66 , 17
.byte 62 , 18
.byte 56 , 20
.byte 51 , 21
.byte 44 , 21
.byte 38 , 21
.byte 31 , 21
.byte 24 , 21
.byte 18 , 20
.byte 13 , 19
.byte 8 , 17
.byte 5 , 16
.byte 3 , 14
.byte 2 , 12
.byte 2 , 10
.byte 3 , 8
.byte 6 , 7
.byte 10 , 5
.byte 15 , 4
.byte 20 , 3
.byte 27 , 2
.byte 33 , 2
.byte 40 , 2
.byte 47 , 2
.byte 53 , 3
.byte 59 , 4
.byte 63 , 5
.byte 67 , 7
.byte 70 , 8
.byte 71 , 10
</PRE>
<HR>
<P><CODE>/home/jan/assembler/include/ncurses.asm</CODE>
<HR>
<PRE>
# ncurses.asm - donated to the public domain by Jan Wagemakers -
# derived of the following C-program
# #include
#
# int main(void)
# {
# initscr(); /* curses¥é¥¤¥Ö¥é¥ê¤Î½é´ü²½ */
# move(10, 2); /* ¥«¡¼¥½¥ë¤ò X: 2, Y: 10 ¤ËÃÖ¤¯ */
# printw("Hello, World !"); /* ɽ¼¨¤¹¤ë¤â¤Î */
# refresh(); /* ʪÍý²èÌÌ¤Ë "Hello, World !" ¤òÃÖ¤¯ */
# getch(); /* ¥¡¼¤¬²¡¤µ¤ì¤ë¤Î¤òÂÔ¤Ä */
# endwin(); /* deinit the curses libraries. */
# return 0;
# }
#
# C¤Ë¤Ä¤¤¤Æ¤è¤¯ÃΤé¤Ê¤¤¤Î¤Ç°Ê²¼¤Ï°ã¤¦¤³¤È¤â¤¢¤ê¤Þ¤¹¡£
# ½¤Àµ¤¹¤ë¤È¤¤Ï¤¿¤á¤é¤ï¤º¤ä¤Ã¤Æ²¼¤µ¤¤¡£
# ncurses¤ò»È¤Ã¤Æ²èÌ̤˲¿¤«½ñ¤¤¿¤¤¤È¤¤¤¦»þ¤Ï°Ê²¼¤Î¥Þ¥¯¥í¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
# 1. _initscr
# 2. _locate x y (x,y = ²èÌ̤κÂɸ)
# 3. _printw message
# 4. _refresh
# 5. _endwin (win¤Î½ª¤ê.... ¤Ê¤Ë¤«¤¤¤¤¶Á¤¤Ç¤¹¤Í ;-)
.MACRO _initscr
# start _initscr
call initscr
# end _initscr
.ENDM
.MACRO _locate x y
# start _locate x y
pushl \x
pushl \y
movl stdscr,%eax
pushl %eax
call wmove
addl $12,%esp
# end _locate x y
.ENDM
.MACRO _printw message
# start _print message
pushl \message
call printw
addl $4,%esp
# end _printw message
.ENDM
.MACRO _refresh
# start _refresh
movl stdscr,%eax
pushl %eax
call wrefresh
addl $4,%esp
# end _refresh
.ENDM
.MACRO _endwin
# start _endwin
call endwin
# end _endwin
.ENDM
# Colors ¤È ncurses. (15/07/97)
# - After _initscr , call _start_color
# - Init with _init_pair a color-pair.
# - With _use_pair select a color-pair.
.MACRO _start_color
# start _start_color
call start_color
# end _start_color
.ENDM
.MACRO _init_pair pair foreground background
# start _init_pair
pushl \background
pushl \foreground
pushl \pair
call init_pair
addl $12,%esp
# end _init_pair
.ENDM
.MACRO _use_pair pair
# start _use_pair
movl \pair,%eax
# | | %ah | %al |
# %eax = xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
# | |
# | |
# | +----> »È¤¤¤¿¤¤¥«¥é¡¼¥Ú¥¢(color-pair)ÈÖ¹æ
# +-------------> 00 = ¥Î¡¼¥Þ¥ë , 20 = BOLD
pushl %eax
movl stdscr,%eax
pushl %eax
call wattr_on
addl $8,%esp
#end _use_pair
.ENDM
</PRE>
<HR>
<P>
<PRE>
as sat_color.s -o sat_color.o
gcc sat_color.o -o sat_color -lncurses
</PRE>
¤È¥³¥ó¥Ñ¥¤¥ë¤·¡¢<CODE>./sat_color</CODE>¤Ç¼Â¹Ô¤·¤Þ¤¹(ÌõÃí¡§¤³¤Î¥×¥í¥°¥é¥à¤ò
¼Â¹Ô¤¹¤ë¤ÈÀĤ¤ÇطʤβèÌÌÃæ±û¤ËÎÐʸ»ú¤Ç¡ÖWorld Domination¡×¡¢¤½¤Î¼þ¤ê
¤ò²«¿§Ê¸»ú¡ÖLinux¡×¤¬¤°¤ë¤°¤ë²ó¤ë¥Ç¥â¤¬¸«¤ì¤Þ¤¹¡£<CODE>color_xterm</CODE>¤Ê¤É¤Ç
¼Â¹Ô¤·¤Æ¤ß¤Æ²¼¤µ¤¤)¡£
<P>
<P>
<HR>
<A HREF="Linux-Assembly-5.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Linux-Assembly-3.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Linux-Assembly.html#toc4">Ìܼ¡¤Ø</A>
</BODY>
</HTML>
|