Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: the_mad_joob on May 02, 2011, 05:18:00 am

Title: asmdream is waking up...
Post by: the_mad_joob on May 02, 2011, 05:18:00 am
hey there...

I'm quite new to these forums but i thought it would be nice to share the thing around :

A few weeks ago, i digged out a project that was sleeping for too long.
It's called "asmdream" and is, in fact, an (other) on-calc asm compiler for the 8X+ series.
So, nothing revolutionnary, but it has its particularities (wanted to make something new).

The main challenge here was to make it able to convert token-based sources directly into machine code.
For the ease of use, i was forced to define a simplified syntax because of the large font usage and lack of readability of the tios prgm editor.
But don't worry, i made it very instinctive so we're not so far from tasm.

It is supposed to handle, at least :
- all z80 instructions (undocumented included)
- includes
- labels
- equates (nesting allowed)
- macros with parameters (nesting allowed)
- bases conversions : binary/decimal/hexadecimal/ascii/token
- arithmetic operators : positive/negative/addition/substraction
- read from flash (sources/includes)

For obvious reasons, i do my best to optimize it in favor of space (about 2K for now) but i'm still amazed how fast it does the job.
I work on it many hours per day but it's still hard to tell when it'll see the light (progress maybe around let's say... 50%).

I'll use this thread to post news and (hope not) ask for help.
Also, don't hesitate if you've some questions/suggestions.

cu around =]
Title: Re: asmdream is waking up...
Post by: ZippyDee on May 02, 2011, 05:57:05 am
Sounds awesome! I can't wait to see how it turns out! Also, welcome! :D [insert peanuts that you've almost definitely already received somewhere else...]
Title: Re: asmdream is waking up...
Post by: aeTIos on May 02, 2011, 01:02:41 pm
I hate to say this, but there's already something for this: Mimas (http://www.ticalc.org/archives/files/fileinfo/431/43140.html)
But, this sounds cool too! And the TI OS prog editor sounds also cool. Mimas is more like an IDE.

Hope this will be finished!
Title: Re: asmdream is waking up...
Post by: AngelFish on May 02, 2011, 01:53:02 pm
Sounds awesome! I can't wait to see how it turns out! Also, welcome! :D [insert peanuts that you've almost definitely already received somewhere else...]


(http://www.omnimaga.org/index.php?action=dlattach;topic=4454.0;attach=7537;image)


You have no idea how close I came to editing the peanuts into your post ;D

*Qwerty.55 always hits the Modify button instead of the Quote button...

Anyway, good luck the_mad_joob. It's a big project, so don't be afraid to ask for help if you need it.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 02, 2011, 02:07:46 pm
Already knew the existence of mimas but thx for the info =]
Didn't try it (yet) but that looks like a great option for now.

Like i said, i wanted to write my own for fun and challenge.

Don't know if mimas (or any other compiler) can do this but i intend to enlarge the way macros work to the maximum, including labels usage and parameters nesting.
If i succeed in this part of the code, the possibilities may be huge, like let's say, an easy way to create a high level programming language.
But, writing this kind of loops may be a true pain without anything to smoke...
Hopefully, i have prodigy =]

Thx for support guys...

P.S. : Some more peanuts ! Tradition sometimes has its good points =]
Title: Re: asmdream is waking up...
Post by: DJ Omnimaga on May 02, 2011, 02:20:45 pm
Heya and welcome on the forums if I did not welcome you already before. This seems interesting. Just keep in mind making an on-calc ASM compiler or IDE can be a bit hard at first, so if you are new to programming, this might be a challenging project. Regardless, good luck. I am curious what this project will include that Mimas is missing. :)
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 02, 2011, 02:29:57 pm
Hey dj...

Writing source code directly from the tios and macros enhancements may be a good start =]
And yeah, that is my first "serious" z80 project but i'm already familiar with asm programming (hopefully).

Cu around...
Title: Re: asmdream is waking up...
Post by: DJ Omnimaga on May 02, 2011, 02:37:51 pm
Ah ok good to hear. I can't wait to see what you will come up with. Keep us updated! :D
Title: Re: asmdream is waking up...
Post by: ralphdspam on May 02, 2011, 09:46:25 pm
Sounds nice!  Good luck.  :)
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 03, 2011, 01:36:53 am
Thx =]

Here's a summary of what's done for now :

*****

DISPLAY
title screen
main interface
status
basic error messages

KEY INPUT
basic actions
target source input

KERNEL
auto-detection of sources/includes locations (ram/flash)
sources/includes reading directly from flash
basic directives
can locate the matching equate definition from its call
can locate the matching macro definition from its call (even if it has some custom parameters)
complex token strings conversion (multiple bases and arithmetic operators mixed in a single expression)

MISC
z80 ops file matching asmdream syntax

*****

So, a lot of work to write all this but the worse is yet to come...

Anyway, i won't forget to share the news =]
Title: Re: asmdream is waking up...
Post by: DJ Omnimaga on May 03, 2011, 01:54:53 am
I see. Good luck with the rest of the stuff!
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 03, 2011, 02:26:02 am
Thx, but i'm afraid the word "luck" has no meaning in zilog world =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 03, 2011, 09:46:42 pm
Yo...

Today, written mac_call & mac_return.
Those routines both allow jumps through sources & includes and increment/decrement a custom stack pointer.
This stack is used to backup calls & definitions pages/offsets before the jumps, in order for the nesting feature to be functional.
Also, it may later allow parameters passing =]
Imagine the possibilities with for example 3 nested macros, the 3rd one using the 1st one's parameters...

Have to do the same for equates now.
After that, i think i will have the necessary routines to code the part of the main which calculates the size of the output program and reserves it in ram (or displays an error if not enough available).

Btw, i have a little question.
If i create a huge basic program (data>16385 bytes more precisely) and then archive it, is there a chance that it will span more than 2 rom pages ?
I'm asking because if this is not the case, this could reduce the size of one of my routines a little bit (and additionally accelerate the reading of archived sources/includes).
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 04, 2011, 01:40:37 pm
Modified mac_call a bit.
It now also includes a backup of the current program counter value.
This will allow the usage of local labels inside macros definitions =]
Title: Re: asmdream is waking up...
Post by: Xeda112358 on May 04, 2011, 03:45:08 pm
Since each page is 16384 bytes, technically if the program was 16386 bytes, it could use the last byte on one page, the whole next page, and the first byte on the following page...

By the way, I have a similar dead project that has all the bcalls and RAM equates in the regular ti83plus.inc file and I might be able to fix it up a little to suit your needs... no guarantees, though x.x That version used Celtic 3 to search for the name and return the address. I've been meaning to update it using other methods of programming that are geared more toward this kind of data crunching (BatLib BASIC).
Title: Re: asmdream is waking up...
Post by: calc84maniac on May 04, 2011, 04:03:59 pm
Here's a neat routine I made that is useful for streaming data from either Archive or RAM (if reading from Archive, it is assumed that the correct page is mapped into $4000 beforehand).
Code: [Select]
;To increase the pointer in HL, just call IncPointer
;For slightly faster throughput, use: inc l \ call z,IncPointerMSB
IncPointer:
    inc l
    ret nz
