mirror of
https://git.soft.fish/val/MicroCorruption.git
synced 2024-11-24 16:25:59 +00:00
208 lines
6.5 KiB
NASM
208 lines
6.5 KiB
NASM
4b66 <run>
|
|
4b66: 0b12 push index
|
|
4b68: 0a12 push r10
|
|
4b6a: 0912 push r9
|
|
4b6c: 0812 push r8
|
|
4b6e: 0712 push r7
|
|
; allocate 0x600 buffer on stack. Woah!
|
|
4b70: 3150 00fa add #0xfa00, sp
|
|
|
|
; r8 = create_hash_table (0x3, 0x5)
|
|
4b74: 3e40 0500 mov #0x5, r14
|
|
4b78: 3f40 0300 mov #0x3, r15
|
|
4b7c: b012 7847 call #0x4778 <create_hash_table>
|
|
4b80: 084f mov r15, r8 ; save result
|
|
|
|
; print out some shit
|
|
4b82: 3f40 384a mov #0x4a38, r15
|
|
4b86: b012 504d call #0x4d50 <puts>
|
|
4b8a: 3f40 584a mov #0x4a58, r15
|
|
4b8e: b012 504d call #0x4d50 <puts>
|
|
4b92: 3f40 954a mov #0x4a95, r15
|
|
4b96: b012 504d call #0x4d50 <puts>
|
|
|
|
; zero out the stack buffer allocated above
|
|
4b9a: 0e43 clr r14
|
|
4b9c: 3740 ff05 mov #0x5ff, r7
|
|
4ba0: 053c jmp $+0xc <run+0x46>
|
|
; run+0x3c
|
|
4ba2: 0f41 mov sp, r15
|
|
4ba4: 0f5e add r14, r15
|
|
4ba6: cf43 0000 mov.b #0x0, 0x0(r15)
|
|
4baa: 1e53 inc r14
|
|
; run+0x46:
|
|
4bac: 079e cmp r14, r7
|
|
4bae: f937 jge $-0xc <run+0x3c>
|
|
|
|
; get 0x550 characters -> stack buffer
|
|
4bb0: 3e40 5005 mov #0x550, r14
|
|
4bb4: 0f41 mov sp, r15
|
|
4bb6: b012 404d call #0x4d40 <getsn>
|
|
; run+0x54:
|
|
4bba: 0b41 mov sp, index
|
|
4bbc: 923c jmp $+0x126 <run+0x17c>
|
|
; check for 'a'
|
|
__access_check:
|
|
4bbe: 7f90 6100 cmp.b #0x61, r15
|
|
4bc2: 3a20 jnz $+0x76 <run+0xd2> ; __access%20_check
|
|
4bc4: 0e4b mov index, r14
|
|
4bc6: 3e50 0700 add #0x7, r14
|
|
4bca: 0b4e mov r14, index
|
|
4bcc: 073c jmp $+0x10 <run+0x76>
|
|
; run+0x68:
|
|
; check for ' '
|
|
4bce: 7f90 2000 cmp.b #0x20, r15
|
|
4bd2: 0320 jnz $+0x8 <run+0x74>
|
|
4bd4: cb43 0000 mov.b #0x0, 0x0(index)
|
|
4bd8: 043c jmp $+0xa <run+0x7c>
|
|
4bda: 1b53 inc index
|
|
; run+0x76:
|
|
4bdc: 6f4b mov.b @index, r15
|
|
4bde: 4f93 tst.b r15
|
|
4be0: f623 jnz $-0x12 <run+0x68>
|
|
; run+0x7c:
|
|
4be2: 1b53 inc index
|
|
4be4: 0a43 clr r10
|
|
4be6: 0b3c jmp $+0x18 <run+0x98>
|
|
; run+0x82:
|
|
; r13 =
|
|
4be8: 0d4a mov r10, r13
|
|
4bea: 0d5d add r13, r13
|
|
4bec: 0d5d add r13, r13
|
|
4bee: 0d5a add r10, r13
|
|
4bf0: 0d5d add r13, r13
|
|
|
|
4bf2: 6a4b mov.b @index, r10
|
|
4bf4: 8a11 sxt r10
|
|
4bf6: 3a50 d0ff add #0xffd0, r10
|
|
4bfa: 0a5d add r13, r10
|
|
4bfc: 1b53 inc index
|
|
; run+0x98:
|
|
4bfe: 6f4b mov.b @index, r15
|
|
4c00: 4f93 tst.b r15
|
|
4c02: 0324 jz $+0x8 <run+0xa4>
|
|
; check for ';'
|
|
4c04: 7f90 3b00 cmp.b #0x3b, r15
|
|
4c08: ef23 jnz $-0x20 <run+0x82>
|
|
; run+0xa4:
|
|
4c0a: 0f48 mov r8, r15
|
|
4c0c: b012 cc49 call #0x49cc <get_from_table>
|
|
4c10: 3f93 cmp #-0x1, r15
|
|
4c12: 0320 jnz $+0x8 <run+0xb4>
|
|
; No such box.
|
|
4c14: 3f40 964a mov #0x4a96, r15
|
|
4c18: 413c jmp $+0x84 <run+0x136>
|
|
4c1a: 0aef xor r15, r10
|
|
4c1c: 3af0 ff7f and #0x7fff, r10
|
|
4c20: 0820 jnz $+0x12 <run+0xcc>
|
|
4c22: 0f9a cmp r10, r15
|
|
4c24: 0334 jge $+0x8 <run+0xc6>
|
|
; Access granted
|
|
4c26: 3f40 a34a mov #0x4aa3, r15
|
|
4c2a: 383c jmp $+0x72 <run+0x136>
|
|
; Access granted, but account not activated.
|
|
4c2c: 3f40 b34a mov #0x4ab3, r15
|
|
4c30: 353c jmp $+0x6c <run+0x136>
|
|
; Aceess denied [sic]
|
|
4c32: 3f40 de4a mov #0x4ade, r15
|
|
4c36: 323c jmp $+0x66 <run+0x136>
|
|
; run+0xd2:
|
|
; check for 'n'
|
|
__n_check:
|
|
4c38: 7f90 6e00 cmp.b #0x6e, r15
|
|
4c3c: 4020 jnz $+0x82 <run+0x158>
|
|
4c3e: 094b mov index, r9
|
|
4c40: 2952 add #0x4, r9
|
|
4c42: 0b49 mov r9, index
|
|
4c44: 073c jmp $+0x10 <run+0xee>
|
|
; run+0xe0
|
|
; check for ' '
|
|
4c46: 7f90 2000 cmp.b #0x20, r15
|
|
4c4a: 0320 jnz $+0x8 <run+0xec>
|
|
4c4c: cb43 0000 mov.b #0x0, 0x0(index) ; if next char is space, skip it
|
|
4c50: 043c jmp $+0xa <run+0xf4>
|
|
; run+0xec
|
|
4c52: 1b53 inc index
|
|
4c54: 6f4b mov.b @index, r15
|
|
4c56: 4f93 tst.b r15
|
|
4c58: f623 jnz $-0x12 <run+0xe0>
|
|
4c5a: 1b53 inc index
|
|
4c5c: 0a43 clr r10
|
|
4c5e: 0b3c jmp $+0x18 <run+0x110>
|
|
|
|
_to_decimal: ; convert the ascii in r10 to decimal?
|
|
4c60: 0c4a mov r10, r12
|
|
4c62: 0c5c add r12, r12 ; x2
|
|
4c64: 0c5c add r12, r12 ; x4
|
|
4c66: 0c5a add r10, r12 ; x5
|
|
4c68: 0c5c add r12, r12 ; xA
|
|
4c6a: 6a4b mov.b @index, r10
|
|
4c6c: 8a11 sxt r10
|
|
; Subtract 0x30
|
|
4c6e: 3a50 d0ff add #0xffd0, r10
|
|
4c72: 0a5c add r12, r10
|
|
4c74: 1b53 inc index
|
|
; run+0x110
|
|
4c76: 6f4b mov.b @index, r15
|
|
4c78: 4f93 tst.b r15
|
|
4c7a: 0324 jz $+0x8 <run+0x11c>
|
|
|
|
; check for ';'
|
|
4c7c: 7f90 3b00 cmp.b #0x3b, r15
|
|
4c80: ef23 jnz $-0x20 <run+0xfa>
|
|
4c82: 0a93 tst r10
|
|
4c84: 0334 jge $+0x8 <run+0x126>
|
|
|
|
; Can not have pin with high bit set
|
|
4c86: 3f40 ec4a mov #0x4aec, r15
|
|
4c8a: 083c jmp $+0x12 <run+0x136>
|
|
|
|
4c8c: 0e49 mov r9, r14
|
|
4c8e: 0f48 mov r8, r15
|
|
4c90: b012 cc49 call #0x49cc <get_from_table>
|
|
4c94: 3f93 cmp #-0x1, r15
|
|
4c96: 0524 jz $+0xc <run+0x13c>
|
|
; User already has an account
|
|
4c98: 3f40 124b mov #0x4b12, r15
|
|
4c9c: b012 504d call #0x4d50 <puts>
|
|
4ca0: 1c3c jmp $+0x3a <run+0x174>
|
|
|
|
add_user_account:
|
|
4ca2: 0a12 push r10
|
|
4ca4: 0912 push r9
|
|
4ca6: 3012 2f4b push #0x4b2f
|
|
4caa: b012 4844 call #0x4448 <printf>
|
|
4cae: 3150 0600 add #0x6, sp
|
|
4cb2: 0d4a mov r10, r13
|
|
4cb4: 0e49 mov r9, r14
|
|
4cb6: 0f48 mov r8, r15
|
|
4cb8: b012 3248 call #0x4832 <add_to_table>
|
|
4cbc: 0e3c jmp $+0x1e <run+0x174> ; NOT strings
|
|
; end of the function:
|
|
4cbe: 3f40 544b mov #0x4b54, r15
|
|
4cc2: b012 504d call #0x4d50 <puts>
|
|
failure_case:
|
|
4cc6: 1f43 mov #0x1, r15
|
|
4cc8: 3150 0006 add #0x600, sp
|
|
run_end:
|
|
4ccc: 3741 pop r7
|
|
4cce: 3841 pop r8
|
|
4cd0: 3941 pop r9
|
|
4cd2: 3a41 pop r10
|
|
4cd4: 3b41 pop index
|
|
4cd6: 3041 ret
|
|
|
|
; loop_end
|
|
4cd8: 1b53 inc index
|
|
; check for ';'
|
|
4cda: fb90 3b00 0000 cmp.b #0x3b, 0x0(index)
|
|
4ce0: fb27 jz $-0x8 <run+0x172>
|
|
; end of the loop
|
|
; run+0x17c:
|
|
4ce2: 6f4b mov.b @index, r15
|
|
4ce4: 4f93 tst.b r15
|
|
4ce6: 6b23 jnz $-0x128 <run+0x58> ; 4bbe
|
|
; cleanup
|
|
4ce8: 0e43 clr r14
|
|
4cea: 603f jmp $-0x13e <run+0x46>
|