Page 1 of 1

Attempting to code a password secure OS.

Posted: Sun Sep 28, 2008 6:53 am
by Saustin
I'm making a Operating System as my first project in 6502 Commodore asembly.

I have ran into a stump..
I know how to:
Grab input, Print output, and all that good stuff.

However, I'm trying to make a password protection part, and idiodically I thought of a simple code, which doesn't work.


I'm not coding in a macro assembler, please, I don't like them.

So, how can I get a word [over atleast 5 letters], store them at a location in the RAM, then compare them?



Offtopic:
How could I make a random number generator, aswell? Mucho gracias.
- Saustin.

Posted: Sun Sep 28, 2008 7:33 am
by GARTHWILSON
That's a pretty general question. Maybe you should post your code and let the forum members inspect it. A couple of ways to do it are at http://6502.org/source/strings/patmatch.htm and http://6502.org/source/strings/comparisons.html on this web site. I have not looked at them in any detail. You may be able to shorten them for your application.

There's a random-number generator at http://6502.org/source/integers/random/random.html also on this website, from Bruce who's very good at algorithms. It looks like he has various versions there.

You say however,
Quote:
I'm making a Operating System as my first project in 6502 Commodore asembly
and
Quote:
I'm not coding in a macro assembler, please, I don't like them.
Are you just hand-assembling? That's actually good for beginners; but to get to projects of any substantial size, you will eventually have to use an assembler. A macroassembler does not mean you have to use macros, but writing and using them effectively raises the level of the language to the next step, making code more efficient, more manageable and maintainable, and more bug-free, without penalties in run speed or code size. I give a couple examples of macros in my tips at viewtopic.php?p=2341#2341 .

Posted: Sun Sep 28, 2008 8:07 am
by Saustin
GARTHWILSON wrote:
That's a pretty general question. Maybe you should post your code and let the forum members inspect it. A couple of ways to do it are at http://6502.org/source/strings/patmatch.htm and http://6502.org/source/strings/comparisons.html on this web site. I have not looked at them in any detail. You may be able to shorten them for your application.

There's a random-number generator at http://6502.org/source/integers/random/random.html also on this website, from Bruce who's very good at algorithms. It looks like he has various versions there.

You say however,
Quote:
I'm making a Operating System as my first project in 6502 Commodore asembly
and
Quote:
I'm not coding in a macro assembler, please, I don't like them.
Are you just hand-assembling? That's actually good for beginners; but to get to projects of any substantial size, you will eventually have to use an assembler. A macroassembler does not mean you have to use macros, but writing and using them effectively raises the level of the language to the next step, making code more efficient, more manageable and maintainable, and more bug-free, without penalties in run speed or code size. I give a couple examples of macros in my tips at viewtopic.php?p=2341#2341 .
Mighty thanks for the fast response, and yes, I'm quite a beginner.
Thanks for those 3 links, they look quite good. I guess Jim Butterfield's book won't teach you all of that, will it? Not really.
By the way, as my assembler if you think I was POKEing each byte into memory, that'd be kind of sad, I was actually using my C-128's [yes it's a emulator] with it's monitor to do that.

What assembler do you recommend, by the way?

Again, thanks. I will look into using a different form of assembler.

Posted: Sun Sep 28, 2008 7:53 pm
by Nightmaretony
My personal favorite is the Mike Kowalski assembler. It is a freebie linked in here. I've been doing a pinball program with it.

Posted: Sun Sep 28, 2008 7:53 pm
by mdpenny
Saustin wrote:
What assembler do you recommend, by the way?
I've been making use of Douglas Beattie's "MAS65" assembler - at least, the DOS version of it, as I can get it to run in a command window under Windows XP.

Link:
http://www.hytherion.com/beattidp/comput/x65tools/

HTH,

--Martin

Posted: Sun Sep 28, 2008 8:26 pm
by Saustin
Thanks guys. :o

Posted: Mon Sep 29, 2008 3:18 am
by dclxvi
GARTHWILSON wrote:
There's a random-number generator at http://6502.org/source/integers/random/random.html also on this website, from Bruce who's very good at algorithms. It looks like he has various versions there.
I should point out that even though there are several routines, it's only one type of generator, specifically a linear congruential generator. The routines give you many ways to use the generator, whether you're looking for small space, fast speed, 8 or 16-bit random integers, or something that can be used from EhBASIC.

In addition to my routines, among the many fine items on Lee Davison's website are a couple of routines for a different type of generator, an LFSR. They are at:

http://members.lycos.co.uk/leeedavison/ ... /prng.html

Not to hijack the thread, but I was recently monkeying around with a variation on the LFSR / combined Tausworthe theme, in an attempt to address the limitations of just a plain old LFSR. The result has a several nice features: all 2^32 values are equally likely, it's easy to seed, its period can be made very long (over 2^6972593, though you need more than 64k to hold that much state, so you'd probably go with a 65816 there), it makes efficient use of state, and it is extremely fast. I've only worked out a small amount of the theory (enough to support my previous claims), but the result of the initial experiments were astonishingly (to me) promising. I have not yet subjected it to any of the various randomness statistical test suites out there, but I've grabbed a few of them from the web (NIST, L'Ecuyer, Diehard), and I'd like try them sometime.

Posted: Mon Sep 29, 2008 12:20 pm
by BitWise
Saustin wrote:
What assembler do you recommend, by the way?
I wrote my own macro-assembler/linker/librarian package in Java a while back when XP's second support pack broke DOS compatibility. It supports the 6502/65C02/65816 and a few other variants.

http://www.obelisk.demon.co.uk/files/6502.zip