IncPointerMSB:
    inc h
    ret po
    push af
    in a,(6)
    inc a
    out (6),a
    ld a,h
    sub $40
    ld h,a
    pop af
    ret
Title: Re: asmdream is waking up...
Post by: willrandship on May 04, 2011, 06:04:05 pm
I see one advantage this has over mimas: Tokens are smaller than straight ASCII, if you use the commands, not just letters. If you just use the tokens for space, A-z and numbers, then it will use more, I think. Plus, it's not like it hurts to have multiple progs available for the same purpose.

May I recommend having a marker at the beginning of the file, that makes it invalid as BASIC, and makes your assembler able to see it? just a thought.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 04, 2011, 07:53:55 pm
Hey guys...

@ Xeda112358 :
- about page spaning :
Thx 4 the answer =]
I wanted to be sure cause i already knew that group variables were (supposed to be) limited to 2 pages at max (meaning data location may be adjusted by the os if crossing a 3rd one).
- about inc file :
Well, that's one of my issues, since asmdream syntax is specific.
I'll take care of this when i'm sure the whole algo works.
I was thinking of building some kind of syntax converter but i won't forget your proposition if i encounter some issues =]

@ calc84maniac :
Thx 4 the routine =]
Mine is 2 bytes bigger but i think i'll leave it as it is for one reason :
It is called after pointer modifications (not only incrementations).
This saves lots of jumps, especially when you need to alter the pointer without accessing data.

@ willrandship :
- about tokens :
I already thought about it before starting the project but unfortunately, only 1-character tokens will be authorized.
Mainly because other ones may definitely not match the directives functions (custom would have been nice but no time for this).
Also, i didn't want the user to spend his life in menus or catalog.
In fact, except when using the token2ascii feature, all the needed tokens can be accessed without entering any menu, for efficiency purpose.
- about the marker :
Thx for reminding it to me !
I already thought about it but for an unknown reason, the idea vanished from my priority stack =]

Have to go... notepad is calling me =]
Title: Re: asmdream is waking up...
Post by: Deep Toaster on May 04, 2011, 08:23:17 pm
KERNEL
auto-detection of sources/includes locations (ram/flash)
sources/includes reading directly from flash
basic directives
can locate the matching equate definition from its call
can locate the matching macro definition from its call (even if it has some custom parameters)
complex token strings conversion (multiple bases and arithmetic operators mixed in a single expression)

Hey, that's pretty awesome. Good luck on this project (yeah, luck)! What do you think the final version'll be like (app, prgm)?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 06, 2011, 06:30:38 pm
@ Deep Thought :
And it's just the beginning =]
Dunno yet if it will be an app or prgm (have to succeed in creatin it first...).
To be honest, i dunno much about apps but it will mainly depend on :
- How much data is copied from flash to ram in the execution process (the less the better).
- If other programs may potentially be reallocated in the execution process.

Written about 500 bytes of routines today.
One of those is "line_size_multi", which is able to return the amount of ram that will be compiled by any type of data-output directive.
Haven't tested it yet, but had to code it, since label usage requires it.

An interesting thing to mention is that when you represent a part of the main algo structure on paper, it definitely matches the Sierpinski fractal =]
Title: Re: asmdream is waking up...
Post by: Ashbad on May 06, 2011, 07:10:09 pm
I see one advantage this has over mimas: Tokens are smaller than straight ASCII, if you use the commands, not just letters. If you just use the tokens for space, A-z and numbers, then it will use more, I think. Plus, it's not like it hurts to have multiple progs available for the same purpose.

May I recommend having a marker at the beginning of the file, that makes it invalid as BASIC, and makes your assembler able to see it? just a thought.

That's how Mimas works ;)  each instruction is split into small tokens -- usually one for the instruction name, a few for the parameters.  In fact, he even condenses the ASCII so if you use mostly lowercase (iirc) letters, he makes them at 5/8ths to 3/4ths the size of what they were before.  However, you can try and best that by making it accept even smaller tokens ;)

good luck on this, joob!
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 06, 2011, 09:06:59 pm
Thx...

The word "mimas" seems to be quite redundant around =]
Remember this is my first "true" asm project on this hardware, so i hope you don't expect to see something better.
Keep in mind sources must be written using the built-in prgm editor so in some ways, there's a great chance some of you find it more restrictive than mimas.
Just think of it as an old-school alternative that may include some juicy features =]
Title: Re: asmdream is waking up...
Post by: Xeda112358 on May 06, 2011, 10:57:32 pm
Hehe, cool. When I was planning out the version I wanted to make, I was going to include things like using a→b if somebody didn't want to use "ld b,a" and a few other things like that. Also, are you going to make it so that the uppercase and lowercase letters are interchangeable? I know I tried using an on-calc assembler that only allowed lowercase and it was not only a pain, but it used about twice as much memory as it needed !_!

I wish you luck!
Title: Re: asmdream is waking up...
Post by: Deep Toaster on May 06, 2011, 11:27:34 pm
The word "mimas" seems to be quite redundant around =]

That's because Mimas is still the only real working on-calc assembler around :) Except for OTBP, but that's not practical for anything larger than a short script.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 07, 2011, 12:33:27 am
@ Xeda112358 :

Thx again =]
Lowercase tokens will be forbidden almost everywhere in sources and includes, for space purpose (and laziness i must confess).
The only places where you will be authorized to use them will be inside tok2ascii or tok2tok fields.
For example :   LD A,"n   will be recognized whereas   ld a,"N   will not.

@ Deep Thought :

Yeah, when i see how horrible (but not impossible) it is to code one, mimas must have been a great achievement for its author(s).
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 01:50:50 am
After several nights of coding, we can now say progress has increased from 50 to 60% =]

Equate call & return routines finished (another dedicated stack was required).

I'm about to code a hard part of the project.
It's a loop which is supposed to return a 16-bit value from a complex expression which can be composed of straight values but also equates (which can themselves call other complex expressions and so on...).

Also, added a funky feature which will allow both basic and asmdream languages to cohabit in a single prgm.
Dunno if it will have a utility of any sort but added it since it was really easy to implement.
Title: Re: asmdream is waking up...
Post by: aeTIos on May 09, 2011, 03:59:38 am
That sounds awesome! great job on the fast coding!
how many app pages is it now?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 05:44:23 am
@ aeTIos :
Terribly awesome =]
For now, it is a simple prgm of about 2,7K (I estimate the final size at about 4-5K).
Add to this the z80 file (~16K), and the ti8X+ file (not ready at all).

*****

Just finished some new routines...
It's official, complex nested equates are functionnal !
(Note : worked for the 1st time when tested ; definitely recommend wu tang for flawless coding =])

Btw, i need some advices from experienced coders about something :
The way i made it, everything can be referenced inside equate definitions, except for macro parameters and labels.
For macro params, i don't even think about it.
But, labels worry me a bit more.
Dyu think it would really be useful ?
In other words, dyu often use label referencing inside equate definitions ?
Title: Re: asmdream is waking up...
Post by: Munchor on May 09, 2011, 07:22:05 am
hey there...

