Skip to content

Instantly share code, notes, and snippets.

@mikesmullin
Last active December 22, 2015 01:59
Show Gist options
  • Save mikesmullin/6400075 to your computer and use it in GitHub Desktop.
Save mikesmullin/6400075 to your computer and use it in GitHub Desktop.
moar_fun_language_experimentation
#include <GL/glfw.h>
#include <iostream>
#define GLFW_INCLUDE_GLU
using namespace std;
int main()
{
int running = GL_TRUE;
glfwInit();
if( !glfwOpenWindow( 640,480, 0,0,0,0,0,0, GLFW_WINDOW ) )
{
glfwTerminate();
return 0;
}
while( running )
{
//GL Code here
glLoadIdentity();
glClearColor(0.0, 0.0, 0.0, 0.0);
glClearDepth(1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
glfwSwapBuffers();
// Check if ESC key was pressed or window was closed
running = !glfwGetKey( GLFW_KEY_ESC ) &&
glfwGetWindowParam( GLFW_OPENED );
}
glfwTerminate();
return 0;
}
include GL/glfw.h
include iostream
define GLFW_INCLUDE_GLU
_start:
def int running setLiteral GL_TRUE
call glfwInit
unless glfwOpenWindow 640, 480, 0, 0, 0, 0, 0, 0, GLFW_WINDOW
return call glfwTerminate
while running
call glLoadIdentity
call glClearColor 0, 0, 0, 0
call glClearDepth 1
call glClear GL_COLOR_BUFFER_BIT bitOr GL_DEPTH_BUFFER_BIT
call glColor3f 1, 1, 1
call glOrtho 0, 1, 0, 1, -1, 1
call glBegin GL_POLYGON
call glVertex3f .25, .25, 0
call glVertex3f .75, .25, .0
call glVertex3f .75, .75, 0
call glVertex3f .25, .75, 0
call glEnd
call glFlush
call glfwSwapBuffers
set running equalsLiteral not glfwGetKey(GLFW_KEY_ESC) trueIfBothTrueOrBothFalse glfwGetWindowParam GLFW_OPENED
call glfwTerminate
call process_exit 0
include GL/glfw.h
include iostream
define GLFW_INCLUDE_GLU
_start:
def int running setLiteral GL_TRUE
jumpTo glfwInit
unless jumpToAndPassReturning glfwOpenWindow 640, 480, 0, 0, 0, 0, 0, 0, GLFW_WINDOW
return jumpToReturning glfwTerminate
while running
jumpTo glLoadIdentity
jumpToAndPass glClearColor 0, 0, 0, 0
jumpToAndPass glClearDepth 1
jumpToAndPass glClear GL_COLOR_BUFFER_BIT bitOr GL_DEPTH_BUFFER_BIT
jumpToAndPass glColor3f 1, 1, 1
jumpToAndPass glOrtho 0, 1, 0, 1, -1, 1
jumpToAndPass glBegin GL_POLYGON
jumpToAndPass glVertex3f .25, .25, 0
jumpToAndPass glVertex3f .75, .25, .0
jumpToAndPass glVertex3f .75, .75, 0
jumpToAndPass glVertex3f .25, .75, 0
jumpTo glEnd
jumpTo glFlush
jumpTo glfwSwapBuffers
set running equalsLiteral not glfwGetKey(GLFW_KEY_ESC) trueIfBothTrueOrBothFalse glfwGetWindowParam GLFW_OPENED
jumpTo glfwTerminate
jumpToAndPass process_exit 0
push = decrementStackPointerAutoBitsAndCopyAutoBitsFrom
LocalStack = decrementStackPointerAutoBits
Stack = base pointer
pushLocalStack
unit32 = size of data 2^32
use x86_64
!!!ELF
#_start
pushLocalStack uint32 a 1
jumpTo b
#b
jumpToAndPass c, 1, 2, "abc"
#c (uint32 a,b, string c)
jumpToAndPassReturning d, 1
exit 0
#d (unit32 a)
0x01 _start:
movq $0x000001, -4(%rbp)
call 0x04
0x04 b:
; cmds to insert variables before stack and into appropriate registers by type
call 0x08
0x08 c:
; cmds to insert variables before stack and into appropriate registers by type
call 0x0a
0x09:
; set args for exit
syscall
0x0a d:
ret