Modula - 2

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

Modula - 2

Post by C.Born »

https://spectrumcomputing.co.uk/entry/1 ... a_Modula-2

does anyone know more about
modula-2
https://www.modula2.org/index.php
and/or
mira software
??

the tape has at least one big error

Code: Select all

--= Block #43 =--
  Block type 0x10 (Standard Speed Data)
  Block duration: 6.08 sec
  Block length: 19 bytes
  Block header, zxlength: 915, parameter1: 32768, parameter2: 0
  Raw header: 00 | 56 49 4c 4c 41 47 45 53 20 20 | 93 03 | 00 80 | 00 00
  Program: "VILLAGES  "
  Length: 915, includes variable length: 915
  Checksum: 0x1f (PASS)
  Pause length: 994 ms

--= Block #44 =--
  Block type 0x10 (Standard Speed Data)
  Block duration: 7.92 sec
  Block length: 518 bytes
  Datablock length: 516
  
  Checksum: 0x83 (FAIL)
  
  Pause length: 12 ms
its about 400 bytes SHORT ??
i retyped it from the "libs" and have a smaller file then the txt files.
maybe due {cr}{lf} since they have the STRANGE habbit off saving the TXT files as a PROGRAM, but not loadable outside M2 (the compiler)

I fixed it all on a MGT as suposed by the software itself and i have to say that i learn typing blind now, well no, almost
there is a "UI" but def no "GUI"
all file that WHERE progs are now CODE. BUT all those files seems 1 BYTE short now ???

the idear off "OPTION" is setting the TAPE, or any DISK device
0-tape
1- disk no 1, whatever device

there is NO mentioning what "option" is open
after messing around it TRIED to compile but something is STILL missing.
but what ??
the manual is pretty large and i think i done it all...
i hope to save my disk somewhere
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

https://retrocomputing.stackexchange.co ... o-modula-2

the zx version has some oddities.
i try the naive aproach since i am
meaning no drives, only tape in 48k
melted the 2 tape sides back in one for convineance

key experience:
'B' , only the START off the block is set, the END = LINECURSOR, where you 'stand'
'O' , 'option' is in fact drive number, while '0' is Tape as drive.
'C' , Cat only works if 'O' > 0 so while option is not Tape
there seems NO ramdrive cat > CAT!
'T' last used name, 10 chr$ , if none '??????????'
'A' + shift FULL RESET TO BASIC, no other exit with 'A' then full wipe aka NEW

testing an 'official' example:

Code: Select all

MODULE FirstEx;
FROM Terminal2 IMPORT WriteLn, WriteString, WriteCard;
VAR Index : CARDINAL;
BEGIN
   WriteString("This is our first example program");
   WriteLn;
   WriteLn;
   FOR Index := 1 TO 12 DO
      WriteString("The value of the index is now ");
      WriteCard(Index,3);
      WriteLn;
   END
END FirstEx.
zx MU2 has no 'Terminal2' AND zx'Terminal' has no 'WriteCard'
if you write 'to' instead off 'TO' is stops compiling
it points directly to the error, thats nice

simpler:
MODULE PuppyDog;
BEGIN
END PuppyDog.

it seems to do every thing and then "stops" aks does a NEW...
"STOP" and "NEW" are related, maybe the wrong hookcode??

does anyone knows any artical or refence to this very intressting ZX MODULA-2 ??
Mira Software Leicestershire
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

i put ALL progs from the large tape on the MGT disk and now i got the CLOCK working on 128k plus plusD
i patched the "run" program with
LET p$="2" AND peek 2899=159: LOAD "DIPL"+p$ CODE 48539,1189
and saved it as "run128"
the explanation off how to compiled routine works is to simple
after compiling the compiler will NEW and after that just type RANDOMIZE USE 48500
not very handy or user friendly but it does work after all.
save "name" code 65536-40000 ???

now i can have a look on the other routines
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

Hi
its not that bad at all!, some small parts have big results like printing the program names on screen in 128k mode, but only there
and thats a big failure, but once past that, he, this works, and even very good, since the bloke from the big fan side was surprised such a small machine as the 48 can do this, and it can , if you wait it out. Modula2 FIRST has to collect every thing and some module load there OWN EXTRA modula inbetween OR load them selves BACK after that other one came inbetween, so
Love that tape erea very much indeed...most off the times, this is the LOAD SCHEME at maximum
i guess some wont be loaded double, while other are.
i am glad i fixed it all on my MGT disc by now. i had to repaur the "VILLAGES" file, its in the demo section as TXT file luckely !!!

