> Python IS slower than perl, especially since you are dealing with
> objects. However, I'd suggest go the cPickle route - have a Z80Cpu
> module, and its C equivalent, cZ80, and use that one if available. This
> way, the emulator will be actually usable everywhere.
Thanks for the advice but ...
> Hey, I got 100% with ASM ZX Spectrum emulator on a low end 386 :-) (I do
> not remember the CPU freqeuncy anymore, maybe 25MHz).
Yes, in ASM a simple 25 or 33Mhz 386 computer was able to emulate
the
Spectrum. At least, under MSDOS, like did Warajevo, Z80, x128 and
"Spectrum"
from Pedro Gimeno.
> > #define STORE_nn_rr(dreg) \
> > r_opl = Z80ReadMem(r_PC); r_PC++;\
> > r_oph = Z80ReadMem(r_PC); r_PC++; \
> > r_tmp = dreg; \
> > Z80WriteMem((r_op),r_tmpl, regs); \
> > Z80
I'm going to quote all the answers in a single post, if you all don't
mind:
> [greg]
> But keep in mind that named "constants" at the module level
> are really global variables, and therefore incur a dictionary
> lookup every time they're used.
>
> For maximum speed, nothing beats writing the nu
> How about
> page, index = divmod(address, 16384)
Surely, much better and faster :-)
Thanks a lot.
--
http://mail.python.org/mailman/listinfo/python-list
Oops, numpy arrays start with index=0 :-)
--
http://mail.python.org/mailman/listinfo/python-list
> You can do clever memory slicing like this with numpy. For instance:
>
> breg = numpy.zeros((16,),numpy.uint8)
> wreg = numpy.ndarray((8,),numpy.uint16,breg)
>
> This causes breg and wreg to share the same 16 bytes of memory. You
> can define constants to access specific registers:
What I'm d
On 12 nov, 18:16, Stefan Behnel wrote:
> Santiago Romero, 12.11.2009 17:43:
>
> > Is there a Python version of C's language #define statements?
>
> > Example:
>
> > #define ReadMem( (x) ) memory[ (x) ]
>
> Yes:
>
> ReadMem = memory.__geti
Is there a Python version of C's language #define statements?
Example:
#define ReadMem( (x) )memory[ (x) ]
Instead of using a function, when you call to ReadMem(), the code is
INCLUDED, (no function is called, the "compiler" just substitues the
ReadMem( expression ) with memory[ (expressio
> > I'm trying to port (just for fun), my old Sinclair Spectrum emulator,
> > ASpectrum, from C to Python + pygame.
>
> The answer to your question is, "Use numpy". More details below.
Let's see :-)
> > How can I implement this in Python, I mean, define a 16 byte variable
> > so that high and
Hi.
I'm trying to port (just for fun), my old Sinclair Spectrum emulator,
ASpectrum, from C to Python + pygame.
Although the Sinclair Spectrum has a simple Z80 8 bit 3.5Mhz
microprocessor, and no aditional hardware (excluding the +2/+3 model's
AYsound chip), I'm not sure if my loved scripted
> If you are reading arbitrary bytes then it will likely not always "look"
> like integers. What you probably meant is:
>
> for i in data:
> print "%d, " % ord(i)
That's it! :-)
Thanks a lot.
--
http://mail.python.org/mailman/listinfo/python-list
Hi.
Until now, all my python programs worked with text files. But now I'm
porting an small old C program I wrote lot of years ago to python and
I'm having problems with datatypes (I think).
some C code:
fp = fopen( file, "rb");
while !feof(fp)
{
value = fgetc(fp);
printf("%d", val
> I want to read text line-by-line from a text file, but want to ignore
> only the first line. I know how to do it in Java (Java has been my
> primary language for the last couple of years) and following is what I
> have in Python, but I don't like it and want to learn the better way
> of doing it.
> I'm curious, what did Python code look like to those of you who have
> seen a bunch of Python code for the first time before k
Clean and readable.
--
http://mail.python.org/mailman/listinfo/python-list
> >> You are using a scripting language.. why not use python directly?
>
> > I just want to execute an small set of commands (PLAYSOUND, PLAYMUSIC,
> > WALKTO, PLAYERSAY, SLEEP and a couple more) ... do you think I can
> > write python code inside my object.exec (list attribute) loaded from a
> > f
This is faster:
http://www.sromero.org/python/zx_parseexec.py
http://www.sromero.org/python/test.par
XD
--
http://mail.python.org/mailman/listinfo/python-list
And the rest of the code:
#
def ExecParser_Exec( exec_type, code, game, debug=0 ):
"""
Execute the previously "compiled" code:
"""
code_level = 0
#player = game.player
#world = game.world
# Take only opco
And the big functions:
I imagine that the following is HORRIBLE in the pythonic-vision and
surely can be rewriten with a single map+reduce+filter + 200 lambdas
functions X-D, but I come from C and any advice on how to implement my
"simple scripting language" without using lex or yacc is welcome
Before I reinvent the wheel, I'm going to post the code.
Feel free to give any advice, and think that I'm new to python, it's
only 1 month since I began programming in python "seriously" (up to
that moment, I wrote just a few log-text parsing system administration
scripts to speed up some old b
> > def ChangeAttribute( object, attribute, value ):
>help(setattr)
>
> Help on built-in function setattr in module __builtin__:
>
> setattr(...) setattr(object, name, value)
>
> Set a named attribute on an object; setattr(x, 'y', v) is
> equivalent to`x.y = v''.
and
> Gary Herron write:
> Yo
Hi...
I'm trying to guess how to access attributes of an existing object
given the attribute name in a string. I mean:
class Object:
self.x = 12
self.y = 20
self.name = "blah"
def ChangeAttribute( object, attribute, value ):
# Insert here the code for object.attribute = value
X
( Surely if this question has been asked for a zillion of times... )
( and sorry for my english! )
I'm impressed with python. I'm very happy with the language and I
find Python+Pygame a very powerful and productive way of writing 2D
games. I'm not, at this moment, worried about execution speed
On 30 ene, 08:09, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> Santiago Romero <[EMAIL PROTECTED]> writes:
>
> > > >>> li = [1,2,3,4,5]
> > > >>> filter(lambda x: x != 3, li)
> > > [1, 2, 4, 5]
>
> > I haven
> how about
>
> >>> li = [1,2,3,4,5]
> >>> filter(lambda x: x != 3, li)
> [1, 2, 4, 5]
I haven't measured it, but this should be the fast solution in all
the thread ...
--
http://mail.python.org/mailman/listinfo/python-list
> Look at this -- from Python 2.5.1:
>
> >>> a = [1, 2, 3, 4, 5]
> >>> for x in a:
> ... if x == 3:
> ... a.remove(x)
> ... print x
Well ... you could use:
>>> for i in range(len(a)-1, -1, -1):
...print a[i]
...if a[i] == 3: del a[i]
...
5
4
3
2
1
>>> print a
[1, 2, 4, 5]
Thanks all for the answers ... I'll use a tuple as you said :)
Anyway, is interesting to know how to sort 2 lists when you dont want
to use tuples, so thanks also to Peter :)
> Then one have to split the list twice.Given the list is large,it's maybe
> not good for performance.Is it a more effe
Hi...
I'm a Linux user, and I would like some windows-friends to test a
game I'm writing with python+pygame without they needing to install
python, pygame, and so on.
I've heard about py2exe and pygame2exe, but I'm not sure on how to
use them to create:
a.- standalone exe files with a single
Hi ...
I have the following DNS MX records info:
domain.com
preference 10 host mx1.domain.com
preference 30 host anotherhost.domain.com
preference 20 host mx2.domain.com
I'm storing this info in 2 lists:
preferences = [10, 30, 20]
hosts = [ "mx1.domain.com", "anotherhost.domain.com",
"mx2.d
> > - Speed Performance: Do you think that changing from list to Array()
> > would improve speed? I'm going to do lots of tilemap[y][x] checks (I
> > mean, player jumping around the screen, checking if it's falling over
> > a non-zero tile, and so).
> First of all: if you have enough memory to use
> Would you care to precisely define "REAL size" first? Consider:
>
> >>> atuple = (1, 2)
> >>> mylist = [(0, 0), atuple]
>
> Should sizeof(mylist) include sizeof(atuple) ?
No, I'm talking about "simple" lists, without REFERENCES to another
objects into it.
I mean:
lists = [ 0, 1, 2, 3, 4, (1
> C:\> \python25\python -m -s
:-)
Thanks a lot :-)
--
http://mail.python.org/mailman/listinfo/python-list
On 9 ene, 17:48, John <[EMAIL PROTECTED]> wrote:
> i want to print something like:
>
> (1sec) working...
> (2sec) working
> (3sec) working.
>
> where the 'working' line isn't being printed each second, but the dots
> are being added with time.
>
> something like:
>
> import time
> s = '.'
>
Is there a way to check the REAL size in memory of a python object?
Something like
> print sizeof(mylist)
or
> print sizeof(myclass_object)
or something like that ...
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
> > This is how I create the tilemap (and the clipboard, a copy of my
> > tilemap):
>
> > def __init__( self, bw, bh, tiles ):
> > self.tilemap = []
> > (...)
> > for i in range(bh):
> > self.tilemap.append([0] * bw)
>def __init__( self, bw, bh, tiles ):
>
Hi :)
First of all, I must apologize for my poor english :)
I'm starting with python and pygame and for testing (and learning)
purposes I wrote an small "Map Editor" for a small game project I'm
going to start next month.
The tilemap editor is working fine, but reading Guido's Van Rossum
PY
36 matches
Mail list logo