Torsten Ruger
d50893bb0f
rename risc_value to register_value
...
almost to register, but it still carries that value
2018-06-29 11:39:07 +03:00
Torsten Ruger
606c7bf906
remove booted flag
...
just boot if needed
2018-06-29 11:36:14 +03:00
Torsten Ruger
f1b09ac58d
move builtin boot to builtin module
2018-06-29 11:23:26 +03:00
Torsten Ruger
ce79617875
fix the exit sequence
...
was returning wrong register (1, not 0)
also saving the message for test, which changes order as the return value destroys the message
2018-06-19 19:52:06 +03:00
Torsten Ruger
5f7683efcf
pass return integer back out through exit
...
for testing of binaries later (and off course general correctness)
Some tests were using the fact that the interpreter was used, changed those to return ints rather than strings
2018-06-19 18:55:47 +03:00
Torsten Ruger
db459fcd3d
fix label loading in arm
...
was still loading the integer address
instead of the return address's address
Hello World working
2018-06-19 17:35:00 +03:00
Torsten Ruger
956c2ebe54
make arm use branch_lsteners
2018-06-19 10:51:03 +03:00
Torsten Ruger
046617f8dc
add branch listener functionaliy
...
have to store the branches and loop again as labels
dont neccessarily have positions yet
2018-06-17 22:25:38 +03:00
Torsten Ruger
3298651238
split create_binary into two phases
...
Which gives instructions a chance to check everything
and in Arms case check the constant loads/ instruction adding
So that during assembly no more change happens (and we don't have to reassemble)
2018-06-17 13:53:17 +03:00
Torsten Ruger
7543236f4f
objects didn't get positions
...
positions.empty? was wrong check
2018-06-16 10:58:54 +03:00
Torsten Ruger
698c845297
seperate position create and register
...
many test fixes
2018-06-15 22:00:49 +03:00
Torsten Ruger
9c93b38b8f
crete positions while collecting objects
...
clear two phase lifecycle for positions
always created invalid and set later
new does not auto add to cache
but create and get_or_create do
2018-06-15 21:54:21 +03:00
Torsten Ruger
2c765c8f14
rename the objects accessor
...
and move to object keys, not object_id
2018-06-15 09:18:39 +03:00
Torsten Ruger
3cc9175efa
start BranchListener
...
but on hold, since it needs positions before we have them
Must create them during collection phase
2018-06-14 21:29:34 +03:00
Torsten Ruger
5ec235d049
fixes outstanding misc, All green
...
Well. it's been a while, positioning is fixed (again)
apart from the upcoming BranchListener
2018-06-10 13:19:55 +03:00
Torsten Ruger
e1683938ed
fix label positioning bug
...
where a label at the end of a binary code resulted in the
label actually taking up a position, instead of sharing it with it's next
2018-06-10 13:18:56 +03:00
Torsten Ruger
0513cd504f
update return address in label
...
so return jumps go to the right address
2018-06-10 09:15:57 +03:00
Torsten Ruger
c7ad1d98ca
introduce the LabeListener to move instructions along when first code position changes
2018-06-09 22:13:43 +03:00
Torsten Ruger
ec1d38f5a6
reimplement instruction listeners with indexes
...
easier to understand, as indexes map to Binarycode indexes, and can thus later be used to assemble directoy into the code
Almost no change in tests (now only multiples of 4 addresses allowed)
2018-06-09 17:41:39 +03:00
Torsten Ruger
cf94227b2c
fix code init bug
...
where initial pos wasnt propagated
2018-06-09 09:16:23 +03:00
Torsten Ruger
e4b4551acf
minor simplification
2018-06-09 08:13:37 +03:00
Torsten Ruger
ad3040a846
add position_chaning to event interface
...
by reacting to the change _before it happens, we can move any BinaryCode out of the way
So when Instruction are inserted and code gets inserted, we don't need to set up the correct listener explicitly (which is tricky across mathods and changing chains), but instead just move anything that is in the way along
2018-06-09 08:10:41 +03:00
Torsten Ruger
5815d32bde
make the instructions jump over the BinaryCode end
2018-06-07 19:27:44 +03:00
Torsten Ruger
2d218bbc48
work on jump insertion continues
...
Now registering CodeListener instead of PositionListener
Also instead of on the previous, in itself, which is simpler
and allows to react to insertion at end
2018-06-07 19:26:02 +03:00
Torsten Ruger
7fa8397b56
insertion pushes, split position tests
2018-06-06 10:19:18 +03:00
Torsten Ruger
c22aff4c4f
start on insertion events and handling
2018-06-06 10:00:07 +03:00
Torsten Ruger
4789b63fcb
fix the gapping of instructions
...
so last binary stays empty and new starts at 8
2018-06-06 01:16:00 +03:00
Torsten Ruger
4ab6d62acf
small arm fixes etc
2018-06-06 00:53:41 +03:00
Torsten Ruger
d7b3368b28
fix some pesty errors
...
need to fix instruction overlap beofre interpreter starts again
2018-06-05 19:05:12 +03:00
Torsten Ruger
8d953a619f
propagate instruction positions
...
still overlapping onto binaries, but a start
2018-06-05 18:11:25 +03:00
Torsten Ruger
f35ee6425a
renaming and test fixing
2018-06-02 23:48:12 +03:00
Torsten Ruger
1d1c7105b4
introduce some helper methods
2018-06-02 23:02:59 +03:00
Torsten Ruger
c2d450f779
fold position module and object position
...
simpler that way, aslo code is moving to listners
2018-06-02 21:59:41 +03:00
Torsten Ruger
24f6e30b54
start on redoing instruction positions
...
using insruction listeners (wip)
2018-06-02 21:20:15 +03:00
Torsten Ruger
3bc35c2275
rework binary code positioning setup
...
dependency chain set up explicitly.
Next have to react to events correctly
2018-06-02 17:29:38 +03:00
Torsten Ruger
91c7903848
start simple with code listner
2018-06-02 16:34:44 +03:00
Torsten Ruger
aa6707337a
positioning wip
2018-06-02 16:12:01 +03:00
Torsten Ruger
46fbfb7101
adds the simple object dependency
...
where the next object is dependent on the previous one
and just behind it, the padded_length away
2018-05-31 20:41:04 +03:00
Torsten Ruger
21a9c56ba9
change position event code to use util
...
general purpose event fireing
can then be used for several event types
2018-05-31 19:05:53 +03:00
Torsten Ruger
2544bc5a85
move position module to folder
2018-05-31 19:01:10 +03:00
Torsten Ruger
49849939a1
little event mechanism for changed positions
2018-05-31 17:01:23 +03:00
Torsten Ruger
67100a3ef8
write adjusted address
...
and rename integer to address in label
1k hurray
2018-05-31 00:07:58 +03:00
Torsten Ruger
e39e96f646
create return address as own class to hold return addresses
...
to distinguish from integer, which does not need adjusting
2018-05-30 23:49:01 +03:00
Torsten Ruger
e86ca5ae9d
integer was wrong padded§ length
...
or rather right (2 as should be and will be)
but currently we use next AND value + type means 3, rounded 4
because we can’t swap types at compile time (as is planned at runtime,
we use next OR value)
2018-05-30 14:55:17 +03:00
Torsten Ruger
53107d3ef8
reducing the label's int for return
...
placing the raw address in the register to jump to
puts the extra instruction at the risc level (not arm), thus changing a
lot of (brittle?) tests
2018-05-30 12:54:40 +03:00
Torsten Ruger
01a2911483
using label int in interpreter
2018-05-30 11:49:29 +03:00
Torsten Ruger
0dc89c772a
get the label int to work consistently
...
still need to use it in the return
2018-05-30 10:54:18 +03:00
Torsten Ruger
074ec34659
wip, fixed some label, need more fixing
2018-05-30 10:29:38 +03:00
Torsten Ruger
c55b41afae
sort objects by class before positioning
...
since we don’t have pages yet, but want consistent layout
2018-05-29 20:52:58 +03:00
Torsten Ruger
296617cbaf
set label integer to position
2018-05-29 20:30:02 +03:00
Torsten Ruger
8322fca7b3
give labels an integer that will end up being the position at runtime
...
Since integers are first class objects, we need to use an integer object
as the return address. The actual address can not be stored in an
instance variable since it is not an object.
The address is unique to the label and never changes after positioning
(using the int is next up)
2018-05-29 20:26:00 +03:00
Torsten Ruger
4b34546c11
fixing the binary code indexes
...
AGAIN, that third of all bugs, the off by one
2018-05-28 18:20:09 +03:00
Torsten Ruger
8ef1a471a4
finally change List to derive from data object
...
can’t derive from data16 as some lists are longer
have to get the delegation to work first
2018-05-28 15:45:29 +03:00
Torsten Ruger
f9a89db10c
use fake memory
...
fix integer offset bug
(which only didn’t cause errors as fixnums are still an order too big
and the famous +1 error hit the empty space)
2018-05-28 15:09:59 +03:00
Torsten Ruger
6c06f61ab8
start on fake memory
...
get index checks on the array access of parfait
2018-05-28 14:46:26 +03:00
Torsten Ruger
be1bc63ff2
jump was written off the end of binary code, fixed
2018-05-28 11:45:04 +03:00
Torsten Ruger
c0cd1e0740
fix an issue where instruction was in wrong code
...
embarrassingly used instance variable where it should have been local
2018-05-25 19:16:13 +03:00
Torsten Ruger
6f0fad0957
dragging the extra through resets
...
as the binary the instruction is in may change when repositioning
2018-05-25 19:04:48 +03:00
Torsten Ruger
ddd408e245
trying to fix the darn jump over object header
2018-05-25 19:03:46 +03:00
Torsten Ruger
8d8cc4b016
more test fixing
...
only one bug to go
2018-05-24 21:20:56 +03:00
Torsten Ruger
183d4152d5
loading label must translate the labels too
...
(psst: like arm translator already did. duh)
2018-05-24 19:20:06 +03:00
Torsten Ruger
dae8e88b7a
recurring bug, don't save label positions
...
labels are ethereal, no length, so they don’t get to occupy a position
2018-05-24 16:26:56 +03:00
Torsten Ruger
8d510c2e7e
getting instruction repositioning right
...
big bug hunt, involving complicated maths (%)
2018-05-24 14:27:53 +03:00
Torsten Ruger
0293320bb8
use a constant for the binary code offset
...
where the instructions start
2018-05-23 21:35:22 +03:00
Torsten Ruger
8ca70a6835
Steamline objectPosition init
...
check for resetting on the same position with different class, which
should not happen
Ie it’s ok for an object to push another object up,
but not for an instruction to land on code
2018-05-23 21:34:49 +03:00
Torsten Ruger
f5d1090c39
no-ops really
2018-05-23 18:06:55 +03:00
Torsten Ruger
a2e7d7c469
give interpreter a clock and pc
...
where the pc, like in cpu’s is the memory position.
That is what the interpreter works on.
But for humans, the clock is a simpler way to count where the program
is at, no. of instructions executed
2018-05-23 18:05:22 +03:00
Torsten Ruger
ef2dc932ad
use positions in interpreter
2018-05-20 15:52:13 +03:00
Torsten Ruger
c0f10bb42b
fix opal error
2018-05-20 15:51:36 +03:00
Torsten Ruger
a7a62d53b2
use modified opal logger
...
logger was having bizarre format errors
copied and simplified (to get on)
2018-05-20 14:45:48 +03:00
Torsten Ruger
a350325b6b
fix function call and simple call logic
...
Before creating DynamicJump, the FunctionCall got a register for a
possible jump address. Now that is handled by DynamicJump and
FunctionCall just needs the method, from which it determines the
binaryCode address
2018-05-19 12:21:20 +03:00
Torsten Ruger
15e4533a2f
fix interpreter to use positions
...
tick from one (simulated memory) position to the next
(not from one instruction to the next)
2018-05-17 20:14:59 +03:00
Torsten Ruger
8966a50a8a
getter by position
...
extract and expand position testing
never return labels (that have the same position as their target)
2018-05-17 20:13:33 +03:00
Torsten Ruger
37d62d298e
assemble risc to it's position (not itself)
...
So in the next step the interpreter can use positions as program counter
and would be much more like the real thing
2018-05-17 09:49:01 +03:00
Torsten Ruger
49c4d170ce
make the interpreter platform
...
but still using the risc_instruction stream
2018-05-17 09:31:36 +03:00
Torsten Ruger
07ed16d765
groundwork for interpreter platform
...
especially positioning makes the previous interpreter approach to
fragile (too far off the real thing)
Interpreter should be it’s own platform (still use the risc
instructions),
get a translator and use positions
2018-05-16 21:00:14 +03:00
Torsten Ruger
ab4bc370ed
another +1 bug
2018-05-15 16:25:55 +03:00
Torsten Ruger
e237bc625a
remove unused methods
...
and a whole lot more index fixes
2018-05-14 20:50:52 +03:00
Torsten Ruger
3c00239f36
another million index fixes
2018-05-14 15:17:04 +03:00
Torsten Ruger
4a88f342d3
random checkin
...
still suffering -1 trauma
2018-05-14 12:38:44 +03:00
Torsten Ruger
4856b9891d
simplify writing binary
...
loop as should be, fixes the problem (one problem at least)
2018-05-13 18:01:45 +03:00
Torsten Ruger
39902401b9
positioning code by setting first method code
...
codes will initial (and on reset) propagate the whole chain
2018-05-13 15:28:10 +03:00
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
Torsten Ruger
88dbc7c84f
slot to reg for builder
2018-04-06 16:35:27 +03:00
Torsten Ruger
c233bd82d6
implement [] for RiscValue for the dsl
2018-04-06 16:08:35 +03:00
Torsten Ruger
44d661fe56
progress on the builder front
...
mainly tests for now
2018-04-06 14:54:24 +03:00
Torsten Ruger
e396807ee5
start work on dsl
...
so i can read my own code
2018-04-06 14:21:38 +03:00
Torsten Ruger
f09086e524
unite the two resolve_to_index functions
2018-04-05 20:10:00 +03:00
Torsten Ruger
ec31bde33a
fix use of messagesetup
...
which does setup for the method being called
not the one we’re in. duh
2018-04-05 12:23:43 +03:00
Torsten Ruger
5bb3ad03cc
some more safety tests
2018-04-05 12:22:40 +03:00
Torsten Ruger
ee0a1ca823
renaming methods args and frame
...
to arguments_type and frame_type, because that is what they are
In honour of setup bug, where the types of those types were loaded,
instead of just them types
2018-04-05 12:22:14 +03:00
Torsten Ruger
4a2a1da3ff
little spring clean
2018-04-03 15:23:19 +03:00
Torsten Ruger
52d389cdbf
auto extend binary code
...
final solution will need repositioning
2018-04-03 15:07:36 +03:00
Torsten Ruger
17b52d4e80
fix dynamic resolution
...
was loading self, when it needs to load receiver
some more test (up to the resolve) start working
2018-04-03 12:55:28 +03:00
Torsten Ruger
c304ad67c6
load space twice in init , messagesetup overwrites first
...
lots of interpreter test changes, brittle, must factor __initi out
2018-04-02 23:25:52 +03:00
Torsten Ruger
576ae9261d
recode resolve method as assembler
...
definitely needs some refactoring
in fact i was hoping to code this in ruby (with compiler tweeks)
but there it is: goes through the linked list of methods of the type
and compares their name with self (method on word)
if not found ends in sys exit for now
2018-04-02 19:32:59 +03:00
Torsten Ruger
beb487eb09
minor fixes
2018-04-02 19:31:08 +03:00
Torsten Ruger
65d57c8c7c
removing unconditional
...
just Branch is fine
2018-04-02 19:30:34 +03:00
Torsten Ruger
9fafbe4e96
remove Kernel class for clarification
...
since it was a class it was fake anyway
moved methods to object
2018-04-02 17:06:31 +03:00
Torsten Ruger
87eee0b66e
add object method missing as sys exit
...
functions get added twice and thus removed once
remove restriction for now
2018-04-02 16:49:30 +03:00
Torsten Ruger
fb29fb6431
linked list of methods instead of list of methods
...
api changes slightly, especially for each, but mostly sama sama
2018-04-02 16:36:43 +03:00