I'm quite new to these forums but i thought it would be nice to share the thing around :

A few weeks ago, i digged out a project that was sleeping for too long.
It's called "asmdream" and is, in fact, an (other) on-calc asm compiler for the 8X+ series.
So, nothing revolutionnary, but it has its particularities (wanted to make something new).

The main challenge here was to make it able to convert token-based sources directly into machine code.
For the ease of use, i was forced to define a simplified syntax because of the large font usage and lack of readability of the tios prgm editor.
But don't worry, i made it very instinctive so we're not so far from tasm.

It is supposed to handle, at least :
- all z80 instructions (undocumented included)
- includes
- labels
- equates (nesting allowed)
- macros with parameters (nesting allowed)
- bases conversions : binary/decimal/hexadecimal/ascii/token
- arithmetic operators : positive/negative/addition/substraction
- read from flash (sources/includes)

For obvious reasons, i do my best to optimize it in favor of space (about 2K for now) but i'm still amazed how fast it does the job.
I work on it many hours per day but it's still hard to tell when it'll see the light (progress maybe around let's say... 50%).

I'll use this thread to post news and (hope not) ask for help.
Also, don't hesitate if you've some questions/suggestions.

cu around =]

Great, will it include a disassembler or just a typer and assembler? Looks promising =D
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 07:40:51 am
Wow... What a post rush =]

No disassembler.
Not even a typer.
Just a compiler which reads sources written directly using the os prgm editor.
Title: Re: asmdream is waking up...
Post by: Munchor on May 09, 2011, 07:45:17 am
Wow... What a post rush =]

No disassembler.
Not even a typer.
Just a compiler which reads sources written directly using the os prgm editor.

Ah OS PRGM Editor, looking good too :D This will shorten the code.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 07:49:15 am
Yeah, quite.
Wanted to make it old-school =]
Title: Re: asmdream is waking up...
Post by: aeTIos on May 09, 2011, 02:08:54 pm
So, like you said for the size, 16+5+a bit ~= 24 =2 app pages, like Mimas.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 04:04:39 pm
Flash is a seducing option for the 1st release, yeah.
But, i'm still asking myself some questions about it :

When you execute an app, i suppose a part of it is loaded into ram when executed.
Taking into acount the size an app can have, there may be multiple copies during its execution.
That means there is a chance other prgms located in ram (sources/includes in this case) may be reallocated by the os during those copy process (the same way it is when a simple prgm is executed).
This could be quite annoying because i would have to modify many things (in other words, check if sources/includes have been moved or not before each reading attempt).
Also, this could slow down the whole thing...

Could someone clarify this for me ?

P.S. : Tonight, i go for the core label features (and maybe mac params if this goes fast).
Title: Re: asmdream is waking up...
Post by: calc84maniac on May 09, 2011, 05:17:38 pm
Actually, APPs are executed directly from Flash ROM, after being mapped into memory at $4000-$7FFF. A side-effect of this is that APPs must be a multiple of 16KB large (and for apps larger than 16KB you'll have to deal with reading data from or jumping between the multiple pages). Also, you cannot modify any data inside the APP, of course.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 05:31:05 pm
Thx =]

Ok, so that looks to me like a great deal.
Another question :

Does the 8811 limitation concerns all prgms, or only the ones made to be executed ?
Title: Re: asmdream is waking up...
Post by: calc84maniac on May 09, 2011, 05:48:02 pm
Thx =]

Ok, so that looks to me like a great deal.
Another question :

Does the 8811 limitation concerns all prgms, or only the ones made to be executed ?
That is the maximum number of executable bytes in an Assembly program, because it is loaded at $9D95, and executing on the RAM past $C000 causes a RAM clear. $C000 minus $9D95 is 8811, which is where this magic number comes from.
Title: Re: asmdream is waking up...
Post by: FinaleTI on May 09, 2011, 05:51:32 pm
Thx =]

Ok, so that looks to me like a great deal.
Another question :

Does the 8811 limitation concerns all prgms, or only the ones made to be executed ?
That is the maximum number of executable bytes in an Assembly program, because it is loaded at $9D95, and executing on the RAM past $C000 causes a RAM clear. $C000 minus $9D95 is 8811, which is where this magic number comes from.
Unless you decide to use Crabcake.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 06:06:54 pm
Thx again guys =]

I'm actually thinking about error handling.
Does anyone knows if there's an easy way to call a "ERR:XXX Quit/Goto" menu from an asm prgm/app (like in DCS) ?
Thought it would be a great idea to easily locate errors in sources/includes...
Title: Re: asmdream is waking up...
Post by: AngelFish on May 09, 2011, 06:07:49 pm
Yes, there's a Bcall for custom errors.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 06:08:17 pm
Sounds great =]

Does it automatically stops execution of asm code or what ?
Title: Re: asmdream is waking up...
Post by: AngelFish on May 09, 2011, 06:09:15 pm
Bcall 4D41 (http://wikiti.brandonw.net/?title=83Plus:BCALLs:4D41) if you're curious.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 06:13:33 pm
Looks like there is no built-in goto option (same with 4D44).
That would mean i would have to code a custom one...
Title: Re: asmdream is waking up...
Post by: AngelFish on May 09, 2011, 06:15:22 pm
There is. Use bcall(_JError) instead and set bit 7 of A.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 06:16:29 pm
Really ?
Let me check that one =]
Thx...
Title: Re: asmdream is waking up...
Post by: AngelFish on May 09, 2011, 06:17:34 pm
Er, B_JUMP JError, not Bcall... My mistake :)
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 06:34:00 pm
Unfortunately, dunno much about exception handler (yet)...
Can a b_jump ret from an asm prgm/app ?
If yes, i'll still have to trick it so that, when goto is selected, it goes to the location (token) i want.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 09, 2011, 07:03:22 pm
Looks like i found how to do it.
Just need to replace the location of asmdream call stored in the stack with the desired offset.
Also, the routine will first have to check if the concerned source/include is archived or not.
Let's try this...
Title: Re: asmdream is waking up...
Post by: the_mad_joob on May 10, 2011, 02:36:45 am
News are not that good...
I've decided not to neglect error handling.
That's why i'll have to modify lots of stuff (better do it now than never).
In other words, progress has dramatically decreased =[
I'll keep ya informed but don't expect to see some news as frequently as before...
Title: Re: asmdream is waking up...
Post by: DJ Omnimaga on June 06, 2011, 06:02:45 pm
Sorry to hear, I hope you don't kill this project. Also sorry for late post, I was sidetracked with other stuff, so I only check projects once a month and don't have time to check every topic XD
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 06, 2011, 08:43:42 pm
Yo...

No problemo master =]
Not much time to dedicate to the project these days so i code a little when i can.
But i can tell i haven't give up yet...
Title: Re: asmdream is waking up...
Post by: DJ Omnimaga on June 06, 2011, 08:54:40 pm
Ah ok, I assume it's due to school? When do you finish?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 07, 2011, 12:41:42 am
School is far behind me now.
Let's say i have some larger philosophic problems to deal with these days...
I'll try to unlock some more time soon, i promise =]
Title: Re: asmdream is waking up...
Post by: DJ Omnimaga on June 07, 2011, 03:35:24 am
Oh ok, sorry to hear. I hope it's nothing too bad D:
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 07, 2011, 08:54:43 pm
Yo...

