about summary refs log tree commit diff stats
path: root/baremetal
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-12-27 08:33:22 -0800
committerKartik Agaram <vc@akkartik.com>2020-12-27 08:45:03 -0800
commit5095021f7778a7b11025f8492195ffd9be8cd870 (patch)
tree0999cf084275c7e0dbebff08537cf138ee123a2f /baremetal
parent0e0b0c6edbe198d42725f03b6e83e75ea22f5429 (diff)
downloadmu-5095021f7778a7b11025f8492195ffd9be8cd870.tar.gz
7424 - baremetal: downsize graphics resolution
If it's large enough that I have doubts whether my top-of-the-line Mac
is showing the bottom of the screen inside an emulator, it's too large.

This way I also feel more confident that most modern hardware will support
this graphics mode, and that these programs will work for others.
Diffstat (limited to 'baremetal')
-rw-r--r--baremetal/README.md2
-rw-r--r--baremetal/boot.hex4
-rw-r--r--baremetal/ex1.hex3
-rw-r--r--baremetal/ex2.hex4
4 files changed, 7 insertions, 6 deletions
diff --git a/baremetal/README.md b/baremetal/README.md
index 9932b662..4d1c2876 100644
--- a/baremetal/README.md
+++ b/baremetal/README.md
@@ -6,7 +6,7 @@ I'd like to eventually test these programs on real hardware, and to that end
 they are extremely parsimonious in the hardware they assume:
 
   0. Lots (more than 640KB/1MB[1]) of RAM
-  1. Pure-graphics video mode (1280x1024 pixels) in 256-color mode. At 8x8
+  1. Pure-graphics video mode (1024x768 pixels) in 256-color mode. At 8x8
      pixels per grapheme, this will give us 160x128 graphemes. But it's still
      an open question if it's reasonably widely supported by modern hardware.
      If it isn't, I'll downsize.
diff --git a/baremetal/boot.hex b/baremetal/boot.hex
index e8591dc7..5cb28127 100644
--- a/baremetal/boot.hex
+++ b/baremetal/boot.hex
@@ -30,7 +30,7 @@
 # Programs using this initialization:
 #   - can't use any syscalls
 #   - can't print text to video memory (past these boot sectors)
-#   - must only print raw pixels (256 colors) to video memory (resolution 1280x1024)
+#   - must only print raw pixels (256 colors) to video memory (resolution 1024x768)
 #   - must store their entry-point at address 0x8800
 
 ## 16-bit entry point
@@ -96,7 +96,7 @@
   # adjust video mode
   b4 4f  # ah <- 4f (VBE)
   b0 02  # al <- 02 (set video mode)
-  bb 07 41  # bx <- 0x0107 (graphics 1280x1024x256
+  bb 05 41  # bx <- 0x0105 (graphics 1024x768x256
             #               0x4000 bit = configure linear frame buffer in Bochs emulator; hopefully this doesn't hurt anything when running natively)
             # fallback mode: 0x0101 (640x480x256)
   cd 10  # int 10h, Vesa BIOS extensions
diff --git a/baremetal/ex1.hex b/baremetal/ex1.hex
index 39b458fa..d891b47e 100644
--- a/baremetal/ex1.hex
+++ b/baremetal/ex1.hex
@@ -1,6 +1,7 @@
 # The simplest possible program: just an infinite loop.
 # All is well if your computer clears screen and hangs without restarting.
-# On an emulator the window may get bigger to accomodate the 1280x1024 graphics mode.
+# On an emulator the window may get bigger to accomodate the higher-resolution
+# graphics mode.
 #
 # To convert to a disk image, first prepare a realistically sized disk image:
 #   dd if=/dev/zero of=disk.img count=20160  # 512-byte sectors, so 10MB
diff --git a/baremetal/ex2.hex b/baremetal/ex2.hex
index 78977c5f..c12f1d78 100644
--- a/baremetal/ex2.hex
+++ b/baremetal/ex2.hex
@@ -17,10 +17,10 @@
   0d  # 00/mod/indirect 001/r32/ecx 101/rm32/use-disp32
   68 7d 00 00 # disp32
 
-# eax <- LFB + 0x13ffff (1280*1024 - 1)
+# eax <- LFB + 0xbffff (1024*768 - 1)
 8d  # copy-address rm32 to r32
   81  # 10/mod/*+disp32 000/r32/eax 001/rm32/ecx
-  ff ff 13 00  # disp32
+  ff ff 0b 00  # disp32
 
 # $loop:
 # if (eax < ecx) break
id='n302' href='#n302'>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 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662