.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 get_password
.global check_password
.global unlock_door
.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 0x4586(r15), 0x2400(r15)
.org 0x4422
jnz -0xc
.org 0x4424
__do_clear_bss: clr r15
.org 0x4426
nop
.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: add #0xff9c, r1
.org 0x443c
mov #0x44a8 , r15
.org 0x4440
call #0x4558
.org 0x4444
mov r1, r15
.org 0x4446
call #0x447a
.org 0x444a
mov r1, r15
.org 0x444c
call #0x4484
.org 0x4450
tst r15
.org 0x4452
jnz 0xa
.org 0x4454
mov #0x44c7 , r15
.org 0x4458
call #0x4558
.org 0x445c
jmp 0xc
.org 0x445e
mov #0x44e4 , r15
.org 0x4462
call #0x4558
.org 0x4466
call #0x449c
.org 0x446a
clr r15
.org 0x446c
add #0x64, r1
.org 0x4470
__stop_progExec__: bis #0xf0, r2
.org 0x4474
jmp -0x4
.org 0x4476
__ctors_end: br #0x4584
.org 0x447a
get_password: mov #0x64, r14
.org 0x447e
call #0x4548
.org 0x4482
ret
.org 0x4484
check_password: mov.b @r15, r14
.org 0x4486
inc r15
.org 0x4488
inc r12
.org 0x448a
tst r14
.org 0x448c
jnz -0x8
.org 0x448e
cmp #0x9, r12
.org 0x4492
jeq 0x4
.org 0x4494
clr r15
.org 0x4496
ret
.org 0x4498
mov #0x1, r15
.org 0x449a
ret
.org 0x449c
unlock_door: push #0x7f
.org 0x44a0
call #0x44f4
.org 0x44a4
incd r1
.org 0x44a6
ret
.org 0x44a8
.strings: .string "Enter the password to continue"
.org 0x44c7
.string "Invalid password; try again."
.org 0x44e4
.string "Access Granted!"
.org 0x44f4
INT: mov 0x2(r1), r14
.org 0x44f8
push r2
.org 0x44fa
mov r14, r15
.org 0x44fc
swpb r15
.org 0x44fe
mov r15, r2
.org 0x4500
bis #0x8000, r2
.org 0x4504
call #0x10
.org 0x4508
pop r2
.org 0x450a
ret
.org 0x450c
putchar: decd r1
.org 0x450e
push r15
.org 0x4510
push #0x0
.org 0x4512
mov r15, 0x4(r1)
.org 0x4516
call #0x44f4
.org 0x451a
mov 0x4(r1), r15
.org 0x451e
add #0x6, r1
.org 0x4522
ret
.org 0x4524
getchar: push r4
.org 0x4526
mov r1, r4
.org 0x4528
incd r4
.org 0x452a
decd r1
.org 0x452c
mov #0xfffc, r15
.org 0x4530
add r4, r15
.org 0x4532
push r15
.org 0x4534
push #0x1
.org 0x4536
call #0x44f4
.org 0x453a
mov.b -0x4(r4), r15
.org 0x453e
sxt r15
.org 0x4540
add #0x6, r1
.org 0x4544
pop r4
.org 0x4546
ret
.org 0x4548
getsn: push r14
.org 0x454a
push r15
.org 0x454c
push #0x2
.org 0x454e
call #0x44f4
.org 0x4552
add #0x6, r1
.org 0x4556
ret
.org 0x4558
puts: push r11
.org 0x455a
mov r15, r11
.org 0x455c
jmp 0xe
.org 0x455e
inc r11
.org 0x4560
sxt r15
.org 0x4562
push r15
.org 0x4564
push #0x0
.org 0x4566
call #0x44f4
.org 0x456a
add #0x4, r1
.org 0x456c
mov.b @r11, r15
.org 0x456e
tst.b r15
.org 0x4570
jnz -0x12
.org 0x4572
push #0xa
.org 0x4576
push #0x0
.org 0x4578
call #0x44f4
.org 0x457c
add #0x4, r1
.org 0x457e
clr r15
.org 0x4580
pop r11
.org 0x4582
ret
.org 0x4584
_unexpected_: reti pc
