small type-in FORMAT vol7

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
C.Born
Manic Miner
Posts: 229
Joined: Sat Dec 09, 2017 4:09 pm

small type-in FORMAT vol7

Post by C.Born »

FORMAT vol 7 no 1 , page 13+14

https://spectrumcomputing.co.uk/issue/2397/Format/v7_1

Code: Select all


  10 CLEAR 39999: LET c=0
  20 FOR a=40000 TO 40439: READ d: POKE a,d: LET c=c+d: NEXT a
  30 IF c<>42629 THEN  PRINT "ERROR in DATA!": STOP 
  40 DATA 1,214,59,197,215,107,13,62,2,215,1,22
  50 DATA 225,34,118,92,17,33,0,25,6,32,126,229
  60 DATA 215,16,0,225,35,16,247,24,32,70,105,108
  70 DATA 101,110,97,109,101,32,32,32,70,105,108,101
  80 DATA 116,121,112,101,32,32,76,101,110,32,32,32
  90 DATA 83,116,97,114,116,62,13,215,16,0,6,32
 100 DATA 62,95,197,215,16,0,193,16,247,237,91,131
 110 DATA 91,33,20,0,25,125,254,0,40,2,24,4
 120 DATA 124,254,236,200,6,10,197,229,243,1,253,127
 130 DATA 30,7,237,89,126,30,16,237,89,251,215,16
 140 DATA 0,225,35,193,16,232,229,62,32,215,16,0
 150 DATA 225,237,91,118,92,213,243,1,253,127,30,7
 160 DATA 237,89,126,50,118,92,35,126,50,119,92,35
 170 DATA 126,254,0,40,21,254,1,40,16,254,2,40
 180 DATA 12,254,3,40,7,254,4,40,3,175,24,3
 190 DATA 60,60,60,30,16,237,89,229,245,237,121,42
 200 DATA 118,92,126,237,89,251,193,225,209,213,229,197
 210 DATA 245,1,9,0,254,0,40,10,254,1,40,11
 220 DATA 254,2,40,12,24,15,33,254,0,24,13,33
 230 DATA 7,1,24,8,33,16,1,24,3,33,25,1
 240 DATA 25,6,9,126,229,215,16,0,225,35,16,247
 250 DATA 24,36,80,114,111,103,114,97,109,32,32,78
 260 DATA 117,109,46,65,114,114,97,121,83,116,114,46
 270 DATA 65,114,114,97,121,66,121,116,101,115,32,32
 280 DATA 32,32,193,241,245,197,243,1,253,127,237,121
 290 DATA 42,118,92,35,94,35,86,62,16,237,121,251
 300 DATA 213,62,32,215,16,0,193,215,43,45,215,227
 310 DATA 45,62,23,215,16,0,62,27,215,16,0,62
 320 DATA 32,215,16,0,241,254,1,40,81,254,2,40
 330 DATA 77,209,243,1,253,127,237,81,42,118,92,35
 340 DATA 35,35,254,0,32,4,35,35,35,35,94,35
 350 DATA 86,46,16,237,105,251,213,254,0,32,12,33
 360 DATA 15,39,237,82,56,36,62,76,215,16,0,193
 370 DATA 215,43,45,215,227,45,62,13,215,16,0,225
 380 DATA 6,8,35,16,253,193,237,67,118,92,235,33
 390 DATA 89,0,9,229,235,201,209,6,5,62,45,197
 400 DATA 215,16,0,193,16,247,24,218
 500 PRINT "press any key to save": PAUSE 0
1000 SAVE d1"CATRAM.EXE"x,40000

1001 SAVE !"CATRAM.EXE"CODE 40000,440
1005 STOP 
1007 POKE @5,255: POKE @10,0: POKE @11,0: LPRINT : LLIST : LPRINT 
1010 CLEAR : SAVE d*"CATRAM.bas"
1011 CLEAR : SAVE !"CATRAM.bas"

C.Born
Manic Miner
Posts: 229
Joined: Sat Dec 09, 2017 4:09 pm

Re: small type-in FORMAT vol7

Post by C.Born »

FORMAT vol 7 no 1 p 12
funny, change the PI to 100 or 1000

Code: Select all

   1 REM spirograph program
   4 POKE 23658,8
  10 INPUT "Which ring? (A=150/105, B=144/96)";R$
  15 INPUT "Inside (=I) or Outside (=O)? ";C$
  20 INPUT "Which wheel? - choices are 24,30,32,36,40,42,45,48,50,52,56,60,63,64,72,75,80 and 84";W$
  30 INPUT "HOW FAR FROM THE EDGE OF THE WHEEL, AS A FRACTION BETWEEN 0 AND 1? ";d
  35 IF r$="A" AND c$="I" THEN  LET r=105
  36 IF r$="A" AND c$="O" THEN  LET r=150
  37 IF r$="B" AND c$="I" THEN  LET r=96
  38 IF r$="B" AND c$="O" THEN  LET r=144
  39 LET r1=VAL w$
  40 LET d=d*r1
  43 LET f=80/(R-D)
  45 FOR t=0 TO 10*PI*r1+R1/(r+r1) STEP 0.05
  50 PLOT 120+f*((r-r1)*SIN t+(r1-d)*SIN ((r1-r)*t/r1)),80+f*((r-r1)*COS t+(r1-d)*COS ((r1-r)*t/r1))
  60 NEXT t
  70 INPUT #0;"MORE OF THE SAME (M), OR A NEW RING/WHEEL (N)? ";Z$
  80 IF Z$="N" THEN  GO TO 10
  90 IF Z$="M" THEN  GO TO 30
 100 GO TO 70
