The Best Of The Plotter [1994 newsletter]

Discussion about ZX80 / ZX81 Software
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

How to Change Ramtop...PART TWO

Post by David G »

[ZX81 Type-Ins] How to Change Ramtop - Best Of The Plotter
CHANGE RAMTOP...PART TWO

The general procedure for lowering RAMTOP in increments of 1/4K (256) was given in Part 1. Here is the reasoning for those who like more than blind faith.

The Sinclair memory system includes a variable upper limit called RAMTOP. When the computer first powers up, the microprocessor, MP, inputs a binary number 2 into each memory cell, or address, in RAM. Then the MP interrogates each address. When if finds an address without a binary 2, MP calls this the top limit of memory. This information is stored in dedicated memory addresses 16388 and 16389. This information can only be changed by actually changing the address of RAMTOP.

Part 1 gave this direct command to determine the present RAMTOP address:

Code: Select all

PRINT PEEK 16389*256+PEEK 16388
This command will cause the address to be printed at 0,0 and will be applicable to your computer memory capacity. If the numbers are smaller than those given in Part 1, either there is a defective memory cell or RAMTOP has already been lowered. To return RAMTOP to standard 32767 address:

Code: Select all

POKE 16388,0
POKE 16389,128
Change 128 to 72 for 2K of memory. To confirm the address, PEEK again.

The address 16388 is filled with 8 zeroes in binary. If there are 8, then something is left over for address 16389. If there is only one bit over then it must be 256 as 2 to power of 8 equals 256, and the number to input into 16389

You may notice a RAMTOP address variation such as 32767 or 32768. 32767 is the actual address but to be above by 1, we use 12768. The following formula lakes this into account:

Code: Select all

POKE 16389, INT ((32768-MK)/256)
POKE 16388,(32768-MK)-256*INT((32768-MK)/256)
...where MK is the amount of memory we wish to store above RAMTOP and is not abbreviated as 2 1/2K (use 2500), etc. This formula will work only for 16K of memory, so substitute if necessary. As mentioned at first, 16389 and 16388 do not vary, only the record in them varies.

The computer is not particular about the two addressed locations being POKE'd in special order as either 16388 or 16389 can be first.
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

[ZX81 Type-Ins] Renumber Subroutine - Best Of The Plotter

Post by David G »

RENUMBER SUBROUTINE from The Best Of The Plotter page 11

This program may have been copied from the Spectrum because it's not actually useable on a ZX81

It appears to do dynamic program alterations without using GOTO. It certainly does not renumber anything
RENUMBER SUBROUTINE by: Glen Ten-Eyck

Here is a handy trick for making subroutines that can be renumbered by simple BASIC renumber programs. It does away with GOTO's. At the start of the subroutine, or elswhere in the program if it is more convenient, define a string with a name that is not used elsewhwere or is a throwaway. X$ will be used in the illustration.

Code: Select all

9000 LET X$="PEEK 23621+256*PEEK 93622"
9010 LET PPC=VAL X$+20: POKE 23618,(PPC-256*INT (PPC/256)): POKE 23619, INT (PPC/256): POKE 23620,1
9020 PRINT "IT DOES NOT WORK"
9030 PRINT FLASH 1;"IT WORKS!"
These are the rules to use -- :

1. Line numbers must advance in a uniform fashion, by 10's is easiest for me.

2. VAL X$ establishes the current line # from the system variables. The amount that is added or subtracted will be the new line number. In the example, add 20 advances the program to 9030 and skips 9020 altogether.

3. 23620 must be POKEd to 1 in order to force the jump to statement 1 or the target line.

Try renumbering this program all that you want. As long as you stay with a spacing of 10, it will work. If you change spacing, it will still work if you remember to change the 20 in line 9010 to the appropriate figure (2*line spaces)

I came up with this because the only renumber program that I have does not renumber GOTOs or GOSUBs and everybody that writes a handy subroutine writes it at line 9000 and on.
also seems like there is a typo in Line 9000:

Code: Select all

9000 LET X$="PEEK 23621+256*PEEK 93622"
That should be probably be PEEK 23622 to match the other PEEK on that line
User avatar
mrtinb
Posts: 1910
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: [ZX81 Type-Ins] Renumber Subroutine - Best Of The Plotter