but with tape this is all WITH OUT ANY THING OR WARNING ON SCREEN
and you WILL have to rewind your tape probably 9 to 11 times in this case, and better FULLY let it pass since you dont know what block is suposed to be loaded.
"ezeltje prik" but then on tape., dont forget to switch tapes, without warning you have to !!!!!
or have a double direction tape that automaticly switches direction, then it will be 30 minutes PER PASS
on emulator ? yes, but there are some misterious failures, although i found two sources for those already

Code: Select all

IMPORT has different following order then in module it self
LOAD MODULE CLOCK;
FROM SYSTEM IMPORT WORD,NEWPROCESS,TRANSFER,IOTRANSFER,ADDRESS,ADR;
FROM HARDWARE IMPORT LOCK,UNLOCK,IM1,KEYSCAN;
FROM R3MATH IMPORT SIN,COS;
FROM SYMBOL IMPORT SYMBOL1;
FROM GRAPH2 IMPORT CIRCLE;
     FROM GRAPH0 IMPORT SCRDOT;
     FROM GRAPH1 IMPORT PLOT,HLINE,LINETO;
          FROM SYSTEM IMPORT WORD;
          FROM GRAPH0 IMPORT SCRNAD,SCRDOT;
        GRAPH1 IMPORT
   GRAPH2 IMPORT
FROM GRAPH1 IMPORT LINETO,PLOT,SETMODE;
     FROM SYSTEM IMPORT WORD;
     FROM GRAPH0 IMPORT SCRNAD,SCRDOT;
   GRAPH1 IMPORT
FROM NUMIO IMPORT WRCARD,WRCARD0,STRTOCARD,SUBSTRTOCARD;
     FROM STDIO IMPORT RDITEM,WRSTRLEN;
          FROM SYSTEM IMPORT ADDRESS;
FROM STDIO IMPORT GETKEY,CLS,GOTOXY,GETXY,RDSTR,WRCHAR,WRSTR,WAITKEY;
     FROM SYSTEM IMPORT ADDRESS;
FROM MAINREAD IMPORT BLANK;
     FROM STDIO IMPORT RDSTR,RDCHAR,CURSOR,UNCURS,WRCHAR,GOTOXY,GETXY,MOVEX,WAITKEY,WRSUBSTR,WRSPS,BUFFRDCHAR,PRINTABLE;
          FROM SYSTEM IMPORT ADDRESS;
     FROM STRINGS IMPORT APPEND,INSERT,DELETE,LENGTH;
          FROM SYSTEM IMPORT ADDRESS;
   MAINREAD IMPORT
FROM FASTO IMPORT WRITEAT;
     FROM SYSTEM IMPORT ADDRESS;
     FROM STDIO IMPORT WRSTR,WRCHAR,WRLN,GOTOXY,UNCURS,CURSOR,MOVEX,GETXY,CLS;
          FROM SYSTEM IMPORT ADDRESS;
     IMPORT GRAPH0;
   FASTO IMPORT
MODULE CLOCK; back home

"Press required key"
SAVE "CLOCK" CODE 25000,65535-25000
RANDOMIZE USR 48500
M2 build up ON SCREEN a large refrence library, there for M2 avoids printing any thing on screen
pitty this fails on standard 128k
first my simplistic POKE solution for not having that LOAD name on screen
BUT
i have no clue how to get that inside Modula2 so this is only a TEST to prove in 128k its possible too

if you stop BEFORE the POKE RESTORE is 100% sure will crash ... mind that GAB

and think 16bit , I copy one adres from the insidechannels into the other, thats all
so it will be PRINTED ON THE PRINTER NOW:

Code: Select all

  10 LET a=PEEK 23739: POKE 23739,PEEK 23749
  20 LET b=PEEK 23740: POKE 23740,PEEK 23750
  30 REM 
  40 PRINT "TEST not PRINT ";CHR$ PEEK 23743
  50 FOR f=0 TO 255: POKE 16384+f,f: NEXT f
  60 SAVE "a"CODE 16384,256
  70 REM 
  80 FOR f=0 TO 7: LOAD "a"CODE 16384+f*256 : NEXT f
  90 REM 
 100 POKE 23739,a: POKE 23740,b
 110 PRINT AT 15,0;"hallo"'"it DOES ask 'save?' on screen !"
there is one faster way
if you use the RAMdrive and first PRELOAD all single modula from that LONG LIST from above then it will NOT print names on screen AND it will be very fast. mind OPTION 13 for that, or 64+13 = 77 for autosave after ward !!
for that you realy need to read that manual five times
it gives all info but stacked!
the best info come as last and then you have to read it again to check what they mean with " but you better do option ..."

so IT WORKS, thats very nice!
User avatar
+3code
Manic Miner
Posts: 452
Joined: Sat Mar 19, 2022 7:40 am

Re: Modula - 2

Post by +3code »

