What would be the smallest set of x86 instructions an assembler would need to support to do reasonable work with?
One could assume only 32bits and above.
I ask because I am building such an assembler here: https://github.com/jamesladd/rasmataz
It is an exercise in metaprogramming and teaching, so it wont be replacing MASM anytime soon.
Rgs, James.
you could google RISC instruction sets
they use add sub jmp call ret - simple stuff only
it might give you something to start with
James,
Disassemble a large app and do a stats analysis on the instruction count for each instruction. You will find that mov's, cmp's and jumps take up a lot of the stats.
I think you can build about anything from:
MOV
ADD ; could be a complimentary SUB though
SUB
XOR
AND
OR
NOT
NEG
CMP
JMP
JZ
CALL
RET
PUSH
POP
I would also add
MUL
DIV
These instructions should be available on every general purpose microprocessor no matter the design or manufacturer.
Hi,
You could get rid of CMP by using SUB, though that would
be a bit inconvenient. I think you would want ADC, JO, and JC
and the like to ease mathematics on down the road.
Regards,
Steve N.
Brilliant start, thanks guys.
IN - OUT would be a definite must as without the ability to comminucate peripherally, what is the point of a computing system
MOV
Quote from: hutch-- on November 23, 2010, 06:34:35 AM
Disassemble a large app and do a stats analysis on the instruction count for each instruction. You will find that mov's, cmp's and jumps take up a lot of the stats.
:bg
IN - OUT would be a definite must as without the ability to comminucate peripherally, what is the point of a computing system
MOV
BOOLEAN OPERATORS
ADD
SUB at minimum
CMP
JMP and it's dirivites JZ, JNZ etc.
"Reasonable work" is somewhat subjective, but it would seem historically, Intels 8080 could be thought of as a minimum, as it and its counterparts "Z80" propelled the PC to what it is today
Yeah, I left out some good ones.... I would add INT, IRET to Tight_Coder_Ex's IN and OUT. Also some way to dump the flags PUSHFD and POPFD would work.
Quote from: donkey on November 23, 2010, 10:01:26 PM
Yeah, I left out some good ones.... I would add INT, IRET to Tight_Coder_Ex's IN and OUT. Also some way to dump the flags PUSHFD and POPFD would work.
He want make something like embedded CPU assembler? Just by instructions which you mentinioned already - it seems like machinery control CPU, one with quite full instruction set.
Hi,
You can get around IN and OUT by using memory mapped
Input/Output. Though that never seemed a good idea to me.
Motorola CPU's used it?
Regards,
Steve N.
I'm starting to think I should just support the intel set.
I wont be supporting all permutations of 8 / 16 combinations, just the 32bit combinations.
From here: http://www.intel.com/design/intarch/manuals/243191.htm