суббота, 30 марта 2013 г.

I love this blog very much.

http://atariaction.tumblr.com/post/37174168567/day-1-getting-started-with-action
 
Kevin Savetz is a very good man trying to say us that there are MUCH more ways to think in a computer way than evidently posessed.

I'm trying only the next one attempt.
Seriously the reason to wrighting something here is my impression of his blog.

When I tried to convert ACTION! program to PL65 I've ran into the first problem...
There was no function in PL65 returning random value between 0 and 1.

So, it's my duty.

The Code:

FUNC RAND()
  CONST RANDOM=$D20A
  BYTE B
BEGIN
  B=PEEK(RANDOM)
  IF B>127 THEN B=1 ELSE B=0 ENDIF
END B


Here we get semirandom value from HW RANDOM register and as we know that it's between 0..255 then we set a border for making choice. 127 is a right value.

And the code of full program:

INCLUDE D8:TERMINAL.LIB
INCLUDE D8:PEEKPOKE.LIB

  INT X

FUNC RAND()
  CONST RANDOM=$D20A
  BYTE B
BEGIN
  B=PEEK(RANDOM)
  IF B>127 THEN B=1 ELSE B=0 ENDIF
END B

MAIN()
  BYTE B
BEGIN
  POKE(82,0)
  WRTSTR("GO") CR()

  REPEAT
    X=(6+RAND())
    PUT(0,X)
  UNTIL PEEK(764)=28
END


Here is TERMINAL - for I/O
PEEKPOKE - for ..?
Hmm! Peek and Poke!

And at last It's work!

суббота, 23 марта 2013 г.

To Learn

Being a clever boy (IMHO) I'm trying to investigate PL65 Libraries.
It's an only right way to learn languages!
And now - the most important - terminal.lib ...
FE Here it is a code of CIO utility!


(Not so sofisticated idea of filling memory from soft stack to previously counted place... Right?)

Do you like to keep LDA-STA in one text line?
Do you like :ioerr LABEL? (It calls from another subroutine...)
Here STACK - is active PL65 internal pointer to STACK beginning.
So XSAVE is Z-Page place to save 6502 X-Register.
RETURN - EXIT from routine.

Does anyone can say that it's no assembler?
- I can!

One of the last strings shows that it calls 'WRTSTR' - a high level function that is not assembler at all!

The asterisk after the name of function shows that it's a case of 'CLOASURE'.

The calling function calls another which needs calling function!
Alice in Wanderland!

Really 'WRTSTR' needs CIO for it's text output.
But CIO needs WRTSTR for ERROR indication!

Next...

Today I can't say that I understand a way how the internal assembler interacts with compiler.
I know how ML interacts with BASIC. I know how ML Interacts with ACEC or CC8.

Today I know that PL65 uses programmed (it's own) stack. I don't know how it does...

Sorry, but now I'm working on bitwise and screen libraries and I can't 'goto' realy fast asm version of them. I'm learning only PL65 now!!! No ASM.

And now - my impressions about PL65...

Anyway it saves my nerves in a way that it taking care of memory utilization like BASIC.
Someway strange, someway right... Anyway I feel it!

(Really I feel that 90% of test programs are good and another is my own errors.
anyway in 'C' it-s not so good. I'm not a programmer at all! )
Now I think that inspite of abylity to create BYTE variables etc.,
PL65 uses ONLY INT's !!! ... and drops MSB's in case of BYTE.
Anyway it's 'counting' variables (FOR ... NEXT... FE) all are INT!!!

You can't write:
FOR I=1 TO 2 WRTSTR("I Love YOU!!!") CR() NEXT

You previously MUST say that:
INT I

(So you must think that your own abylity to love 'someone' goes to 65536 times !!!)
At a boy!!!

- It's PL65!

CUL8R

воскресенье, 17 марта 2013 г.

Let's begin.


Let's begin.

 After more then 30 years of working my beloved Atari 130XE lost it's memory.
Memory chips are broaken. Full sclerosis!

So I was forced to work with emulators.
They all are perfect enough but my personal preference is Altirra.

IMHO the most valuable feature of Altirra is that even in "Warp Speed" mode it stays the speed of emulated keyboard on Windows responcibility (what saving standard Atari keyboard speed) instead of WarpSpeeding of Atari keyboard what leads to keystrokes like this:
DDDDDDDDDDDDDDIIIIIIIIIIIIRRRRRRRRRRRRRR
and then terrible "File not found"...

Then lets begin.
Today I worked on creating useful ATR disk image for investigating PL65.
These efforts are documented here.

My goal was to determinate the cummulative comfort of PL65 as Integrated Programming Environment.
I prefere SpartaDOS as Atari Operating system. But I'm not sufficiantly qualified for SDX memory adjustment and thus the first memory problem will became the last.
I'm using Sparta, which can recognize H6: device of Altirra (This device converting ATASCII to ASCII and vice versa automatically thus I can write my codes in Windows and I can read it from emulator as standard Atary text.) Fortunately PL65 compiles from plain text instead of using tagged symbols.
And of course this DOS must be compatible with PL65 itself.

Here is the directory of disk:


Some more about utilities... I'm using AC.COM from "MAD TEAM" as the best file manager and txt/doc viewer, EDIT.COM as very useful text editor, DESEG.COM as file desegmentator (Both are created by great FJC), SHELL.COM and SFX.COM (by famous Tom Hunt) as PATH saver and selfextractor, and CHVOL.COM (May be Tom Hunt's too.) as volume renaming tool for Sparta and, at all I,m using HYPRAM.COM as 1088mb Ramdisk. That's all.
It's amusing that first time I have launched PL65.COM for obvious "Hello world!" compiling I saw this picture after all:


Noahsoft exhaustively working on PL65 have forgot about returning HW Atari cursor into scene. And this is a case of the need for programming in PL65!

I have launched Editor and after editing code and pressing a SECRET COMBINATION of OPTION+Escape tried to Compile the program.

Here is the result. Bad code:


It is a working PL65 code:


! CURSOR.COM
! The utility for restoring HW-cursor
MAIN()
  BYTE CRSINH=752
BEGIN
  CRSINH=0
END

And as the result:

PL65 Noahsoft(C)1987

Some words about Noahsoft(c)1987 PL65.

At first It’s a compiler for 8-bit 6502 computers. I even don’t know was it designed for other then Atari 8-bit machines or not. Anyway I love Atari 8-bit from early 90-th.
This Programming Language has nothing concerned with well known respectable PL/1.  If you ask me what’s it like?  I’ll be in some kind of trouble.  The fact is that PL65 was born earlier then C.  And there were times when no one knew exactly how to design a programming language.  Seriously it looks like mostly ALGOL, then C and BASIC with ASSEMBLER simultaneously. I think it was an eclectic mixture of all of them with the purpose of giving to programmers their benefits.  Thus you can realize that Noahsoft gave not only benefits but their shortcomings too.

Certainly  it is a high level programming language with extensive system of structuring but it has BASIC’s rudiments like “GOTO label” and also fully featured 6502 assembler and pointers of some kind like in C.
Well, are you intrigued enough now?
Some words about me.
I’m Russian.  My English is too bad for normal conversation.  But be aware that my Russian is much better.  No mean. I only want to learn PL65 and English of course too.

So your advices concerning programming or learning English will be highly appreciated.