| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639 |
- XDEF Password
- XREF __SEG_END_SSTACK,pw_required,byte_out,disp,Keypad,display_string,pressed_num,password,pw_set,pw_reset,pw_check,PORT_S,await_key_release,await_key_press,entered_password,pw_correct
-
- Variables: Section
- pw_char_index ds.b 1
- pw_char ds.b 1
- Constants: Section
- Code: Section
- Password:
- ;push register and accumulator values for retention
- PSHA
- PSHB
- PSHD
- PSHX
- PSHY
-
- ;setting password for the 1st time
- LDAA pw_set
- CMPA #$00
- BEQ PasswordInit
-
- ;user has elected to change the password
- LDAA pw_reset
- CMPA #$FF
- LBEQ PasswordReset
-
- ;user has selected something requiring auth
- LDAA pw_check
- CMPA #$FF
- LBEQ PasswordCheck
-
- LBRA Return
-
-
- PasswordInit:
-
- ;MOVB #$FF,
-
-
- ;inital prompt
- movb #'S',disp
- movb #'e',disp+1
- movb #'t',disp+2
- movb #' ',disp+3
- movb #'p',disp+4
- movb #'a',disp+5
- movb #'s',disp+6
- movb #'s',disp+7
- movb #'w',disp+8
- movb #'o',disp+9
- movb #'r',disp+10
- movb #'d',disp+11
- movb #':',disp+12
- movb #' ',disp+13
- movb #' ',disp+14
- movb #' ',disp+15
- ;next line
- movb #'_',disp+16
- movb #'_',disp+17
- movb #'_',disp+18
- movb #'_',disp+19
- movb #'_',disp+20
- movb #'_',disp+21
- movb #'_',disp+22
- movb #'_',disp+23
- movb #' ',disp+24
- movb #' ',disp+25
- movb #' ',disp+26
- movb #' ',disp+27
- movb #' ',disp+28
- movb #' ',disp+29
- movb #' ',disp+30
- movb #' ',disp+31
- movb #0,disp+32 ;string terminator, acts like '\0'
-
- ;print the prompt string
- LDD #disp ;both of these steps are necessary to
- jsr display_string ;print to the LCD screen
- ;AWAIT KEYPRESS
- movb #$FF,await_key_press
-
- ;READ EACH CHARACTER
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+16 ;change the display to acknowledge input
- MOVB pressed_num,password ;store the read value into the password
- LDD #disp
- jsr display_string
- ;LBRA Return
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+17 ;change the display to acknowledge input
- MOVB pressed_num,password+1 ;store the read value into the password
- LDD #disp
- jsr display_string
- ;LBRA Return
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+18 ;change the display to acknowledge input
- MOVB pressed_num,password+2 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+19 ;change the display to acknowledge input
- MOVB pressed_num,password+3 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+20 ;change the display to acknowledge input
- MOVB pressed_num,password+4 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+21 ;change the display to acknowledge input
- MOVB pressed_num,password+5 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+22 ;change the display to acknowledge input
- MOVB pressed_num,password+6 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+23 ;change the display to acknowledge input
- MOVB pressed_num,password+7 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- ;mark the password as set
- MOVB #$FF,pw_set
- LBRA Return
- PasswordReset:
- ;MOVB #$FF,
-
-
- ;inital prompt
- movb #'C',disp
- movb #'u',disp+1
- movb #'r',disp+2
- movb #'r',disp+3
- movb #'e',disp+4
- movb #'n',disp+5
- movb #'t',disp+6
- movb #' ',disp+7
- movb #'p',disp+8
- movb #'a',disp+9
- movb #'s',disp+10
- movb #'s',disp+11
- movb #'w',disp+12
- movb #'d',disp+13
- movb #'.',disp+14
- movb #':',disp+15
- ;next line
- movb #'_',disp+16
- movb #'_',disp+17
- movb #'_',disp+18
- movb #'_',disp+19
- movb #'_',disp+20
- movb #'_',disp+21
- movb #'_',disp+22
- movb #'_',disp+23
- movb #' ',disp+24
- movb #' ',disp+25
- movb #' ',disp+26
- movb #' ',disp+27
- movb #' ',disp+28
- movb #' ',disp+29
- movb #' ',disp+30
- movb #' ',disp+31
- movb #0,disp+32 ;string terminator, acts like '\0'
-
- ;print the prompt string
- LDD #disp ;both of these steps are necessary to
- jsr display_string ;print to the LCD screen
- ;AWAIT KEYPRESS
- movb #$FF,await_key_press
-
- ;READ EACH CHARACTER
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+16 ;change the display to acknowledge input
- MOVB pressed_num,entered_password ;store the read value into the password
- LDD #disp
- jsr display_string
- ;LBRA Return
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+17 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+1 ;store the read value into the password
- LDD #disp
- jsr display_string
- ;LBRA Return
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+18 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+2 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+19 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+3 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+20 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+4 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+21 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+5 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+22 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+6 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+23 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+7 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- ;check if the password is correct
- LDX #password
- LDY #entered_password
-
- ;read the current password character and compare it to the new password character
- ;this resets if the password is incorrect
- ;1.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordReset
-
- INX
- INY
-
- ;2.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordReset
-
- INX
- INY
-
- ;3.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordReset
-
- INX
- INY
-
- ;4.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordReset
-
- INX
- INY
-
- ;5.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordReset
-
- INX
- INY
-
- ;6.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordReset
-
- INX
- INY
-
- ;7.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordReset
-
- INX
- INY
-
- ;8.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordReset
-
- ;inital prompt
- movb #'N',disp
- movb #'e',disp+1
- movb #'w',disp+2
- movb #' ',disp+3
- movb #'p',disp+4
- movb #'a',disp+5
- movb #'s',disp+6
- movb #'s',disp+7
- movb #'w',disp+8
- movb #'o',disp+9
- movb #'r',disp+10
- movb #'d',disp+11
- movb #':',disp+12
- movb #' ',disp+13
- movb #' ',disp+14
- movb #' ',disp+15
- ;next line
- movb #'_',disp+16
- movb #'_',disp+17
- movb #'_',disp+18
- movb #'_',disp+19
- movb #'_',disp+20
- movb #'_',disp+21
- movb #'_',disp+22
- movb #'_',disp+23
- movb #' ',disp+24
- movb #' ',disp+25
- movb #' ',disp+26
- movb #' ',disp+27
- movb #' ',disp+28
- movb #' ',disp+29
- movb #' ',disp+30
- movb #' ',disp+31
- movb #0,disp+32 ;string terminator, acts like '\0'
-
- ;print the prompt string
- LDD #disp ;both of these steps are necessary to
- jsr display_string ;print to the LCD screen
- ;AWAIT KEYPRESS
- movb #$FF,await_key_press
-
- ;READ EACH CHARACTER
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+16 ;change the display to acknowledge input
- MOVB pressed_num,password ;store the read value into the password
- LDD #disp
- jsr display_string
- ;LBRA Return
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+17 ;change the display to acknowledge input
- MOVB pressed_num,password+1 ;store the read value into the password
- LDD #disp
- jsr display_string
- ;LBRA Return
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+18 ;change the display to acknowledge input
- MOVB pressed_num,password+2 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+19 ;change the display to acknowledge input
- MOVB pressed_num,password+3 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+20 ;change the display to acknowledge input
- MOVB pressed_num,password+4 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+21 ;change the display to acknowledge input
- MOVB pressed_num,password+5 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+22 ;change the display to acknowledge input
- MOVB pressed_num,password+6 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+23 ;change the display to acknowledge input
- MOVB pressed_num,password+7 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- ;password has been reset
- MOVB #$00,pw_reset
- LBRA Return
- PasswordCheck:
- ;MOVB #$FF,
-
-
- ;inital prompt
- movb #'E',disp
- movb #'n',disp+1
- movb #'t',disp+2
- movb #'e',disp+3
- movb #'r',disp+4
- movb #' ',disp+5
- movb #'p',disp+6
- movb #'a',disp+7
- movb #'s',disp+8
- movb #'s',disp+9
- movb #'w',disp+10
- movb #'o',disp+11
- movb #'r',disp+12
- movb #'d',disp+13
- movb #':',disp+14
- movb #' ',disp+15
- ;next line
- movb #'_',disp+16
- movb #'_',disp+17
- movb #'_',disp+18
- movb #'_',disp+19
- movb #'_',disp+20
- movb #'_',disp+21
- movb #'_',disp+22
- movb #'_',disp+23
- movb #' ',disp+24
- movb #' ',disp+25
- movb #' ',disp+26
- movb #' ',disp+27
- movb #' ',disp+28
- movb #' ',disp+29
- movb #' ',disp+30
- movb #' ',disp+31
- movb #0,disp+32 ;string terminator, acts like '\0'
-
- ;print the prompt string
- LDD #disp ;both of these steps are necessary to
- jsr display_string ;print to the LCD screen
- ;AWAIT KEYPRESS
- movb #$FF,await_key_press
-
- ;READ EACH CHARACTER
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+16 ;change the display to acknowledge input
- MOVB pressed_num,entered_password ;store the read value into the password
- LDD #disp
- jsr display_string
- ;LBRA Return
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+17 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+1 ;store the read value into the password
- LDD #disp
- jsr display_string
- ;LBRA Return
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+18 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+2 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+19 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+3 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+20 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+4 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+21 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+5 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+22 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+6 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- MOVB #$FF,await_key_release
- jsr Keypad ;read a keypress
- movb #'*',disp+23 ;change the display to acknowledge input
- MOVB pressed_num,entered_password+7 ;store the read value into the password
- LDD #disp
- jsr display_string
-
- ;check if the password is correct
- LDX #password
- LDY #entered_password
-
- ;read the current password character and compare it to the new password character
- ;this resets if the password is incorrect
- ;1.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordCheck
-
- INX
- INY
-
- ;2.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordCheck
-
- INX
- INY
-
- ;3.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordCheck
-
- INX
- INY
-
- ;4.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordCheck
-
- INX
- INY
-
- ;5.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordCheck
-
- INX
- INY
-
- ;6.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordCheck
-
- INX
- INY
-
- ;7.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordCheck
-
- INX
- INY
-
- ;8.
- LDAA 0,X
- LDAB 0,Y
- CBA
- LBNE PasswordCheck
-
- CLR pw_required
-
- BRA Return
-
- Return:
- ;here, set the pressed number to something impossible so that
- ;the password input doesn't spill into other code
- MOVB #$FF,pressed_num ;set the pressed_num to something impossible
- ;restore registers and accumulators
- PULY
- PULX
- PULD
- PULB
- PULA
-
- RTS
|