.global __trap_interrupt
.global __init_stack
.global __low_level_init
.global __do_copy_data
.global __do_clear_bss
.global main
.global __stop_progExec__
.global __ctors_end
.global unlock_door
.global test_password_valid
.global login
.global INT
.global putchar
.global getchar
.global getsn
.global puts
.global _unexpected_

.text
.org 0x10
__trap_interrupt: ret
.org 0x4400
__init_stack: mov #0x4400, r1
.org 0x4404
__low_level_init: mov &0x015c, r5
.org 0x4408
and.b #-0x1, r5
.org 0x440a
bis #0x5a08, r5
.org 0x440e
__do_copy_data: clr r15
.org 0x4410
nop
.org 0x4412
tst r15
.org 0x4414
jz 0xe
.org 0x4416
mov r5, &0x015c
.org 0x441a
decd r15
.org 0x441c
mov 0x460c(r15), 0x2400(r15)
.org 0x4422
jnz -0xc
.org 0x4424
__do_clear_bss: mov #0x22, r15
.org 0x4428
tst r15
.org 0x442a
jz 0xc
.org 0x442c
mov r5, &0x015c
.org 0x4430
dec r15
.org 0x4432
mov.b #0x0, 0x2400(r15)
.org 0x4436
jnz -0xa
.org 0x4438
main: call #0x4520
.org 0x443c
clr r15
.org 0x443e
__stop_progExec__: bis #0xf0, r2
.org 0x4442
jmp -0x4
.org 0x4444
__ctors_end: br #0x460a
.org 0x4448
unlock_door: push #0x7f
.org 0x444c
call #0x457a
.org 0x4450
incd r1
.org 0x4452
ret
.org 0x4454
test_password_valid: push r4
.org 0x4456
mov r1, r4
.org 0x4458
incd r4
.org 0x445a
decd r1
.org 0x445c
mov.b #0x0, -0x4(r4)
.org 0x4460
mov #0xfffc, r14
.org 0x4464
add r4, r14
.org 0x4466
push r14
.org 0x4468
push r15
.org 0x446a
push #0x7d
.org 0x446e
call #0x457a
.org 0x4472
mov.b -0x4(r4), r15
.org 0x4476
sxt r15
.org 0x4478
add #0x8, r1
.org 0x447a
pop r4
.org 0x447c
ret
.org 0x447e
.strings: .string "Enter the password to continue."
.org 0x449e
.string "Remember: passwords are between 8 and 16 characters."
.org 0x44d3
.string "Testing if password is valid."
.org 0x44f1
.string "Access granted."
.org 0x4501
.string "That password is not correct."
.org 0x451f
.string ""
.org 0x4520
login: mov.b #0x0, &0x2410
.org 0x4524
mov #0x447e , r15
.org 0x4528
call #0x45de
.org 0x452c
mov #0x449e , r15
.org 0x4530
call #0x45de
.org 0x4534
mov #0x1c, r14
.org 0x4538
mov #0x2400, r15
.org 0x453c
call #0x45ce
.org 0x4540
mov #0x2400, r15
.org 0x4544
call #0x4454
.org 0x4548
tst r15
.org 0x454a
jz $+0x8
.org 0x454c
mov.b #0x31, &0x2410
.org 0x4552
mov #0x44d3 , r15
.org 0x4556
call #0x45de
.org 0x455a
cmp.b #0x96, &0x2410
.org 0x4560
jne 0xe
.org 0x4562
mov #0x44f1 , r15
.org 0x4566
call #0x45de
.org 0x456a
call #0x4448
.org 0x456e
ret
.org 0x4570
mov #0x4501 , r15
.org 0x4574
call #0x45de
.org 0x4578
ret
.org 0x457a
INT: mov 0x2(r1), r14
.org 0x457e
push r2
.org 0x4580
mov r14, r15
.org 0x4582
swpb r15
.org 0x4584
mov r15, r2
.org 0x4586
bis #0x8000, r2
.org 0x458a
call #0x10
.org 0x458e
pop r2
.org 0x4590
ret
.org 0x4592
putchar: decd r1
.org 0x4594
push r15
.org 0x4596
push #0x0
.org 0x4598
mov r15, 0x4(r1)
.org 0x459c
call #0x457a
.org 0x45a0
mov 0x4(r1), r15
.org 0x45a4
add #0x6, r1
.org 0x45a8
ret
.org 0x45aa
getchar: push r4
.org 0x45ac
mov r1, r4
.org 0x45ae
incd r4
.org 0x45b0
decd r1
.org 0x45b2
mov #0xfffc, r15
.org 0x45b6
add r4, r15
.org 0x45b8
push r15
.org 0x45ba
push #0x1
.org 0x45bc
call #0x457a
.org 0x45c0
mov.b -0x4(r4), r15
.org 0x45c4
sxt r15
.org 0x45c6
add #0x6, r1
.org 0x45ca
pop r4
.org 0x45cc
ret
.org 0x45ce
getsn: push r14
.org 0x45d0
push r15
.org 0x45d2
push #0x2
.org 0x45d4
call #0x457a
.org 0x45d8
add #0x6, r1
.org 0x45dc
ret
.org 0x45de
puts: push r11
.org 0x45e0
mov r15, r11
.org 0x45e2
jmp 0xe
.org 0x45e4
inc r11
.org 0x45e6
sxt r15
.org 0x45e8
push r15
.org 0x45ea
push #0x0
.org 0x45ec
call #0x457a
.org 0x45f0
add #0x4, r1
.org 0x45f2
mov.b @r11, r15
.org 0x45f4
tst.b r15
.org 0x45f6
jnz -0x12
.org 0x45f8
push #0xa
.org 0x45fc
push #0x0
.org 0x45fe
call #0x457a
.org 0x4602
add #0x4, r1
.org 0x4604
clr r15
.org 0x4606
pop r11
.org 0x4608
ret
.org 0x460a
_unexpected_: reti pc
