06-04-2016, 04:20 AM
(This post was last modified: 08-06-2016, 09:06 PM by monday.

*Edit Reason: added "else" to the code*)
Piece of code which allows you to save more numbers without storing them in external files.

Edit: Tested and changed into simpler and actually working code

This way by using only 2 variables it's possible to store a lot of data

Edit: Tested and changed into simpler and actually working code

Code:

`alloc 0@ 512 //array pointer`

1@ = 0 //buffer

0AB1: @IntArray_Write 3 arrayPointer 0@ index 0 val 123

0AB1: @IntArray_Write 3 arrayPointer 0@ index 1 val 9919

0AB1: @IntArray_Write 3 arrayPointer 0@ index 2 val 77

0AB1: @IntArray_Write 3 arrayPointer 0@ index 3 val 5

0AB1: @IntArray_Write 3 arrayPointer 0@ index 4 val 3661

0AB1: @IntArray_Write 3 arrayPointer 0@ index 5 val 91

0AB1: @IntArray_Write 3 arrayPointer 0@ index 6 val 7255

0AB1: @IntArray_Write 3 arrayPointer 0@ index 7 val 525

0AB1: @IntArray_Read arrayPointer 0@ index 0 _returned 1@

//do something with 1@ which becomes 123

0AB1: @IntArray_Read arrayPointer 0@ index 1 _returned 1@

//do something with 1@ which becomes 9919

0AB1: @IntArray_Read arrayPointer 0@ index 2 _returned 1@

//do something with 1@ which becomes 77

0AB1: @IntArray_Read arrayPointer 0@ index 3 _returned 1@

//do something with 1@

0AB1: @IntArray_Read arrayPointer 0@ index 4 _returned 1@

//do something with 1@

0AB1: @IntArray_Read arrayPointer 0@ index 5 _returned 1@

//do something with 1@

0AB1: @IntArray_Read arrayPointer 0@ index 6 _returned 1@

//do something with 1@

0AB1: @IntArray_Read arrayPointer 0@ index 7 _returned 1@

//do something with 1@

//0AB1: @IntArray_Write 3 arrayPointer 0@ index 1@ val 2@

:IntArray_Write

0012: 1@ *= 4

005A: 1@ += 0@ // (int)

0A8C: write_memory 1@ size 4 value 2@ virtual_protect 1

0AB2: ret 0

//0AB1: @IntArray_Read arrayPointer 0@ index 1@ _returned 2@

:IntArray_Read

0012: 1@ *= 4

005A: 1@ += 0@ // (int)

0A8D: 2@ = read_memory 1@ size 4 virtual_protect 1

0AB2: ret 1 2@