Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jj2007

Pages: [1] 2 3 ... 11
1
Community news and announcements / Re: X11 to Droid
« on: 28. October 2018, 09:47:57 »
I notice that programming on an Android phone is still very cumbersome.

9 Best Bluetooth keyboards you can currently buy

2
Offtopic / Re: compilers101
« on: 22. October 2018, 03:56:36 »
why your richmasm is not standalone ?

RichMasm is a standalone editor :)

3
Offtopic / Re: compilers101
« on: 20. October 2018, 19:51:29 »
you know with that amount of code I expect totally new assembler/compiler/linker

The totally new assembler is here. RichMasm is an editor, and a very special one. If you deal with a 30,000+ lines source, RichMasm offers some great functionality. Inter alia, I use it also to build my BASIC, C and Pascal sources. I would never use one of those toy editors for a complex task ;)

4
Offtopic / Re: compilers101
« on: 20. October 2018, 03:36:26 »
how to build code editor in less than 1000lines

That's exaggerated, 26 lines should be enough:

GuiMenu equ @Files, &New..., &Open..., &Save, &Build, -, E&xit, @Edit, Cut, Copy, Paste, @Options, Settings, @Help, &About
GuiParas equ "Editor demo", x100, y50, w900, h600      ; menu and paras are optional, if omitted, title is filename
include \masm32\MasmBasic\Res\MbGui.asm         ; part of MasmBasic
GuiControl MyEdit, "RichEdit", wCL$(), font -16        ; use Unicode commandline and a big font (use MakeFont for special needs)
GuiControl MyStatus, "statusbar", "Ready, Готовы, 準備, ..."

Event Menu
  Switch_ MenuID
  Case_ 0: SetWin$ hMyEdit=0    ; pass a nullpointer to clear the control
  Case_ 1
        .if wFileOpen$("Unicode text=*.txu|Plain text=*.txt|Rich text=*.as?;*.rtf|All files=*.*", "Select a file", "Добро_пожаловать.txu")
               SetWin$ hMyEdit=wFileRead$(wFileOpen$())        ; do not use wSetWin$
        .endif
  Case_ 2
        .if FileSave$("Plain text=*.txt|Rich text=*.as?;*.rtf|All files=*.*")
                .if MbOfn.nFilterIndex==2
                                FileWrite FileSave$(), stream:hMyEdit   ; rich text
                .else
                                FileWrite FileSave$(), Win$(hMyEdit)    ; normal text
                .endif
        .endif
  Case_ 3
        FileWrite "tmpBuild.asm", Win$(hMyEdit)
        Launch Cat$("build.bat tmpBuild.asm"
  Case_ 4 .. 9
        MsgBox 0, Str$("Menu #%i not yet implemented", MenuID), "Hi", MB_OK
  Endsw_
GuiEnd


It depends a bit on your needs, of course: RichMasm is a bit over 20,000 lines now ;)

5
Code and examples / Re: Floyd's Triangle
« on: 18. October 2018, 05:57:22 »
It wasn't about speed, readability was the last thing I was concerned about and I didn't really care about the beauty of the output. ... but it was fun.

You should add it to the Rosetta code Ruby example. Your coding style is certainly different from mine, but when I saw your one-liner, my first thought was WOW!  ;)

@Mike: No, that was no waste of time. Tomaaz impressed you and me, and he had fun.

6
Code and examples / Re: Floyd's Triangle
« on: 17. October 2018, 22:41:34 »
Version 1, a smooth triangle (but not exactly what the Rosetta specs ask for):

include \masm32\MasmBasic\MasmBasic.inc         ; download
  SetGlobals rows, columns, ct
  Init
  For_ rows=0 To 19
        For_ columns=0 To rows
                inc ct
                Print Str$("%__i ", ct)
        Next
        Print
  Next
  Inkey
EndOfCode


Code: [Select]
  1
  2   3
  4   5   6
  7   8   9  10
 11  12  13  14  15
 16  17  18  19  20  21
 22  23  24  25  26  27  28
 29  30  31  32  33  34  35  36
 37  38  39  40  41  42  43  44  45
 46  47  48  49  50  51  52  53  54  55
 56  57  58  59  60  61  62  63  64  65  66
 67  68  69  70  71  72  73  74  75  76  77  78
 79  80  81  82  83  84  85  86  87  88  89  90  91
 92  93  94  95  96  97  98  99 100 101 102 103 104 105
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210

