Jump to content

576XE

Members
  • Posts

    848
  • Joined

  • Last visited

About 576XE

  • Birthday 03/26/1959

Profile Information

  • Gender
    Male
  • Location
    Moscow, Russia

Recent Profile Visitors

11,258 profile views

576XE's Achievements

Dragonstomper

Dragonstomper (6/9)

166

Reputation

  1. 576XE

    CC8

    Hello friends! Here is some routine from documentation to illustrate using of constant expression with asm statement. char ml_routine[] = 0x68, ..., 0x60; /* ML routine */ char * strchr(s, c) char *s; int c; asm ml_routine; I can't initialize array of bytes absolutely this way. What's wrong? Help me, please! I want to write 24-bit calculations for C. zen
  2. Hello there, Ticled Pink! And YES, of course, I have some pretentions to PL65, but ... - You know that Atari filesystem is FRAGMENTED anyway! And this compatibility is essential! - You know that There are no Structs/Records in PL65 - TOO BAD, TOO SAD! But POINTERS are available, thus workarounds! I created some functions to control Linked Lists, voila! The BEST language for Atari is CLSN PASCAL of course, but ... The common PROBLEM is ORDINAL TYPE of LONGINT, i.e. Multiplication in Cycles for ... EVERY calculated BYTE! There are CC65 - TOO SLOW! I think they wanted to make all-platform-language and it was bad idea anyway. Only PL65 Rules!!! Really no problem in placement of memory parts in PL65 because Atari is one-tasc computer. Times ago I thinked that PMG is too memory consumption thing, but I was youngster there. Now I'm trying to find some useful algorythm to move small bites oriented object (like Mouse) on screen. And thank you for your reply. Highly Appreciated! zen
  3. May be this looks slightly better...
  4. Here I added 24 bit calculations (I just needed an access to Bank memory so Add24 and Sub24) It needs TEXT.LIB because "num to text" and "text to num" transformations. INCLUDE TERMINAL.LIB INCLUDE TEXT.LIB != Globals ==========================! BYTE op1[3]=$0600,op2[3]=$0603 STRING li1$[7],li2$[7] !------------------------------------! PROC inpHex(INT li1A,li1L,li2A,li2L) STRING l1$[2],m1$[2],b1$[2] STRING l2$[2],m2$[2],b2$[2] BEGIN l1$=Mid$(li1$,6,2) m1$=Mid$(li1$,4,2) b1$=Mid$(li1$,2,2) l2$=Mid$(li2$,6,2) m2$=Mid$(li2$,4,2) b2$=Mid$(li2$,2,2) BASE=16 op1[0]=VAL(l1$) op1[1]=VAL(m1$) op1[2]=VAL(b1$) op2[0]=VAL(l2$) op2[1]=VAL(m2$) op2[2]=VAL(b2$) BASE=10 END !------------------------------------! PROC outHex() STRING w$[2] BEGIN IF op1[2]>=10 THEN WRITE(op1[2]) ELSE w$[1]=STR$(0) w$[2]=STR$(op1[2]) WRTSTR(w$) ENDIF IF op1[1]>=10 THEN WRITE(op1[1]) ELSE w$[0]=STR$(0) w$[1]=STR$(op1[1]) WRTSTR(w$) ENDIF IF op1[0]>=10 THEN WRITE(op1[0]) ELSE w$[1]=STR$(0) w$[2]=STR$(op1[0]) WRTSTR(w$) ENDIF END !------------------------------------! PROC Add24() POINTER zp1,zp2 BEGIN zp1=.op1 zp2=.op2 STX XSAVE LDX #$03 LDY #$00 CLC :loop LDA (zp1),Y ADC (zp2),Y STA (zp1),Y INY DEX BNE loop LDX XSAVE END !------------------------------------! PROC Sub24() POINTER zp1,zp2 BEGIN zp1=.op1 zp2=.op2 STX XSAVE LDX #$03 LDY #$00 SEC :loop LDA (zp1),Y SBC (zp2),Y STA (zp1),Y INY DEX BNE loop LDX XSAVE END !====================================! MAIN() STRING w$[2] BEGIN li1$="$ABCDEF" li2$="$123456" inpHex(li1$,li2$) BASE=16 Add24() WRTSTR("$") outHex() CR() inpHex(li1$,li2$) BASE=16 Sub24() WRTSTR("$") outHex() CR() END !====================================! Here is the image of disk... PL65 TEXT SpDOSx33a 360.atr And the result of $ABCDEF and $123456 Addition and Subtruction
  5. Some explaination after all... There are 2 forms of string arguments representation in PL65. 1. String Name calling: FE out$=Conc$(a$,b$) - Useful ONLY if we initialize string in THE SAME function !!! 2. String INTs calling: FE out$=Conc$(aAdr,aLen,bAdr,bLen) Here aAdr,aLen,bAdr,bLen obviously declared as INTs in Conc$ - Useful if we initialize string in Calling Procedure and want to send string parameters to Called Subroutine. It's related to the fact that strings are stored on Stack Only in Adr,Len format and Called Function expected just such data but Name. Best wishes from Moscow zen
  6. Sorry!!! BYTE wV BASED sP !Must be INT in Library of course!
  7. Hello Friends! Recently I've wrote PL65 TEXT Librery with some useful functions. You can use it at your service, of course. !====================================! ! TEXT.LIB ! ! Text Functions Library for PL65 ! ! Programming Language ! !------------------------------------! ! Evgeny Zolotarev,(aka 576XE), 2023 ! !====================================! POINTER sP BYTE sV BASED sP BYTE wV BASED sP !====================================! FUNC Left$(INT sA,sL,n) STRING out$[256] INT i BEGIN FOR i=0 TO n DO sP=sA+i out$[i,i]=CHR$(sV) NEXT END out$ !------------------------------------! FUNC Mid$(INT sA,sL,m,n) STRING out$[256] INT i BEGIN sA=sA+m-1 FOR i=0 TO n DO sP=sA+i out$[i,i]=CHR$(sV) NEXT END out$ !------------------------------------! FUNC Right$(INT sA,sL,n) STRING out$[256] INT i BEGIN sA=sA+sL-n FOR i=0 TO n DO sP=sA+i out$[i,i]=CHR$(sV) NEXT END out$ !------------------------------------! FUNC Pos(INT pA,pL,sA,sL) POINTER pP BYTE pV BASED pP INT i,j,psn BYTE f BEGIN IF pL<=sL THEN sL=sL-pL+1 i=0 j=0 ! While Fail ... ! Repeating along the String REPEAT f=$FF ! If Success... ! Indexing along the Pattern FOR j=0 TO pL-1 DO sP=sA+i+j pP=pA+j IF sV<>pV THEN f=0 ENDIF NEXT i=i+1 UNTIL (i=sL OR f<>0) IF f<>0 THEN psn=i ELSE psn=0 ENDIF ELSE psn=0 ENDIF END psn !------------------------------------! FUNC Conc$(INT sA,sL,pA,pL) STRING out$[256] INT i,j BEGIN FOR i=0 TO sL DO sP=sA+i out$[i,i]=CHR$(sV) NEXT FOR j=0 TO pL DO sP=pA+j out$[i+j,i+j]=CHR$(sV) NEXT i=sL out$[i,i]=" " END out$ !------------------------------------! FUNC Ins$(INT pA,pL,sA,sL,m) STRING out$[256],a$[256],b$[256] INT n BEGIN a$=Left$(sA,sL,m) b$=Right$(sA,sL,sL-m-1) n=LEN(a$)+pL+1 a$=Conc$(a$,pA,pL) out$=Conc$(a$,b$) END out$ !------------------------------------! FUNC Del$(INT sA,sL,m,n) STRING a$[256],b$[256],out$[256] INT i BEGIN a$=Left$(sA,sL,m) b$=Right$(sA,sL,sL-m-n) out$=Conc$(a$,b$) i=LEN(a$) out$[i,i]=" " sP=.out-2 wV=sL-n+1 END out$ !------------------------------------! FUNC Inv$(INT sA,sL,m,n) STRING out$[256] INT i BEGIN out$=Mid$(sA,sL,1,sL) FOR i=0 TO n-1 DO sP=.out+m-1+i sV=sV+128 NEXT END out$ !------------------------------------! FUNC Upper$(INT sA,sL,m,n) STRING out$[256] INT i BEGIN out$=Mid$(sA,sL,1,sL) FOR i=0 TO n-1 DO sP=.out+m-1+i IF sV>$60 AND sV<$7B THEN sV=sV-$20 ENDIF NEXT END out$ !------------------------------------! FUNC Lower$(INT sA,sL,m,n) STRING out$[256] INT i BEGIN out$=Mid$(sA,sL,1,sL) FOR i=0 TO n-1 DO sP=.out+m-1+i IF sV>$40 AND sV<$5B THEN sV=sV+$20 ENDIF NEXT END out$ !====================================! ENDFILE Also here is Driver program to check functionality. !====================================! ! TEXT.PRG ! ! Text Functions Program for PL65 ! ! Programming Language ! !------------------------------------! ! Evgeny Zolotarev,(aka 576XE), 2023 ! !====================================! INCLUDE TERMINAL.LIB INCLUDE TEXT.LIB !====================================! MAIN() STRING s$[256],p$[256],a$[256],out$[256] INT psn,m,n BEGIN s$="Moscow Alma-Ata Petersburg Evpatoria Feodosia Simeiz Konakovo" p$="Alma-Ata" a$="Syktyvkar" m=15 n=12 CR() WRTSTR("Left$ - ") WRTLN(Left$(s$,6)) WRTSTR("Mid$ - ") WRTLN(Mid$(s$,8,8)) WRTSTR("Right$ - ") WRTLN(Right$(s$,8)) CR() psn=Pos(p$,s$) WRTSTR("Pos - ") WRITE(psn) CR() CR() WRTSTR("Conc$ - ") WRTLN(Conc$(p$,a$)) out$=Ins$(a$,s$,m) WRTSTR("Ins$ -") WRTLN(out$) out$=Del$(s$,m,n) WRTSTR("Del$ -") WRTLN(out$) m=17 n=10 CR() WRTSTR("Inv$ - ") WRTLN(Inv$(s$,m,n)) WRTSTR("Upper$ - ") WRTLN(Upper$(s$,m,n)) WRTSTR("Lower$ - ") WRTLN(Lower$(s$,m,n)) END !====================================! And the result of course... Here is ATR Image of disk PL65 TEXT SpDOSx33a 360.atr Best Wishes from Moscow zen
  8. Merry Christmas and Season Greetings to Old Good Friends. God Bless You and my Warmest Wishes from Cold Moscow. zen
  9. Hi there, Mark. Glad to here from You. 8 years of investigations, and Voila! Best wishes from Moscow! zen
  10. Hello, Friends! Today I decided the problem with string arguments passing to subroutine. The reason of problem is in the fact that There are two different representation of strings in PL65. Human oriented (str$[40]) for declaring and Compiler oriented (addr,len) for calculations. The fact is that Compiler simply not decipheres Human oriented representation into Compiler oriented thus PROC pos(STRING patn$[40],strg$[40]) is meaningless as subroutine arguments must be in Compiler representation for calculations. And this code is working! INCLUDE TERMINAL.LIB FUNC Pos(INT pA,pL,sA,sL) POINTER pP,sP BYTE pV BASED pP,sV BASED sP INT sC,pC,i,j,psn BYTE f BEGIN IF pL<=sL THEN sL=sL-pL+1 i=0 j=0 ! Repeating along the String REPEAT f=$FF ! Indexing along the Pattern FOR j=0 TO pL-1 DO ! Initialize and Atualize Data sP=sA+i+j sC=sV pP=pA+j pC=pV IF sC<>pC THEN f=0 ENDIF NEXT i=i+1 UNTIL (i=sL-1 OR f<>0) IF f<>0 THEN psn=i ELSE psn=0 ENDIF ELSE psn=0 ENDIF END psn MAIN() STRING s$[256],p$[256] INT psn BEGIN s$="Moscow Petersburg Evpatoria Feodosia Simeiz Konakovo" p$="Petersburg" CR() psn=Pos(p$,s$) WRITE(psn) CR() END zen
  11. Hello Friends! As far as it is concerned passing string arguments to PROC... Here is some kind of WORKAROUND! INCLUDE TERMINAL.LIB PROC print(INT a,l) BEGIN WRTLN(a,l) END MAIN() STRING str$[10] ! Defined as Local INT adr,len BEGIN str$="Moscow" ! Initialized adr=.str len=LEN(str$) CR() print(adr,len) END IMHO it can help. Also I think that Pointers can be passed too for working with Literals. zen
  12. ! T.PRG INCLUDE TERMINAL.LIB STRING s$[255] ! String Declaration PROC print(PROC WRTSTR) BEGIN CR() END MAIN() BEGIN s$="Moscow" ! String Assignment print(s$) END This code works. PROC is just indirect parameters passing. Too strange strings behavior. Seems like something crashes the stack. zen
  13. Hello Friends! Investigating PL65 I made too many mistakes!!! So sorry! Here some string declarations: First - Declared and initialized in compile time! STRING s$[960] DATA "Some String Data"; And another: This MUST be Declared in compile time but can be Initialized in Runtime while running MAIN() STRING s$[960] ... MAIN() BEGIN s$="Some String Data" END The memory structure of PL65 strings is : DIM,SIZ,STRING where: NAME=s$ ADDR of string - can be accessed as .s (without $-sign) SIZ is Runtime Size (INT value) addressed as .s-2 DIM is Declared (INT value) like [960] can be accessed as .s-4 STRING is "Some String Data" and is equal to count between "..." (here 16) Here is my trying to make TEXT.LIB for PL65 to normally work with strings. !====================================! ! TEXT.LIB ! ! String Functions for PL65 ! ! Programming Language ! !------------------------------------! ! Evgeny Zolotarev,(aka 576XE), 2022 ! !====================================! !- Global Strings -------------------! STRING p$[960],s$[960] != String Functions =================! FUNC Find() !- Returns COUNTED but INDEXED ------! POINTER pP,sP BYTE pV BASED pP,sV BASED sP BYTE sC,pC,f INT pL,sL,i,j,pos BEGIN pL=LEN(p$) sL=LEN(s$) IF pL<=sL THEN sL=sL-pL+1 i=0 j=0 ! Repeating along the String REPEAT f=$FF ! Traversing along the Pattern FOR j=0 TO pL-1 DO sP=.s+i+j sC=sV pP=.p+j pC=pV IF sC<>pC THEN f=0 ENDIF NEXT i=i+1 UNTIL (i=sL-1 OR f<>0) IF f<>0 THEN pos=i ELSE pos=0 ENDIF ELSE pos=0 ENDIF END pos !====================================! ENDFILE And code for testing !====================================! ! TEXT.PRG ! ! Using String Functions for PL65 ! ! Programming Language ! !------------------------------------! ! Evgeny Zolotarev,(aka 576XE), 2022 ! !====================================! INCLUDE TERMINAL.LIB INCLUDE TEXT.LIB !- Global Data ----------------------! !====================================! MAIN() INT posn BEGIN !- Strings Assignment ---------------! p$="Petersburg" s$="Moscow Petersburg Evpatoria Feodosia Simeiz Konakovo" posn=Find() CR() WRITE(posn) CR() END !====================================! The purpose of placing STRING p$[960],s$[960] in such a strange place is to make it vizible for Find routine while Initializing from MAIN() program !!! I still have some problems with transfering string parameters in PL65, thus use GLOBALS instead. Best wishes from Moscow! zen
  14. Is it possible to create NTSC/PAL version? The Idea of socketed 130XE Mobo is very impressive! zen
  15. Hello Rybags! Really I want to write a library for PL65 to access to 512Kb of my extended memory and use it as normal heap. 3-bytes arithmetic is not a matter. I just need some suggestions to parse a number like this $124000. (i.e. LSB=$00 MSB=$40 BNK=$12) This is DEMO of PL65 using EXTMEM. !====================================! ! BANKS.PRG ! ! Using 130XE Extended Banks in ! ! PL65 Programming Language ! !------------------------------------! ! Evgeny Zolotarev,(aka 576XE), 2020 ! !====================================! INCLUDE TERMINAL.LIB !- Miscellaneous Procedures: !- Clear Screen Procedure -----------! PROC clrScr() CONST clr=125 BEGIN WRTSTR(CHR$(clr)) END !- Wait for Any Key Pressed ---------! PROC anyKey() CONST none=255 BYTE CH=764 BEGIN WRTSTR("Wait for a Key...") CR() WHILE CH=none DO ENDWHILE CH=none END !- EXTMEM Procedures !- CONSTANTS & VARIABLES: CONST bkMask=%10010001 BYTE bkTag,PORTB=$D301,NMIEN=$D40E INT bkNum !- DUMMY array representing ---------! !- Bank Access Window ---------------! BYTE bkMem[$4000]=$4000 !- Bank Selector Values -------------! !- Atari800WinPlus 576XE ------------! BYTE bkSel[33] DATA $93, $81,$83,$85,$87,$89,$8B,$8D,$8F, $A1,$A3,$A5,$A7,$A9,$AB,$AD,$AF, $C1,$C3,$C5,$C7,$C9,$CB,$CD,$CF, $E1,$E3,$E5,$E7,$E9,$EB,$ED,$EF; ! String VAR to store in all BANKS STRING inp$[4+27] DATA " => User DATA from Bank #00"; ! Set string as VAR for output STRING out$[4+27] DATA " "; !- Place bkSel Tags into PORTB ------! PROC setBk*(BYTE bkTag) BEGIN !- Start Wrapper; STOPs IRQ & NMI ---! SEI LDA #$00 STA NMIEN LDA PORTB AND bkMask OR bkTag STA PORTB !- Stop Wrapper; STARTs IRQ & NMI ---! LDA #$40 STA NMIEN CLI END !- Send bkNum to setBk subroutine ---! PROC setBank(INT bkNum) BEGIN bkTag=bkSel[bkNum] setBk*(bkTag) END !- Writes to Bank -------------------! PROC writBk() BEGIN FOR bkNum=0 TO 32 DO WRTSTR("Writing to BANK #") WRITE(bkNum) CR() IF bkNum<10 THEN inp$[25,25]=STR$(0) inp$[26,26]=STR$(bkNum) ELSE inp$[25]=STR$(bkNum) ENDIF out$=inp$ setBank(bkNum) MOVE(.out,LEN(out$),.bkMem) NEXT END !- Reads from Bank ------------------! PROC readBk() BEGIN FOR bkNum=0 TO 32 DO WRTSTR("Reading BANK #") WRITE(bkNum) CR() setBank(bkNum) MOVE(.bkMem,LEN(out$),.out) WRTSTR(out$) CR() NEXT END !------------------------------------! MAIN() BYTE PORT BEGIN LDA PORTB STA PORT clrScr() anyKey() writBk() anyKey() clrScr() readBk() LDA PORT STA PORTB END ! >>> EOF <<< ! Many thanks. Glad to hear from you zen (It's my initials)
×
×
  • Create New...