Looks like i'm gonna be able to unlock some more time on the project.
I'm still on my way to include some essential error handling.
Basically, that means re-thinking/re-writing a fat part of my stuff.
When this part of the algo will be finished, there will be (i hope) no way for asmdream to crash while assembling, which is a good point.
Despite it's a real pain, it had to be done and fortunately, things work like i want these coding days =]

While i'm at it, i decided to remove several restrictions.
More precisely, most of the features will only be limited by the amount of available memory.

The road is long but i'll make it !
Title: Re: asmdream is waking up...
Post by: DJ Omnimaga on June 07, 2011, 08:57:02 pm
Cool to hear. :D Keep up the good work and good luck :D
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 07, 2011, 08:58:30 pm
Thx there =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 18, 2011, 01:20:57 pm
Hey there =]

A quick post to keep ya informed...

overall progress : let's say around 67%
current code size : almost 5K

I'm currently coding the part that deals with address labels (hot).

*****

While i'm at it, i need some advices on something :

When asmdream encounters an error in pass 1 (check part), i'd like the user to be able to use a goto feature to easily locate the error in source|includes.

More precisely, asmdream displays the appropriate error message and if the user selects "goto", i need to process the following steps :
- quit the program, and right after :
- automatically opens up the os prgm editor for the concerned prgm
- automatically sets the blinking cursor to a predefined token

I already thought of tricking the os by simulating a fake syntax error, but without displaying its err message, since i already have mine.
But, i still dunno how to do this =S

Also, i found a bcall named _GoToErr (4CD8) but it's fully undocumented =[

Anyway, for now, when an error is encountered, asmdream saves the following data :
- prgm obj & name
- error token offset
- error token page (if in rom)

Any idea ?

Thx in advance =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 19, 2011, 01:08:02 pm
Written 500 bytes today...

Progress at about 70% now.

It's getting better and better =]

Anyone to answer my question (see previous post) ?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 20, 2011, 10:33:46 am
If everything goes well, i'll finish the address labels feature today.

It will then be time to finish the macro feature.
The way i made it, the possibilities will be really huge, like, for example, being able to create new instructions.
Wouldn't it be fun to be able to code something like, for example : EX BC,DE =]

Cu around...

P.S. : I still need some help (2 posts behind). Thx in advance u experienced coders =]
Title: Re: asmdream is waking up...
Post by: Deep Toaster on June 20, 2011, 02:39:25 pm
The OS has error messages in the form of B_JUMP routines. You call bjump on them, handing control back to the OS, and after the user selects Quit or Goto you're out of the program. I wouldn't recommend using it though -- might even be simpler to just write your own error message. ERR:SYNTAX isn't really informative anyway :P
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 20, 2011, 03:46:54 pm
Thx for reply =]

Already knew about the b_jump routines.
Qwerty.55 already adviced me to use the JError one.
The problem is, that it seems to be just an error displayer and nothing else.
What i need to do is, after exiting, forcing the system to point to a specific token in a specific prgm.
I know it's possible, since it's one of DCS features.

*****

Progress has moved to 75%.
It's official, address labels are now fully interpreted by the algo =]
I'm on my way to complete the macro features and i'm sure it's gonna be quite a pain, since i have to deal with parameters.
Once this part completed, the rest will be a cake walk...
Title: Re: asmdream is waking up...
Post by: Deep Toaster on June 20, 2011, 06:15:07 pm
Thx for reply =]

Already knew about the b_jump routines.
Qwerty.55 already adviced me to use the JError one.
The problem is, that it seems to be just an error displayer and nothing else.
What i need to do is, after exiting, forcing the system to point to a specific token in a specific prgm.
I know it's possible, since it's one of DCS features.

Yeah, the JError routines basically just display the error messages. If you want it to jump to a specific location in a program, you need to find that location yourself, open up the edit buffer, load the program in, and set up the edit pointers to point to that location.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 21, 2011, 03:34:55 am
Just what i needed to know.
Informations are now copied inside my brain =]
I'll try to manage this using the edit buffer.
I knew it was a good choice when i decided to keep, a long time ago, that undocumented EDITBUF.PDF.

Thx again =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 22, 2011, 07:20:25 pm
progress : 80% (6357 bytes)

left to do before initial release :
- variables initialisation
- automatic differentiation of executable or read-only data
- main loop (compatible with pass 1 & 2)
- final size check before writing
- goto on errors handling (automatic unarchiving if enough free ram to do so)
- z80 include prgm (progress : 95%)
- 8X+ include prgms (progress : 0%)
- code testing & optimizing
- readme file
Title: Re: asmdream is waking up...
Post by: the_mad_joob on June 29, 2011, 09:53:52 am
progress : 85% (code : about 8K bytes)

left to do before initial release :
- main loop > 99% > currently practicing bugs genocide
- final size check before writing > 0%
- goto on errors handling > 0%
- z80 ops compatible include prgm > 99% > last ascii to token conversions
- 8X+ equates compatible include prgm(s) > 0%
- overall testing > 0%
- optimizing if necessary > 0%
- readme file > 0%