Version 2, strictly following the spacing specs:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  SetGlobals rows, columns, ct
  Init
  round=0
  repeat 2
        Clr ct
        For_ rows=0 To 4+9*round
                For_ columns=0 To rows
                                inc ct
                                Print Str$("%__i", ct)
                                .if columns>6
                                        Print " "
                                .endif
                Next
                Print
        Next
        Print
        round=round+1
  endm
  Inkey
EndOfCode


Code: [Select]
  1
  2  3
  4  5  6
  7  8  9 10
 11 12 13 14 15

  1
  2  3
  4  5  6
  7  8  9 10
 11 12 13 14 15
 16 17 18 19 20 21
 22 23 24 25 26 27 28
 29 30 31 32 33 34 35 36
 37 38 39 40 41 42 43 44  45
 46 47 48 49 50 51 52 53  54  55
 56 57 58 59 60 61 62 63  64  65  66
 67 68 69 70 71 72 73 74  75  76  77  78
 79 80 81 82 83 84 85 86  87  88  89  90  91
 92 93 94 95 96 97 98 99 100 101 102 103 104 105

7
General questions and discussions / Re: Yabasic
« on: 15. October 2018, 01:38:14 »
So the same goes for required typing of variables by suffix or DIM

Over the years I find that the ThisIsText$ suffix is really helpful for the readability of code. The C/C++ gang find it unprofessional, and produce lots of buggy code, he he >:(

Dim is OK for arrays, but I find it annoying to dim a simple integer. OTOH it can help to avoid bugs that creep in with typos, like confusing MyVar with My_Var etc.; the old defunct GfaBasic had an excellent solution for this problem: If you typed MyVar=123, it asked if you wanted to create that variable. Sure, I want that. And if some pages further down you typed My_Var=456, it asked you again ... oops! Almost foolproof, and no Dim required.

8
General questions and discussions / Re: Yabasic
« on: 13. October 2018, 09:49:30 »
I suspect it's popular because it's beginner-friendly...

9
Here are the specs. Lachie Dazdarian from Croatia has launched that competition. Aurel, do you know him?

10
Community news and announcements / Re: X11 to Droid
« on: 09. October 2018, 22:46:54 »
Maybe you want to have a look into the GFA-BASIC 32 for Windows

I have programmed for over a decade with the 16-bit Windows version, a great dialect - unfortunately its author was not interested in porting it to 32-bit. I vaguely remember that Hamstra's product is horribly bloated and slow, and not at all compatible with the 16-bit version. That's why I develop MasmBasic ;)

P.S.: I've given Gfa32 a chance. The interpreter runs fine, the compiler compiles, but the exe complains that it can't find GfaWin23.Ocx, a one MByte runtime which happens to be hidden away in gb32\Bin\GfaWin23.Ocx. And no, the name is not a typo of mine, it's really GfaWin23 8)

253 sample files, and none of them contains the term string array. GfaBasic 16's most useful command, Recall, is implemented but no example available; ok, the manual has one, and it works if you know beforehand how many strings the text file has. MasmBasic Recall has dynamic arrays, and is over a factor 7 faster than Gfa32.

11
Community news and announcements / Re: X11 to Droid
« on: 09. October 2018, 16:52:41 »
Calling procedures with @ is yucky specially for functions but I think QB had CALL for subs, JB still does.

The @ calls a sub; functions are declared with DEFFN and used with somevar=FN myfunction(x, y, z)

Quote
EXIT IF is weird too.

Almost the same as in assembly:
.Repeat
  ... do stuff ...
  .Break .if eax==edx
  ... do stuff ...
.Until eax>somevar

Quote
Have yet to figure out what Clr is for, clear a variable value?

Exactly.

12
Community news and announcements / Re: X11 to Droid
« on: 09. October 2018, 05:24:02 »
Quote
The syntax is most similar to GFA-Basic for ATARI-ST. It is a structured dialect with no line numbers. A full manual and command reference is available. GFA-programs should run with only a few changes. Also DOS/QBASIC programmers will feel comfortable.
I still have a hundred GFA programs hanging around, the biggest one at 365 kBytes - a full-scale editor with graphics capability, and a heavy dosis of embedded 68000 assembly. It still runs fine on this Win7 machine, using the Steem emulator. A screenshot, produced right now:

