2
0

vgasel.pas 937 B

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