Screenies soon to come =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on July 01, 2011, 09:21:04 am
Prgms are assembled correctly and all the features seem to work as intended.
I'm facing one problem now : the whole process becomes really slow when huge prgms are included in the source.
Looks like the optimization part is gonna be more than just optimization =[
Title: Re: asmdream is waking up...
Post by: the_mad_joob on July 06, 2011, 10:51:39 am
A quick screeny, just to show that a simple program can be generated successfully.
As you can see, the process is quite slow for now.
That is due to the huge size of the prgm which includes z80 ops (around 16K).
I'm actually working on it and hope i'll find a way to speed it up.

There u go :

(http://i41.servimg.com/u/f41/15/81/14/46/asmdre10.gif) (http://www.servimg.com/image_preview.php?i=68&u=15811446)
Title: Re: asmdream is waking up...
Post by: TIfanx1999 on July 13, 2011, 09:24:32 am
Hey, this is pretty cool. I actually like the fact that it uses the built in program editor. Keep up the good work. ^^
Title: Re: asmdream is waking up...
Post by: ztrumpet on July 13, 2011, 09:41:13 am
Wow, this is awesome.  Nice work, the_mad_joob. :D
Title: Re: asmdream is waking up...
Post by: Hayleia on July 13, 2011, 09:42:22 am
This is amazing ! This is one reason why I gave up ASM: not on-calc.
With ASMdream, I wouldn't have given up (maybe)!
Title: Re: asmdream is waking up...
Post by: ztrumpet on July 13, 2011, 09:52:46 am
This is amazing ! This is one reason why I gave up ASM: not on-calc.
With ASMdream, I wouldn't have given up (maybe)!
* ZTrumpet looks at Mimas...
http://ourl.ca/7269
Title: Re: asmdream is waking up...
Post by: Hayleia on July 13, 2011, 10:16:43 am
* ZTrumpet looks at Mimas...
http://ourl.ca/7269
I didn't know about it, but it is too late, now, :-\ I've given up.
Thanks anyway.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on July 13, 2011, 05:52:09 pm
Hey guys...

It's good to have some support, since i haven't seen some for a while, so thx again =]

What i'm doing these days :
- prgm to app converting (1 page), to free up as much ram as possible
- optimizing in favor of speed
- making it compatible with all 83+|83+SE|84+|84+SE devices

Also, looks like i found a way to increase speed by internally indexing the reading of system includes.
Add to that automatic switching to 15mhz and it should be fast enough.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on July 29, 2011, 08:05:21 am
Some little news for those interested in this not-so-dead project :

The conversion of my source from prgm to app is going good.
However, it requires a lot more rigour, since i have to handle memory swapping in bank b (the price to pay to be able to read archived prgms).

Also, decided to abandon the idea of treating z80 ops as macros (which was working, but definitely too slowly).
Instead, they're gonna be hard-coded, following an horrible (but lot more efficient) algorithm i'm about to give birth.
Anyway, the way i'm making it, the whole thing will fit in a 1-page app.

While i was dealing with z80 ops, i noticed some errors in the well-known undocumented z80 table provided by joe wingbermuehle (tasm compatible).
I'm posting the thing here, since i thought creating a dedicated topic was, let's say, too much :

replace :
OUT   F,(C)   71ED   2   NOP   1
by :
OUT   (C),F   71ED   2   NOP   1

replace :
DEC   IYH   24FD   2   NOP   1
by :
DEC   IYH   25FD   2   NOP   1
This one is especially dedicated to those who never found the origin of the bug in their source =]

Nothing thick to show for now, except maybe my new splash :

(http://i41.servimg.com/u/f41/15/81/14/46/asmdre11.gif) (http://www.servimg.com/image_preview.php?i=69&u=15811446)
Title: Re: asmdream is waking up...
Post by: ztrumpet on July 29, 2011, 11:31:28 am
That's pretty interesting.  Personally, I think you should make a new topic, in case some people don't see it here. ;)

I like the new splash screen. ;D
Title: Re: asmdream is waking up...
Post by: the_mad_joob on July 29, 2011, 12:09:34 pm
Hey trumpet man...

Well, didn't really know if that specific tasm80.tab was used by lots of coders.
If you think that's worth it, maybe i should create a dedicated topic, indeed.
Add to that the fact that i found a 3rd error...
Title: Re: asmdream is waking up...
Post by: the_mad_joob on August 19, 2011, 04:59:44 am
Some fresh news...

After infinite failed attempts, i finally found a way to force the os to open up the prgm editor upon exiting the app.
However, since the method is quite tricky, i won't get the render i wanted.

The sequence will look like this :

- An error is encountered during the process.
- The error details are displayed.
- The curious user selects the goto option.
- The app automatically quits.
- The os immediately shows a syntax error.
- If goto is selected, the prgm editor is opened for the concerned prgm (source or include), the cursor pointing to the line where the error was encountered.

Unfortunately, here are the drawbacks :

- The ugly ERR:SYNTAX menu.
- The user will have to select the goto option twice (one time in the app and one time when back to the os).
- Not possible to point to a token, only a line (The user will have to use his brain a bit, despite i didn't wanted that).
- I will have to modify my code again =[

I wouldn't say i'm proud of it but it's better than nothing and at least, it works =]
Title: Re: asmdream is waking up...
Post by: ZippyDee on August 19, 2011, 06:14:17 am
There must be SOME way to get it to work. Axe Parser does it if you press [PRGM] on the error screen when compiling...Ask Quigibo how he does it.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on August 19, 2011, 07:01:12 am
PM sended.
Thx for the tip zippy =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on November 24, 2011, 09:24:01 am
Some little fresh news about the project :

Current size is about 17K, and final will probably be around 20 (2 pages app confirmed).
The code part will probably be finished in a few weeks.
It took longer than expected, cuz i did lots of changes since.
I'm also optimizing the best i can, in real time (trust me, would be too dangerous to perform post-optim with such code).
The way i coded it (and if everything works as expected), asmdream should handle things such as high level language libraries (soundz juicy i know =]).

z80 ops are now hard-coded and threated using my new 4-levels indexing algorithm, which should improve the assembling speed significantly.
On the other hand, i reduced the assembler limitations to the max i could, and there's a chance it'll have a negative impact on assembling speed (definitely hope not).

It will handle up to 17 different error types.
That said, still have to find how to code a custom goto routine... (@Quigibo : help me plz you're my only lead there =])
Title: Re: asmdream is waking up...
Post by: aeTIos on November 24, 2011, 09:36:48 am
Nice!
Title: Re: asmdream is waking up...
Post by: the_mad_joob on November 25, 2011, 10:41:10 am
> all procedures complete <

current overall size (bin) : 17830 bytes

left to do, in order :

> main code for passes 1, 2, and 3 (represents less than 10% of the whole code)
> debugging part 1
> screeny for u guyz =]
> hardware-specific include prgm(s) (basically some boring reformating job)
> debugging part 2
> find a way to code the goto feature and do it
> debugging part 3
> jp>jr optimization
> readme
> upload beta @www.ticalc.org
> create dedicated topic @www.omnimaga.org

I can make it...
Title: Re: asmdream is waking up...
Post by: LincolnB on December 01, 2011, 10:29:18 am
Very nice! I don't code ASM, I'm more into the Axe side of things, but this sounds pretty neat.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 09, 2011, 06:17:09 pm
Thx =]

*****

left to do :

> code for passes 1, 2, and 3
> debugging part 1
> screeny for u guyz =]
> hardware-specific include prgm(s) (basically some boring reformating job)
> debugging part 2
> find a way to code the goto feature and do it
> debugging part 3
> optimization
> readme
> upload beta @www.ticalc.org
> create beta-testing topic @www.omnimaga.org

As promised, the new algorithm, which is waaaaay faster :

(http://i41.servimg.com/u/f41/15/81/14/46/asmdre12.gif) (http://www.servimg.com/image_preview.php?i=70&u=15811446)
Title: Re: asmdream is waking up...
Post by: C0deH4cker on December 09, 2011, 07:13:29 pm
Looks awesome!!!

I use mimas now, but am frustrated over the lack of macro support. This will help a lot. Maybe you could include support for including appvars as headers? like convert ti83plus.inc into appvTI83PLUS. That way, we dont have to define every b_call address or system ram pointer/flags offset.
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 09, 2011, 08:06:09 pm
Oh, hey, did your question ever get answered about jumping to errors? I do this in Grammer, so I do know how to do this, but to make life easier, you will need to only allow it for programs in RAM. Anyways, what I would do:

-At the beginning of the program, store the source file name at address 9652h. Since you must at some point have the name of the program in OP1, just copy OP1 here.
-Next, get the size of the program and make sure to have a pointer to the data (not the size bytes)
-Store the address of where the program data is at 965Bh
-Add the size of the program to the start address to get the end of the source file and store it to 965Fh

Now you are all set up. When you need to jump to an offending byte, store the address to 965Dh and then just use bcall(_JError)

I hope this helps!
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 09, 2011, 08:34:02 pm
Looks awesome!!!

I use mimas now, but am frustrated over the lack of macro support. This will help a lot. Maybe you could include support for including appvars as headers? like convert ti83plus.inc into appvTI83PLUS. That way, we dont have to define every b_call address or system ram pointer/flags offset.

Thx =]

