News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_andymccall

Newbie assembler CPC question...

Started by andymccall, 12:19, 28 June 25

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

andycadley

Quote from: andymccall on 13:37, 05 July 25
Quote from: arnoldemu on 13:08, 05 July 25https://www.cpcwiki.eu/imgs/e/ef/S968ap05.pdf

This lists the default colours.

You can always change them with SCR SET INK and SCR SET BORDER as you have done already.

Ahhhh!!!!

I didn't realise the pen's were already assigned a colour.  I thought the pens were all empty and I had to set the ink's I wanted to them.

This makes much more sense!  ;D
The relationship between PENs and INKs is one of those things that's a lot more intuitive if you've played around with BASIC a lot. I think the firmware guide sort of assumes that you're familiar with BASIC in many ways, so it's worth skimming through the BASIC manual to be honest.

arnoldemu

I wanted to see if my theory worked (using MC SET MODE) to change mode on screen, stopping MC SCREEN CLEAR from doing anything and then using SCR SET MODE to setup firmware to use correct text drawing.

The result is attached.

andymccall

Thanks for all the help.

Here's a video of what I've learned and managed to do so far:



I tried to do the mixed mode, but it was beyond me at the moment :-/  The next bit I need to do is take a png, export it into a format the CPC can understand, then load the .bin in my project and display it over the black stripe.  I think because of the complexity of the Amstrad CPC's graphics system, this is going to be much harder than on the other systems I've written this demo for.  If anyone has any tutorials or tips for doing this then I'd appreciate the links.  I have managed to display a full screen image, but that was a bit easier as I could conver the whole image into a format for the whole graphics memory, displaying a smaller image over the top of another one seem to be much harder.

Source code is here - https://github.com/andymccall/bitriotdev-cpc for those experienced dev's that fancy a laugh at a newbie  ;D

lightforce6128

Quote from: andymccall on Yesterday at 18:05... The next bit I need to do is take a png, export it into a format the CPC can understand, then load the .bin in my project and display it over the black stripe. ... If anyone has any tutorials or tips for doing this then I'd appreciate the links.  I have managed to display a full screen image, but that was a bit easier as I could conver the whole image into a format for the whole graphics memory, displaying a smaller image over the top of another one seem to be much harder.

Here I would like to do some advertising for the existing Wiki page about this topic as well as for my small plugin for the GIMP graphics software (link at the end of the Wiki page, discussion on this forum page). The plugin provides a small BASIC program that in turn installs a small assembler program to copy the graphics data to the screen - currently always at the upper left corner, but this can be changed.

ZorrO

I'm looking at your video to see what effect you want to achieve. And on Amstrad you don't need machine code for this. You can do it in a few lines of Basic or even display such a screen as a text file with a few control codes. For the address text you can use characters with codes from 128 to 143, and for option font use narrow font with a 4x8 pixels matrix in MODE 0, or switch bottom of screen to MODE 1. Last one thing can't be done in text file. The only difficulty is to get a lighter gray color that is not in palette, there are 3 ways to do this but each has a certain drawback.

CPC+PSX 4ever

andymccall

Quote from: ZorrO on Yesterday at 19:57I'm looking at your video to see what effect you want to achieve. And on Amstrad you don't need machine code for this.
Oh, I get this.  This is an exercise purely to learn asm on a few different platforms. In fact the absolute easiest way would be to have a script to display two full screen images - but that's not why I'm writing this.

I started programming when I was about 14/15 when I got DevPac 3 for the Amiga for my birthday, and I just couldn't understand it.  I tried a number of times throughout the years to go back and learn it and it's been a bit of a mental block for me.  About 18 months ago I started getting into retro systems and decided to finally learn how to code in asm.  I've been exploring different modern 8-bit systems like the Commander X16, Neo6502 and Agon Light, and I thought I'd go back to the very first system I ever had - the Amstrad CPC 6128 and see if I could write it for that.

The demo/app isn't for anything, it doesn't really do anything - it's a few loops, keyboard input, shapes, screen mode changes, displaying an image tile or a sprite etc. but it's enough for me to learn a few common skills across a number of platforms.  I'll expand on it to try new things as I learn more.  One thing I've already thought of is having a data structure for all my rects that loop through to display them.  Right now I could do that in C/C++ or Java, but I've got no idea about this in asm so it will be fun learning.

ZorrO

It's cool, have fun as you wish. Just knowing assembler without knowing properties of specialized chips and contents of kernel doesn't give you feeling that you know what and how to do it. Many coders, when switching to another platform with the same processor they know, are unable to do as effective things on new machine as on the previous one. Accustomed to being better than those who write only in Basic, on new one they see that those who don't know assembler can do better things because they know machine. At least at the beginning it is like that. :)
CPC+PSX 4ever

Powered by SMFPacks Menu Editor Mod