Crap 0.1 first assembly project

Show us what you're working on, (preferably with screenshots).
Post Reply
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 36: 329 days left

It's day 36 and I just got to the stage where documentation is at a good place. After having a gentle critique that my code was a little bit on the 'WTF is this? what is it doing?' side of the spectrum. (I recalled in college winning an award for obscure C coding.. I kept that mars bar for years after :lol: )

I figured that my current approach of using a wiki was going nowhere fast as frankly I am too lazy to update it. What I wanted was a way that I could write the code at the same time as waxing lyrical about it in the source .. have that source then either compile/assemble/run in an interpreter when I wanted it too or when I needed to read it, use a markdown viewer to show all the information about what the code was doing, along with the code it was talking about.

In a nutshell... literate programming.

To be honest at first when this was explained to me I just though 'ahh sounds like some sort of chin scratcher crap.' but I thought "well give it a go, its got to be better than what your doing now.." and to my suprise it is.

The script is just a humble awk script called blaze. If that wank word / programming wuwu offended you as much as it did me. Then you are on the same page as I was with regards to this.. At this point I nearly clicked off in disgust but thinking that this literate programming stuff might have some merit I stuck with it and turned the other cheek.

Still its the ends not the means .. What this enables me to do is put all of the explanation, ideas and stuff into the actual source document. That way when I forget everything about it then have to come back and try and fix it I just look at the source in a markdown viewer and badabing badabomb I or whoever is handling my estate is going to be able to maintain whatever mess is left of my programming output.

The nice thing about this is because its markdown, most everyone knows how to write it. You can include images, videos, audio whatever takes your fancy. The source now explains the program. Giving the reader the ability to maintain it. It's not documentation - that is something else. The user manual could probably use a good portion of what is inside the source comments but that is a different thing for a different application (teaching people about the application to be able to use it... not to maintain/upgrade it.) I think that is what got me confused at the beginning.

Anyway - this is how the projects are really going to get commented. Hopefully this will make explaining what I am doing in crap-chess much easier and in the noughts and crosses game.

To test this I will use the technique on Noughts and Crosses and see how it goes today.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Quick update,

the literate programming idea worked out well. It produces a nice readable document that makes things much clearer (to me anyway.).

I did a bit of work on crap chess, but to be honest I was a bit burned out commenting the dragon quest clone and noughts and crosses. I needed something else that was not the IDE to spend some time with lol...

So of course the next logical step is to write a z80 forth. - I know I know groan. But hear me out. I figure this is a good way to learn more about the spectrum, z80 assembly and bizarrely sharpen up my forth skills.

A decent version of forth for the spectrum would be pretty sweet. There are plenty of z80 forth all nicely documented and ripe for study. For this I selected the two most prommising candidates. z80 eforth ( 30 machine code routines form the foundation of the system. everything else is built upon words from these 30 routines.) This gives us a slower system overal but its trivial to port. And you can incremententally convert the words to assembly to see what speed impact you get on the system. Its a great way to play and learn.

The eForth is a bare metal forth, it handles everything itself. But it does not have to be that way - there is nothing to stop you using the rom routines where they exist. The advantage here is that you don't have a initial dependence on an OS like the second system I looked at (Camel forth).

This is the base system, Camel forth is the comparison. I use this to compare against eforth. - Camel is designed to be as slick as possible where as eforth was built with portability and as a learning tool. you could optimise it as much as you wanted after. but at the start its pretty slow.

like I said Camel forth z80 is using CP/M and well that is a bit of a problem as we don't have that on the stock zx spectrum (assuming you didn't get a rom upgrade for the +3... hmmmm)

Anyway. The methodology is compare each part of the system - have a play and try and figure out what each is doing and why. and make a value judgement on what one I would use. (or perhaps none at all..).

Code: Select all

; Camel forth z80
NEXT:    MACRO    ; Start of the macro def.
        EX DE,HL    ; Swap the register pairs
        LD E,(HL)    ; Load value pointed to by HL into E
        INC HL    ; +1 to HL
        LD D,(HL)    ; Load value pointed to by HL into D
        INC HL    ; +1 to HL
        EX DE,HL    ; Swap the register pairs
        JP(HL)    ; Jump to next word pointed to by HL
        ENDM    ; End of the macro def.
This assembles the 'NEXT' code in-line. You need a NEXT for every word you have. This is the most fundamental atom of the operating environment. Every forth word has this little blighter.

Now the issue with the code I have is its designed to work with CP/M that is no big deal as really its only using CP/M to handle the boot sequence, keyboard input and screen management. This can totally be implemented using the Spectrum rom routines but to be honest I probably will just write my own subroutines for this. That said as a quick start using the inbuilt rom routines makes a lot of sense then just phase them out as I write my own routines.

As a learning exercise its pretty fun. The whole source is 6k.

I am looking at two separate implementations to compare and contrast how each author handled each stage. because of this its a great way to figure out how to approach the problem myself. I should have thought of this before...
User avatar
Seven.FFF
Manic Miner
Posts: 735
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: Crap 0.1 first assembly project

Post by Seven.FFF »

Do you ever sleep??!

Do you have an original Jupiter ACE? I missed the chance to get one when they were only a few hundred pounds, sadly. Did you know the team behind TheC64 are planning a modern remake (and also for the SAM Coupe)?

I used to have the Leo Brody book, that was great, especially the illustrations.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Seven.FFF wrote: Mon Feb 05, 2018 6:32 pm Do you ever sleep??!

Do you have an original Jupiter ACE? I missed the chance to get one when they were only a few hundred pounds, sadly. Did you know the team behind TheC64 are planning a modern remake (and also for the SAM Coupe)?

I used to have the Leo Brody book, that was great, especially the illustrations.
Lol yes but admittedly last night not so much. :lol: The Jupiter ace, I never got to see one. I don't think I ever saw one on the flesh they were fairly rare beasts. Would have been cool to have one though. At the start of the 90s there were so many of the micro computers you could pick up at boot sales and charity shops I got to have a go on the majority of popular models but I never got to play with the Ace.

Not sure about the modern machine, looks interesting. The big news for me was being told that A. a lisp OS that runs on real hardware, in 2018 has been created and that B. One guy wrote it. :lol: He also managed to port a bunch of libraries that previously were so difficult nobody considered it practical. Haha to say I was floored is understatement. I saw videos of the lisp machines and the gui from the 80s and it was awesome to think that a guy did something like that on modern hardware by himself is just stunning. Everything in lisp... from the ground up. Not using a linux base... not some cheesy emulator. :o

Hmmm So yea for me the more interesting project would be to get a forth machine running on bare metal 64 bit processors with TCP/IP stack, file support and gui would be a more wow proposition. :lol: Starting on the spectrum - a target that already had Camel forth ported to it in the past seems a good start. the Z88 already has a stable version.

