vgasel.pas 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. { example for :
  2. Selectors and descriptors
  3. segment_to_descriptor()
  4. seg_fillchar()
  5. realintr()
  6. trealregs record
  7. }
  8. { This example demonstrates the use of the segment_to_descriptor() function.
  9. It switches to VGA mode 13h (320x200x256 color), creates a selector to the
  10. memory (based at $A000:0000), clears this memory with color 15 (white) and
  11. waits until the enter key is pressed
  12. }
  13. uses go32;
  14. var vgasel : Word;
  15. r : trealregs;
  16. begin
  17. { set VGA mode 13h }
  18. r.eax := $13; realintr($10, r);
  19. { allocate descriptor to VGA memory quickly; it could be done with
  20. allocate_ldt_descriptors() too, but we would have to initialize it
  21. by ourselves... unlike segment_to_descriptor() which automatically sets
  22. the limit and the base address correctly }
  23. vgasel := segment_to_descriptor($A000);
  24. { simply fill the screen memory with color 15 }
  25. seg_fillchar(vgasel, 0, 64000, #15);
  26. { wait for a return press }
  27. readln;
  28. { back to text mode }
  29. r.eax := $3; realintr($10, r);
  30. { don't deallocate vgasel, that can't be done }
  31. end.