Uh, I tested it on +3 and seemed interesting, long time ago. I have the .dsk somewhere.
User avatar
PeterJ
Site Admin
Posts: 6939
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Modula - 2

Post by PeterJ »

@C.Born has provided us with some fixed versions of Modula2. The files are available to download from this post.

Chris also sent some notes on the repairs:
So its about the SUBmodule 'VILLAGES" which was broken on tape
i re-typed it from the available txt file it with Modula2 and saved it
with Modula2, showing antoher bug
the header info is 1 byte SHORT meaning the last byte, highbyte off the
LINE info, will be random and THUS show an "line 0" instead off no line info
that is NOT repaired

128k version has a "name on screen" bug, that is perhaps repairable if 1
byte extra is possible, see my basic solution on line

so i changed TWO things

i ADDED an CLS command on line 3 from the INIT-LOADER, now the welcome
screen is clear and normal readable
and the VILLAGES file is now correct in length and correct loading
Attachments
MiraModula-2_Repaired.tzx.zip
Mira Modula 2 Repaired
(66.81 KiB) Downloaded 8 times
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

Thank you Peter,
that helps abit since this 18k block off modules is rather complex in its simplicity.
So we first should try to determin WHICH off all 'forks' off modula-2 we are using here.Its from 1991 and there are plenty version PIM 2/3/4 and ISO and then plenty more. Its assimilated adopted by GNU, its has an 'Terminal' which seems equal. maybe it follows GNU
https://gcc.gnu.org/onlinedocs/gm2/gm2- ... minal.html

I tried an example from the common tutorial FirstEx.mod and i found severall different versions
uses "InOut' https://www.nachocabanes.com/tutors/modula2n.htm
uses "Terminal2" https://www.modula2.org/tutor/introduction.php

The "InOut" version happens to compile easily since ZXM2 has no terminal2 but only 'Terminal'
the "original" terminal2 seems very rudimentary itself
https://www.modula2.org/tutor/download.php
there you find
https://www.modula2.org/downloads//m2or ... /m2def.zip

then inside ZXM2 there are diverse ways to get modulas working

Code: Select all

DEFINITION MODULE InOut;
WriteLn;
leads to
PROCEDURE WriteLn;
BEGIN WRLN END WriteLn;
leads to
FROM STDIO IMPORT ...,WRLN, ...
leads to
WRLN:=SWRLN;
leads to
PROCEDURE SWRLN;
HEX CD (@15) 3E 0D D7 C9
END SWRLN;
yet
'Terminal' leads to

Code: Select all

DEFINITION MODULE Terminal;
 PROCEDURE WriteLn;
leads to
PROCEDURE WriteLn;
HEX 3E 0D END WriteLn;
(*  ld a,
    defb 0x0D  ; cr = 13*)

PROCEDURE Write(ch:CHAR);
HEX
08 3E FE CD 01 16 08 D7 C9 END Write;
(* ex af,af'
ld a,0xFE
call 0x1601   ; channel open , 0xfe=-2
ex af,af'
rst#10        ; write chr$ a
ret *)
which are two separate but equal functioning routines whith HALF the same comaand instruction.
thats confusing. for the online exapleme i guess InOut will do. but for me its as much an expiremnt as for you, if so.

Meanwhile i tried to find a BEEP instruction which i "got working" but with out any sound at all.

Code: Select all

MODULE Bliep;
FROM BASIC IMPORT BEEP;
PROCEDURE Bliep;
VAR PITCH:REAL;
     TIME:REAL;
BEGIN
PITCH:=1.0;
TIME:=2.0;
BEEP(PITCH,TIME);
END Bliep;
END Bliep.
its does compile with out complaing but i miss something
it uses $03f8 starting the FPcalculator instead off $03bf which presets DE and HL
But probably i have to do something with the RxIO files, but i did not have a look at it
its at lot and its complex. yet it has a clever aproach like the above WriteLN and Write() forming a single asm if starting with WriteLn
If people have any experience with any type off M2, please add it here ;-)
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

+3code wrote: Sat Sep 23, 2023 7:46 pm Uh, I tested it on +3 and seemed interesting, long time ago. I have the .dsk somewhere.
Cool. did you perhaps try some codings your self or did you follow the examples ?
I made an MGT myself. if i have ftp controle again i will upload some of my mess.
i dont seem to find ANY sound related module but i only recently started looking for.
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

from viewtopic.php?p=24955#p24955

Code: Select all

