{$CLEO .s} {$USE debug} {$USE file} {$USE bitwise} var 0@ : Integer var 1@ : Integer var 2@ : Integer var 3@ : Integer var 4@ : Integer var 5@ : Integer var 6@ : Integer var 7@ : Integer var 8@ : Integer var 9@ : Integer var 10@ : Integer goto @DATA_END hex FF EE DD CC BB AA 99 88 77 66 55 44 33 22 11 00 end :DATA_END script_name "2301" // read_block_from_file debug_on trace "2301 (read_block_from_file)" // open the file wait 0 if 0@ = open_file ".\2301.s" {mode} "r" then trace "~g~~h~~h~2301 (read_block_from_file), #0 PASSED" else breakpoint "~r~~h~~h~~h~2301 (read_block_from_file), #0 FAILED! Failed to open file." end // seek file to hex data block wait 0 file_seek 0@ {offset} 7 {origin} SeekOrigin.Begin trace "~g~~h~~h~2301 (read_block_from_file), #1 PASSED" // read 0 bytes wait 0 1@ = 0xcccccccc 2@ = 0xcccccccc 3@ = 0xcccccccc 4@ = 0xcccccccc 5@ = get_var_pointer 2@ if 2301: read_block_from_file 0@ {size} 0 {destination} 5@ // tested opcode then trace "~g~~h~~h~2301 (read_block_from_file), #2 PASSED" else breakpoint "~r~~h~~h~~h~2301 (read_block_from_file), #2 FAILED! Condition result: FALSE" end if and 1@ == 0xcccccccc 2@ == 0xcccccccc 3@ == 0xcccccccc 4@ == 0xcccccccc then trace "~g~~h~~h~2301 (read_block_from_file), #3 PASSED" else breakpoint "~r~~h~~h~~h~2301 (read_block_from_file), #3 FAILED!~n~%08x %08x %08x %08x Expected~n~%08x %08x %08x %08x Occured" 0xcccccccc 0xcccccccc 0xcccccccc 0xcccccccc 1@ 2@ 3@ 4@ end // read 1 byte wait 0 1@ = 0xcccccccc 2@ = 0xcccccccc 3@ = 0xcccccccc 4@ = 0xcccccccc 5@ = get_var_pointer 2@ 2301: read_block_from_file 0@ {size} 1 {destination} 5@ // tested opcode if and 1@ == 0xcccccccc 2@ == 0xccccccff 3@ == 0xcccccccc 4@ == 0xcccccccc then trace "~g~~h~~h~2301 (read_block_from_file), #4 PASSED" else breakpoint "~r~~h~~h~~h~2301 (read_block_from_file), #4 FAILED!~n~%08x %08x %08x %08x Expected~n~%08x %08x %08x %08x Occured" 0xcccccccc 0xccccccff 0xcccccccc 0xcccccccc 1@ 2@ 3@ 4@ end // read 2 bytes wait 0 1@ = 0xcccccccc 2@ = 0xcccccccc 3@ = 0xcccccccc 4@ = 0xcccccccc 5@ = get_var_pointer 2@ 2301: read_block_from_file 0@ {size} 2 {destination} 5@ // tested opcode if and 1@ == 0xcccccccc 2@ == 0xccccddee 3@ == 0xcccccccc 4@ == 0xcccccccc then trace "~g~~h~~h~2301 (read_block_from_file), #5 PASSED" else breakpoint "~r~~h~~h~~h~2301 (read_block_from_file), #5 FAILED!~n~%08x %08x %08x %08x Expected~n~%08x %08x %08x %08x Occured" 0xcccccccc 0xccccddee 0xcccccccc 0xcccccccc 1@ 2@ 3@ 4@ end // read 3 bytes wait 0 1@ = 0xcccccccc 2@ = 0xcccccccc 3@ = 0xcccccccc 4@ = 0xcccccccc 5@ = get_var_pointer 2@ 2301: read_block_from_file 0@ {size} 3 {destination} 5@ // tested opcode if and 1@ == 0xcccccccc 2@ == 0xccaabbcc 3@ == 0xcccccccc 4@ == 0xcccccccc then trace "~g~~h~~h~2301 (read_block_from_file), #6 PASSED" else breakpoint "~r~~h~~h~~h~2301 (read_block_from_file), #6 FAILED!~n~%08x %08x %08x %08x Expected~n~%08x %08x %08x %08x Occured" 0xcccccccc 0xccaabbcc 0xcccccccc 0xcccccccc 1@ 2@ 3@ 4@ end // read 4 bytes wait 0 1@ = 0xcccccccc 2@ = 0xcccccccc 3@ = 0xcccccccc 4@ = 0xcccccccc 5@ = get_var_pointer 2@ 2301: read_block_from_file 0@ {size} 4 {destination} 5@ // tested opcode if and 1@ == 0xcccccccc 2@ == 0x66778899 3@ == 0xcccccccc 4@ == 0xcccccccc then trace "~g~~h~~h~2301 (read_block_from_file), #7 PASSED" else breakpoint "~r~~h~~h~~h~2301 (read_block_from_file), #7 FAILED!~n~%08x %08x %08x %08x Expected~n~%08x %08x %08x %08x Occured" 0xcccccccc 0x66778899 0xcccccccc 0xcccccccc 1@ 2@ 3@ 4@ end // read 6 bytes wait 0 1@ = 0xcccccccc 2@ = 0xcccccccc 3@ = 0xcccccccc 4@ = 0xcccccccc 5@ = get_var_pointer 2@ 2301: read_block_from_file 0@ {size} 6 {destination} 5@ // tested opcode if and 1@ == 0xcccccccc 2@ == 0x22334455 3@ == 0xcccc0011 4@ == 0xcccccccc then trace "~g~~h~~h~2301 (read_block_from_file), #8 PASSED" else breakpoint "~r~~h~~h~~h~2301 (read_block_from_file), #8 FAILED!~n~%08x %08x %08x %08x Expected~n~%08x %08x %08x %08x Occured" 0xcccccccc 0x22334455 0xcccc0011 0xcccccccc 1@ 2@ 3@ 4@ end // close the file wait 0 close_file 0@ trace "~g~~h~~h~2301 (read_block_from_file), #9 PASSED" terminate_this_custom_script