Calculator language

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
User avatar
mrtinb
Posts: 1911
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Calculator language

Post by mrtinb »

PokeMon wrote: Wed Jun 07, 2017 12:03 pm Why not use
10 PRINT "HELLO WORLD"
which is just much shorter. :mrgreen:
If you've tried the example, you would know it does not produce the same output. ;)
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
Moggy
Posts: 3267
Joined: Wed Jun 18, 2008 2:00 pm

Re: Calculator language

Post by Moggy »

olofsen wrote: Wed Jun 07, 2017 1:42 am Cracking as well ;)

Code: Select all

1 REM 1112222333334444455
10 REM START
11 POKE 16514,239
12 POKE 16515,47 ; jump
13 POKE 16516,5
20 REM STRING
21 POKE 16517,63
22 POKE 16518,61
23 POKE 16519,36
24 POKE 16520,29
30 REM STRING ADDR,LEN
31 POKE 16521,48 ; stk-data
32 POKE 16522,129
33 POKE 16523,133
34 POKE 16524,64
35 POKE 16525,4
40 REM STK FETCH AND PRINT
41 POKE 16526,48
42 POKE 16527,124
43 POKE 16528,53
44 POKE 16529,192
45 POKE 16530,41 ; usr
50 REM END
51 POKE 16531,52 ; end-calc
52 POKE 16532,201
100 RAND USR 16514
I was going to award you a virtual cigar for this Erik but as it doesn't say "HELLO WORLD" I now ban you from the forum!!! :lol:

Serious face on, nice work but how does the jump work at 16515 just after the calculator is switched on,is this part of the calculators language as I thought a jump would start with something like 24(D)-jr,nn or 32(D)-jr nz,nn. :D


As you can tell assembler is not my strong point. :oops:
User avatar
mrtinb
Posts: 1911
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Calculator language

Post by mrtinb »

This is not ML. 47d (2Fh) is the "calculator opcode" for jump. So "47 5" jumps over 5, Z, X, 8, 1.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
Moggy
Posts: 3267
Joined: Wed Jun 18, 2008 2:00 pm

Re: Calculator language

Post by Moggy »

Thanks Martin all clear now. :D

He still can't have a cigar! :lol:
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: Calculator language

Post by PokeMon »

@martin

But this was initially requested or proposed. ;)
olofsen wrote: Mon Jun 05, 2017 11:23 pm Well it would always be nice to have a "hello world" example in this language (perhaps screen output can be done with the MEM system variable pointing to the display file) 8-)
olofsen
Posts: 189
Joined: Wed Jan 08, 2014 12:29 pm

Re: Calculator language

Post by olofsen »

Yes, for MEM output, MEM needs to be set, which may not be possible with CL. The current code goes from RST 28h to end-calc; however, it is not relocatable :( Nevertheless, perhaps we are now ready to have a go at "81 boxes with a Z80 inside" (conceivably without a virtual single malt award) ;) https://en.wikipedia.org/wiki/99_Bottle ... er_science
User avatar
mrtinb
Posts: 1911
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Calculator language

Post by mrtinb »

olofsen wrote: Wed Jun 07, 2017 8:52 pmThe current code goes from RST 28h to end-calc; however, it is not relocatable :(
This is a simple example that display inverse Z, but it's relocatable.

Code: Select all

4082 EF            RST 28H
4083 30             STFP
4084 B83F0000          191
4088 2B             CHR$
4089 30             STFP
408A 7C35C0           2908
408D 29             USR
408E 34             END
408F C9            RET
Line 4083-408D can be repeated for each char to be printed.

It would probably be better to do a

Code: Select all

[C0] STOR 0
after the first

Code: Select all

STFP 2908
to save the number 2908 in MEM-1, and the just do

Code: Select all

[E0] GET 0
everytime 2908 is needed, and save 3 bytes.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
mrtinb
Posts: 1911
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Calculator language

Post by mrtinb »

Maybe a better way to have string data is to have them stored in Basic variables, and fetch them somehow when they're needed. Basic variables have the same properties as Calculator Language:
  • Can be anywhere in memory, as it is just data
  • Data is fully relocatable, as it has a name as reference
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
GCHarder
Posts: 428
Joined: Sat Dec 14, 2013 7:46 pm

Re: Calculator language

Post by GCHarder »

Here's a program which uses the FP calculator extensively. Originally written for the Spectrum, I converted it way back in '87 to run on a hi-res capable T/S 1000. It shows that the calculator in the Spectrum is pretty much the same as the ZX81's. The listing is nicely annotated in the article.

Regards;

Greg
Attachments
Spirograph.zip
Program and article
(577.61 KiB) Downloaded 161 times
Moggy
Posts: 3267
Joined: Wed Jun 18, 2008 2:00 pm

Re: Calculator language

Post by Moggy »

Thanks Greg this is MUCH appreciated. :D

EDIT
just trying it with the new Zxpand+ and whilst some of the introductory surround/border is a bit corrupted the text is fine and so is the first demo I'm running albeit very very slow.
A cracking piece of work and it's nice to see the calculator being used like this. :geek:

I think Martin will like this.


More like this please Greg!!!
Post Reply