http://calcg.org/newlogo2.png Not Logged in.
Login | Register

General Discussion Board \ Calculator Discussion \ OOP figured out in ASM

Click here to log in (you must be logged in to post comments).

AuthorComment
threefingeredguy
Ghost
avatar
Posted: 3 Jun 2005
10:17 GMT
Total Posts: 1189
I think I may have figured out a way to simulate OOP in asm, or any basic language. It wont work in TI-83/84 + basic because of speed and memory issues, but it will work in 83/84 + assembly. Por ejemple, we have a list of the objects attributes, which can be rewritten using program writeback:

ObjectAttributes:
.db BINARY,BINARY,BINARY,BINARY

Each binary code is a pointer to a memory location where another list is held. It is effectively a matrix. So lets say the first attribute points to the x-position, second to the y-position, 3rd to the name of the object, and 4th to it being alive.

Xpos:
.db 0,12

Ypos:
.db 0,42

We use "0" as an integer identifier. We can now use "1" for the string.

Name:
.db 1,3,15,16,255

We can use the pre-established values of ascii to know that 3,15,16 represent "3fg". The "1" identifier at the beginning tells the program that it will be reading a string and the 255 tells it to stop reading (I'm sure theres a better way to tell it to stop reading but I don't know it). Maybe someone could put 1(for type),3(for length),3,15,16. w/e.

Alive:
.db 2,1

We use "2" here to identify it as a boolean; the program will read it in like an integer but will only write 0 or 1. Or it could read it in as 'true' or 'false' like java, but its much more effectient to use 0 and 1.

The ObjectAttributes list can be made longer and shorter with writeback, all values can be written back on to. You can even change the type of variable by editing the first term in the list.


Anyone want to write some assembly stuff for this? If you do, I can write a language like java and a compiler that writes it down to the hexcode (you can either find the asm equivalents and I'll translate them to hex or you can do it yourself) and is ready to send to your calc.

Any takers? Ideas? Suggestions?

---
Someone call for an exterminator?
zkostik
Carrier
avatar
Posted: 3 Jun 2005
20:27 GMT
Total Posts: 2486
Hmm interesting... not sure if it'll get much use but definitely is interesting. That asm progs may look more readable...

---
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
threefingeredguy
Ghost
avatar
Posted: 5 Jun 2005
13:02 GMT
Total Posts: 1189
i hope its practical. im not sure if its really useful or time saving like real oop.

---
Someone call for an exterminator?
Lunchbox
Carrier
avatar
Posted: 5 Jun 2005
13:40 GMT
Total Posts: 2007
Nice. I think I can make the values readable/translatable to TI-OS variables, if there are type identifiers as you have said.
threefingeredguy
Ghost
avatar
Posted: 6 Jun 2005
20:03 GMT
Total Posts: 1189
yes i realized that after i wrote this. i realized something else to but ive forgotten it.

---
Someone call for an exterminator?
threefingeredguy
Ghost
avatar
Posted: 7 Jun 2005
15:53 GMT
Total Posts: 1189
Ok i thought some more and thought of a way to make it fully object oriented.

Obj# is the hexcode address of a table with the Obj attributes.

Obj1:
.db 4,Obj1Boolean,Obj1Number,Obj3String,Obj4Object

Obj1Boolean:
.db 0,1 ;0-false 1-true, this one is true

Obj1Number:
.db 1,00,00,00,00,00,00 ;follows floating point format except has
;a 1 at the beginning to identify it

Obj3String:
.db 2,1,2,3,15,16 ; "123fg"!

Obj4Object:
.db 3,Obj2 ;hex address of annother object!

so it has 4 attributes, a boolean, a floating point number (no more integers just op1-op9 style registers), a string (array of numbers with identifier), and another Object.

You can create an object and use it as a list, but its not typecast as one. maybe in later versions.

ok bye.

---
Someone call for an exterminator?





Portal | My Account | Register | Lost Password or Username | TOS | Disclaimer | Help | Site Search | File Archives Copyright © 2002-2019 CalcG.org