News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Minimal Instruction Set ?

Started by James Ladd, November 23, 2010, 03:24:10 AM

Previous topic - Next topic

James Ladd

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.

dedndave

you could google RISC instruction sets
they use add sub jmp call ret - simple stuff only
it might give you something to start with

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

donkey

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.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

FORTRANS

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.

James Ladd


Tight_Coder_Ex

IN - OUT would be a definite must as without the ability to comminucate peripherally, what is the point of a computing system
MOV

Antariy

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

Tight_Coder_Ex

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

donkey

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.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Antariy

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.

FORTRANS

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.

James Ladd

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