Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: the_mad_joob on December 29, 2011, 09:21:48 am
-
### #### # # #### #### ##### ### # #
# # # ## ## # # # # # # # ## ##
# # # # # # # # # # # # # # # #
##### ### # # # # # #### #### ##### # # #
# # # # # # # # # # # # # #
# # # # # # # # # # # # # #
# # #### # # #### # # ##### # # # #
THE TI-8X+ ON-CALC ASSEMBLER
CURRENT VERSION : 1.00
Asmdream is an on-calc assembler for the TI-8X+ calculator series.
It reads symbolic content (sources & includes) written directly using the OS built-in program editor.
It writes machine code into protected programs in ram.
You can think of it as a hybrid between mimas & axe.
DOWNLOAD
http://www.ticalc.org/archives/files/fileinfo/444/44479.html
Don't forget to read asmdream.txt.
NEWS
http://ourl.ca/14654/276283
http://ourl.ca/14654/278334
http://ourl.ca/14654/342852
FEATURES
all z80 instructions (undocumented ones included)
constant byte strings
variable byte strings (ascii strings handled)
variable word strings (ascii strings handled)
token strings
comments
immediate arguments
decimal
hexadecimal
binary
ascii
operators
positive
negative
addition
substraction
program counter symbol (changeable initial value)
address labels (usable in main and macro code)
equate labels (nesting handled)
macros (nesting handled)
macro parameters
error handling (goto handled)
automatic include detection
ultra complete collection of equates
running asmdream from external code supported
TOPIC PURPOSES
troubleshooting
feedback
SCREENSHOT
The assembler in action :
(http://www.ticalc.org/archives/files/ss/841/84190.gif)
-
AWESOME! When will the download be available, or don't you know yet? This is soo cool! I wonder if this is news worthy o.o
-
Hey Xed =]
Waiting for ticalc.org validation...
-
This looks cool!/me should start learning assembly
-
Ah,cool! So you are one of those "pending files" :D I uploaded ASMComp last night, too, and I am waiting for validation.
-
Congratulations for ASMComp =]
-
Meh, ASMComp is nothing compared to ASMDREAM. I am not even going to attempt things like macros x.x
EDIT: Just downloaded!
-
Yeah, those nasty macros were a true hell to code.
Had to use paper & pen to avoid brain explosion =]
-
I made my first ASMDREAM program! It was a simply "HOWDY WORLD" program, but I got it to work! I haven't even tried making my own macros, but I like that idea with LD A,?,B,?,C,?... Cool!
So what I have learned so far:
-Instructions use a space first then the instruction
-Labels do not start with a space
-.db statements start with a . instead of a space
I like it!
Here is an example code:
→SRC
prgmƟROM1
prgmƟROM2
prgmƟMACROS
AsmPrgmHELLO
NOSTUB
LD HL,HELLO
BCALL(/PUTS)
RET
HELLO
."HOWDY WORLD!
End
-
Good to here =]
Just one syntaxic error in your code : ascii string must be quote-terminated.
Also, the zero-terminating is missing, but asmdream doesn't really know the input for rom calls =]
Just found my first bug : the new instructions return a label-missing error.
Have to check that out.
-
So it's like Mimas, but use OS program editor?
Sounds great! :D
-
In short, yes.
The macro features makes it a little bit unique, though.
-
The bug i'm currently facing :
The macros that add the extra instructions are interpreted as real instructions !
For example, LD BC,DE is interpreted as LD BC,label_de.
I'm on it =]
EDIT
I know how to fix that, but i also know it will slow down the address labels calculation a lot.
I think i'm gonna go for the "Do not choose a macro name too close to a z80 instruction name." solution.
I also have to rename the extra instructions macros.
I'm hesitating between 2 syntaxs : XLD BC,DE and LD16 BC,DE
-
Hmm, oops, I forgot that 0... Still, it works nicely! Also, maybe macros can have mandatory parentheses like bcall( ? That might help.
-
Already thought of that solution.
The problem is that i don't want the user to misunderstand the meaning of the parentheses, since those are used to refer to indirect access in regular instructions.
The chosen syntax will be XLD (X for extra loading instructions).
Let's update that...
-
macros.8xp fixed and asmdream.zip updated.
All extra instructions are now working properly.
*****
Ideas for the next update :
advanced exchanges (at the cost of 1 hardware stack entry) :
EX BC,DE
EX BC,HL
EX BC,IX
EX BC,IY
EX DE,IX
EX DE,IY
EX HL,IX
EX HL,IY
general backup (at the cost of 6 entries) :
PUSH ALL
POP ALL
-
I have always wanted to make an assembler syntax that would take B→A and translate that to 78 (for ld a,b) and other such basicised assembly. Now I can do that!
-
Actually, that won't work, since the store token is not allowed in macro definitions/calls.
But i can change that easily =]
-
If you can, that would be cool, but it isn't necessary XD
-
After reading the readme, I see a couple of things that would keep me from wanting to use this. For one thing, it seems like it would be really annoying to have to delete the assembled program manually each time I want to assemble it again. And also, there are no bitshifting or bitwise operators... how am I supposed to split my labels into 2 bytes? D:
-
What do you mean by splitting your labels into two bytes? Do you mean getting the MSB and LSB?
-
What do you mean by splitting your labels into two bytes? Do you mean getting the MSB and LSB?
Yes, that's what I mean.
-
Thx for feedback calc84maniac =]
For one thing, it seems like it would be really annoying to have to delete the assembled program manually each time I want to assemble it again.
That's an interesting point.
I guess adding some kind of overwriting (wih confirmation) feature shouldn't represent too much trouble.
And also, there are no bitshifting or bitwise operators... how am I supposed to split my labels into 2 bytes? D:
I'm actually thinking of adding those to the feature list (multiplication also if i can).
By curiosity, in which case would you need to access the lsb or msb of a label ?
-
This seems pretty nice. Have you considered putting it in the Omni downloads in the future so it can be found easier here? :)
-
Accessing the LSB or MSB is sometimes useful in optimisations. For example, when I am computing the address to write a pixel to the graph buffer, I often do something that includes setting the 6th bit of C and loading 93h into B.
-
This seems pretty nice. Have you considered putting it in the Omni downloads in the future so it can be found easier here? :)
That would be a true honor =]
Maybe after the beta period ?
Accessing the LSB or MSB is sometimes useful in optimisations. For example, when I am computing the address to write a pixel to the graph buffer, I often do something that includes setting the 6th bit of C and loading 93h into B.
Optimization... of course.
*****
After having looked at it, i'm on my way to code :
logical bit shift left
logical bit shift right
bitwise and
bitwise or
bitwise xor
multiplication
possibility to automatically overwrite the destination program if it already exists
-
Cool! Maybe you can have something in the source code that is an "Autodelete" token. So if you started with maybe AsmPrgm.NAME it would automatically delete the program NAME. I'm just throwing around ideas, but I do like this, so far! I have already had a scenario where I was without a computer and compiler, so I used this :)
-
A "triggering" token is a nice idea i haven't even thought about...
Thx a lot for that suggestion.
Anyway, i'm definitely happy asmdream could have helped you that day =]
-
NEWS
Fixed a few minor bugs.
The store token is now allowed in macro name definitions (Thx xeda112358).
Overwriting the destination program is now possible (Thx calc84maniac).
Added more extra loading instructions (XLD).
Added extra exchange instructions (XEX).
LIST OF CURRENT EXTRA INSTRUCTIONS (space>speed)
no requirements :
XLD BC,DE
XLD BC,HL
XLD DE,BC
XLD DE,HL
XLD HL,BC
XLD HL,DE
requires 1 available stack entry :
XLD AF,BC
XLD AF,DE
XLD AF,HL
XLD AF,IX
XLD AF,IY
XLD BC,AF
XLD BC,IX
XLD BC,IY
XLD DE,AF
XLD DE,IX
XLD DE,IY
XLD HL,AF
XLD HL,IX
XLD HL,IY
XLD IX,AF
XLD IX,BC
XLD IX,DE
XLD IX,HL
XLD IX,IY
XLD IY,AF
XLD IY,BC
XLD IY,DE
XLD IY,HL
XLD IY,IX
requires 2 available stack entries :
XEX AF,BC
XEX AF,DE
XEX AF,HL
XEX AF,IX
XEX AF,IY
XEX BC,DE
XEX BC,HL
XEX BC,IX
XEX BC,IY
XEX DE,IX
XEX DE,IY
XEX HL,IX
XEX HL,IY
XEX IX,IY
NEXT CHALLENGE
new operators :
*:multiplication
<<:logical bit shift left
>>:logical bit shift right
and :bitwise and
or :bitwise or
xor :bitwise xor
[:left parenthese (calculation priority)
]:right parenthese (calculation priority)
-
Cool, new operators!
Also, a lot of those exchanges can be done with a single stack entry (and faster/smaller code).
XEX AF,HL: PUSH AF \ EX (SP),HL \ POP AF
XEX AF,IX: PUSH AF \ EX (SP),IX \ POP AF
XEX AF,IY: PUSH AF \ EX (SP),IY \ POP AF
XEX BC,HL: PUSH BC \ EX (SP),HL \ POP BC
XEX BC,IX: PUSH BC \ EX (SP),IX \ POP BC
XEX BC,IY: PUSH BC \ EX (SP),IY \ POP BC
XEX DE,IX: PUSH DE \ EX (SP),IX \ POP DE
XEX DE,IY: PUSH DE \ EX (SP),IY \ POP DE
XEX HL,IX: PUSH HL \ EX (SP),IX \ POP HL
XEX HL,IY: PUSH HL \ EX (SP),IY \ POP HL
XEX IX,IY: PUSH IX \ EX (SP),IY \ POP IX
-
You rock !
To tell the truth, i feel a bit ashamed to haven't found those by myself =S
Thx a lot =]
-
Do you have, or are you planning to make any entry points from other programs?
-
What you mean ?
Adding some shell routines into the app ?
-
is there a way to bring over includes from the computer (.inc)?
-
What you mean ?
Adding some shell routines into the app ?
I mean allowing a different program to pass a source to your assembler. If someone made a code editor, they would be able to place the program name in ram and call a routine in your app to compile it.
-
is there a way to bring over includes from the computer (.inc)?
No, and to tell the truth, i won't probably have the time to code that (That's why i included as much equates as possible.).
I mean allowing a different program to pass a source to your assembler. If someone made a code editor, they would be able to place the program name in ram and call a routine in your app to compile it.
Not initially, but that's an interesting idea.
I'll take a look at that, and see if that could be compatible without altering too much code.
*****
I'm also thinking of adding those :
- symbolic arguments allowed in program counter definition
- a faster way to call all the includes :
Why not an automatic detection/inclusion of all unprotected programs starting with theta (then check header) ?
Some feedback would be quite appreciated about this idea =]
-
If you are going to add an entry, I would start the app with a JP to the actual app code followed by a jump table (even if it is just 1 entry, so far). As for the automatic detection, that sounds useful and all you would need to do is load the name for prgm Theta into OP1, check it, then use _FindAlphUp to check for other programs.
-
Is there a way to include your own equate files made specifically for asmDream? If so, then I might be able to whip up a python script that converts .inc to a asmDream file (.txt to be converted to .8xp with a tokenizer), which the users could just send over to their calcs and then include like a normal include file.
-
That sounds pretty nice. :)
-
NEWS (screeny updated)
The assembling is now processed in 2 passes, instead of 3.
Includes are now detected automatically (no calls anymore).
Sources & includes names must now start with theta (overwriting security).
The destination name can not start with theta anymore (overwriting security).
The destination name is now displayed at the overwriting confirmation screen.
AsmPrgm was replaced by prgm (new syntax).
Refering to equate labels is now possible in initial program counter definition.
Destination data size security implemented (changeable maximum value).
Ascii arguments are now parsed properly (bug fix).
When using the goto feature, the cursor position is now properly set if there are word tokens in the line (bug fix).
The ram available for the destination data is now calculated properly (bug fix).
Some extra instructions have been optimized (thx calc84maniac).
Various code parts have been optimized.
Also, i added a to do list in the first post.
#####
As for the automatic detection, that sounds useful and all you would need to do is load the name for prgm Theta into OP1, check it, then use _FindAlphUp to check for other programs.
Coded =]
I used a custom routine (I always do that when i can).
Is there a way to include your own equate files made specifically for asmDream? If so, then I might be able to whip up a python script that converts .inc to a asmDream file (.txt to be converted to .8xp with a tokenizer), which the users could just send over to their calcs and then include like a normal include file.
Of course.
The compatible include format is detailed in asmdream.txt.
Don't hesitate to ask if you find something ambiguous =]
-
Wow, very cool! Is the download in the first post?
-
Wow, very cool! Is the download in the first post?
Everything was updated =]
-
Wow, and on TICalc.org, too, it is ranked in the top 150 most downloaded for the past week, that is crazy! There must be thousands of programs on there for all types of TI calculators!
-
Wow, and on TICalc.org, too, it is ranked in the top 150 most downloaded for the past week, that is crazy! There must be thousands of programs on there for all types of TI calculators!
However, the ticalc.org download is outdated for now so i recommend downloading here.
-
I can't wait to use this ! I have to wait until TI-Connect starts working for me again XD
Thanks much for this!
-
You're welcome Xedy =]
Btw, how naughty is your ti-connect ?
-
Oh, it recognises my calc, it just doesn't seem to want to send anything :/
-
Weird...
Do you use a front panel usb port ?
Any other usb devices in trouble ?
-
One of my USB ports has not worked for about a year (it still supplies power, so I can charge things), but TI-Connect has always been notorious for not being reliable.
-
Low batteries sometimes causes it to fail on transfers as well. You can try a fresh set if yours isn't.
-
Thanks! I will try that and that is probably the reason. In any event, I got it to send to my other calculator (after I got the batteries out of my 89), so I can use it :)
EDIT: Okay, so I have a few questions:
1) Is there any way to use calls in a macro? That could be very helpful!
2) Would you be able to add these as math operations: *, /, and, or, xor, not( ?
I ask these two because I wanted to make this macro:
Pxl-On(?,?{
LD BC,?0+?1*256
CALL GETPXLLOC
OR (HL)
LD (HL),a
}
Also, I made the outline of a snake game using Asmdream!
-
1) Is there any way to use calls in a macro? That could be very helpful!
In asmdream, an address label is always local, which means it can only be refered to in the area where it was defined.
In other words, it's not possible to refer directly to an address label in a macro body, if the label was defined in the data|code area of your source.
The thing is, macro parameters are there to help you do that =]
For example, this won't work :
APPLE{
CALL JUICE < "undefined label" error there, since JUICE is not in the macro area.
}
prgmFRUIT
APPLE
JUICE
...
You have to use a macro parameter to be able to refer to JUICE, indirectly, like this :
APPLE(?){
CALL ?0
}
prgmFRUIT
APPLE(JUICE) < JUICE can be refered there, since it's in the same area.
JUICE
...
You can also use this method, if your code is compatible :
APPLE{
...
}
prgmFRUIT
CALL JUICE
JUICE
APPLE
You can also define address labels directly in a macro body (but won't then be able to refer to them in the data|code area of the source) :
APPLE{
CALL JUICE
JUICE
...
}
prgmFRUIT
APPLE
2) Would you be able to add these as math operations: *, /, and, or, xor, not( ?
Most of the missing operators are already in my todo list (see first post).
To be honest, that won't be for today, since i have to revise many routines to integrate those.
I won't probably add the / operator, since there could be conflicts with labels names (/ already used as a replacement for _).
Same thing goes for the not( token.
Indeed, that left parenthese bothers me, since parenthese tokens are already reserved for instructions & macros.
Anyway, you'll still have this option : -argument-1.
I ask these two because I wanted to make this macro:
Pxl-On(?,?{
LD BC,?0+?1*256
CALL GETPXLLOC
OR (HL)
LD (HL),a
}
I know u know but this piece of code is a good occasion for me to clarify for other potential users :
Only the following tokens are allowed in a macro name definition :
numbers (0>9)
uppercase letters (A>Z) < The first one must be one of these.
space
,
> (store)
(
)
? (special, defines a parameter)
{ (end of line only)
Unfortunately, i'm afraid allowing more tokens would slow down the macro parsing and i want to avoid that.
Also, LD (HL),a should be LD (HL),A.
Also, I made the outline of a snake game using Asmdream!
I'm definitely happy to see i'm not the only one testing asmdream.
That's a true honor my friend =]
-
NEWS
Version 1.00 is out.
Not many changes, since i decided to go for a bigger project.
That said, i won't probably add new features (sorry bout that).
I'll still handle bug fixes of course.
Changes :
Bug fix : Instructions starting with "EX" now work properly.
Bug fix : Using the goto feature doesn't eat a few stack entries anymore.
Undocumented instructions syntax now fit the one used in "The Undocumented Z80 Documented" by Sean Young (as a reference).
Added "IM 3" instruction ($ED,$4E).
"NOSTUB" macro renamed to "ASM".
Removed extra instructions (I'll handle that in my other project).
Running asmdream from external code is now supported (standard and auto modes, see asmdream.txt).
Some reorganisations in includes.
Some optimisations here and there.
source now available, as promised.
See you around =]
-
This is good news :). What is your next project by the way?
-
Yo master DJ =]
It will be some kind of shell...
-
Are you hoping to have some kind of built in editor or something? Also, thanks for the update!
-
You're welcome buddy =]
I gave up the idea of coding a shell (today actually).
Instead, i'll probably go for a new programming language.
I really like the idea of making it real-time.
But it's quite a challenge, since parsing & executing at the same time eats some cycles.
I'm curious to see how fast it can be (compared to ti-basic)...
-
Instead, i'll probably go for a new programming language.
I really like the idea of making it real-time.
But it's quite a challenge, since parsing & executing at the same time eats some cycles.
I'm curious to see how fast it can be (compared to ti-basic)...
Already, asmdream could be converted into a powerful language on its own. If you take out the compiling menu stuff and simply run through the source code throwing in bonus functions like for drawing, output/input, and loops, it doesn't matter if it is slower. It would still be a very powerful language with how versatile you have made macros.
-
Versatile ? I like that word =P