MODULE ZX;
FROM InOut IMPORT WriteString,WriteLn,WriteInt;
VAR [2899]    ZX : SHORTCARD;
BEGIN
WriteInt(ZX,3);
WriteLn;
WriteString("ZX Spectrum ");
IF ZX = 165 THEN
WriteString("48k");
WriteLn;
END;
IF ZX = 159 THEN
WriteString("128k");
WriteLn;
END;
IF ZX = 126 THEN
WriteString("+3");
WriteLn;
END;
END ZX.
Now i have to find a way to make it a short procedure instead of this large program.
Meanwhile i found that the 'Terminal' module on ZX has a bug, it fails to print the LAST chr from an
WriteString("What ever you PRINT");
giving
What ever you PRIN
InOut does this job better.
i Did find SOUND MOD but those are for the DosBeep from OS/2, after an email to Australia i got a whole bunch off it to read
You'll find a lot of my software on my web site at
http://www.pmoylan.org
Nearly all of it is in Modula-2. Most of my programs, though, are server software, and would be too big for the Spectrum memory. All of my programming these days is on OS/2.
well, its good reading and if i can get it covinced to use a ZX ROM routine that would help

My preious attempt for a Beep was to "big" and had NO adresses in the "module stack" to call
i found that after following USR 48500 to some RET right after each other.
But the better attempt gives an error message.

Code: Select all

MODULE Bliep;
FROM BASIC IMPORT BEEP;
VAR PITCH:REAL;
     TIME:REAL;
BEGIN
PITCH:=1.0;
TIME:=2.0;
BEEP(PITCH,TIME);
END Bliep.
"C Nonsense in BASIC 0:1"
well i may hope so since this is MODULA-2
1 step closer AND a simple ZX detection.. jippy
User avatar
ParadigmShifter
Manic Miner
Posts: 863
Joined: Sat Sep 09, 2023 4:55 am

Re: Modula - 2

Post by ParadigmShifter »

Nonsense in Basic stuff is usually modifying H'L' before returning to Basic, which messes with the error code/FP calculator stack I think?

If the beep routine uses the shadow registers and an interrupt goes off while it is doing that is what I would have thought is happening.

Maybe there is a routine to disable interrupts you can call before that and enable them again after? If you can emit ASM from Modula-2 then it's easy (DI before then EI after).

If not there's probably a procedure to do that - may be named something different I guess (e.g. in Windows and such EnterCriticalSection() and ExitCriticalSection() is the name for that).
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

ParadigmShifter wrote: Thu Sep 28, 2023 7:48 am Nonsense in Basic stuff is usually modifying H'L' before returning to Basic, which messes with the error code/FP calculator stack I think?
(..)
No , i think it uses MEMBOT by putting values down with LDIR instead of the rom routine STACK_AEDCB. M2 has a large internal 'lib' and it even has an MI1 instructions and separate EI and DI instructions. the manual tells all abot it.
The two variables are REAL which are the native 5byte values. the M2 manual has a long talk about that, and further Toni Baker wrote/build a FP calculator
http://www.users.globalnet.co.uk/~jg27p ... ulator.zip
thats good reading

So what i have to do it check what happens with USR 48500.
I did try some routines in BASIC , next is to find the CALL instruction to the ROM routines involved with FP valc.
from TBfiles some debug addresses, i expected STK_STORE but did not find it yet

Code: Select all

;table of constants (rom address)
FP_CALC      EQU  #28               ; Restart call to FP calculator(mode)
STACK_A      EQU  #2d28             ; preload stack with value reg A, Integers Between 0 and +255d
FP_TO_A      EQU  #2dd5             ; Load A with float point value

STACK_BC     equ  #2D2B             ;Integers Between 0 and +65535d
FP_TO_BC     equ  #2DA2             ;BC= required factorial

STACK_AEDCB  equ  #2AB6
STK_STORE    equ  STACK_AEDCB       ; ROM name=STK_STORE
FP_TO_AEDCB  equ  #2BF1
PRINT_FP     equ  #2DE3
STACK_NUM    equ  #33B4             ; move 5 bytes to 'stkend'
e_to_fp2     equ  #2D4F             ; the DIRECT use off the bugged calculator call  ; eg  rst#28,(..),end_calc : ld a,n : call e_to_fp2 : rst#28, (..),end_calc
find a string in memory, can be CHR$ CD+ CHR$ B6 + CHR$ 2D , hex

Code: Select all

1000 LET a$="EXPECT": LET b$="": CLS : PRINT ">";a$
1005 REM LET ram= PEEK VAL "23388": OUT VAL "32765", VAL "16": POKE VAL "23388", VAL "16"
1010 FOR f=VAL "32768" TO 65535-LEN a$: PLOT  OVER 1;0,175
1020 LET p$=CHR$ PEEK f: LET p=(p$=a$(1)): IF NOT p THEN  NEXT f
1030 FOR g=0 TO LEN a$-1
1040 IF PEEK (f+g)=CODE a$(g+1) THEN  NEXT g: PRINT f;">";a$;: LET b$=b$+STR$ f+"   ": LET f=f+g
1050 LET p=(g=LEN a$): IF NOT p THEN  NEXT f
1100 LET p=PEEK f: IF (p>64 AND p<91) OR (p>192 AND p<219) THEN  PRINT CHR$ (p-128 AND p>128);: LET f=f+1: GO TO 1100
1110 PRINT 
1210 NEXT f
1300 REM OUT 32765,ram: POKE 2388,ram
2000 STOP 
3000 CLEAR : SAVE d*"find$.bas"
tape to disk

