Making A Programming Language


Blah

Wanna Be Programmer
Joined
Dec 18, 2003
Messages
3,253
Age
31
Location
Oregon, USA
Website
Visit site
Last edited by a moderator:

rokdcasbah

got me a date with botticelli's niece
Joined
Jan 5, 2006
Messages
1,517
Location
up on cripple creek
We're a little off-topic but what the hey. Blah mentioned How to Think Like a CS. Little known fact: I am trying to pick up a little Python. Here are some other online books and tutorials.

A Byte of Python
The LiveWires Python Course
The docs.python.org Tutorial (by Guido himself)
Thinking in Python (advanced Topics)

last but not least:
Learning Python. Not the book, but a blog that covers just about everything related to Python, including the game libraries.

O'Reilly has a few printed books on Python, which your local bookstore may have. I have been thinking about getting a regular book so that I can stay focused a little better, and have more exercises.

I am finding that tutorials on Pygame are hard to come by, but there's some stuff at pygame.org and I'm guessing at the general game development sites. It's close enough to SDL that knowing one will help you in the other, I think.

I would love to see someone get Pyglet on the Pandora, and even the gp2x.
 

.Gogeta§§J4BR.

that brazilian guy =`]
Joined
Feb 13, 2006
Messages
476
Age
33
Location
São Paulo - SP - Brasil
Website
robertocr.com
craigix said:
I had a go at writing a basic compiler in ASM in about 1996/7 when i was a crazzzyy young teen.

I had a nightmare of a time working out how to do the maths functions sin, cos, tan etc. in a day before you could look these things up on the net. I never found out how to do one of them, I can't remember which and I do remember the answer was a lot of ^.

I used to have fun trying to match other compilers for speed etc. but I never finished it after about 6 months of 'for fun' work. Christ. I can't believe I did all that back then. Why didn't I just turn off the TV and go outside and do something better instead?

Someone else has always done it already, and thanks to the net these days you can find it all! The future is here!
you really think as an administrator, don't you? :) you are definitely the business man B)
 
Last edited by a moderator:

sam fisher

Well-Known Member
Joined
Apr 11, 2004
Messages
9,452
Location
Bristol, UK
Website
blog.peter-r.co.uk
craigix said:
Looking back it was very clever that computers like the Spectrum etc. could do cos, sin, tan etc. and make it look as if the computer could handle it with ease, instead they used clever calculations on their 8bit cpus which gave amazingly accurate answers fast.

I'm in a mood to look it all up again now.
No look up tables back then? When you find out how it's done do come back and post it here. I'm interested as well now :p

Blah said:
I've been reading some of this as it's part of the precourse material for my course. Another book on that is part of it is [URL="http://www.diveintopython.org/"]Dive Into Python.
 
Last edited by a moderator:

craigix

Mega GP Mania
Joined
Feb 3, 2003
Messages
11,010
Location
England
Website
twitter.com
Amazingly I stilll cannot find the answers to it via google. Back in the day a friend of mine was able to send me the answer via his Msc in maths. Does anyone know how to calculate cos , sin & tan in 8 or 16bit?
 

bustaballs

Member
Joined
Dec 31, 2007
Messages
196
Gotta use that kind of math for AI pathfinding and such. I've always been pretty decent at math so I hoe I don't have too much trouble with it when I get to the point where I need it.
 

gp32rich

Never been accused of being subtle
Joined
Nov 16, 2003
Messages
840
Location
dev heck!
Website
www.geocities.com
craigix said:
Amazingly I stilll cannot find the answers to it via google. Back in the day a friend of mine was able to send me the answer via his Msc in maths. Does anyone know how to calculate cos , sin & tan in 8 or 16bit?
In my misspent youth things hardware interested me and I had pretentions of CompSci.

I had a book for C64 called Whole Memory Guide which dissected the OS at the assembly level and I remember that the sin/cos/tan/log/exp functions are all related and call the same subroutines.

I'll dig it out and post more info later.
In the meantime ...,
here is the definition of sin & cos in terms of 'e', which the above routines use.
http://en.wikipedia.org/wiki/Trigonometric...complex_numbers

I used to work with DSP's. It is now 10 yrs ago, so it's all a bit hazy, but the code for these functions was in the user guide for either AT&T's DSP32c or TI's 21064, (possibly for the fixed point TI DSP's too) if you have access to these.
 
Last edited by a moderator:

Dunny

Exophase Approved® Forum Troll
Joined
Dec 24, 2006
Messages
1,112
Age
47
Location
Broughton, Brigg, UK
Website
www.zxspin.com
Sinclair BASIC didn't directly calculate any of the higher functions - instead, it had an intermediate "maths language" which was interpreted (on-topic! whee!) by the calculator routine. Basically, you set your algorithm up as a series of bytes (which represented the commands of this language) and then issued an RST instruction on the CPU, which called the interpreter.

It was very, very slow - floating point calculations took forever in terms of CPU cycles. The spectrum also handled integers very fast indeed, but unlike the BBC could handle any variable as int or float, and knew how to make the distinction. The calculator is fascinating stuff, and is fully documented in Geoff Wearmouth's online disassembly of the Spectrum ROM. The calculator disassembly starts at L0028 and thereafter moves almost immediately to L335B.

I'm currently working on an x86 adaptation of the sinclair spectrum ROM for use on old laptops and suchlike, to be used as a retro-styled OS but with modern capability in graphics/sound/storage.

WarmFluffyUK:

The entire Spectrum manual is part of the BASin distribution - BASin being an integrated development environment (IDE) for Sinclair BASIC. You can find it here, as a windows installer. It's quite fun to play with the BASIC with a full delphi-like debugging suite and tools. The manual can be found in the helpfile, and it's fully hotlinked and searchable.

D.
 
Q

quasist

Guest
craigix said:
Does anyone know how to calculate cos , sin & tan in 8 or 16bit?
Just make a table of sin values for (0---(pi/2)) or (0--(2pi))
memory consumed: 256byte table for 8bit, and 128kb for 16bit
 
Last edited by a moderator:

WarmFluffyUK

The Big Wad Bolf.
Joined
Sep 4, 2004
Messages
3,384
Location
UK
Website
www.retrotech.one
Does anyone remember the odd bug in Sinclair Basic on the original ZX spectrum that drew a mass of pretty swirling patterns on the screen? I think it was something to do with COS.
 
Q

quasist

Guest
512bytes that manages ingame events of the level

The scripting assembler I wrote for FleshChasmer
 

gp32rich

Never been accused of being subtle
Joined
Nov 16, 2003
Messages
840
Location
dev heck!
Website
www.geocities.com
Okay. I've had a look and the C64 evaluated the series functions to work out the "trans fns" (sin, atan, exp, sqr, log). [cos drops through to sin(x+pi/2), tan calls sin(x)/cos(x)]

They use six or seven constants multiplied in a series.
My guess is they tested how many levels of the series gave an machine accurate answer and didn't go any further :rolleyes:


.. all in 4byte floating point on a 1Mhz chip :p
How did they put men on the moon? Why can't they now :huh:


btw. Did you know M$ wrote the C64 Roms for a one-off fee?
No licensing restrictions there (until v7):rolleyes:
 
Top