Post by mrtinb »

David G wrote: Sat Aug 20, 2022 12:04 am This program may have been copied from the Spectrum because it's not actually useable on a ZX81
This is definitely not a ZX81 program, as you cannot use ":" to have multiple statements on a line with a ZX81.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
mrtinb
Posts: 1910
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: [ZX81 Type-Ins] Renumber Subroutine - Best Of The Plotter

Post by mrtinb »

David G wrote: Sat Aug 20, 2022 12:04 am RENUMBER SUBROUTINE from The Best Of The Plotter page 11

...

It appears to do dynamic program alterations without using GOTO. It certainly does not renumber anything
A more dynamic approach will be with the routines from Pascalated Basic.

Here each subroutine start with a number divided by 100. And a subroutine at start, sets a variable with the line number for each subroutine. Then subroutines can be called with GOSUB <subroutine-name>.

http://arcalusitana.fun/MuseuZX/Pascala ... index.html
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

[ZX81 Type-Ins] SAVEing Unbreakable Programs - Best Of The Plotter

Post by David G »

This one is not actually a program, but a command line that you can type in at the cursor.

SAVE CHR$ USR 832-SAVEing Unbreakable Programs On The ZX81/TS1000 from The Best Of The Plotter page 5
SAVE CHR$ USR 832"PROGRAM NAME"

This one line routine will help you make a copy of those unsaveable program. Put the tape you want to copy in your recorder, make sure that you have a new, blank tape in front of your recorder, as you have only five, that's 5, seconds in which to turn off the recorder, remove one tape, insert the new tape, and start the recorder on "record". That is not a lot of time as you will find out, but, with a few practice runs you should have no trouble. This routine tells the computer to load the program and then, via a USR call, tells the machine to save it exactly as it was loaded, and, if there are no bugs in the program, the routine will work every time. Give it a try.
Address 832 is THE 'LOAD' COMMAND ROUTINE of the ROM. Logan says:
The bytes collected from the tape are matched against the program name and then the program is loaded into RAM.

0340 LOAD
Address 0340 hexadecimal is 832 decimal, the address of the LOAD routine in the ROM

What I don't understand is how the rest of the line continues working to SAVE it. Because when you LOAD a program it overwrites what it is in memory ... doesn't it?
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: The Best Of The Plotter [1994 newsletter]

Post by XavSnap »

To LOAD & Break an autorun program:
FAST
RAND USR 836



SAVE CHR$ USR 832"HELLO"
LOAD "HELLO" & SAVE ""

The ASM-Basic stack at the top of memory (RAM_TOP) isn't erased by the loading process.
It load the program, and return the BASIC jump at previous jump stack, and return to the BASIC after the SAVE BASIC command.
The SAVE name is placed after the VARS and is empty if nothing is in the memory, but the SAVE command can't be empty (F/0 error) at the BASIC prompt.

In this example, the program name isn't needed... SAVE LOAD"" work too...
SAVE CHR$ USR 832""
It's easier to load the game if you don't know its name.

The file name can't be retrieved on the ZX81 ! (The only way is to list the program 9999 SAVE"NAME")
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: The Best Of The Plotter [1994 newsletter]

Post by David G »

I think I understand. You are saying that this command that you type in is copied to the BASIC stack and executed it sequence?

Type and ENTER/NEWLINE

Code: Select all

SAVE CHR$ USR 832""
First it does a

Code: Select all

LOAD ""
(because USR 832 is the equivalent of LOAD)

Then after the program successfully loads, BASIC will continue with the next command that is on the stack

Code: Select all

SAVE <name>
and in this case the name is the string CHR$(return value of the USR call). It doesn't matter what the return value is, just that it is turned into a string so that the syntax checker is satisfied there is a string after the SAVE command

Is my understanding correct?
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

[ZX81 Type-Ins] Scrolling Bulletin Boards - Best Of The Plotter

Post by David G »

Now we are getting towards the end of the ZX81 section of The Best Of The Plotter. There are even more programs listed for the 2068 (Spectrum-derived machine)


