Ignore:
Timestamp:
Oct 20, 2010, 1:35:59 PM (9 years ago)
Author:
mulligan
Message:

New features:

1) conditional jumps to labels implemented

[Note: all conditional jumps are to relative addresses;

if the label is too far away, an assert false is currently raised]

2) we now have a preamble of declarations of data labels in external

memory and a new pseudo-instruction "Mov" to place the value of a
data label into DPTR.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D4.1/ASM.mli

    r158 r200  
    2525type addr16 = [ `ADDR16 of word ]
    2626
    27 type instruction =
     27type 'addr jump =
     28 [ `JC of 'addr
     29 | `JNC of 'addr
     30 | `JB of bit * 'addr
     31 | `JNB of bit * 'addr
     32 | `JBC of bit * 'addr
     33 | `JZ of 'addr
     34 | `JNZ of 'addr
     35 | `CJNE of (acc * [ direct | data ], [ reg | indirect ] * data) union2 * 'addr
     36 | `DJNZ of [ reg | direct ] * 'addr
     37 ]
     38
     39type 'addr preinstruction =
    2840 (* arithmetic operations *)
    2941 [ `ADD of acc * [ reg | direct | indirect | data ]
     
    7587
    7688 (* program branching *)
    77  | `JC of rel
    78  | `JNC of rel
    79  | `JB of bit * rel
    80  | `JNB of bit * rel
    81  | `JBC of bit * rel
     89 | 'addr jump
    8290 | `ACALL of addr11
    8391 | `LCALL of addr16
     
    8896 | `SJMP of rel
    8997 | `JMP of indirect_dptr
    90  | `JZ of rel
    91  | `JNZ of rel
    92  | `CJNE of (acc * [ direct | data ], [ reg | indirect ] * data) union2 * rel
    93  | `DJNZ of [ reg | direct ] * rel
    9498 | `NOP ]
     99
     100type instruction = rel preinstruction
    95101
    96102type labelled_instruction =
     
    100106 | `Jmp of string
    101107 | `Call of string
     108 | `Mov of dptr * string
     109 | `WithLabel of [`Label of string] jump
    102110 ]
     111
     112(* pairs <datalabel,size> *)
     113type preamble = (string * int) list
     114
     115type assembly_program = preamble * labelled_instruction list;;
Note: See TracChangeset for help on using the changeset viewer.