I guess what makes me wonder about these modern remakes of the old systems is why not have somthing like a pentagon where you push the limits of the design and see where it goes. or replicate the orignal perfectly. A lot of these projects seem to fall somewhere in the middle. And the expense - its still cheaper to get an original in many cases. That's what makes me think its better to spend the effort building a system on a modern cpu (in the case of lisp/forth machines) and getting all that power with none of the bloat. The ability to go in and change anything you don't like. to be able to drill down to the bare metal and tinker that is really something else.

The nice thing about the 8 bit machines is you are walking the path travelled by many. eforth & camel forth have so much work already on multiple platforms it makes studying how it was done way easier. Plus the processor & architectures of the 8 bit machines is so much more friendly than trying to figure out 64 bit systems with black holes of documentation :lol:

Yea I read Leo B book, his second is also good Thinking in Forth https://archive.org/details/thinking_forth. In fairness to the Forth authors its rare you find a bad book about forth. Even the Fig Forth books for the micros are pretty kick ass. The documentation for the language is solid - the Forth encyclopaedia is one of the best examples of a documented language I can think of every word is diagrammed and explained. Real time forth is another good book I liked very much hmmm I will get the list haha. The only (forth) books I have not read are by Dr Ting. They were supposed to be something else but he still sells them on his website for $35 a piece so I don't want to knock the guys hustle lol to be selling a bunch of books from the late 70s still nearly 50 years later is kinda mind boggling.

oh..

p.s

SAM Coupe was a much better designed system :lol: I'll get me coat.

p.p.s

S100 bus emulation, now that would be a black hole of a project right there. The amount of time I could waste defining custom cards :lol: Its weird it was never emulated.

[youtube]https://youtu.be/DLFIBQ1WlmU[/youtube]

This series is great..
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

To follow up on the NEXT word discussion,

When I read one of the source words, I check it against my copy of forth encylopedia - this was for the 8080 but the principle of operation is going to be close enough for it still to be useful. Plus z80 emulates 8080 so it shouldn't be too far removed (except for the ZXs extra registers and some instructions..)

Anyway - to see what I mean lets look at the flowchart for NEXT. It's one of the most important parts of the whole system. So it makes sense to spend a lot of time here. Because of the decision with Camel forth to in line the code by using the MACRO command. any optimisation you can make to the routine will get propagated every time a forth word is generated/used. The impact of an increase of speed, or reduction of memory is therefore many orders of magnitude larger than one might first think.

It also shows how important seemingly minor choices can be to the whole project. Had this not been in-line code and instead used higher level functions, every single operation in the forth system would have been impacted. It's probably the single worst place to introduce a bug into the system. It literally will get replicated everywhere.

Generally its accepted that in modern Forth's that are concerned with speed that you want to move more towards direct threaded code. Where you are not using it as a learning tool. Yes many older implementations used the indirect technique but that will make the system pretty slow. But if you are looking for a very beautiful and portable system Indirect is a great choice. But you pay for style with speed.

One thing to look at is did the person that ported the 8080 code take advantage of the z80? or was it a lazy port? In the NEXT subroutine/word it makes sense more than any other word to check this.

So later today that is what will happen, a straight comparison between the eForth z80 NEXT and Camel Forth Z80. To start though lets see what the Fig 8080 NEXT word looks like and how its supposed to function..

Image

NEXT is essentially the Forth systems 'Inner interpreter'.

Ok pop pickers, as a sketch eForth is generally going to pick the slower indirect method as the idea is you get the forth system up and running as quickly as possible without a lot of porting of low level assembly. (It only requires the implementer to write 30 subroutines, define the memory map that the program will use and figure out if you want it to be stand alone or work with a existing OS/Rom. That said you can still make eForth faster by making sure that the 30 routines it does go the assembly routine are going to be slick. The other thing is with eForth generally you have lots of options on how to tackle any of the implementation points. You can go with a heavy direct threaded inline approach but the docs warn you about the time its going to take to code the system. Its always going to be a trade off.

Camel forth is taking the Direct threaded, macro approach. And surprise surprise so does eForth. (Well was it that surprising really - this was the one part of the system where you really couldn't compromise for ideological reasons about performance. But we will see looking through the rest of the code that this happens but its more for practical time reasons rather than just because...

Still its intresting to look out for.

For me I am more a fan on how Camel Forth handled NEXT, but your see that eForth is doing some pretty interesting optimisations of its own. (but at the expense of space) Perhaps a hybrid solution might be in order.. I will have a think.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 37: 328 days left

Progress was pretty good today, managed to get fork-exec to work properly in gforth. So now my menu/ide can now execute multiple system applications/tasks and return control to the main program without blocking. :lol: So it now launches relevant pdfs, play sound effects (i like audible cues - ok I admit it I grew up watching knightrider..)

With that issue out of the way I can now get a back to more specy related tasks. doing the literate programming alterations to all the projects is progressing nicely. It makes a big difference to readability and seems to suit my habits better. I should have all three of the spectrum projects commented properly and looking pretty nice by the end of the week.

Arkannoyed's isometric chess was something else to see how a non-potato would go about coding a slick chess program is really something. :lol: I like the idea about encoding data for routines in the actual graphics data as non-display colours. Hopefully I can use that in my own projects as that is a very slick and compact way to handle things.

Besides that spent the day reading documents and trying out various examples in qemu. I had written a boot loader for dos ages ago in college but its been years and my skilz are decidedly rusty. Anyway its not as bad as I remember. Got my bin booting and its all looking peachy. Having got that technical hurdle ticked off can always come back to it later when I want a custom loader for a project. Having qemu makes it so much easier than having to actually do it on a real box.

Image

I found another good source of information - the computer journal was getting referenced a lot in 'Forth Dimension' and it seemed that many of the same authors were writing for both publications. Luckily the full run is on archive.org .

https://archive.org/details/the-compute ... ads&page=2

This newsletter was full of useful stuff - tons of 8bit info, listings and informative articles. One great series is by Brad Rodriguez in Issue 56, it talks about creating a forth kernel on 8 bit machines and all of the planning stages/considerations. It is a really well written series. I would recommend it if anyone reading this was remotely interested in writing there own forth based system. A lot of the suggestions and hints really come down to 'it depends' so he quite cleverly avoids a lot of the flame wars that went on over direct and intersect threading. (me being tactless, unless there is a sentimental reason or some bizarre cpu issue (like having a crippled instruction set) would seem to me direct threading is the way to go. unless you are really pressed for time.)

To sum up cant really complain about today, got the dos boot loader written, got off to a good start with the z80 forth and found some cracking techniques to use for the z80 game projects. Finished my menu launcher poor mans IDE to help write even more tools..


Overall a good day.

Some spoilers for tomorrow - Camel forth z80 without the CP/M :lol: in fairness this was no where near as bad as I first predicted. To walk a well worn path is indeed a pleasure.
User avatar
Morkin
Bugaboo
Posts: 3251
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: Crap 0.1 first assembly project

Post by Morkin »

Nomad wrote: Mon Feb 05, 2018 7:51 am Day 36: 329 days left
This is going to be a very long thread... :lol:

Nomad wrote: Mon Feb 05, 2018 7:51 am It's day 36 and I just got to the stage where documentation is at a good place. After having a gentle critique that my code was a little bit on the 'WTF is this? what is it doing?' side of the spectrum. (I recalled in college winning an award for obscure C coding.. I kept that mars bar for years after :lol: )
I wonder what would have happened if Speccy games programmers back in the 80s had followed the 'clean, tidy and well documented' code mantras of today. I suspect the archive would contain about 50 games... ;)
My Speccy site: thirdharmoniser.com
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Morkin wrote: Tue Feb 06, 2018 10:43 pm
Nomad wrote: Mon Feb 05, 2018 7:51 am Day 36: 329 days left
This is going to be a very long thread... :lol:

I wonder what would have happened if Speccy games programmers back in the 80s had followed the 'clean, tidy and well documented' code mantras of today. I suspect the archive would contain about 50 games... ;)
Lol I am sure to the 1-2 other people that read it it must feel like an eternity already. :lol:

