Making A Programming Language


Last edited by a moderator:
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.
 
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:
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:
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?
 
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.
 
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:
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.
 
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:
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.
 
512bytes that manages ingame events of the level

The scripting assembler I wrote for FleshChasmer
 
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:
 
Back
Top