Code: Select all

  10 CLEAR 32767
  20 RESTORE 130
  30 READ a$,a,l: LET a$=(a$+"          ")( TO 10)
  40 DIM b$(10): IF a$=b$ THEN  STOP 
  60 CLS : CAT *;a$: FOR f=1 TO 10: LET b$(f)=SCREEN$ (3,f+2): NEXT f
  70 IF a$=b$ THEN  GO TO 30
  80 LOAD a$CODE a
  90 SAVE d*;a$CODE a,l
 100 GO TO 30
 110 REM 
 120 REM tape side 1
 130 DATA "TAPE2",VAL "48539",VAL "1148"
 140 DATA "PLS2A",a,l
 150 DATA "PLUS3",a,l
 160 DATA "DIPL",a,l
 170 DATA "DIPL2",a,l
 180 DATA "RTAPE",a,VAL "613"
 190 DATA "RTAPE2",a,l
 200 DATA "RPLS2A",a,l
 210 DATA "RPLUS3",a,l
 220 DATA "RDIPL",a,l
 230 DATA "RDIPL128",a,l
 240 DATA "RDIPL+2",a,l
 250 REM 
 260 REM tape side 2
 270 DATA "STARS",VAL "49512",VAL "4900"
 280 DATA "VILDATA",a,VAL "6362"
 290 DATA "",NOT PI,a
 300 CLEAR : SAVE d*"Tape2Disc"
they mention RUNTIME as alternative, but HOW, this one does NOT work yet.
what USR is needed?

Code: Select all

   5 LET p$=("128" AND PEEK VAL "2899"=VAL "159")+("+2" AND PEEK VAL "2899"=VAL "126"): LET b=1
  10 PRINT AT 20,0;"compiler drive ";b: INPUT "file name";n$'"source drive";d
  20 LOAD dd"$"+n$CODE 
  25 LOAD dd"#"+n$CODE 
  30 LOAD db"M2"CODE 
  40 LOAD db"RDIPL"+p$CODE 48539
  50 RANDOMIZE USR 48500
the ZX module works, here is a list of system variable with VERY DISCUSABLE NAMES
M2 does NOT allow the underscore '_' as name_part !!

Code: Select all

MODULE ZXsys48;

VAR [16384] SCREEN0  :SHORTCARD;
VAR [22528] ATTR0    :SHORTCARD;
VAR [23296] printbuf :SHORTCARD;

