Commit Graph

161 Commits

Author SHA1 Message Date
Torsten Ruger
2d901bf7b6 not wrapping the cpu initial jump anymore
also introduce padding after cpu_init (wip)
2018-05-12 18:36:59 +03:00
Torsten Ruger
232fe67c09 introduce platform to abstract cpu and load address 2018-05-12 18:32:10 +03:00
Torsten Ruger
776a97986d fix instruction positioning
use at as at and only compute difference when needed (to determine if
there is a jump in binary)
Easier to understand that way
2018-05-11 18:36:45 +03:00
Torsten Ruger
bc1e29e4f6 seperate different Position classes into own files
also tests
and have Position module keep all positions
(singletons should be at module, not class level)
2018-05-10 20:56:12 +03:00
Torsten Ruger
1169fa7220 propagating binary code position on extend 2018-05-09 20:36:49 +03:00
Torsten Ruger
6a1528e75a Fix instruction resetting
which happens on insert of a new instruction
2018-05-08 20:53:48 +03:00
Torsten Ruger
7ca7e92dda remove link exception class 2018-05-08 20:22:04 +03:00
Torsten Ruger
cf06642768 start passing positions along inside the position code 2018-05-08 19:59:43 +03:00
Torsten Ruger
ce3cc72f9e move all position setting into position
Position and subclasses handle the logic, external to
the classes, so it can be swapped out later
(at runtime positions can’t change)
2018-05-07 22:30:43 +03:00
Torsten Ruger
68fb9b1bdc rename Position get/set 2018-05-06 20:04:02 +03:00
Torsten Ruger
e89c4d1ce1 pass binary that arm instruction belongs to in
at least to first. repositioning and stuff next
2018-05-06 19:56:36 +03:00
Torsten Ruger
415df49199 hand context into position 2018-05-06 00:34:59 +03:00
Torsten Ruger
40f4bfc287 change to position objects complete 2018-05-05 20:25:10 +03:00
Torsten Ruger
3244c7d633 add position tests
and refactor padding out
2018-05-05 20:11:08 +03:00
Torsten Ruger
d65a982454 start by moving positioned(module) to position(class) 2018-05-05 19:47:18 +03:00
Torsten Ruger
43d5521cfc debugging positions 2018-05-05 19:32:01 +03:00
Torsten Ruger
d49d2665c5 reinit risc_init
fixes over 100 tests :-)
2018-05-01 22:36:46 +03:00
Torsten Ruger
6be28e7f55 fix (re)positioning when link exceptions are thrown
slow design, but sort of works
2018-05-01 19:48:11 +03:00
Torsten Ruger
1c52ab6b67 use hex for labels
idea was to be able to compare to positions
(but they are different positions)
2018-05-01 19:20:16 +03:00
Torsten Ruger
dd2c2cb975 fix init jump bug
the label for the jump was not translated correctly
call needs to go through to_cpu to create single instance
on the way init order slightly changed
2018-05-01 19:19:04 +03:00
Torsten Ruger
1acd231a33 debugging binaries, initial jump issues 2018-04-30 13:28:55 +03:00
Torsten Ruger
ec5a7f8a02 implement larger/smaller or equal 2018-04-24 19:45:58 +03:00
Torsten Ruger
7a2160e9b4 fix comparison operator
< implemented <=
2018-04-23 19:39:16 +03:00
Torsten Ruger
04359546b7 implement greater than 2018-04-19 22:57:31 +03:00
Torsten Ruger
be3d125b82 implement smaller than comparison
which is NOT an operator in the risc sense
rather a minus and a check for sign
(which _could be more efficient in arm, with conditional execution)
2018-04-19 22:41:40 +03:00
Torsten Ruger
9e21719aeb generalise the operator handling
ie passing them through
implementing more
2018-04-19 22:13:52 +03:00
Torsten Ruger
3a50b7dd0e fix mod4 name
really did div4
2018-04-19 10:00:55 +03:00
Torsten Ruger
8e1efa3993 fix source for exit label 2018-04-18 20:10:07 +03:00
Torsten Ruger
75d5fff611 let builder pass the source down, but inly once 2018-04-18 19:27:46 +03:00
Torsten Ruger
059ff4a868 pass a source into the builder
for debugging
2018-04-18 19:12:30 +03:00
Torsten Ruger
7c33f19bee dont patch over existing string method 2018-04-16 21:24:27 +03:00
Torsten Ruger
59e6298879 first resolved call running though
and returning an int, as it should
just the value .  .  .
2018-04-08 23:45:23 +03:00
Torsten Ruger
e5d014b936 bit more regs, bit more resets 2018-04-08 22:29:08 +03:00
Torsten Ruger
33ffcf1d88 move resolve_method code from word to mom
rather make resolve an instruction.
Since it was coded in risc anyway, we not only save the setup and call
But also makes the mom instruction flow clearer
The method really came from not wanting to code it in risc, but with
the Builder, that is now surprisingly painless
2018-04-08 18:55:17 +03:00
Torsten Ruger
8c322329fb fix builtin methods according to last commit 2018-04-08 18:52:17 +03:00
Torsten Ruger
9867234c38 move most code from method_compiler to builder
rather use builder in two ways, than sometimes compiler and sometimes
builder
Also makes it possible to reuse builtin code in mom’s to_risc, as both
use builder. The builtin code by directly adding to compiler, the mom
code not.
2018-04-08 18:51:20 +03:00
Torsten Ruger
c2860bef7a fix interpreter operator args
as in binary strings words symbols will be same
2018-04-08 01:26:29 +03:00
Torsten Ruger
c30e461385 add operator to builder
just minus for now, easily extended
2018-04-08 01:01:24 +03:00
Torsten Ruger
5d4b9d4834 add branches to builder 2018-04-08 00:50:51 +03:00
Torsten Ruger
695ae5ad99 add label generation to builder 2018-04-08 00:39:35 +03:00
Torsten Ruger
6958fc31ab rework resolve_method, using builder 2018-04-07 23:07:44 +03:00
Torsten Ruger
bf8e9e508b opal hack 2018-04-07 22:35:48 +03:00
Torsten Ruger
26cf911a5c change build names a little and document 2018-04-07 22:35:40 +03:00
Torsten Ruger
db55ec3fd6 slightly changing built return logic
very tempted to add immediately, but bigger change
2018-04-07 00:35:54 +03:00
Torsten Ruger
dd0d162ebf fix the init also, was using first message twice
not advancing after first load
2018-04-07 00:14:02 +03:00
Torsten Ruger
1ddbde1191 return single message for "message" ie r0
other names, like next_message allocate  a new register
2018-04-06 22:54:54 +03:00
Torsten Ruger
22409c93ee remove >>, consistent use of <<
makes code easier to read, like assignments
does remind of Passengers
2018-04-06 22:40:58 +03:00
Torsten Ruger
c042dd9faa allow reverse syntax for >> (ie <<)
slot >> reg makes sense, being a slot_to_reg
but . . .
consistently use of << (as meaning assignment , =) also makes sense
allow both and let time tell which makes more sense
2018-04-06 21:05:26 +03:00
Torsten Ruger
c02576b239 reuse dished out names
so they become like variables
2018-04-06 20:55:21 +03:00
Torsten Ruger
cae5e323ec add reg to slot 2018-04-06 20:21:14 +03:00