News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_rob

Fortune and Cowsay as RSX commands

Started by rob, 23:08, 06 January 22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rob

Hello everyone!

Here is my first attempt at making some kind of expansion ROM, it's a "clone" of the Fortune and Cowsay programs for Linux and the like.


RSX commands are as follows:

       
  • |FORTUNE - Displays a random fortune cookie quote from the ROM.
  • |COWSAY - Displays an ASCII-art cow with a speech bubble containing a quote.
  • |COWSAY,"Hello, World!" - Makes the cow say Hello, World!
  • |COWTHINK - Same functionality as COWSAY but with a thought bubble instead of a speech bubble.
There's no word-wrapping in the speech bubbles, I'm still working on that. Also, I'm a complete amateur at assembly language and I built the whole thing using WinAPE's assembler but I have tested it on my real 6128 plus and it seems ok.


The quotes are a random selection from https://www.shlomifish.org/humour/fortunes/ - as many as I could fit in 16K of ROM!


Anyone interested in the source code can find it at https://github.com/robdmob/CPC-Cowsay but I must warn you I'm still learning so it might be a bit rubbish.


Edit: Just realised the ROM file in the zip was empty. Now fixed  :doh:

Prodatron


GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

m_dr_m

Beginner or not, great project!
Having that at boot time would be sweet (no need to enter the RSX).

OTOH, I like to mute all ROM inits (it takes space and time, even in mode 2).
It would be nice to agree on a way to discriminate boilerplate presentations (always the same stuff displayed) from insightful messages (those ones, warning or error logs).

Quote from: rob on 23:08, 06 January 22as many as I could fit in 16K of ROM!
I made an ad-hoc compressor dedicated to corpus of messages, for a project of mine.
It bulk-crunches all the corpus, yet allowing to uncrunch just one arbitrary message (indexed one 1 byte for now).
I can polish that and make it available through a RSX if there is interest.

rob

#3
Thanks for the encouragement!


I agree it would be nice to have it displayed at boot but I think the biggest challenge would be generating a random number. At the moment I'm using KL TIME PLEASE which obviously would give the same number every boot, but I'm open to any better suggestions there. Also, I know people can be very fussy about what is and isn't displayed at boot! Maybe things like that are best left to the individual to put in an AUTOEXEC.BAS if they have the hardware.


I did consider some kind of text compression but I was determined not to use any RAM and that proved to be a bit of a stumbling block. Definitely something I'm interested in learning more about though so I'd like to see your compressor.

GUNHED

For random numbers, you can just add the content of register R. It's not perfect but easy.  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

rob

Quote from: GUNHED on 17:24, 10 January 22For random numbers, you can just add the content of register R. It's not perfect but easy. 

Interesting! Would R contain a different number every boot? I'll do some experiments.

rob

I've done some tests and unfortunately R contains the same number if you read it at the same time each boot. Looks like unless you've got some external hardware like an RTC or Wifi there's no way to get an unpredictable number at startup.


Thanks anyway GUNHED, that definitely wins the award for quickest and easiest way to get a one-off random number!  :)

m_dr_m

You could xor together the bytes of uninitialised area of the ram, plus poke back a seed at a safer place.

rob

Quote from: m_dr_m on 17:23, 11 January 22You could xor together the bytes of uninitialised area of the ram, plus poke back a seed at a safer place.



That's a good idea! Won't be able to test that on an emulator of course. Time to dig out the real CPC.

Powered by SMFPacks Menu Editor Mod