Here is a short sample of the syntax:
Code: [Select]
Procedure Calc(Y$)
  Local Ti%,Is%
  Clr R_err%
  Sub C.max%,Instr(Y$," e")=0
  Do
    Is%=Instr(Y$," ")
    Exit If Is%=0
    Dec C.max%
    Y$=Left$(Y$,Is%-1)+Mid$(Y$,Is%+1)
  Loop
  Repeat
    Is%=Instr(Y$,")")
    Exit If Is%<2
    @R.ins("(",Left$(Y$,Is%-1))
    Sub R_err%,Ris%=0
    If Ris%
      Yl$=Left$(Y$,Ris%-1)
      Yr$=Mid$(Y$,Is%+1)
      Y$=R.i$
      @Calc0
      Clr Ogs%
      If Len(Yl$)>=3
        Ogs%=(Instr("SINCOSTANLOGLGEMAXMIN",Upper$(Mid$(Yl$,Ris%-3,3)))+3)/Tgv%
      Endif
      If Ogs%
        W=Val(Y$)
        Wl=W*Pi/180
        On Ogs% Gosub C1si,C1co,C1ta,C1lo,C1lg,C1max,C1max
        Y$=Left$(Yl$,Ris%-Tgv%)+Str$(W)+Yr$
      Else
        Y$=Yl$+Y$+Yr$
      Endif
    Endif
  Until R_err%
  Sub R_err%,Instr(Y$,"(")>0
  @Calc0
  X0=Val(Y$)
  Add C.max%,Len(Str$(X0))-Len(Y$)
  If R_err%
    Clr Play!
    @Melde(H44%,Str$(R_err%)+" Syntaxfehler")
  Endif
Return
That was February 1986 btw. How QBASIC programmers should feel "comfortable" here, though, seems a mystery to me  ;D

13
General questions and discussions / Re: Dir Walk Challenge
« on: 26. September 2018, 02:18:32 »
Just for fun - pure assembly, of course:
Code: [Select]
include \masm32\MasmBasic\MasmBasic.inc
  Init
  Let esi=ExpandEnv$("%WINDIR%\")+"*.*" ; usually C:\Windows
  PrintLine "Searching ", esi
  GfCallback cbGetFiles ; define a callback function
  GetFiles esi
  Print Str$("\n%i files found\n", eax) ; 2805 files found
  For_ ecx=0 To Min(19, Files$(?)) ; print a few
PrintLine Files$(ecx)
  Next
  Store "NumericalFiles.txt", Files$() ; write the complete list to disk
  Exit
cbGetFiles:
  test ecx, 1048575 ; file or folder counter
  If_ Zero? Then Print "*" ; console mode progress bar ;-)
  .if [ebx.WIN32_FIND_DATAW.dwFileAttributes]==FILE_ATTRIBUTE_DIRECTORY
clc
  .else
void Val(Utf8$(esi))
.if edx==-127
stc
.elseif edx<20
clc
.else
stc
.endif
  .endif
  ret
EndOfCode
Typical output:
Code: [Select]
Searching C:\Windows\*.*
************************************************************************************************
******************************************
2805 files found
C:\Windows\Downloaded Installations\{32641B63-651D-43D9-B6F7-8C45F2FF07E1}\1033.MST
C:\Windows\ehome\CreateDisc\Components\tables\1cb0
C:\Windows\ehome\CreateDisc\Components\tables\1cb1
C:\Windows\ehome\CreateDisc\Components\tables\1cb2
C:\Windows\ehome\CreateDisc\Components\tables\2cb0
C:\Windows\ehome\CreateDisc\Components\tables\2cb1
C:\Windows\ehome\CreateDisc\Components\tables\2cb2
C:\Windows\inf\1394.inf
C:\Windows\inf\1394.PNF
C:\Windows\inf\61883.inf
C:\Windows\inf\61883.PNF
C:\Windows\Performance\WinSAT\DataStore\0012-01-16 10.43.33.070 Cpu.Assessment (Prepop).WinSAT.xml
C:\Windows\Performance\WinSAT\DataStore\0012-01-16 10.43.33.070 Disk.Assessment (Prepop).WinSAT.xml
C:\Windows\Performance\WinSAT\DataStore\0012-01-16 10.43.33.070 DWM.Assessment (Prepop).WinSAT.xml
...

14
Offtopic / Re: How old are you?
« on: 21. September 2018, 14:43:33 »
Is JJ still looking in? I see him at FB.

Occasionally, but at age 62 I must concentrate on my own babies ;)

15
General questions and discussions / Re: Beginner friendly BASICs
« on: 21. September 2018, 14:34:04 »
You see, this is where all the friction comes from.
..
Angry and bitter people are these; they get no joy from their pursuits unlike the coders who do it purely for fun.

In my experience, the angriest are those who code for a living. Of course, there are many who live well from coding and therefore are not angry and bitter. Sometimes I feel privileged to be retired. Coding just for pleasure, yeah, that's luxury ;)

Pages: [1] 2 3 ... 11