VAR [23552] KSTATE   :SHORTCARD;
VAR [23553] KSTATE1  :SHORTCARD;
VAR [23554] KSTATE2  :SHORTCARD;
VAR [23555] KSTATE3  :SHORTCARD;
VAR [23556] KSTATE4  :SHORTCARD;
VAR [23557] KSTATE5  :SHORTCARD;
VAR [23558] KSTATE6  :SHORTCARD;
VAR [23559] KSTATE7  :SHORTCARD;
VAR [23560] LASTK    :SHORTCARD;
VAR [23561] REPDEL   :SHORTCARD;
VAR [23562] REPPER   :SHORTCARD;
VAR [23563] DEFADD   :CARDINAL;
VAR [23564] DEFADDh  :SHORTCARD;
VAR [23565] KDATA    :SHORTCARD;
VAR [23566] TVDATA   :CARDINAL;
VAR [23567] TVDATAh  :SHORTCARD;
VAR [23568] STRMS    :CARDINAL;
VAR [23568] STRMSFD  :CARDINAL;
VAR [23569] STRMSFDh :SHORTCARD;
VAR [23570] STRMSFE  :CARDINAL;
VAR [23571] STRMSFEh :SHORTCARD;
VAR [23572] STRMSFF  :CARDINAL;
VAR [23573] STRMSFFh :SHORTCARD;
VAR [23574] STRMS00  :CARDINAL;
VAR [23575] STRMS00h :SHORTCARD;
VAR [23576] STRMS01  :CARDINAL;
VAR [23577] STRMS01h :SHORTCARD;
VAR [23578] STRMS02  :CARDINAL;
VAR [23579] STRMS02h :SHORTCARD;
VAR [23580] STRMS03  :CARDINAL;
VAR [23581] STRMS03h :SHORTCARD;
VAR [23582] STRMS04  :CARDINAL;
VAR [23583] STRMS04h :SHORTCARD;
VAR [23584] STRMS05  :CARDINAL;
VAR [23585] STRMS05h :SHORTCARD;
VAR [23586] STRMS06  :CARDINAL;
VAR [23587] STRMS06h :SHORTCARD;
VAR [23588] STRMS07  :CARDINAL;
VAR [23589] STRMS07h :SHORTCARD;
VAR [23590] STRMS08  :CARDINAL;
VAR [23591] STRMS08h :SHORTCARD;
VAR [23592] STRMS09  :CARDINAL;
VAR [23593] STRMS09h :SHORTCARD;
VAR [23594] STRMS10  :CARDINAL;
VAR [23595] STRMS10h :SHORTCARD;
VAR [23596] STRMS11  :CARDINAL;
VAR [23597] STRMS11h :SHORTCARD;
VAR [23598] STRMS12  :CARDINAL;
VAR [23599] STRMS12h :SHORTCARD;
VAR [23600] STRMS13  :CARDINAL;
VAR [23601] STRMS13h :SHORTCARD;
VAR [23602] STRMS14  :CARDINAL;
VAR [23603] STRMS14h :SHORTCARD;
VAR [23604] STRMS15  :CARDINAL;
VAR [23605] STRMS15h :SHORTCARD;
VAR [23606] CHARS    :CARDINAL;
VAR [23607] CHARSh   :SHORTCARD;
VAR [23608] RASP     :SHORTCARD;
VAR [23609] PIP      :SHORTCARD;
VAR [23610] ERRNR    :SHORTCARD;
VAR [23611] FLAGS    :SHORTCARD;
VAR [23612] TVFLAGh  :SHORTCARD;
VAR [23613] ERRSP    :CARDINAL;
VAR [23614] ERRSPh   :SHORTCARD;
VAR [23615] LISTSP   :CARDINAL;
VAR [23616] LISTSPh  :SHORTCARD;
VAR [23617] MODE     :SHORTCARD;
VAR [23618] NEWPPC   :CARDINAL;
VAR [23619] NEWPPCh  :SHORTCARD;
VAR [23620] NSPPC    :SHORTCARD;
VAR [23621] PPC      :CARDINAL;
VAR [23622] PPCh     :SHORTCARD;
VAR [23623] SUBPPC   :SHORTCARD;
VAR [23624] BORDCR   :SHORTCARD;
VAR [23625] EPPC     :CARDINAL;
VAR [23626] EPPCh    :SHORTCARD;
VAR [23627] VARS     :CARDINAL;
VAR [23628] VARSh    :SHORTCARD;
VAR [23629] DEST     :CARDINAL;
VAR [23630] DESTh    :SHORTCARD;
VAR [23631] CHANS    :CARDINAL;
VAR [23632] CHANSh   :SHORTCARD;
VAR [23633] CURCHL   :CARDINAL;
VAR [23634] CURCHLh  :SHORTCARD;
VAR [23635] PROG     :CARDINAL;
VAR [23636] PROGh    :SHORTCARD;
VAR [23637] NXTLIN   :CARDINAL;
VAR [23638] NXTLINh  :SHORTCARD;
VAR [23639] DATADD   :CARDINAL;
VAR [23640] DATADDh  :SHORTCARD;
VAR [23641] ELINE    :CARDINAL;
VAR [23642] ELINEh   :SHORTCARD;
VAR [23643] KCUR     :CARDINAL;
VAR [23644] KCURh    :SHORTCARD;
VAR [23645] CHADD    :CARDINAL;
VAR [23646] CHADDh   :SHORTCARD;
VAR [23647] XPTR     :CARDINAL;
VAR [23648] XPTRh    :SHORTCARD;
VAR [23649] WORKSP   :CARDINAL;
VAR [23650] WORKSPh  :SHORTCARD;
VAR [23651] STKBOT   :CARDINAL;
VAR [23652] STKBOTh  :SHORTCARD;
VAR [23653] STKEND   :CARDINAL;
VAR [23654] STKENDh  :SHORTCARD;
VAR [23655] BREG     :SHORTCARD;
VAR [23656] MEM      :CARDINAL;
VAR [23657] MEMh     :SHORTCARD;
VAR [23658] FLAGSh   :SHORTCARD;
VAR [23659] DFSZ     :SHORTCARD;
VAR [23660] SRNTOP   :CARDINAL;
VAR [23661] SRNTOPh  :SHORTCARD;
VAR [23662] OLDPPC   :CARDINAL;
VAR [23663] OLDPPCh  :SHORTCARD;
VAR [23664] OSPPC    :SHORTCARD;
VAR [23665] FLAGX    :SHORTCARD;
VAR [23666] STRLEN   :CARDINAL;
VAR [23667] STRLENh  :SHORTCARD;
VAR [23668] TADDR    :CARDINAL;
VAR [23669] TADDRh   :SHORTCARD;
VAR [23670] SEED     :CARDINAL;
VAR [23671] SEEDh    :SHORTCARD;
VAR [23672] FRAMES   :CARDINAL;
VAR [23672] FRAME1   :SHORTCARD;
VAR [23673] FRAMEh   :SHORTCARD;
VAR [23674] FRAME3   :SHORTCARD;
VAR [23675] UDG      :CARDINAL;
VAR [23676] UDGh     :SHORTCARD;
VAR [23677] COORDX   :SHORTCARD;
VAR [23678] COORDY   :SHORTCARD;
VAR [23679] PPOSN    :SHORTCARD;
VAR [23680] PRCC     :CARDINAL;
VAR [23681] PRCCh    :SHORTCARD;
VAR [23682] ECHOE    :CARDINAL;
VAR [23683] ECHOEh   :SHORTCARD;
VAR [23684] DFCC     :CARDINAL;
VAR [23685] DFCCh    :SHORTCARD;
VAR [23686] DFCCL    :CARDINAL;
VAR [23687] DFCCLh   :SHORTCARD;
VAR [23688] SPOSUC   :SHORTCARD;
VAR [23689] SPOSUL   :SHORTCARD;
VAR [23690] SPOSLC   :SHORTCARD;
VAR [23691] SPOSLL   :SHORTCARD;
VAR [23692] SCRCT    :SHORTCARD;
VAR [23693] ATTRP    :SHORTCARD;
VAR [23694] MASKP    :SHORTCARD;
VAR [23695] ATTRT    :SHORTCARD;
VAR [23696] MASKT    :SHORTCARD;
VAR [23697] PFLAG    :SHORTCARD;
VAR [23698] MEMB0r   :REAL;
VAR [23698] MEMBOT00 :SHORTCARD;
VAR [23699] MEMBOT01 :SHORTCARD;
VAR [23700] MEMBOT02 :SHORTCARD;
VAR [23701] MEMBOT03 :SHORTCARD;
VAR [23702] MEMBOT04 :SHORTCARD;
VAR [23703] MEMB1r   :REAL;
VAR [23703] MEMBOT05 :SHORTCARD;
VAR [23704] MEMBOT06 :SHORTCARD;
VAR [23705] MEMBOT07 :SHORTCARD;
VAR [23706] MEMBOT08 :SHORTCARD;
VAR [23707] MEMBOT09 :SHORTCARD;
VAR [23708] MEMB2r   :REAL;
VAR [23708] MEMBOT10 :SHORTCARD;
VAR [23709] MEMBOT11 :SHORTCARD;
VAR [23710] MEMBOT12 :SHORTCARD;
VAR [23711] MEMBOT13 :SHORTCARD;
VAR [23712] MEMBOT14 :SHORTCARD;
VAR [23713] MEMB3r   :REAL;
VAR [23713] MEMBOT15 :SHORTCARD;
VAR [23714] MEMBOT16 :SHORTCARD;
VAR [23715] MEMBOT17 :SHORTCARD;
VAR [23716] MEMBOT18 :SHORTCARD;
VAR [23717] MEMBOT19 :SHORTCARD;
VAR [23718] MEMB4r   :REAL;
VAR [23718] MEMBOT20 :SHORTCARD;
VAR [23719] MEMBOT21 :SHORTCARD;
VAR [23720] MEMBOT22 :SHORTCARD;
VAR [23721] MEMBOT23 :SHORTCARD;
VAR [23722] MEMBOT24 :SHORTCARD;
VAR [23723] MEMB5r   :REAL;
VAR [23723] MEMBOT25 :SHORTCARD;
VAR [23724] MEMBOT26 :SHORTCARD;
VAR [23725] MEMBOT27 :SHORTCARD;
VAR [23726] MEMBOT28 :SHORTCARD;
VAR [23727] MEMBOT29 :SHORTCARD;
VAR [23728] NONAME   :CARDINAL;
VAR [23629] NONAMEh  :SHORTCARD;
VAR [23730] RAMTOP   :CARDINAL;
VAR [23631] RAMTOPh  :SHORTCARD;
VAR [23632] PRAMT    :CARDINAL;
VAR [23633] PRAMTh   :SHORTCARD;

