Data update

This commit is contained in:
Ingy döt Net 2025-02-27 18:35:13 -05:00
parent 8e4e15fa56
commit 72eb4943cb
1853 changed files with 35514 additions and 9441 deletions

View file

@ -1 +1 @@
10 MODE 1: REM 320x256 4 colour graphics
MODE 1: REM 320x256 4 color graphics

View file

@ -1,2 +1 @@
10 REM GW Basic can switch VGA modes
20 SCREEN 18: REM Mode 12h 640x480 16 colour graphics
SCREEN 9: REM 640x350, 16 colors

View file

@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit;
import javax.swing.JFrame;
import javax.swing.JLabel;
public final class VideoDisplay {
public final class VideoDisplayModes {
public static void main(String[] aArgs) throws InterruptedException {
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
@ -36,10 +36,10 @@ public final class VideoDisplay {
}
// Uncomment the line below to see an example of programmatically changing the video display.
// new VideoDisplay();
// new VideoDisplayModes();
}
private VideoDisplay() throws InterruptedException {
private VideoDisplayModes() throws InterruptedException {
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Video Display Demonstration");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

View file

@ -1 +1 @@
10 MODE 0: REM switch to mode 0
mode 0 ' switch to mode 0

View file

@ -0,0 +1,40 @@
GLOBAL OLDMODE
WINDOW MODE, WINDOW
MODULE SET_RES (X, Y) {
OLDMODE<=MODE
SCREEN.PIXELS X, Y
WINDOW 6, X*TWIPSX, Y*TWIPSY
FORM 60, 40
FORM ;
MOTION (X*TWIPSX-SCALE.X) DIV 2, (Y*TWIPSY-SCALE.Y) DIV 2
BACK {CLS 0,0:REFRESH}
}
MODULE RESTRORE_RES {
SCREEN.PIXELS !
WINDOW OLDMODE, WINDOW
}
SET_RES 1024, 768
PRINT "RES 1024X768"
PRINT "WIDTH:";WIDTH
PRINT "HEIGHT:";HEIGHT
fOR I=1 TO 500: PRINT ""+(I MOD 10);: NEXT
PRINT "PRESS ANY KEY"
A$=KEY$
RESTRORE_RES
WINDOW MODE, 0
PRINT "PRESS ANY KEY"
A$=KEY$
PRINT "WAIT..."
WHILE INKEY$<>""
WAIT 50
END WHILE
SET_RES 1280, 800
PRINT "RES 1280X800"
PRINT "WIDTH:";WIDTH
PRINT "HEIGHT:";HEIGHT
fOR I=1 TO 500: PRINT ""+(I MOD 10);: NEXT
PRINT "PRESS ANY KEY"
A$=KEY$
RESTRORE_RES
WINDOW MODE, 0

View file

@ -1,2 +1 @@
'QBasic can switch VGA modes
SCREEN 18 'Mode 12h 640x480 16 colour graphics
SCREEN 13 ' use 320x200 pixels, 40x25 characters, 256 colors

View file

@ -1,66 +0,0 @@
/* gcc Video_display_modes.c -o Video_display_modes -lwren -lm */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "wren.h"
void C_xrandr(WrenVM* vm) {
const char *arg = wrenGetSlotString(vm, 1);
char command[strlen(arg) + 8];
strcpy(command, "xrandr ");
strcat(command, arg);
system(command);
}
void C_usleep(WrenVM* vm) {
useconds_t usec = (useconds_t)wrenGetSlotDouble(vm, 1);
usleep(usec);
}
WrenForeignMethodFn bindForeignMethod(
WrenVM* vm,
const char* module,
const char* className,
bool isStatic,
const char* signature) {
if (strcmp(module, "main") == 0) {
if (strcmp(className, "C") == 0) {
if (isStatic && strcmp(signature, "xrandr(_)") == 0) return C_xrandr;
if (isStatic && strcmp(signature, "usleep(_)") == 0) return C_usleep;
}
}
return NULL;
}
static void writeFn(WrenVM* vm, const char* text) {
printf("%s", text);
}
char *readFile(const char *fileName) {
FILE *f = fopen(fileName, "r");
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
rewind(f);
char *script = malloc(fsize + 1);
fread(script, 1, fsize, f);
fclose(f);
script[fsize] = 0;
return script;
}
int main(int argc, char **argv) {
WrenConfiguration config;
wrenInitConfiguration(&config);
config.writeFn = &writeFn;
config.bindForeignMethodFn = &bindForeignMethod;
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "Video_display_modes.wren";
char *script = readFile(fileName);
wrenInterpret(vm, module, script);
wrenFreeVM(vm);
free(script);
return 0;
}

View file

@ -1,22 +1,17 @@
/* Video_display_modes.wren */
class C {
foreign static xrandr(args)
foreign static usleep(usec)
}
import "os" for Process
import "timer" for Timer
// query supported display modes
C.xrandr("-q")
Process.exec("xrandr -q")
C.usleep(3000)
Timer.wait(3000)
// change display mode to 1368x768
System.print("\nChanging to 1368 x 768 mode.")
C.xrandr("-s 1368x768")
Process.exec("xrandr -s 1368x768")
C.usleep(3000)
Timer.wait(3000)
// change it back again to 1920x1080
System.print("\nReverting to 1920 x 1080 mode.")
C.xrandr("-s 1920x1080")
Process.exec("xrandr -s 1920x1080")