9997 REM FORMAT VOL7 NO1 P12
9998 STOP 
9999 SAVE d*"SpiroG"
C.Born
Manic Miner
Posts: 229
Joined: Sat Dec 09, 2017 4:09 pm

Re: small type-in FORMAT vol7

Post by C.Born »

boring as it is, FORMAT vol 7, no 1, page 7+8
hope i didnt misspell any thing, that would be a bummer

Code: Select all

   1 REM Clifford & Mark Ramshaw. Commodore 64 Games Book.
   2 REM Revised first to Radio Shack TRS-80-II, now to ZX Spectrum+ 128K by B.C.R.Burford 270293
  10 REM ***Poetry***
  20 DIM j$(10,3,15): DIM v$(10,3,15): FOR i=0 TO 9
  30 READ j$(i+1,1),j$(i+1,2),j$(i+1,3),v$(i+1,1),v$(i+1,2),v$(i+1,3): NEXT i
  32 INPUT "Screen(2) or Printer(3)";o$
  33 IF o$<>"2" AND o$<>"3" THEN  GO TO 32
  35 LET o=VAL o$
  37 IF o=3 THEN  PRINT "Printer ready? Y/Break:": PAUSE 0
  40 PRINT #o;TAB 8;"***Poetry***"''
  55 LET fl=0: LET mo=INT (RND*3)+1
  60 FOR i=1 TO 4+INT (RND*4): LET v=INT (RND*10)+1
  65 LET j=INT (RND*10)+1: IF j=v THEN  GO TO 65
  70 LET s$=j$(j,mo): GO SUB 600: LET k$=c$
  75 LET s$=v$(v,mo): GO SUB 600: LET w$=c$
  77 GO TO 80+INT (RND*11)*10
  80 PRINT #o;"The ";k$;" man ";w$;" beguiled her": GO TO 500
  90 PRINT #o;"A ";k$;" woman enchanted me with ";w$;" blinking eyes": GO TO 500
 100 PRINT #o;"In ";w$;" keeping with her ";k$;" vows": GO TO 500
 110 PRINT #o;"Ala, she must ";w$;" leave his ";k$;" presence": GO TO 500
 120 PRINT #o;"A breath of ";k$;" air ";w$;" rustled in the trees": GO TO 500
 130 PRINT #o;"Another ";k$;" day ";w$;" ended": GO TO 500
 140 PRINT #o;"The ";k$;" hills marched ";w$;" across the horizon": GO TO 500
 150 PRINT #o;"and then:": GO TO 500
 160 PRINT #o;"The ";k$;" bell tolled ";w$;" once again": GO TO 500
 170 PRINT #o;"The ";w$;" ";k$;" human arrived": GO TO 500
 180 PRINT #o;"Life ";w$;" dawned on the ";k$;" universe": GO TO 500
 500 NEXT i: IF fl=0 AND RND>.5 THEN  LET fl=1: GO TO 60
 502 PRINT ''"Another? Y/N: "
 503 LET a$=INKEY$
 505 IF a$="n" OR a$="N" THEN  STOP 
 510 IF a$="" THEN  GO TO 503
 515 PRINT #o;': GO TO 40
 600 REM Strip trailing spaces
 610 FOR s=4 TO LEN s$
 620 IF s$(s)<>" " THEN  GO TO 640
 630 LET c$=s$( TO s-1): LET s=LEN s$
 640 NEXT s
 650 RETURN 
1000 DATA "sorrowful","apathetic","joyful","sadly","carelessly","happily"
1005 DATA "putrid","odourless","scented","foully","carefully","sweetly"
1010 DATA "boring","enlightening","interesting","tirelessly","effortlessly","easily"
1015 DATA "ugly","plain","beautiful","clumsily","gracefully","gently"
1020 DATA "fat","thin","lean","noisily","quietly","loadly"
1025 DATA "apathetic","ordinary","super","pathetically","superbly","excellently"
1030 DATA "irritating","calming","exciting","sharply","cooly","excitedly"
1035 DATA "tortuous","hating","loving","contemptuously","lovingly","caringly"
1040 DATA "dying","living","newly-born","painfully","wildly","fitfully"
1045 DATA "stupid","ignorant","intelligent","foolishly","intelligently","wisely"
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: small type-in FORMAT vol7

Post by flatduckrecords »

C.Born wrote: Tue Jan 02, 2024 5:33 pm FORMAT vol 7 no 1 , page 13+14

Code: Select all

