|
@@ -68,6 +68,7 @@ section .data
|
68
|
68
|
def_str syntax_error, {"Syntax error", 0xA}
|
69
|
69
|
def_str bigline_error, {"Line with more than 16 tokens !", 0xA}
|
70
|
70
|
def_str nl_error, {"Character \n is not the last one", 0xA}
|
|
71
|
+ def_str badop_error, {"Bad OP", 0xA}
|
71
|
72
|
|
72
|
73
|
;
|
73
|
74
|
; Old stuff for first oscillator
|
|
@@ -265,8 +266,9 @@ parse:
|
265
|
266
|
mov rax, OP.numeric
|
266
|
267
|
stosq
|
267
|
268
|
xor rax, rax
|
|
269
|
+ xor r11, r11 ; numeric token length raz
|
268
|
270
|
xchg rax, rdx
|
269
|
|
- shl rax, 32
|
|
271
|
+ shl rax, 32 ; shl to allow reading as dword ?
|
270
|
272
|
stosq
|
271
|
273
|
pop rax
|
272
|
274
|
.match_op:
|
|
@@ -275,7 +277,7 @@ parse:
|
275
|
277
|
add rax, op_ptrs
|
276
|
278
|
mov rax, [rax]
|
277
|
279
|
test rax, rax
|
278
|
|
- jz exit.syntax_error
|
|
280
|
+ jz exit.bad_op
|
279
|
281
|
jmp .end_op
|
280
|
282
|
|
281
|
283
|
.no_nl: ; TODO : print warning
|
|
@@ -425,16 +427,23 @@ exit:
|
425
|
427
|
mov rdx, bigline_error_len
|
426
|
428
|
push qword 2
|
427
|
429
|
jmp exit.parse_error
|
|
430
|
+ .bad_op:
|
|
431
|
+ mov rsi, badop_error
|
|
432
|
+ mov rdx, badop_error_len
|
|
433
|
+ push qword 2
|
|
434
|
+ jmp exit.parse_error
|
428
|
435
|
.parse_error:
|
429
|
436
|
; print error lineno & chrno
|
430
|
|
- push rsi
|
|
437
|
+ push rsi ; source ptr
|
431
|
438
|
push rdx
|
432
|
|
- push rbx
|
|
439
|
+ push rbx ; chrno in line
|
|
440
|
+ sub r14, rsi ; chr count
|
|
441
|
+ push 14
|
433
|
442
|
mov rdi, "chr:0x"
|
434
|
443
|
mov rsi, 6
|
435
|
444
|
call short_err
|
436
|
|
- mov rdi, r15
|
437
|
|
- sub rdi, [rsp+(8*3)]
|
|
445
|
+ pop rdi ; chr count
|
|
446
|
+ mov rsi, 2
|
438
|
447
|
call print_hnum
|
439
|
448
|
mov rdi, ",line:0x"
|
440
|
449
|
mov rsi, 8
|
|
@@ -660,7 +669,14 @@ OP:
|
660
|
669
|
ret
|
661
|
670
|
.div:
|
662
|
671
|
call .prep_2arg
|
|
672
|
+ test ebx, ebx
|
|
673
|
+ jz .nodiv
|
|
674
|
+ xor edx, edx
|
663
|
675
|
div ebx
|
|
676
|
+ jmp .divend
|
|
677
|
+ .nodiv:
|
|
678
|
+ xor eax, eax
|
|
679
|
+ .divend:
|
664
|
680
|
mov edi, eax
|
665
|
681
|
call OP._push
|
666
|
682
|
ret
|
|
@@ -678,7 +694,14 @@ OP:
|
678
|
694
|
ret
|
679
|
695
|
.mod:
|
680
|
696
|
call .prep_2arg
|
|
697
|
+ test ebx, ebx
|
|
698
|
+ jz .nomod
|
|
699
|
+ xor edx, edx
|
681
|
700
|
div ebx
|
|
701
|
+ jmp .endmod
|
|
702
|
+ .nomod:
|
|
703
|
+ xor edx, edx
|
|
704
|
+ .endmod:
|
682
|
705
|
mov edi, edx
|
683
|
706
|
call OP._push
|
684
|
707
|
ret
|