115,12 → 115,7 |
or eax,eax |
jz assemble_ok |
mov [current_line],eax |
call error_handler |
error_handler: |
mov eax,[error] |
sub eax,error_handler |
add [esp],eax |
ret |
jmp near [error] |
next_pass: |
inc [current_pass] |
mov ax,[current_pass] |
364,13 → 359,11 |
mov dword [operand_size],0 |
mov [opcode_prefix],0 |
mov [immediate_size],0 |
call instruction_handler |
instruction_handler: |
movzx ebx,word [esi] |
mov al,[esi+2] |
add ebx,assembler |
add esi,3 |
add [esp],ebx |
ret |
jmp near ebx |
instruction_assembled: |
mov al,[esi] |
cmp al,0Fh |
901,7 → 894,7 |
mov byte [org_registers+2],ch |
mov byte [org_registers+3],cl |
call allocate_structure_data |
mov word [ebx],virtual_directive-instruction_handler |
mov word [ebx],virtual_directive-assembler |
not eax |
not edx |
add eax,1 |
1000,7 → 993,7 |
je zero_repeat |
jl negative_repeat |
call allocate_structure_data |
mov word [ebx],repeat_directive-instruction_handler |
mov word [ebx],repeat_directive-assembler |
xchg eax,[counter_limit] |
mov [ebx+10h],eax |
mov eax,1 |
1045,7 → 1038,7 |
jmp instruction_assembled |
find_end_repeat: |
call find_structure_end |
cmp ax,repeat_directive-instruction_handler |
cmp ax,repeat_directive-assembler |
jne unexpected_instruction |
ret |
while_directive: |
1052,7 → 1045,7 |
cmp [prefixed_instruction],0 |
jne unexpected_instruction |
call allocate_structure_data |
mov word [ebx],while_directive-instruction_handler |
mov word [ebx],while_directive-assembler |
mov eax,1 |
xchg eax,[counter] |
mov [ebx+10h],eax |
1092,7 → 1085,7 |
jmp do_while |
find_end_while: |
call find_structure_end |
cmp ax,while_directive-instruction_handler |
cmp ax,while_directive-assembler |
jne unexpected_instruction |
ret |
if_directive: |
1112,7 → 1105,7 |
mov al,[esi] |
cmp al,1 |
jne else_true |
cmp word [esi+1],if_directive-instruction_handler |
cmp word [esi+1],if_directive-assembler |
jne else_true |
add esi,4 |
jmp if_directive |
1120,7 → 1113,7 |
xor al,al |
make_if_structure: |
call allocate_structure_data |
mov word [ebx],if_directive-instruction_handler |
mov word [ebx],if_directive-assembler |
mov byte [ebx+2],al |
mov eax,[current_line] |
mov [ebx+4],eax |
1135,7 → 1128,7 |
else_directive: |
cmp [prefixed_instruction],0 |
jne unexpected_instruction |
mov ax,if_directive-instruction_handler |
mov ax,if_directive-assembler |
call find_structure_data |
jc unexpected_instruction |
cmp byte [ebx+2],0 |
1144,7 → 1137,7 |
mov al,[esi] |
cmp al,1 |
jne skip_else |
cmp word [esi+1],if_directive-instruction_handler |
cmp word [esi+1],if_directive-assembler |
jne skip_else |
add esi,4 |
call find_else |
1168,9 → 1161,9 |
jmp instruction_assembled |
find_else: |
call find_structure_end |
cmp ax,else_directive-instruction_handler |
cmp ax,else_directive-assembler |
je else_found |
cmp ax,if_directive-instruction_handler |
cmp ax,if_directive-assembler |
jne unexpected_instruction |
stc |
ret |
1179,7 → 1172,7 |
ret |
find_end_if: |
call find_structure_end |
cmp ax,if_directive-instruction_handler |
cmp ax,if_directive-assembler |
jne unexpected_instruction |
ret |
find_structure_end: |
1202,28 → 1195,28 |
cmp byte [esi],1 |
jne find_end_directive |
mov ax,[esi+1] |
cmp ax,prefix_instruction-instruction_handler |
cmp ax,prefix_instruction-assembler |
je find_end_directive |
add esi,4 |
cmp ax,repeat_directive-instruction_handler |
cmp ax,repeat_directive-assembler |
je skip_repeat |
cmp ax,while_directive-instruction_handler |
cmp ax,while_directive-assembler |
je skip_while |
cmp ax,if_directive-instruction_handler |
cmp ax,if_directive-assembler |
je skip_if |
cmp ax,else_directive-instruction_handler |
cmp ax,else_directive-assembler |
je structure_end |
cmp ax,end_directive-instruction_handler |
cmp ax,end_directive-assembler |
jne find_end_directive |
cmp byte [esi],1 |
jne find_end_directive |
mov ax,[esi+1] |
add esi,4 |
cmp ax,repeat_directive-instruction_handler |
cmp ax,repeat_directive-assembler |
je structure_end |
cmp ax,while_directive-instruction_handler |
cmp ax,while_directive-assembler |
je structure_end |
cmp ax,if_directive-instruction_handler |
cmp ax,if_directive-assembler |
jne find_end_directive |
structure_end: |
pop [error_line] |
1246,7 → 1239,7 |
jc if_block_skipped |
cmp byte [esi],1 |
jne skip_after_else |
cmp word [esi+1],if_directive-instruction_handler |
cmp word [esi+1],if_directive-assembler |
jne skip_after_else |
add esi,4 |
jmp skip_if_block |
1260,15 → 1253,15 |
jne invalid_argument |
lods word [esi] |
inc esi |
cmp ax,virtual_directive-instruction_handler |
cmp ax,virtual_directive-assembler |
je end_virtual |
cmp ax,repeat_directive-instruction_handler |
cmp ax,repeat_directive-assembler |
je end_repeat |
cmp ax,while_directive-instruction_handler |
cmp ax,while_directive-assembler |
je end_while |
cmp ax,if_directive-instruction_handler |
cmp ax,if_directive-assembler |
je end_if |
cmp ax,data_directive-instruction_handler |
cmp ax,data_directive-assembler |
je end_data |
jmp invalid_argument |
break_directive: |
1282,11 → 1275,11 |
cmp ebx,[additional_memory_end] |
je unexpected_instruction |
mov ax,[ebx] |
cmp ax,repeat_directive-instruction_handler |
cmp ax,repeat_directive-assembler |
je break_repeat |
cmp ax,while_directive-instruction_handler |
cmp ax,while_directive-assembler |
je break_while |
cmp ax,if_directive-instruction_handler |
cmp ax,if_directive-assembler |
je break_if |
add ebx,20h |
jmp find_breakable_structure |
1695,7 → 1688,6 |
pop ebx |
mov edx,eax |
sub [esp],edx |
jc value_out_of_range |
position_ok: |
cmp byte [esi],',' |
jne size_ok |
1708,8 → 1700,6 |
push ebx edx |
call get_dword_value |
pop edx ebx |
cmp eax,[esp] |
ja value_out_of_range |
mov [esp],eax |
size_ok: |
xor al,al |