1000 SAVE d1"CATRAM.EXE"x,40000
Very useful, thanks! As it happens I normally use my PlusD with a 128K so a neat RAMDisc CAT is handy. It’s also nice example of a PlusD “execute” file too. (For others that aren’t familiar; it runs in the PlusD’s own 8K of RAM so it doesn’t disturb anything in the Spectrum’s memory).
C.Born
Manic Miner
Posts: 229
Joined: Sat Dec 09, 2017 4:09 pm

Re: small type-in FORMAT vol7

Post by C.Born »

flatduckrecords wrote: Sat Jan 06, 2024 10:24 pm Very useful, thanks! As it happens I normally use my PlusD with a 128K so a neat RAMDisc CAT is handy. It’s also nice example of a PlusD “execute” file too. (For others that aren’t familiar; it runs in the PlusD’s own 8K of RAM so it doesn’t disturb anything in the Spectrum’s memory).
Sorry, not completely correct
this X,40000 states its loaded AND executed at 40000
the +D has an internal buffer and even free memory in which the routine CAN be loaded, since its inside an external RAM it needs a page switch to its MGT ram
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: small type-in FORMAT vol7

Post by flatduckrecords »

Thanks @C.Born

Yes, it can be RUN from 40000. To RUN it in PlusD RAM we need to LOAD it with:

Code: Select all

LOAD D*"CATRAM",X
(That will also handle the paging automatically).
C.Born
Manic Miner
Posts: 229
Joined: Sat Dec 09, 2017 4:09 pm

Re: small type-in FORMAT vol7

Post by C.Born »

is it that easy ?
the coder would have liked to know that since in the txt its explained he did not know
i was looking were to put it
https://www.biehold.nl/rudy/disciple/ramlayou.htm
https://www.biehold.nl/rudy/plusd/patches.htm

but just move the 'x' to the place off the adress.
i had a patch for some colour borders after changing the screen from grey to colour, for DISCiPLE 3d
so i have some more to check.
edit
my "patch" is even here, its written in TORNADO
https://spectrumcomputing.co.uk/entry/2 ... iPLE_3c-3d
TORNADO is here
https://www.biehold.nl/rudy/sgg/index.htm
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: small type-in FORMAT vol7

Post by flatduckrecords »

C.Born wrote: Mon Jan 08, 2024 7:02 pm is it that easy ?
the coder would have liked to know that since in the txt its explained he did not know
i was looking were to put it
Yes, I think so -

For PlusD, when it's paged in, the execute location is 15318 (0x3BD6) or 214,59 as in line 40:

Code: Select all

 40 DATA 1,214,59,197,215,107,13,62,2,215,1,22
Im not familiar with the DiSCIPLE but I think you'd change that to 7126 (0x1BD6) that is, 214,27:

Code: Select all

 40 DATA 1,214,27,197,215,107,13,62,2,215,1,22
(i.e. the missing values that Miles Kinloch was looking for!)
Thanks for those links! Yes in the DiSCIPLE RAM layout, the “Buffer” is labelled as 0x1BD6 with a length of 510 bytes. As with the PlusD this is given in the manual as the length of one disk sector and is the maximum size of an execute file.
C.Born wrote: Mon Jan 08, 2024 7:02 pm i had a patch for some colour borders after changing the screen from grey to colour, for DISCiPLE 3d
Ah, so this is a DiSCIPLE execute file that modifies the DOS print routines?
User avatar
+3code
Manic Miner
Posts: 433
Joined: Sat Mar 19, 2022 7:40 am

Re: small type-in FORMAT vol7

Post by +3code »

C.Born wrote: Mon Jan 08, 2024 7:02 pm TORNADO is here
https://www.biehold.nl/rudy/sgg/index.htm
Off-topic, but what is the "256K RAM/96K ROM expansion for the Spectrum 48K"?
C.Born
Manic Miner
Posts: 229
Joined: Sat Dec 09, 2017 4:09 pm

Re: small type-in FORMAT vol7

Post by C.Born »

flatduckrecords wrote: Mon Jan 08, 2024 11:21 pm Ah, so this is a DiSCIPLE execute file that modifies the DOS print routines?
no , its just the internal greyscale table https://www.biehold.nl/rudy/disciple/printer.htm
in DISCiPLE nieuwsbrief there was a patch for it and i permanently put it in my work system.
i think only RealSpectrum has a correct DISCIPLE emulation, for both 48 and 128k
fuse fails with DISCiPLE on 128, big pitty, it seems an automated ramswitch on NMI has its one behaiour if i remember correct.

meanwhil i "discovered" that +D just works on an 16k in Fuse! except for the FORMAT since that uses upper memory.
i tried to write a different format routine that uses the STACK with a 300 bytes calculated image.
but i never tested it on a real machine so its very theoretical if the EG the SKEW will work ??
http://cborn.nl/zxfiles/+D_Direct_Format_asm.zip

btw
dutch DISCiPLE magazines, with several translated FORMAT routines
http://cborn.nl/zxfiles/DISCiPLENieuwsbriefViewer.html
Post Reply