generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Making A 16bit Language

Previous Thread :: Next Thread 
JohnFrimp is not online. JohnFrimp
Joined: 07 Jun 2012
Total Posts: 109
08 Jun 2012 10:33 PM
A lot of people like to make their own language when they get ahead in programming. But for me, I thought, what's the point in making a language if there's so many out there?

So I decided to make my language specifically 16bit. This way, it can have a unique use.

How do you compile it?

Well, I have an app I wrote in C++. When you open the script file with the app it will convert it to x86 Assembly and then use FASM to compile the Assembly.

Here is an example of the code for a basic game where a ball bounces around the room and you have to block it with your paddle using W and S:

var Y = 15;
var BallX = 10;
var BallY = 3;
var BallVelocityX = 1;
var BallVelocityY = 1;
var tester = 0;

setcursor hidden;

MainLoop:

if ($_ISKEY) then
getkey;
end if


_next:


if ($_KEY == 'w') then
Y -= 1;
end if

if ($_KEY == 's') then
Y += 1;
end if

if ([Y] < 1) then
revar Y = 1;
end if

if ([Y] > 23) then
revar Y = 23;
end if

setcolor 0x00;
clear;

setcolor 0xFF;
printpixel 2, [Y];
Y += 1;
printpixel 2, [Y];
Y -= 2;
printpixel 2, [Y];
Y += 1;

BallX += [BallVelocityX];
BallY += [BallVelocityY];

if ([BallY] > 23) then
revar BallVelocityY = -1;
end if

if ([BallY] <= 0) then
revar BallVelocityY = 1;
end if

if ([BallX] >= 79) then
revar BallVelocityX = -1;
end if

revar tester = 0;
if ([BallX] == 2) then
tester += 1;
end if

if ([BallY] == [Y]) then
tester += 1;
end if

Y += 1;
if ([BallY] == [Y]) then
tester += 1;
end if

Y -= 2;
if ([BallY] == [Y]) then
tester += 1;
end if

Y += 1;

if ([tester] == 2) then
revar BallVelocityX = 1;
end if
setcolor 0xBB;
printpixel [BallX], [BallY];

clearkeys;

delay 1;
goto MainLoop;




If you are wondering what is with all the square brackets, in Assembly, square brackets represent the address of a value (kind of like a pointer). I have to make the user put them in for certain things. I may figure out a way so that it doesn't make them have to in the future.

Here is the Assembly code this produces:


org 100h

mov ah, 01h
mov cx, 2607h
int 10h
MainLoop:
mov ah, 11h
int 16h
jne _THEN
jmp _ENDIF
_THEN:

mov ah, 08
int 21h
_ENDIF:
_next:
mov cl, 'w'
cmp al , cl
je __THEN
jmp __ENDIF
__THEN:
mov al, 1
sub [Y ], al
__ENDIF:
mov cl, 's'
cmp al , cl
je ___THEN
jmp ___ENDIF
___THEN:
mov al, 1
add [Y ], al
___ENDIF:
mov cl, 1
cmp [Y] , cl
jl ____THEN
jmp ____ENDIF
____THEN:
mov [Y ], 1
____ENDIF:
mov cl, 23
cmp [Y] , cl
jg _____THEN
jmp _____ENDIF
_____THEN:
mov [Y ], 23
_____ENDIF:
mov ah, 02h
mov dh, 0d
mov dl, 0d
int 10h
mov ah, 09h
mov al, 20h
mov bl, 0x00
mov cx, 1000h
int 10h
mov ah, 02h
mov dl, 2
mov dh, [Y]
int 10h
mov ah, 09h
mov al, 20h
mov bl, 0xFF
mov cx, 1d
int 10h
mov al, 1
add [Y ], al
mov ah, 02h
mov dl, 2
mov dh, [Y]
int 10h
mov ah, 09h
mov al, 20h
mov bl, 0xFF
mov cx, 1d
int 10h
mov al, 2
sub [Y ], al
mov ah, 02h
mov dl, 2
mov dh, [Y]
int 10h
mov ah, 09h
mov al, 20h
mov bl, 0xFF
mov cx, 1d
int 10h
mov al, 1
add [Y ], al
mov al, [BallVelocityX]
add [BallX ], al
mov al, [BallVelocityY]
add [BallY ], al
mov cl, 23
cmp [BallY] , cl
jg ______THEN
jmp ______ENDIF
______THEN:
mov [BallVelocityY ], -1
______ENDIF:
mov cl, 0
cmp [BallY] , cl
jle _______THEN
jmp _______ENDIF
_______THEN:
mov [BallVelocityY ], 1
_______ENDIF:
mov cl, 79
cmp [BallX] , cl
jge ________THEN
jmp ________ENDIF
________THEN:
mov [BallVelocityX ], -1
________ENDIF:
mov [tester ], 0
mov cl, 2
cmp [BallX] , cl
je _________THEN
jmp _________ENDIF
_________THEN:
mov al, 1
add [tester ], al
_________ENDIF:
mov cl, [Y]
cmp [BallY] , cl
je __________THEN
jmp __________ENDIF
__________THEN:
mov al, 1
add [tester ], al
__________ENDIF:
mov al, 1
add [Y ], al
mov cl, [Y]
cmp [BallY] , cl
je ___________THEN
jmp ___________ENDIF
___________THEN:
mov al, 1
add [tester ], al
___________ENDIF:
mov al, 2
sub [Y ], al
mov cl, [Y]
cmp [BallY] , cl
je ____________THEN
jmp ____________ENDIF
____________THEN:
mov al, 1
add [tester ], al
____________ENDIF:
mov al, 1
add [Y ], al
mov cl, 2
cmp [tester] , cl
je _____________THEN
jmp _____________ENDIF
_____________THEN:
mov [BallVelocityX ], 1
_____________ENDIF:
mov ah, 02h
mov dl, [BallX]
mov dh, [BallY]
int 10h
mov ah, 09h
mov al, 20h
mov bl, 0xBB
mov cx, 1d
int 10h
mov ah, 0ch
int 21h
mov ah, 86h
mov cx, 1
int 15h
jmp MainLoop
int 20h