asmdream only reads prgms, which can be sources, label libraries and macro libraries.
With prgms, the user is free to consult them, just like he'd do on a computer.
I plan on creating maybe half a dozen includes with useful equates.
More precisely, this is the next thing on my todo list =]

*****

Oh, hey, did your question ever get answered about jumping to errors? I do this in Grammer, so I do know how to do this, but to make life easier, you will need to only allow it for programs in RAM. Anyways, what I would do:

-At the beginning of the program, store the source file name at address 9652h. Since you must at some point have the name of the program in OP1, just copy OP1 here.
-Next, get the size of the program and make sure to have a pointer to the data (not the size bytes)
-Store the address of where the program data is at 965Bh
-Add the size of the program to the start address to get the end of the source file and store it to 965Fh

Now you are all set up. When you need to jump to an offending byte, store the address to 965Dh and then just use bcall(_JError)

I hope this helps!

I already tried this method but couldn't get it to work like i want.
You convinced me to try again.

Thx =]

*****

BONUS : asmdream assembling a prgm that creates a basic prgm, and run them both :

(http://i41.servimg.com/u/f41/15/81/14/46/asmdre13.gif) (http://www.servimg.com/image_preview.php?i=71&u=15811446)
Title: Re: asmdream is waking up...
Post by: C0deH4cker on December 09, 2011, 10:26:41 pm
That's cool
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 10, 2011, 10:37:17 am
Thx =]

*****

Oh, hey, did your question ever get answered about jumping to errors? I do this in Grammer, so I do know how to do this, but to make life easier, you will need to only allow it for programs in RAM. Anyways, what I would do:

-At the beginning of the program, store the source file name at address 9652h. Since you must at some point have the name of the program in OP1, just copy OP1 here.
-Next, get the size of the program and make sure to have a pointer to the data (not the size bytes)
-Store the address of where the program data is at 965Bh
-Add the size of the program to the start address to get the end of the source file and store it to 965Fh

Now you are all set up. When you need to jump to an offending byte, store the address to 965Dh and then just use bcall(_JError)

I hope this helps!

Tried it again.
Here are the encountered problems :
1) _jerror always jumps to the 1st byte of the prgm, no matter which value i stored into nextparsebyte ($965D).
2) My custom error messages are already coded (without error handler) so it would be definitely good if i could find a way to directly jump to the problematic token (avoid the "ERR:XXXXX" menu display).
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 10, 2011, 12:01:15 pm
Okay, did you do the other parts? Meaning store the name of the var at 9652h, the start address of the data (not the size bytes) at 965Bh, the error location at 965Dh and the end var address at 965Fh?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 10, 2011, 12:45:16 pm
Yeah =[

Also, tried both bcall & bjump but result is the same.
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 10, 2011, 05:30:36 pm
Hmm, well then I am not sure what could cause the issue :/
Here is some code to give you an idea of how it works:
Code: [Select]
    ld de,9652h      ;115296  ;address to store the name
    ld hl,8478h      ;217884  ;ld hl,OP1
    ld bc,9          ;010900
    ldir             ;EDB0    ;copies the name in OP1
    bcall(42F1h)     ;EFF142  ;bcall(_CheckFindSym)
    ex de,hl         ;EB
    ld c,(hl)        ;4E
    inc hl           ;23
    ld b,(hl)        ;46
    inc hl           ;23      ;HL points to the start of the var
    ld (965Bh),hl    ;225B96

    ld d,h \ ld e,l  ;545D    ;points to the start of the var
    add hl,bc        ;09      ;HL is now the end of the var
    ld (965Fh),hl    ;225F96

    ld bc,4          ;010400  ;Offset into the var to error at
    ex de,hl         ;EB
    add hl,bc        ;09
    ld (965Dh),hl    ;225D96

    ld hl,ErrorMsg   ;21****
    ld de,984Dh      ;114D98  ;Where custom error message needs to be
    ld bc,14         ;010E00  ;14 is max size of message
    ldir             ;EDB0
    ld a,2Bh+80h     ;3EAB    ;Custom error
    bcall(44D7h)     ;EFD744  ;jError
    ret              ;C9      ;Don't think this is needed XD
ErrorMsg:
    .db "Oh Crap.",0 ;4F6820437261703A

For a bonus I can show errors in action with my own assembler project >.> (I haven't added nearly as much functionality as you). The errors jump to bad equates/labels or non-hex digits were hexadecimal is expected.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 10, 2011, 09:11:15 pm
Thx 4 help =]
I was just giving my custom chkfindsym routine a bad input.
My turn to help : dunno if you actually use a similar code in your projects, but you should consider adding a dec hl right before ld (965Fh),hl.

Now that that works, any idea if there's a way to bypass the ERR:XXXXX screen ?
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 10, 2011, 09:29:50 pm
Ah, now I see where you would need that. I took a peak at the bcalls, but I have not found a good way to do this, sorry :/
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 10, 2011, 09:45:53 pm
If the code is not too heavy, i'll disassemble and take a look at _gotoerr ($4CD8) to see what it really does...
At least, its name suits my needs =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 11, 2011, 11:09:44 am
Here is the disassembling of gotoerr :

Code: [Select]
call addr_2
ld bc,(erroffset)
ld hl,(editcursor)
add hl,bc
addr_1
ld de,(editcursor)
call off_2
ret z
ret c
push hl
call addr_3
pop hl
ret z
push hl
call addr_5
pop hl
jr addr_1
addr_2
ld hl,(editcursor)
ld de,(edittop)
or a
sbc hl,de
ret z
ld c,l
ld b,h
ld hl,(editcursor)
dec hl
ld de,(edittail)
dec de
lddr
inc hl
ld (editcursor),hl
inc de
ld (edittail),de
ret
addr_3
ld hl,(edittail)
ld de,(editbtm)
call off_2
ret z
call off_1
ld d,0
jr nz,addr_4
push hl
call addr_4
pop hl
ld d,e
inc hl
addr_4
ld e,(hl)
inc hl
ld (edittail),hl
ld hl,(editcursor)
ld (hl),e
inc hl
ld (editcursor),hl
or 1
ret
addr_5
bit 1,(iy+apiflg3)
jr z,addr_6
call off_3
ret
addr_6
call off_5
call off_4
ret

;calls to rom page 0 that i won't disassemble (lazy me) :
off_1 = $1937
off_2 = $1B1E
off_3 = $3100
off_4 = $3A9C
off_5 = $3BBC

As you can see, the edit buffer has to be opened before calling this routine.
Also, it reads erroffset, which is relative, starting from 0.
There's a high chance this code may be called when the goto option is validated.
I'll check this.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 11, 2011, 02:12:43 pm
Too hard for me =[
Looks like i'm gonna use the _jerror method (as a temporary solution i hope).
Thx again Xed =]

The conversion of ti83plus.inc is now at about 50%.
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 11, 2011, 03:05:32 pm
That's okay, I have been looking at the code that is run when you actually press "Goto"  and I am trying to see if there is a bcall that matches it. Maybe ask ThePenguin77 or KermM? I know DoorsCS has its own custom error routine and then lets you jump to the offending error.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 11, 2011, 05:23:24 pm
I already PMed Quigibo long time ago but still no answer and i don't want to bother him u know...
But, i haven't tried to reach Kerm yet.

[EDIT] : I figured out the digits in your username hé hé =]
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 11, 2011, 05:59:26 pm
It is one of the Lovely Sequences :3

