Jump to content

Machine code: Difference between revisions

Line 68:
If you're going to do this in actual programming (which is somewhat common on 8-bit computers for quick interrupt handling), it may be a good idea to know ahead of time the maximum size of your RAM area for machine code and fill it with return statements to avoid crashing.
 
=={{header|68000 Assembly}}==
 
We'll execute the following program:
<lang 68000devpac>MOVE.B #7,D0
ADD.B #12,D0
RTS</lang>
And here is the code that sets it up:
<lang 68000devpac>LEA CodeArray,A0
MOVE.L #$103C0007,(A0)+ ;MOVE.B #7,D0
MOVE.L #$D03C000C,(A0)+ ;ADD.B #12,D0
MOVE.W #$4E75,(A0)+ ;RTS
JSR CodeArray
 
JMP $ ;halt the cpu, we're done.
 
CodeArray:
DS.B 16 ;16 bytes of padding (this is assumed to be RAM)</lang>
 
=={{header|Action!}}==
1,489

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.