Is this what they used to call a "Marquee program"? It uses a "Big Print" type routine, but then scrolls the words up the screen

Scrolling Bulletin Boards from The Best Of The Plotter page 10
SCROLLING BULLETIN BOARDS by Dick Wagner

Moving message type programs are interesting to people; hence the question: "How do you do that?"

Of course, current TV advertising has us expecting fantastic graphics, but we can program our TS 1000/1500 computers to do interesting message writing.

Horizontal and vertical scrolling small characters is just about our limit. Some variations such as background, framing, flashing, etc. all add interest.

I have several programs based on material from some issues of Synchrosette magazine (now out of business) that should delight the experimenter. These will be published at times in the PLOTTER. Keep them in your program file for reference as you won't find them in books.

The first program will produce large letter words in an upward scroll. Marquee type message presentation (horizontal scroll) will come later. I even have a program that splits the 32 character message, in the middle and scrolls right and left at the same time! One program for long messages will encompass some machine language. A loader program plus the MC input, and a means for error correcting will be included. This is not MC programming, so it is really like inputting BASIC that you copy.

The BIG SCROLL program following has a limit of 8 characters per word but will accept many words. It is slow as it shapes each character. The message is continuously repeated but it reforms the letters each time.

Code: Select all

   5 REM SCROLL MESSAGE WITH BIG LETTERS
  10 LET S=1
  20 LET G=4
  30 PRINT AT 10,0;"TYPE IN A MESSAGE."
  40 INPUT B$
  50 LET B$=B$+"  "
  60 CLS
 100 GO SUB 1000
 110 FOR I=1 TO G
 120 REM CHANGE THIS LINE TO SCROLL
 130 NEXT I 
 200 FOR K=1 TO LEN A$
 210 LET C=CODE A$(K)
 220 IF C<128 THEN GOTO 250
 230 LET M$=CHR$ (C-128)
 240 LET C=0
 250 FOR L=0 TO 7
 260 LET P=PEEK (7680+C*8+L)
 270 LET V=128
 280 FOR J=0 TO 7
 290 IF P<V THEN GOTO 330
 300 PLOT 8*(K-1)+J,10-L
 310 GO SUB 2000
 320 LET P=P-V
 330 LET V=V/2
 340 NEXT J
 350 NEXT L
 360 NEXT K
 370 GOTO 100
1000 FOR N=S TO LEN B$
1010 IF B$ (N)=" " THEN GOTO 1030
1020 NEXT N
1030 LET A$=B$ (S TO N-1)
1040 LET S=N+1
1050 RETURN
2000 IF N<LEN B$-1 THEN LET G=4
2010 IF N>=LEN B$-1 THEN LET S=1
2020 IF N>=LEN B$-1 THEN LET G=2
2030 RETURN
9998 SAVE "BIG SCROLL"
9999 RUN
Note that the line 9999 will cause the program to AUTORUN when loaded.

COMMENT about line 260 LET P=PEEK (7680+C*8+L)

PEEK 7680 is the location in ROM of the ZX81 character set
(7680 decimal = 1E00 hexadecimal)

It defines the bit patterns of each letter. So the big print part of this program is an exact enlargement of ZX81 letts

Code: Select all

; ------------------------
; THE 'ZX81 CHARACTER SET'
; ------------------------

;; char-set - begins with space character.

; $00 - Character: ' '          CHR$(0)

L1E00:  DEFB    %00000000
        DEFB    %00000000
        DEFB    %00000000
        DEFB    %00000000
        DEFB    %00000000
        DEFB    %00000000
        DEFB    %00000000
        DEFB    %00000000
Attachments
BIG_SCROLL_16K.p
(2.24 KiB) Downloaded 77 times
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: [ZX81 Type-Ins] Scrolling Bulletin Boards - Best Of The Plotter

Post by David G »

double post
Last edited by David G on Sat Sep 10, 2022 9:19 pm, edited 1 time in total.
Moggy
Posts: 3266
Joined: Wed Jun 18, 2008 2:00 pm

Re: The Best Of The Plotter [1994 newsletter]

Post by Moggy »

A reminder for ZXpand users that the overlay ROM needs switching out for this to work otherwise it prints garbage characters.
Post Reply