tagDollarSign:
mov ah, 02h
add si, 1d
cmp word[bx+si], 20h
jg tagDollarSign
mov word[bx+si-1], '$'
ret
Y db 15
BallX db 10
BallY db 3
BallVelocityX db 1
BallVelocityY db 1
tester db 0
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
08 Jun 2012 10:48 PM
Hmm, interesting. It is also neat you decide to have those graphical + user input functions built into the language. In most cases, they either aren't in the language at all, or if they are, are stored in separate standard libraries/namespaces/packages/whatevers, and are often very limited in what they can do.

-Jode
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
08 Jun 2012 11:04 PM
| So I decided to make my language specifically 16bit. This way, it can have no use.

FTFY. Very nice, and impressive, but that is a bad reason to make a language.
Report Abuse
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
08 Jun 2012 11:08 PM
@Stravant

A fellow Redditor? :D
Report Abuse
JohnFrimp is not online. JohnFrimp
Joined: 07 Jun 2012
Total Posts: 109
08 Jun 2012 11:46 PM
@ stravant
No need to be such a jerk.

There is a use in making 16bit games. To make 16bit games. Some people just like making games for older systems.

I don't see a point in making a language for modern computers when I could never make anything better than the language I'm using: C++.

I don't always make simple stuff, though. I'm also working on an HTML5 game developer that allows you to create HTML5 games without any programming knowledge at all. That still has a few more weeks to go.

Oh, and I'm also making a 2D platformer with OpenGL. But again, still a long way to go.

Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
09 Jun 2012 02:38 AM
Came off a bit less jokingly than I intended, sorry.

It is really the wrong idea to do stuff just because you can to make your language unique, although you do have the right idea in making it something which not syntax related, which is good. You should not care much about syntax when doing language design work.

The reason that I would say it has no use is because you'd be hard pressed to find a 16bit CPU. Pretty much anything out there now is 32bit or higher. The only common other thing which you would realistically write a program for is the Z80 in TI calculators, which is more 8bit than 16bit.

It is a very nice piece of work though, and if you want to do more then you should check out Jack Crenshaw's "lets build a compiler" if you're not already using it.

I also have a piece of work in Lua which you may find interesting:
http://wiki.roblox.com/index.php/User:XLEGOx/luatext
Which is a YACC style parser-generator for Lua, that includes a capture system complex enough to easily build a compiler using.
Report Abuse
pwnedu46 is not online. pwnedu46
Joined: 23 May 2009
Total Posts: 7534
09 Jun 2012 03:47 AM
"The reason that I would say it has no use is because you'd be hard pressed to find a 16bit CPU."

There are a number of micro-controllers that are 16 bit.


----------
    ~pwnedu46, wiki writer~
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
09 Jun 2012 04:07 AM
[ Content Deleted ]
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jun 2012 04:54 AM
I made an epic 32-bit language called 'slow'. It's unique purpose in existance is that it is slower than most, if not all alternatives.

For example, this snippet of code:

DEFINE_AN_INTEGER_WHICH_EQUALS_=234=_CALLED_=EGGY=
ADD_=123=_ONTO_=EGGY=

Produces:

int EGGY = 234;
for (EGGY = EGGY; EGGY < EGGY + 123; EGGY++)
{
std::cout << "EGGY INCREASED" << std::endl;
}

ya. endl. umad?
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jun 2012 04:55 AM
but when you compile the result make sure you don't turn on optimisations or it ruins the point of slow.
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
09 Jun 2012 05:35 AM
Make a language which n00bs can understand, like LOLCode.

Hello world:

hullo
see hallo wurld
de ende


Loop to 10 with var up thing:

hullo
lol is 1
do
lol ish lol + 1
stop if lol ish 10
de ende

Image:

hullo
see image lol cat.png
top corner
de ende
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
09 Jun 2012 05:36 AM
Basically, no brackets, no ""'s, not many symbols, more random l33t words.
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
09 Jun 2012 05:41 AM
there's a reason lolcode never caught on

it's easier to write

for i = 1, 10 do
print("ELLO")
end

than

LOL i ISH 1
RPEEAT DAT i ISH i ADDS 1 UNTIL i ISH 10 AND 0LS0 REPEAT:
LOL SAY ELLO
K STOP RERPETATING
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
09 Jun 2012 06:27 AM
Make a language where you write the algorithm, the expected usage and coherency of usage and blah blah, the amount of ram and the amount of processing power, which you prefer it to use and then it will generate the code for you :D

k
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
09 Jun 2012 08:33 AM
@Stravant

What about Notch's DCPU-16 for his new game 0x10c?...
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
09 Jun 2012 10:05 AM
whut

weeee
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
09 Jun 2012 10:08 AM
Lets design a language where the size of integers is a part of the language.


so if we have a template liek in c++, instead of haxy stuff, we can has

int[32] //at least 32 bit int

That should actually be added to c++ to replace the ugly way it works now.
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
09 Jun 2012 12:27 PM
C/C++ already have stdint.h / cstdint for that, and there's no need to make it a template-like since there's very little code that would actually both care what the bit-width of a number is, and actually be able to share any implementation between different bit-widths.
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
09 Jun 2012 03:26 PM
O rly
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image