about summary refs log tree commit diff stats
path: root/subx/050_write.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-11-30 10:54:42 -0800
committerKartik Agaram <vc@akkartik.com>2018-11-30 10:54:42 -0800
commit6030d7e2e56d445ca67c6a0e8c9cf33e46bc673c (patch)
tree83b6fc800dc5c90295b58e5b0494b083636efbaa /subx/050_write.subx
parente9661581f092f3e210b7bd900af058d8b8c4369e (diff)
downloadmu-6030d7e2e56d445ca67c6a0e8c9cf33e46bc673c.tar.gz
4801
Reindent all SubX code to make some room for the new comment style.
Diffstat (limited to 'subx/050_write.subx')
-rw-r--r--subx/050_write.subx64
1 files changed, 32 insertions, 32 deletions
diff --git a/subx/050_write.subx b/subx/050_write.subx
index 8a65fc05..1975f7a3 100644
--- a/subx/050_write.subx
+++ b/subx/050_write.subx
@@ -1,45 +1,45 @@
 # _write: write to a file descriptor
 
 == code
-# instruction                     effective address                                                   operand     displacement    immediate
-# op          subop               mod             rm32          base        index         scale       r32
-# 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
+#   instruction                     effective address                                                   operand     displacement    immediate
+#   op          subop               mod             rm32          base        index         scale       r32
+#   1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
 # main:
-  # syscall(exit, 0) -- can't test _write just yet
-  bb/copy-to-EBX  0/imm32
-  b8/copy-to-EAX  1/imm32
-  cd/syscall  0x80/imm8
+    # syscall(exit, 0) -- can't test _write just yet
+    bb/copy-to-EBX  0/imm32
+    b8/copy-to-EAX  1/imm32
+    cd/syscall  0x80/imm8
 
 _write:  # fd : int, s : (address array byte) -> <void>
-  # prolog
-  55/push-EBP
-  89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-  # save registers
-  50/push-EAX
-  51/push-ECX
-  52/push-EDX
-  53/push-EBX
-  # syscall(write, fd, (data) s+4, (size) *s)
+    # prolog
+    55/push-EBP
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # save registers
+    50/push-EAX
+    51/push-ECX
+    52/push-EDX
+    53/push-EBX
+    # syscall(write, fd, (data) s+4, (size) *s)
     # fd : EBX
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           3/r32/EBX   8/disp8         .                 # copy *(EBP+8) to EBX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           3/r32/EBX   8/disp8         .                 # copy *(EBP+8) to EBX
     # data : ECX = s+4
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           1/r32/ECX   0xc/disp8       .                 # copy *(EBP+12) to ECX
-  81          0/subop/add         3/mod/direct    1/rm32/ECX    .           .             .           .           .               4/imm32           # add to ECX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           1/r32/ECX   0xc/disp8       .                 # copy *(EBP+12) to ECX
+    81          0/subop/add         3/mod/direct    1/rm32/ECX    .           .             .           .           .               4/imm32           # add to ECX
     # size : EDX = *s
-  8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           2/r32/EDX   0xc/disp8       .                 # copy *(EBP+12) to EDX
-  8b/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           2/r32/EDX   .               .                 # copy *EDX to EDX
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    5/base/EBP  4/index/none  .           2/r32/EDX   0xc/disp8       .                 # copy *(EBP+12) to EDX
+    8b/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           2/r32/EDX   .               .                 # copy *EDX to EDX
     # syscall
-  b8/copy-to-EAX  4/imm32/write
-  cd/syscall  0x80/imm8
-  # restore registers
-  5b/pop-to-EBX
-  5a/pop-to-EDX
-  59/pop-to-ECX
-  58/pop-to-EAX
-  # epilog
-  89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
-  5d/pop-to-EBP
-  c3/return
+    b8/copy-to-EAX  4/imm32/write
+    cd/syscall  0x80/imm8
+    # restore registers
+    5b/pop-to-EBX
+    5a/pop-to-EDX
+    59/pop-to-ECX
+    58/pop-to-EAX
+    # epilog
+    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+    5d/pop-to-EBP
+    c3/return
 
 # vim:nowrap:textwidth=0
id='n317' href='#n317'>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