(I call them Lovely Sequences, I don't think anybody else does...)

But yeah, Kerm seems to have made a decent job of accessing the Goto option without making the user go through the OS menu. Though, of course, that could be a hook, now that I think about it x.x
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 12, 2011, 11:24:55 pm
Created a dedicated topic on cemetech.
Anyway, if nobody can help me on this, the _jerror method will be just fine.

For now, i have converted, let's say, 85% of ti83plus.inc.
The whole thing will probably be around 100K, so i plan on splitting all the equates into 4, or maybe 5 include prgms.
My only (and last) fear is the assembling speed, cause even with an optimized code, seeking an equate thru 100K bytes can take a lot of time for such a slow processor.
Can't wait to see what it gets...

That said, looks like i'm not so far from the end of the tunel =]
Title: Re: asmdream is waking up...
Post by: C0deH4cker on December 13, 2011, 01:23:44 am
Maybe have the equates sectioned off into categories.

EQU1: B_CALL addresses
EQU2: Ram pointers
EQU3: GetKey and GetCSC codes
EQU4: Flags
EQU5: Tokens


Maybe split up tokens into 2 EQU files or something.


Idea: how about for the equates, you make a compressed file format for them. You could compress the equate names down to just 5-6 bits if you make the predefined ones case insensitive. Then, have the null byte actually, use a LBS instead, followed by the value. Example of structure:

[$XX (str len)][COMPRESSED STR DATA (padded to nearest byte)][VALUE]

_examp1 .EQU $9D95 ;just an example

    "_examp1" = 7 chrs * 6 bits = 42 bits / 8 bits per byte = 6 bytes (padded)
[$06][000000 000101 011000 000001 001101 010000 011100][$9D95]
In total, that is just 9 bytes. It could probably be compressed further, but this is just an example. Also, there would be better compression for longer equate strings.
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 13, 2011, 07:36:04 am
I know I just took all of what I considered the most common equates and put it into one file and had the user define their own equates if they needed (and they could create their own). If you split it up into 5 files or whatever, will they be by some category?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 13, 2011, 11:10:49 am
Maybe have the equates sectioned off into categories.

EQU1: B_CALL addresses
EQU2: Ram pointers
EQU3: GetKey and GetCSC codes
EQU4: Flags
EQU5: Tokens


Maybe split up tokens into 2 EQU files or something.


Idea: how about for the equates, you make a compressed file format for them. You could compress the equate names down to just 5-6 bits if you make the predefined ones case insensitive. Then, have the null byte actually, use a LBS instead, followed by the value. Example of structure:

[$XX (str len)][COMPRESSED STR DATA (padded to nearest byte)][VALUE]

_examp1 .EQU $9D95 ;just an example

    "_examp1" = 7 chrs * 6 bits = 42 bits / 8 bits per byte = 6 bytes (padded)
[$06][000000 000101 011000 000001 001101 010000 011100][$9D95]
In total, that is just 9 bytes. It could probably be compressed further, but this is just an example. Also, there would be better compression for longer equate strings.

For now, i keep the idea of includes being readable and editable by the user (That's mainly why i decided to use unprotected prgms.).
If assembling is too slow, i will probably go for something similar (but hope not, since it'll be very long to convert).
Thx anyway =]

I know I just took all of what I considered the most common equates and put it into one file and had the user define their own equates if they needed (and they could create their own). If you split it up into 5 files or whatever, will they be by some category?

The idea is to have the fewest number of includes as possible.
For now, i'm thinking of using the comment feature, like, for example :

PROGRAM:ASMDINC1
:>LAB
:
:,CONTENT :
:,RAM
:,KEYS
:,TOKENS
:
:,RAM
:...
:
:,KEYS
:...
:
:,TOKENS
:...
:
:End
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 13, 2011, 07:15:30 pm
Syntax conversion complete =]

Here is what i have for now :

PRGM        SIZE

θFLAGS     4251
θFONTS    6034
θKEYS     12015
θMACROS    160
θOTHER     6670
θRAM        8021
θROM1     13530
θROM2     17400
θTOKENS  10170

TOTAL      78251

It's less than expected, which is a good point.

I now have to code a simple in/out prgm that will convert ascii characters into tokens.
That's the easy part, believe me.

Debugging part 2 soon to come...
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 13, 2011, 07:19:46 pm
Wait, ASCII to tokens or tokens to ASCII?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 13, 2011, 07:20:13 pm
ascii to toks
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 13, 2011, 07:20:46 pm
On calc or computer or manually?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 13, 2011, 07:22:12 pm
Probably oncalc, since it's been a while since i last coded some x86 shit.
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 13, 2011, 07:25:18 pm
x.x What I did with AsmComp was make all of the equates capital letters that way the ASCII was the same as the token (and I omitted weird symbols like _). Also, you could store it on calc with the ASCII and just convert the tokens to ascii and search for the equates.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 13, 2011, 07:28:11 pm
About capital letters, i did the same =]
In fact, the prog only has to convert these :

>
enter
{
:
^
}
(
?
)
.
,

=
/
space
_
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 13, 2011, 07:30:00 pm
Ah, so that shouldn't be bad at all :D
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 13, 2011, 07:31:46 pm
A cake walk compared to everything i've done with my own hands...
Ok, i must confess, winhex helped me a lot =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 14, 2011, 08:04:01 pm
Includes are ready guyz =]

Here is a little screeny to show how it looks like.
Also, it shows the assembling of a 1 byte program using the last equate of the last include.
Basically, that means the assembling speed you can see here is the time it takes for the algo to do the comparison with 75 KB of flash equates (2 times actually).
It's a bit slow, but i thought it would have been a lot more.
Hopefully, i have a few things in my mind to speed it up...
Anyway, the good point is that IT WORKS !!!

There u go :

(http://i41.servimg.com/u/f41/15/81/14/46/asmdre14.gif) (http://www.servimg.com/image_preview.php?i=72&u=15811446)
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 14, 2011, 08:06:54 pm
That looks really cool O.O Great job! And searching through that much data... the speed does not surprise me.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 14, 2011, 08:19:04 pm
Thx =]