I thought the whole documentation thing was BS also, until I would come back to my work and find myself having to figure out what I had done before and having no idea. A lot of time I would just rage quit and start afresh. :lol: cursing my ancestors for not writing down why i had done such and such. Or how to use this tool.

It takes a bit more time, but what I found helps is imagining I am explaining to a knuckle dragger how to do it. then just write it down in the comments. Nice thing about that markdown documentation is you can add cool stuff like video links, photos ect in the comments. And if you are super lazy people demand a manual you can just kick back and say 'oooh its almost ready' :lol: do a slap dash rush edit from the literate programming comments and boom one poorly written manual but done in a fraction of the time it would have otherwise taken.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 39 326 left to go!:

Well despite many potato miss understandings about the spectrum display, things went quite well.

For crap chess, I finished reading the microdrive manual :lol: also found the file library for fuse. So this is looking dangerously close to being a thing. Assuming I have this right I should be able to slurp a regular chess game encoded with standard notation, get the script to encode it into byte format then using the library create a microdrive file.

I still need to go through the microdrive rom disassembly. And figure out how to talk to the thing properly. But I don't think that will be too much of a painful experience (famous last words..)

The one step I forget was I need to use zx7 to compact the data before I create the microdrive... That is an important step. I will also need to have the decoder in the main code blob. (I can see myself forgetting this and then wondering why its all garbage coming from the microdrive :lol:

Noughts and crosses, going to have some fancy XXXOs lol. Well how pretty can you make a noughts and crosses board.. were see. I got regular tiles down now. But I have been seduced by isometric view game boards :roll:
I figure noughts and crosses should be the simplest board imaginable for this approach. That said being a potato even with a fantastic example in the isometric chess source I will still mess this up no doubt haha. But it should be a good learning experience. In one fell swoop I have made what was the simplest of the projects probably the most difficult because of screen positioning issues with a isometric grid and the need for the Noughts and Crosses to know what V position they now need depending on H pos.

I thought about just rushing it out with a simple layout but I won't learn anything from that. The real value is in pushing myself beyond what I can do now. But I knew I wouldn't be able to handle doing the whole of the crapchess board in this way. Its good to acknowledge gross limitations on skill :D

Moving onto tech demos, I have been looking at generators with interesting properties. For procedural generation what I want it to have a set of subroutines & tables that can give a wide range of choices for near randomness or just interesting sequences to be used in various ways in the projects. What was really useful was having the fibonachi society being such all round nice people and leaving almost all of their research free to anyone to look at. There is over 5 decades of information, techniques just waiting to be used.

This is where things sort of went down a rabbit hole. But in a good way. Assuming I didn't want to model the population of bees (yes that is a Fibonacci sequence.. the males do not require fertilisation. Only the female bees have a father figure.. ) There are other sequences that have interesting properties that can be used on 8 bit platforms either straight or as a map on the sequence. Beyond pisano points, there are lewis numbers, we can do the same thing we did with the pissano points but with the lewis numbers and get a whole new sequence to work with.

But where things get a little nuts is I was using the sequence to generate a music track, and I thought 'jeez these sequences are ok, but I would like a bit more choice without fudging the results..' my maths fairy godmother then gave me the Wythoff Array. While Fibonacci and Lewis numbers do turn up all over the place the sequences are one of many that are possible that have similar properties. With the Wythoff array you can get as many sequences as you can generate with your equipment. (I don't like saying infinite, how can you prove that?)

So yea I have over 5000 of these sequence seeds , More than enough for my needs. I just got done creating the word in forth to generate the sequence from the seed. So when I tested it to make sure I didn't make a potato error I will share it :)

What is the point? Well all these sequences can have a map applied to them of some description (probably modulo) and its that sequence that will be used in the subroutines. For example modulo 7 will generate a sequence of non negative integer values in the range of 0 to 6. That is just what I need for lazy music creation.

But it goes further than that, for things like backgrounds - It would be nice to be able to use a sequence generator to create the table data for the background that was displayed on screen. given that a sequence is always going to run the same way - you can design the background around the sequence output you know is going to come. with a cyclical sequence this is useful because you can have a very complex sequence that would have taken a very large amount of space in memory just use a sequence generator to create the data needed. once you have passed that part of the level you just forget that background data till you need it again. For games where you are just moving forward this is a nice optimisation. But even if you have freedom of movement you would just need a buffer of some realistic amount this would still give you a great saving.

Wythoff arrays are from the late 70s early 80s so its fits time-line wise with the retro computing this would have been cutting edge number theory at the time.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

321 days left!

Spent some time working on my pixel skills and creating better backgrounds :lol: Also went through every book I could find about the Interface I and microdrive.

Image

Probably one to many energy drinks lead me to that point. Still I think it was worth it. :roll:

Annoyingly I was missing the microdrive disassembly book which was the one thing I needed after going through all the others.

At this point though, after reading all the interface one stuff, I was so tempted by the references to interface 2 rom cartridges.

Yea you only get 16 k.. but there is a lot of potential. To be able to pack all of the required routines into the cartridge, then get the rest of the memory to play with.. mmmm...

One thing I don't understand is, why you can't just use paging to make huge Rom cartridges?

Hmmm well time to search archive.org for the interface 2 stuff.

One thing I will say is that the quality of the pan microdrive book was outstanding. It's like the author had thought of all the questions someone who wanted to seriously use the microdrive/rs232 or the net would ask.

A couple of questions come to mind regarding the rs232 port and emulation. could I connect to it via a socket?

Trying to figure out how this stuff is emulated is another thing on the todo list. :lol:

As far as progress on the games goes, well having now 'figured out' how the microdrive works, I can create the crapchess data files and the program that will read them. I already did some tests in basic accessing the drive and it all seems to be ok. Next is to use the microdrive shadow rom directly as I already can talk to it via the RST 8 hooks. But I am thinking I will need to be able to talk to it directly if I went the cartridge route.

Thus the need to get the microdrive disassembly book. :lol:

Actually its probably at the point where I could do with getting a hard copy of both.. time to kill a few trees. The other books I can live with looking up the pdfs but somthing like the disassembly's its nice to have it in a ring binder.

I am really happy with the progress that has been made compared to my last entry I really didn't understand how the file transfer process worked with the interface I, now I do. To be honest its pretty easy once you sit down and read :lol: Even the assembly calls are trivial assuming you use the hooks.

One important thing that came up was my misunderstanding of the speed bottleneck, its not the Interface I that is slow, its basic when it trys to access rs232 or the microdrive. Using assembly I can shift the bottle neck to the device rather than the basic interpreter. Some pretty crazy baud rates are possible on paper but in practice hard to say what the specy will tap out at.. still its interesting.

Getting crapchess to work over the spectrum network would be pretty cool but the basic code limits the connection via rs232 or the net to around 50-150 baud. Still for crap chess its kinda ok But assuming I write the routines in assembly this can then be increased. This is more important for later games that were faster.

Going to find out how the emulation of the spectrum network works with fuse, still this is a logical feature creep as I am already using the interface I to store the game data. Might as well use the net/rs232 to enable two players across the network/modem.

The nice thing about the pan book was it actually had the code for a network game of battleship so I can use that as the template. But its all in basic, the next step is to implement it in crapchess in assembly.

The final step is collecting all of the routines, and support routines - and putting the whole thing on a interface ii cartridge.

I think the learning curve of this last step is quite steep but having done it I would be a much better spectrum programmer.

Just getting the microdrive talking in assembly was a big deal :lol: But after I got it working it was easy. It's just getting the information.

I really want to get the game finished, I just seem to be going by a non-direct route and 'enjoying the journey' It seems every tangent I am taking is improving my potato skills better than If i had just rushed it out. :lol:

Regarding the Interface I, its such a shame that it seems to be pretty well designed but they seem to have really bodgged the last hurdle with the hooks, some of them don't work quite right and it cripples the potential for the microdrive.

I had wondered why you were forever having to use NEW, or for example the weird bug you get with the colours. That could have been fixed were they a bit more careful in the final stages of development. It is a real pitty as there seems to have been a lot of care and thought that went into the design of the device its just that in the last stages they seem to have either got someone else to finish the project or just rushed it.

Part of me was there thinking 'but would it not just be easier to ask the user to insert a new disk?' :lol:

I need to check the plus 3 manual but I don't think it works with interface 1. Weird as the plus 2 and the 128k are fine with it. The greedy fella that I am would love to have both the interface 1,2 and the disk drive. as this would give me the greatest amount of space. Ah well that is a simple thing to google.

Being almost a month and a half in now I am really glad I started, its a lot of fun finding out about all these obscure features and bugs, for hardware I never had a chance to actually buy back in the day (microdrives were way to expensive for a kid). Haha I would look at the magazines and wish I could own the microdrive so I guess that is why it has that mystique.

When we got the +3 the disks were cool, and I pretty much stopped using tapes to store my programs. But because I actually owned it there is not quite the same appeal. (weird right...)

Other things that wasted some time, I went through the Machine code tutor, and that is a very nice program. Its just a shame its rotting in obscurity now. So thinking this was a great injustice I decided to 'liberate' it and so now I have 198+ screens of all of the pages no need to hit space to get to the next screen its all on a bootstrap webpage. :lol:

The annoying interface done away with its way easier to look up the lessons. The simulator you could play with on archive. But were I really to go to town I guess its possible to do in java script. That is a really nice way to learn z80 assembly. More people should get to see it. I wonder why its not on some website already. Once I have the spelling mistakes I made on the template fixed I will find somewhere to upload it.

In addition to that been spending time looking at generators functions.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 45, 320 days left!

Well things are starting to come together, finally got my arse in gear and set up a virtual sd card image so I can start organizing the project files properly. It also makes backups simple as now I just copy and paste the image at the end of the day with a script.

For the curious if you are on arch linux... assuming you want to manually create the virtual card/image. And not depend on some cute gui/tool that you didn't write yourself..

Before you read on and get frustrated, and rage quit. If you are trying to create a bootable card, this is not the poorly written tutorial for you. Sadly this method can't generate bootable images (I know I cried myself to sleep over this feature fail myself the first time..) But for creating regular media images this method works just fine. ( hint your missing the bootloader padawan. )

The way you create a bootable image is a bit esoteric manually and would only confuse the potato's amongst us reading the tutorial who just want a regular card image.

First create the image file using dd, I decided to go for a 4 gig card, that is big enough not to worry about having to use multiple images to store asses and binary files but its also not too big (but in fairness if you wanted to target a 64gig + sd card you just have to bite the bullet and use exFAT.) A lot of this is going to depend on your target. You need to go check the technical documentation on what it can and can't handle, what file system it is expecting, what the maximum card size it can take is. Had I gone for 1gb card image then FAT16 would have made more sense. I guess 4gig is just on that threshold where FAT32 makes sense.

Still you might have a target with older firmware for the sd/micro-sd reader so I will include the options for different sizes. It's just a matter of changing the value used in the dd command but if you are as much as a potato as I was your need some guidance/hand holding. Plus dd is not the sort of command you want to just play around with :lol: (its not jokingly called 'Disk Destroyer' for nothing) In addition for very old device targets you might need to use FAT16.. (I don't know you might be targeting some old school hand held thing..

Yea you can have some pretty large FAT32 cards but past a certain point performance starts to suffer and you really should just go for exFAT (assuming your target can support that).

Going bellow 1 gig switch to FAT16..

Remember exFAT is going to need a slightly different command syntax (don't worry I'll add that as an example just in-case you are reading this from 10 years in the future with a 10tb sd card image..)

You might be really pushing the edge case of life and need to use FAT12 (welcome to 1977) Ok I won't judge you...

32gb card

Code: Select all

dd if=/dev/zero bs=1M count=32768 of=mysd32gb.raw
16gb card

Code: Select all

dd if=/dev/zero bs=1M count=16384 of=mysd16gb.raw
8gb card

Code: Select all

dd if=/dev/zero bs=1M count=8192 of=mysd8gb.raw
4gb card

Code: Select all

dd if=/dev/zero bs=1M count=4096 of=mysd4gb.raw
2gb card

Code: Select all

dd if=/dev/zero bs=1M count=2048 of=mysd2gb.raw
1gb card

Code: Select all

dd if=/dev/zero bs=1M count=1024 of=mysd1gb.raw
512mb card

Code: Select all

dd if=/dev/zero bs=1M count=512 of=mysd512mb.raw
256mb card

Code: Select all

dd if=/dev/zero bs=1M count=256 of=mysd256mb.raw
128mb card

Code: Select all

dd if=/dev/zero bs=1M count=128 of=mysd128mb.raw
64mb card

Code: Select all

dd if=/dev/zero bs=1M count=64 of=mysd64mb.raw
32mb card

Code: Select all

dd if=/dev/zero bs=1M count=32 of=mysd32mb.raw
16mb card

Code: Select all

dd if=/dev/zero bs=1M count=16 of=mysd16mb.raw
(I remember my first sd card for my camera was a 64 meg.. (*wipes tear away..)

Ok now you have a raw file, congratulations - you did it and your system is not borked. (well were assume things went ok because your able to read this..) If not, well you have brought shame to your ancestors - go sit in the corner as your system is restored and try again later. All jokes aside. We can't just run off mounting our new card image, because its not formatted yet. Hold ya horses... to format the card image do the following.

get on your big boy pants - were going in as root. If you don't have root access beg the person that does to complete the following steps...

Instead of mysd.raw use whatever name you used to create the card image.. if you are using a different file format (FAT12, FAT16, exFAT or the various other formats... if you are using them your know what they are..) use that instead of FAT32 obviously. But I am going to assume a simple potato like myself is going to stick to something middle of the road size wise ( >2gb <64gb ) and so FAT32 is going to be what ya need to succeed.

For FAT32 cards

Code: Select all

su 

mkfs.fat -F 32 mysd.raw

exit
For FAT16 cards

Code: Select all

su 

mkfs.fat -F 16 mysd.raw

exit
For FAT12 cards

Code: Select all

su 

mkfs.fat -F 12 mysd.raw

exit
For the big boys...

exFat cards

Code: Select all

su

mkfs.exfat -F mysd.raw

exit
Ok cool the last part is perhaps the most obscure - because of some platform changes that happened back in 2012 to arch. A lot of the guides and tutorials that you will find on the interwebs for Linux will fail you hard in this next step.. most distros have the removable media live in a directory /media/ at the top of the file system.
In arch this is no longer the case fear not for I have shed the tears of frustration and rage so that you don't have too.. It's actually close by.

enter the following.. continue to wear your big boy pants in root. Like before if you don't have root access - beg the person that does to help you with the following step.

1 create a directory called sdcard in your media directory.. this is located in /run/media/<name>/ at the top of your file system. It doesn't have to be called sdcard but as I am the one writing this I got to make some choices right?

obviously when you see <name> look at what your actual account name is on the path.. don't know how to do that.. cut yourself just a little.. not too deep. the pain is the best way to learn. :lol: ok joke don't actually do that...

Code: Select all

pwd
look at the output, drink it all in. ok assuming you are in /run/media/<name>/ you should see something similar but your own systems account. use this instead of <name>... you get it?

next the finale! We mount the newly formatted card.

Code: Select all

su 

mount -o defaults,umask=000 /home/<name>/<folder>/<file>.raw  /run/media/<name>/sdcard/

exit
Ok like before <name> is your login, <folder>is whatever you called the folder you have the card image stored at on your system. <file> is the card image file name. you get it?

Assuming it all went ok.. savour the win, you now have the card mounted and ready for use. When you are done for the day, you can just unmount the image.

Code: Select all

unmount /run/media/<name>/sdcard
Remember to back up your image for safekeeping. at the start of your next session just go through the mount step and you are ready to rock out with your card out :lol:

Having gone through this manually the next logical step is to create your own script to handle the process or if you are of the FORTH persuasion - a set of words to create a tool that will handle the process. (Come on you knew that was coming..) Because I don't know about you but I don't trust myself messing with dd manually at 3am in the morning..

Once we have the script set up or alternatively a shiny new set of FORTH words we are all set to create card images of any size and format we want till our hard drive space runs out.

One thing I should add is that there are some really obscure settings you can use when formatting the image - its best to check the documentation but if your platform is mentioned then use that switch.

Anyway we now have a reliable way to generate images for use in development projects. Someone wants to see what your up to you just upload the image (assuming its a reasonable size / depending on connection speed and storage space that is going vary from person to person but don't be that guy that uploads a 4gb image with only 200mb of data on it.. ) to the net or burn the image onto a real media for them and they can walk away. No annoying searching for files or wondering if paths will work. This saves so much time.

The use case is your friend walks in asks to take your project home to work on, you ask if you can email him the files he then complains about how long that will take, can't you make it easy? you then ask him for his sd card/usb stick. You then promise not to look at his porn stash as you copy your development card image to the drive/card and he walks away happy yet oddly ashamed. And you now spend the next week poking fun at his choice of fetish subtly in front of unsuspecting friends and family. :lol:
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Well project time today was spent backing up my hard drive (boring but if I don't do it the laptop will explode and take all my data with it.) While this was happening got to do somthing I was meaning to finish for ages - setting up atari800 and getting the roms and carts all ready. Why? as far as 80s development machines go its not a bad choice, you could have a 6mb hard disk, ram expansions and lots of software. Lots of fig forth got written on the 400 and 800. My plan is test the high level forth stuff using the atari then when its ready run the definitions on the spectrum.

As it stands with the spectrum, developing natively is a bit of a pita. I have to dick about with tiny memories using the stock machines and if you load forth it leaves you with only 18k to play with. vs 1000k...

I thought about using the pentagon but that has its own issues, but to be fair a very cool machine.

So now I have a fig forth that is fast has a huge memory, this makes working through the old forth journals/periodicals so much easier to follow as there is no need to port the code to the new standard it will work right out of the box.

Probably don't need 1024k but nobody said no to bigger right lol?
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 46, 319 days left!

Got wine displaying at a proper dpi for fonts! :lol: no more trying to strain my eyes to make out the menus.
So that is good.

Project time was spent marvelling at the Corvus disk setup. :lol: It has to be the single best hardware you could get for the Atari. For a developer with the equivalent of 5k usd (in today's money) burning a hole in his pocket this 6mb drive is the business. The wait time to load from the hard disk is comparable to a modern machine.

The widget used the two joystick ports of the atari to get a parallel data bus, (thus the speed).

Internally the drive is split into a bunch of floppy disk sized partitions. But because this is a hard disk, and its always spinning. access times are fast. You just copy across the applications you would usually load via floppy disk and assuming there was no annoying copy protection you couldn't remove. The applications load at a fraction of their normal load times.

No more going for a coffee while the project files got backed up :lol:

I spent the day playing with ValForth - an already fast forth for the Atari, lol now its just nuts. :lol: I thought the openmsx was impressive when you pimped out the emulated systems but its got nothing on this.

Watching Amoeba debug at a speed like it was a threaded application is something else. :shock:

This has a cascading effect as it now means all the time you previously would have waited for disk access, swapping out floppy disks, waited for copies of files that is now gone...

To put it into perspective, I didn't get load times for applications like that till I had windows XP and a bunch of ram.

MSX is now in position 2# for nicest 8 bit dev machine I have ever seen. :lol: (I know what your asking... #3 BBC Micro with the Z80 coprocessor, hard disk, and econet)
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Update:

Got the program launcher working nicely with wine applications, this also has a side-effect that I can now use zxpaintbrush properly :lol:

The atari emulator also runs under wine so that now works with the program launcher one key press and I can launch the 6502 development tools, all running natively on the atari 800 and ready to run.

To get my files out of the atr disks, I have a utility that can extract the files, and pop them back once I have edited them on the pc. This means all of the productivity software and tools for the atari I can now mess with and export simply.

what this lets me do is share assets like the graphics, and listings across platforms simply. I can take my asm files that SevenuP creates and use them in the atari 6502 development box. But if you were really going to be a purist there are a number of pixel editors for the atari. But its easier just to use the same tool for everything I think.

This also means that all my fig forth stuff I can write using the atari then anything decent I can just curl out a floppy disk image then have the utility diddle the files to PC ready to do whatever.

This would also enable me to use the code editor to write assembly for the specy, write to the disk then have the utility diddle the files, ready for the pc to then assemble in pasmo. I do this because I can get better reliability with the atari editor, its faster than sublime text editor and its easier to use. :lol:

I'll add some screen shots later (for those playing along at home.) It just blows my mind that something that was written at the dawn of the 80s still owns an editor that is supposed to be the panacea of dev tools. :lol:

Ok here are the screen shots.

Atari intended this only to be a macro assembler to improve the speed of basic programs. The theory was that users would create subroutines they would call from Atari basic. But due to the fact Atari subcontracted this project out to a pretty kick ass development house they totally over delivered and created a brutally effective application that was used for full blown development of assembly projects. :lol: once the copy protection from the disk had been removed of course...

Image

Image

This was the in house debugger for Atari, it was only recently re-discovered but it has everything you could want. The nice thing is amoeba is tiny, fast and has lots of features. You pair it up with the macro assembler and that is a killer combo.

Image

The third tool Atari Program Editor - This is highly customizable code editor. As you can see I have it set up to have a kind of pigs intestines pink when ASM files are being edited. But you can use whatever colour you like. Its a nice way to differentiate between source files. I really like this feature. Its very fast as you would expect and easy to use. Just like a modern editor. But this one loads in less than a second. And has no slow down, and never crashes. Unlike Sublime editor lol. :lol:

Once I have it completely set up, will have z80 extensions show up as orange, the forth extensions will show up as green and basic as black.

Image

Image

Corvus tools +dos, once you get the hang of the commands its pretty straight forward, the menu is all based from one letter key presses. Its very fast also. This is what really makes the thing shine is you can have floppy applications on the Corvus drive running with almost no delay because the write / read times are so fast.

Image

Image
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 47, 318 days left!

Today was mostly a rest day - good to take a break now and again and re-charge the batteries. That said I still ended up messing around with the Corvus atari box :lol: Trying to figure out the extent of Amoeba's patch capability. But to be honest I was such a potato it was a good way to really learn how to use a debugger :lol: to let you in on a secret I haven't been using one for the spectrum. :lol:

Once I figured out what the thing did, and what I could do I face palmed as many of the errors I had with crapchess could have been traced using zeus (lets not go crazy, fuse's debugger needs a lot of love for it to have similar functionality.). So in a roundabout way I made some progress with crapchess in that I am now comfortable using the debugger features so that should catch a lot of the stupid errors I was making each build.

On the plus side the documentation for the Atari is really solid. You seem to have had more of a market for professional books. So everything is there to create a really slick program it just takes some effort.

But with the added advantage that you have lots of support processors/hardware in a way its like a 6502 MSX. A lot of the headaches you get with the spectrum are taken away and you can be very lazy in programming for the Atari.

I had a look at the 6502 mnemonics and they are not all that bad, the Lance L books are essentially the same across processor families just a straight port. So having read through the z80 book his 6502 book is pretty easy to work through. Though dry, the guy goes through everything and gives you a bunch of subroutines that are functionally equivalent across both processor families.

This is what would need to be done for crapchess, have each of the subroutines implemented in both the z80 and the 6502 - where things start to branch even further is when you need I/O. but that is really the only difference + the memory map for the target.

What I am thinking is have the different targets have there own library. That way I can just compile the version I need to test.

In the case of the 6502 the process its-self is different but its not a crippled cpu like say trying to get the z80 code to port to something like a 4004. I think a 6502 port could be done. Just the question is do you want to make a good port or not to the targets within the family.

For instance, I could have the code mostly use the 6502, and have the bare minimum of I/O code. This would require only some changes to the memory addresses used and stuff like figuring out where screen ram lives, the keyboard buffer. That's it. For a lazy port that is totally viable solution but the game would not take advantage of the target systems support chips. and Would probably be slower than it could have and definitely a lot less flashy. (Looking at you ZX spectrum ports on MSX) lol...

The problem with the MSX is - while its got extremely good system design, and its well documented that documentation is for the most part in Japanese. But in fairness there is a lot of good websites and documents to help its not the same as what you find with the Atari.

I think a middle ground can be taken, for logically designed systems with well documented systems its a lot easier to write the libraries and do the port. Because this is ultimately my hobby, its not like I am getting paid to do this so I will just target the systems I find interesting. I can always do more as the mood takes me.

The Atari 800 is well documented, feature rich and has a lot of tools (cough cough the corvus systems). I will do some tests and see if its as straight forward as the books make out to get the atari to bend to my will. :lol:

Anyway enough wibble, time for some action. :lol:

p.s

I did look at the Beeb, and even (spits) the C64 but it came down to two things.

1. the corvus development system is all kinds of awesome.
2. in the case of the Beeb - a lot of the websites are gone. Stairway to hell is for all intents a pay to play site now (you can pay for other peoples material) and all of the previously free stuff is taken off line. So I was less keen doing a beeb version.. In the case of the C64. Well - Something just made my skin crawl. :lol: Plus while having a larger software base its documentation is not quite at the same level. Plus I don't get the system design. The Atari is pretty logical. Same as MSX.

C64 seems like a bunch of compromises/hacks. In that its a lot closer to the spectrum. So I think it would be harder to make a good port to the C64. That said I will keep an open mind, never say never and all that...

Image

More of the Amobea debugger in action :lol: I think it says a lot about how easy to use a program is if a potato like me can pick it up.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Heres the Trace in action...

Image
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 48, 317 days left!

Today was cool, for the first time I wrote a sizeable program in assembly and it worked as I had planned, plus there were no errors. :lol: Well compared to where I started this is good progress.

So yea looking at a lot of the wonderful demo's on the spectrum got me thinking, I wanted to see what I could do with just a screen and some udgs.

Reading about token systems for displaying data got me thinking. Wouldn't it be great to have a program that did something with counting in another number base. Now there are many for hex and binary. That is a path well travelled. I thought why not base 20?

I can't have been the only one who wanted to learn how to count like a Mayan?

:lol:

So this also in a round about way links into the conversation about background tile techniques before. The UDGs are the most basic elements to construct a user interface. It makes sense to really nail this before going onto doing different sized tiles on the screen. Sure it looks crap - but that is because of my lack of pixel love for the UDGs - given enough time they could be made to look a whole lot better.

Image
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 49, 316 days left!

Spent today realising the implications of thinking of the permanent colour values passed to various rom functions as a matrix of continuous values. This makes selecting background and foreground colours pretty straight forward and could easily be implemented in a function. This is something to work on for later. Other than that - created a list of the 16 'bad' colour values that will result in both ink and paper having the same value.

All pretty simple stuff, but still its the little things that get you.

Second part of this was figuring out the most efficient way to preserve my registers when calling subroutines. I am thinking of just a set of register pair pushes to the stack then pop them after. At first I was concerned about the time spent pushing and popping each subroutine call but from a sanity stand point it makes much more sense just to do this each and every time and just eat the performance cost. The amount of hours I have wasted tracing bugs and implementing hacks to get round the register values being trashed after a subroutine call are embarrassingly large. There came a moment where it dawned on me that fixing the trashed registers was causing just as many problems as it was fixing, took a lot of my time and was unpredictable compared to just pushing and poppin' the stack.

Still I think its best to come to these revelations by your own pain and suffering otherwise it really does not sink in why you need to do something. :lol:

Aside from that my project time was taken up accepting that markdown was not going to be good enough to do what I wanted with documenting the project as a final product. The major sticking point is that there is no way to create multi column displays. Other than that it was ok. But I recalled that LaTeX was not all that bad. I found some good guides and sure enough you can create some quite nice presentations, documentation documents with not much change from the markdown. This made me happy. Y'all will get to see the fruits of this shortly. I figure its easier to read if I organize all my wibble into a logical flow relating to the various programs, techniques, topics.

Like for example, I wanted to find the code I used to block copy a screen to the display memory space I had to search through 17 pages of project talk :lol: I got irritated and I am the one that wrote it so I can only lament at what others must be going through. :lol:

Today was good as I now have a clear idea what to do to get all of the previous programs you have seen in this thread finished and working properly. Crap chess/Noughts and Crosses and the Mayan counter. The plan is to use a standard set of subroutines across all programs to cover stuff like I/O, maths, and graphics. That way it will cut the time needed to fix each program. Sure there is some unique portions of each program that need to be written to make them work properly and make sure that all my register values are preserved but its not such a big job as one might think. Plus when I have finished I have a reliable set of tools to use in the next project.

It's true what is said as soon as you are close to finishing something you will want to re-write it. :lol: But this iterative development stuff is ok it needed to happen as I was so embarrassed by what I had written before I had to do something to fix it. I figure a couple of more cycles like this should result in a tight set of subroutines.

The biggest change you will see compared to before is colours, lots more colours. The attribute clashes are going to be over as I am now at a place where I can start to use NIRVANA+ to handle the graphics. I did sevenFFF tutorial and it totally ruined me :o :shock: seeing what could be done on the crippled machine that is the spectrum left me with a feeling like 'I have to use this, there is no going back.' Haha I don't know about you but once you see it its hard to go back..

It might not look like it but I learned a lot from when I started this, reading through the thread awared me to that :roll: (well there is only one positive direction to go from 0)... So much time wasted on blind alleys and not following simple advice/concepts. But then what do you expect from a potato.

Here is to finishing the damn thing. its almost day 50 for f*^& sake and still no working program. :evil: Why do this log, well I think its a good way to make myself accountable and stick to my goal. Don't get me wrong I enjoy the process of creating stuff for the spectrum and its a lot of fun finding out about its quirks and 'features'. But were it not for this long thread keeps me honest. I tend to get distracted with many projects. And in fairness the spectrum is a pita to program for compared to Atari. (But not C64 it turned out.) At a stage now where I can implement my subroutine library for multiple targets. this completes one of the stated aims of the project to get it working on multiple systems.

It was perhaps the most ambitious part of the whole enterprise but then I am reminded of this
A man's worth is no greater than his ambitions. -- Marcus Aurelius
and
The great proof of madness is the disproportion of one's designs to one's means. -- Napoleon Bonaparte
:lol:

So here is to a working resolution to the project, with 3 working programs each working from a common library of subroutines. Each using the Nirvana engine. Each with the ability to be easily ported to different systems. Each fully documented, properly tested. And finally and most importantly finished.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 50, 315 days left!

I am now an enemy of Greenpeace. Lol I have in my grubby hands a hard copy of the Interface I rom, the spectrum 48k rom and the atari OS rom II b. :lol:

It is so much easier to figure out what's happening when its on paper and not scrolling around on a screen.

The 'easy' printing setup took 15 steps to manually install cups, the drivers, configure cups and set up a print buffer. Yup its one thing arch is its user friendly. :lol: Anyway got the documents printed that's all that counts.

I think once I understand the rom & the interface I rom that will give me a big advantage in deciding what to use and what to implement myself. Plus being able to see exactly how they set things up and try and figure out why is a exercise in itself. I enjoy that kind of puzzle. Trying to figure out a equivalent in the atari os is going to be the secondary task.

The big win there is even the bog standard source code listing was almost 100% commented to the line level. It is a lot easier to figure out what's going on. Once you get over the mnemonic variance - its so well written even a potato like me can appreciate the skill that went into that.

Next on the list is organizing all of my previous source code, log book comments into a more logical and searchable way. catalog all of the subroutines used. any bugs that need to be fixed on a todo list and the outstanding subroutines to be written. Once that is done then I have a clear idea of what needs to be created from scratch. Will then go back - refactor the earlier work to make it slight less potato then tackle the unfinished parts. This I think will take about a week. (not the rom study lol the re factoring of my own code...)

while I was waiting for Bono to zipline in and try and double tap me for abusing the planet I had a look through at my work and its further along than I remembered in most cases. Things are not looking quite so bad. For the spectrum versions the end is in sight for CrapChess, and for the mayan counter. Bizarrely noughts and crosses is going to need some major love as I seem to have written it in a frenzy period where things were just slung at a wall and I saw what stuck. :lol:

Tex typesetting is a pita but it looks very nice. All the pain will be worth it once I get it finished. The packages you can use with tex are like crack you just want to use more and more of them. When I saw how with a bit of pain I could create a microdrive byte map diagram I was hooked.

I was planning on going straight on to doing some more tools/games after I finish the ones I got on my plate currently but I think my time would be much better spent taking some time out once crap chess and the other two are done and going through the roms and really getting 'gud' I can bore you all with my T state analysis of the various subroutines and variants. :lol: you thought it was dry now you have not seen anything yet.

But not to fear, it will look pretty and be a whole lot easier to read.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

I been such a potato - the answer was right in front of my face the whole time.

Forth can directly manipulate memory, in a ridiculously easy way. therefore a cross compiler is just a matter of

1. writing the byte code to a area of memory, advancing some sort of pointer address and looping till you are done creating the binary blob.

2. When the blob is created in memory - write the blob to a device (tape/disk/paper tape whatever) then take it to the target machine and load the blob into memory and run.

For something like the Z80 your talking 252 words. Probably to make it a nice 256 you would just have the unused words be nop.

So a Vocabulary of 252 words, the core forth vocabulary + a sprinkling of initialization and load save routines (talking a handful of words) that wouldn't be such a crazy idea.

A byte code poke is nothing, its like at most a line in forth. even for the most complicated of oppcodes.

of-course the program I envisaged wouldn't be good at making decisions on things like labels and the like so the design of the code would involve a bit more hand holding than usual but for the moment it at least answers a question that was plaguing my potato brain. :lol:

But when you climb the mountain you only realise there is just another peak in the distance. a 2 pass cross assembler is a much more complicated beast. My 'skills' would have to be on another level to write something like that. but one day.. haha.

Telling you a cross compiler in forth or action! would be the business.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Update:

Well I am writing this using the Lynx browser. Why you might ask? well thanks to a broken system update my arch install can no longer run programs with GNOME dependencies lol.. Untill it gets fixed im stuck using terminal software and non-gnome stuff. This makes things a bit more of a challange to use. But I figure the mesa drivers are going to get a bug fix in the next few days and things will be back to normal (this is what happened last time in November lol..) Hopefully this will post correctly. I can tell you its a bit weird using text brower to use the net - it feels like I am back in the BBS days lol. Still your be glad to know the forum works OK. Despite all these problems the pdf viewer works and vlc so I can in a round about way still watch youtube lol I just how to use youtube-dl first. Bizarely one of the few apps not to be affected was Wine. So I can still do all my dev stuff just not with sublime text. If I could get used to the interface Lynx is really very fast... Progress on the project is going pretty good in a bizare way this is actually going to accelerate the development as I don't have any distractions not even pictures anymore haha. I might be a bit slow to respond to personal messages because of the way the interface works here.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 51, 314 days left!

Luckily the Mesa drivers got an update after I wrote the update post, it's still not perfect and it looks like programs with Gnome dependency's are still borked but at least chromium is working.

As a precaution I re-installed all the packages hoping that the new build would help matters, it didn't but it was worth a shot. On the plus side I got a lot of reading done in the downtime.

Getting better at tex beamer so expect some nice presentations :lol: I think that is a much better way to communicate what I have been doing in a more understandable way. I can then go through each part and show what the program does in a much simpler and logical way. It's also easier to take in in bytesized chunks rather than reading this dribble.

The other side effect to doing things this way is I can explain what I am doing often a lot more concisely with math notation. I think it will help others review what I am doing as its easier to spot my mistakes that way.

Other news: Found the source code for the corvus drive. Now have the manuals I need for the Atari. I wish there was a similar book for the spectrum to the 'Atari Technical Notes' :lol: They wrote a book that you could give someone, along with the hardware guide and a 6502 assembly book (probably zaks or Lance L's) and said 'go away - learn this and give us a game.)

Obscure subroutine corner: While reading a random paper about Danish folktales. They had studied 30k of folk tails and defined what was far-away/outside vs inside, the most likely location to find treasure, witches, robbers and monsters. So With these boundaries (no tale mentions anyplace further than 250km from the story teller and no closer than 10km) Why does this matter - well you can use this data to generate lore for your adventure game.

Each location is linked to others in the world. there is some way to measure distance from A-B. Therefore to generate lore for each point of your world. You just use a map on the location where a location is selected that is |10km -> 250km|. This could be further simplified if you defined the area as first a area of 8 subsets. then finally looking at the selected set to find a point to use for the quest.

That way every time you went to a different location, your random quests would occur in the 'right' places you would expect to conform to a myth structure. (no evil monster right in the village - it lair would always be miles away in a non-populated area.) converse, cunning women & witches would always be close to population areas or inside (as these were the 'inside' threat).

Robbers and bandits are in the sweet spot between population centers and the 'far outside' Because they needed to be within a realistic distance to the population center for re-supply and also to prey upon the people. But they couldn't be inside the population center because of the fear of discovery. They were 'Out' laws for a reason... (well technically, an outlaw was legally no longer a person with rights, once declared an outlaw your status in society was lower than a farm animal. You could be killed on sight by a citizen with no penalty. (But I digress)
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 52, 313 days left!

Finished writing the script to generate the noughts and crosses boards in latex. :lol:

Also done reading the libraries concerning chess and latex. So now can actually write up the source code properly and explain what I am doing in a non potato way.

Third have the bytefield library up and running so now with a bit of tweaking I can show a pretty sweet memory map & of course bit/byte diagram of structures.

BNF notation is also done, that is not really going to feature so much with the current projects but its more something for later with the Forth stuff. That really helps clarify what is happening with the language.

the assembly language code is shown using python pigments (well under the hood).

Other stuff, decided to use the memoir package as that seems to be more all in one solution. Its a compromise but I didn't want to have to learn 5 different 'best' libraries I would prefer something that was just 'very good'

There were a bunch of graphics libraries I looked at but all were lacking, and eventually I bit the bullet and I knew myself I wouldn't be happy unless I had full control and a strong library. So I went with the mamoth Tikz. It's fully featured you can pretty much achieve any graphics effect you want with this. But the documentation takes ages to read. That said its pretty easy to use. The noughts and crosses board is a good example. I could have done the chess illustrations in it but I wanted the extra features that chessboard & xkicks give you.

Found me some really cheesy creative commons graphic art - for my money there is not enough technical books now that have the same type of inexplicable cover art as back in the 80s.

Any thoughts on number of columns? I have been flipping between two column and single column with a big margin to put notes/illustrations.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 53, 312 days left!

Almost done typesetting my project notes! next will be going through and cutting out all the repetition and non-essential wibble. So I think i am going to loose about 50% of what was wrote. :lol:

Not going to lie, LaTeX is a nasty language, I would say its as frustrating as perl to use. :lol:
The one consolation is that once I have the damn template done, I won't have to touch it again.

Besides the typesetting was not a lot of time for other stuff. That said got a basic memory map done for the spectrum 48k stock. Next is going to be mapping the rom routines in a visual way.

For the morbid curious, bytefield is the package you need to do this in LaTeX. :lol:

WIth all that said, it makes nice diagrams, there is even a flowchart package that can be tricked into doing d-diagrams with some coaxing.

While organizing my notes I came to realize that my projects so far have all been positional games. That at least explains my itch to do battleships :lol:
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad »

Day 54, 311 days left!

Refactoring Crap Chess. Thanks for all of the advice and hints/help you guys have given me.

Lol I got to see the really early screenshots from crapchess. :lol:

The end is in sight now ... finally. :lol: That said I kinda moved the goalposts a number of times with this project.

The thing that has surprised me the most is how little specific code you really need to make a game. Once you have the general routines done its really just the graphics and some engine rules.

Expect noughts and crosses/mayan counter to be done pretty fast. Once Crap Chess is out the way I can just update the routines and badabing badaboom.

Other developments,

Found a really interesting article in ZX computing about using the microdrive for random file access read/writes by abusing the table/buffer. This guy was doing it from basic to avoid '7 second read/writes' so I think doing it with assembly will make it even faster.

His technique is sound but its a fragile method. You really need to have a good idea of the microdrive's current file structure and what read/writes need to be done to what sectors.

Figured I would start trawling for new/novel techniques by going through the archive.org magazines. Started with zx computing as that seemed to be the most neck beard of the z80 magazines.
Post Reply