END ZXsys48.
some MODs on internet has different LINE endings as in CR,13 and LF,10

Code: Select all

  10 DEF FN a(a)=PEEK a+VAL "256"*PEEK (a+SGN PI)
  20 CLEAR VAL "25999": LET r=FN a(VAL "23730")+SGN PI: LET n=NOT PI: LET e=NOT n: LET b=INT PI: LET t=b*b+e: LET d=t+b
  30 INPUT ("CLEAR mem ";r;" to 65535?y/n")'c$: IF c$="y" THEN  FOR f=r TO VAL "65535": POKE f,n: PLOT  OVER e;n,n: NEXT f
  40 DIM b$(t): INPUT "file:";n$'"Drive:";dr: LET n$=(n$+b$)( TO t): IF n$=b$ OR dr<e OR dr> e+e THEN  GO TO 40
  50 INPUT "external BIN load'YES'";y$: IF y$<>"" AND y$<>"YES" THEN  GO TO 50
  60 IF y$="YES" THEN  CLS : PRINT "BIN import NOW"'"dont break"'"press key if ready"'"Filename:";n$: PAUSE n
  70 IF y$="YES" THEN  INPUT "BIN adres";c'"BIN length";l: PRINT "file ";n$;" ";c;",";l: SAVE ddr;n$CODE c,l
  80 CLS : CAT dr;n$: DIM b$(t): FOR f=e TO t: LET b$(f)=SCREEN$ (b,f+e+e): NEXT f
  90 IF b$<>n$ THEN  PRINT "file ";n$;" not found": PAUSE n: GO TO 40
 100 DIM b$(t): FOR f=e TO VAL "5": LET b$(f)=SCREEN$ (b,f+t+t): NEXT f: LET c=VAL b$
 110 DIM b$(t): FOR f=e TO VAL "5": LET b$(f)=SCREEN$ (b,f+VAL "26"): NEXT f: LET l=VAL b$
 120 PRINT n$;"CODE ";c;",";l: IF c<r THEN  PRINT "original CODE to low": STOP 
 130 LOAD ddr;n$CODE c: FOR f=c TO c+l-e: LET p1=PEEK (f-e): LET p=PEEK f: LET p2=PEEK (f+e)
 140 IF p<>t AND p<>d AND (p<VAL "32" OR p>VAL "127") THEN  PRINT "NON printable chr found"'"@";f;",";PEEK f'"check your MOD file": STOP 
 150 IF p=t AND p2=d THEN  POKE f,VAL "32"
 160 IF p=t AND p1=d THEN  POKE f-e,VAL "32": POKE f,d
 170 IF p=t AND p1<>d AND p2<>d THEN  POKE f,d
 180 PRINT CHR$ PEEK f;: POKE VAL "23692",-e: NEXT f
 190 LET n$=("D"+n$)( TO t): SAVE ddr;n$CODE c,l
 200 STOP 
 210 CLEAR : SAVE d*"M2chr13"