I intend to optimize my "next_line" routine.
For now, it checks for page boundary overflow for each token.
I'm thinking of calculating the last address of the page first, and then playing with CPIR to catch TENTER =]
Would be significantly faster i suppose...
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 14, 2011, 08:20:31 pm
Hmm, I heard that as long as the var is less than a whole flashpage in size, it will not cross boundaries
(The OS won't let it)
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 14, 2011, 08:33:29 pm
Already heard this before but already heard the contrary...
Anyway, one of my goal with this app is to have the minimum limitations for the user (and that includes includes size).
Also, doing sbc $8000,cur_addr periodically won't hurt the whole speed that much (i think).
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 14, 2011, 09:06:37 pm
Ooh, wanna optimised routine? I made this one to be very fast and you don't need to worry about checking where you are at.
Code: [Select]
IncHLMem1 :
;                   speed    1 page         total
;
     inc l         ;    4    4*16384        65536
     ret nz        ;11| 5    64*5+16320*11  179840
     inc h         ;    4    4*64           256
     ret po        ;11| 5    11*63+5        698
     ld h,40h      ;    7    7              7
     in a,(6)      ;   11    11             11
     inc a         ;    4    4              4
     out (6),a     ;   11    11             11
     ret           ;   10    10             10
Pretty much, it will increment hl and once it hits 8000h it will increment the flash page. it will destroy a when it goes to the next flash page, but otherwise it remains intact. If you are reading RAM, A is never destroyed as it will never hit 8000h. Alternatively, if you want to make sure A is never destroyed:

Code: [Select]
IncHLMem1 :
;                   speed    1 page         total
;
     inc l         ;    4    4*16384        65536
     ret nz        ;11| 5    64*5+16320*11  179840
     inc h         ;    4    4*64           256
     ret po        ;11| 5    11*63+5        698
     ld h,a
     in a,(6)      ;   11    11             11
     inc a         ;    4    4              4
     out (6),a     ;   11    11             11
     ld a,h
     ld h,40h      ;    7    7              7
     ret           ;   10    10             10
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 14, 2011, 11:05:46 pm
Thx for your help man =]

I definitely like the RET PO (haven't even thought of it) but it's too bad i don't need it, since i have to deal with port 7, not 6 =[
Except from that, my code is quite similar, and i'm now doing some tests with CPIR, which i'm convinced can be faster for seeking EOLs.

Anyway, there's a place for you in the credits =]
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 15, 2011, 04:41:29 pm
Great news =]

I can say using CPIR was a good idea :

(http://i41.servimg.com/u/f41/15/81/14/46/asmdre15.gif) (http://www.servimg.com/image_preview.php?i=73&u=15811446)
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 19, 2011, 06:23:38 pm
Ah, you are looking for EOLs and whatnot? CPIR is definitely faster. To seek the end of a line all you would need to do is ld a,3Fh \ cpir. I am currently rewriting my search routine for a speed boost and to shed some size, too. You can similarly look for the starting byte of your search string and then check the bytes following. (That is what my rewrite looks like, anyway)

Also, I now want to see if it would be easier to load pages into port 7... I just load the code into RAM (like TempSwapArea) if it needs to swap out the flashpage in port 6 and then swap back.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 19, 2011, 10:41:45 pm
Ah, you are looking for EOLs and whatnot? CPIR is definitely faster. To seek the end of a line all you would need to do is ld a,3Fh \ cpir. I am currently rewriting my search routine for a speed boost and to shed some size, too. You can similarly look for the starting byte of your search string and then check the bytes following. (That is what my rewrite looks like, anyway)

The only shitty thing is that once the matching byte has been found using CPIR, you also have to check the previous byte to be sure it's not part of a word token.
For example, $3F can also be the second half of a TVARSYS, T2BYTETOK, or T2BYTETOK2 token.
That additionnal check adds a little bit of time & space but is the way to go if you wanna ensure maximum compatibility (and avoid bad surprises).

An alternative method is to entirely forbid word tokens :
For each prgm that you intend to read, you first scan it entirely for word toks, and then return some kind of compatibility error if one was found.
Of course, that must be done only once for each prgm.
After that, you're free to use CPIR alone to find your shit.

Also, I now want to see if it would be easier to load pages into port 7... I just load the code into RAM (like TempSwapArea) if it needs to swap out the flashpage in port 6 and then swap back.

This is something i was planning for, when asmdream used to be a program.
Could allow faster comparison of data located on 2 different flash pages (one on port 6, the other on port 7).
But it's quite a complicated method, since you then need to use port 5 for accessing ram.
In other words, you only have 1 bank left to : run your code, access os ram locations and use the hardware stack.
I guess that's not worth it, since the flash swapping you wanted to avoid has now turned into a horrible ram swapping...

*****

News about the project :

Did some little optimization these days.
I finally found a way (thx to Quigibo) to code the goto feature properly, so i'm actually coding that part.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 20, 2011, 03:10:59 pm
Goto feature coded successfully :

(http://i41.servimg.com/u/f41/15/81/14/46/asmdre16.gif) (http://www.servimg.com/image_preview.php?i=74&u=15811446)

Time has come for nasty bugs seeking.
After that, final optimization.
Beta imminent =]
Title: Re: asmdream is waking up...
Post by: C0deH4cker on December 21, 2011, 09:54:10 am
Cool! That looks good. When I was watching it, i thought you had made a typo in your prgm. Then i realized that you were demonstrating the goto error.
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 21, 2011, 10:09:13 am
Haha, cool! Did it require loading a keycode to 843F or 8445h?
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 21, 2011, 03:05:11 pm
Nope.
The only areas where i store data are : progtoedit, editcursor & edittail.

Also, the following bcalls were needed :
_newcontext
_dispeow
_cursorright
_mon
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 24, 2011, 06:57:02 am
Added a symbol for the current program counter value, since it was quite easy to implement (couldn't resist =]).

Main testing/debugging phase almost over.
The ultimate test will be a try at assembling a "complex" program, fat enough.

After that, i have to build a decent readme.
I can tell that part annoys me, A LOT.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 24, 2011, 11:32:21 am
Test passed successfully =]

I'm on my way to build the readme...
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 24, 2011, 01:25:25 pm
Good luck with the house keeping :P That is sometimes the most tedious part, especially if you are so intimately familiar with the program. Explaining the little stuff can be a bit (boring?) . Awesome job, though, this seems really cool and definitely worth downloading.
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 26, 2011, 02:40:51 pm
Thx =]

Readme at about 50%...
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 28, 2011, 06:57:28 pm
Beta probably for tomorow =]
Title: Re: asmdream is waking up...
Post by: annoyingcalc on December 28, 2011, 07:02:40 pm
YAY!
Title: Re: asmdream is waking up...
Post by: Xeda112358 on December 28, 2011, 07:03:20 pm
Awesome o.o You have managed to inspire me to work a little more, too, I am really liking the look of this. The advanced functionality is awesome!
Title: Re: asmdream is waking up...
Post by: the_mad_joob on December 29, 2011, 10:55:04 am
Asmdream is now awake : http://ourl.ca/14654