Attempting to code a password secure OS.

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
Saustin
Posts: 3
Joined: 28 Sep 2008

Attempting to code a password secure OS.

Post 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.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post 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 .
Saustin
Posts: 3
Joined: 28 Sep 2008

Post 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.
Nightmaretony
In Memoriam
Posts: 618
Joined: 27 Jun 2003
Location: Meadowbrook
Contact:

Post 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.
"My biggest dream in life? Building black plywood Habitrails"
mdpenny
Posts: 50
Joined: 24 Sep 2002
Location: Essex, UK

Post 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
Martin Penny

.sig in beta - full release to follow.
Saustin
Posts: 3
Joined: 28 Sep 2008

Post by Saustin »

Thanks guys. :o
User avatar
dclxvi
Posts: 362
Joined: 11 Mar 2004

Post 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.
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Post 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
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
Post Reply