Password generator: Difference between revisions

Content added Content deleted
(Applesoft BASIC)
Line 33: Line 33:
<!-- or zed, on the other side of the pond. -->
<!-- or zed, on the other side of the pond. -->
<br><br>
<br><br>

=={{header|6502 Assembly}}==
Unfortunately, easy6502 cannot display text, but it does have a random number generator, so this example merely contains the logic for generating the password itself. The screen can only display colored pixels, and the top 4 bytes are masked off, so this is just a visual aid to show the process in action. The X register is loaded with the password's length (in this case, 20 characters, not counting the null terminator.)
<lang 6502asm>LDY #0
LDX #20
LOOP:
LDA $FE ;load a random byte
BMI LOOP ;IF GREATER THAN 7F, ROLL AGAIN
CMP #$21 ;ASCII CODE FOR !
BCC LOOP
CMP #$5C
BEQ LOOP ;NO \
CMP #$60
BEQ LOOP ;NO `
;else, must be a good character
STA $0200,Y
INY
DEX
BNE LOOP
BRK ;end program</lang>



=={{header|8086 Assembly}}==
=={{header|8086 Assembly}}==