probably i overdid a bit, but most is working

and i still hope z88dk-dis will help with a good disassembly.
User avatar
+3code
Manic Miner
Posts: 452
Joined: Sat Mar 19, 2022 7:40 am

Re: Modula - 2

Post by +3code »

C.Born wrote: Mon Sep 25, 2023 5:26 am Cool. did you perhaps try some codings your self or did you follow the examples ?
I made an MGT myself. if i have ftp controle again i will upload some of my mess.
i dont seem to find ANY sound related module but i only recently started looking for.
Uh, I remember I started programming something (https://sites.google.com/site/samneverc ... a-modula-2) but it was long time ago, I think I found some problem compiling something, but can't remember, sorry...
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

An existing ZX Modula2 SITE, thank you!
the progs for SAM might be to big but this is an closencounter, aint it ?? :ugeek:


COOOOL

https://www.cpcwiki.eu/index.php/Hisoft_FTL_Modula-2

its a very slow link as if some one has an old attick with an SAM as server ??
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

btw did you perhaps do a BEEP module?
or AY?
User avatar
+3code
Manic Miner
Posts: 452
Joined: Sat Mar 19, 2022 7:40 am

Re: Modula - 2

Post by +3code »

C.Born wrote: Wed Oct 18, 2023 7:27 pm btw did you perhaps do a BEEP module?
or AY?
Nopes, I only tested it superficially, my idea was something really basic, like a primitive text adventure based in menus.
C.Born
Manic Miner
Posts: 254
Joined: Sat Dec 09, 2017 4:09 pm

Re: Modula - 2

Post by C.Born »

pitty
but i have to contiue with the basic FP disassembler anyway
i dont understand the BEEP instruction on Modula2 and guess its actualy not complete since it has to deploy the FP calculator and pre-set those mems with the correct ROM routines
writing the basic FP disassembler helps a bit
PERHAPS i can learn some modula2 by converting BASIC to MODULA2... i dont know
i do to much and jump from one to another and back...
Post Reply