Jump to content

dmsc

Members
  • Posts

    1,157
  • Joined

  • Last visited

  • Days Won

    1

dmsc last won the day on July 14 2017

dmsc had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Viña del Mar, Chile

Recent Profile Visitors

10,588 profile views

dmsc's Achievements

Stargunner

Stargunner (7/9)

2k

Reputation

  1. Hi! This is because the optimizer in the cross-compiler is really dumb, the program is represented as a list of tokens and certain patterns replaced with others. With a three based representation, the optimizer could do much more. Yes, multiplications in the 6502 are slow 😛 If you need to perform floating point operations, it is better to replace the mathpack with a faster one, for example the Altirra mathpack. About a list of tips, I'm not aware of any. Have Fun!
  2. Hi! Problem is windows command line processing: there is no way to pass filenames to a windows command line directly; it does not support the concept of command line "arguments", only of a single command line. I followed the advice of https://learn.microsoft.com/en-us/cpp/c-runtime-library/spawn-wspawn-functions?view=msvc-170#arguments-for-the-spawned-process and enclosed parameters with spaces in double quotes, this seems to work. And released a new beta version, attached is the ATR plus windows and linux cross-compiler, all other version over github: https://github.com/dmsc/fastbasic/releases/tag/v4.7-beta1 Changes from v4.6: Language changes: Adds SIO statement Adds Fujinet support: NOPEN, NCLOSE, NSTATUS and NGET statements, see "nc" and "mastodon" examples. Support ADR for floating point variables. Adds %() function. You can now omit parentheses in string functions, like LEN "X" instead of LEN("X") Fixes: Fixes compiling long DLI statements. Fixes for AND/OR mixing bools and integer operands. Fixes chaining COLOR() and RTAB() in PRINT statements. Cross Compiler: Fixes on Windows cross compiler for filenames with spaces or Unicode characters. Better error messages: show variable names in errors, ASCII art with the error location, shows errors on missing ending of loops or ifs. Have Fun! fastbasic-v4.7-beta1-win32.zip fastbasic-v4.7-beta1.atr fastbasic-v4.7-beta1-linux64.zip
  3. Hi! The definitive guide: https://www.virtualdub.org/downloads/Altirra Hardware Reference Manual.pdf See in section 2.7. "Extended memory", at page 35. Have Fun!
  4. Hi! So, if you boot into BW-DOS and type "MEMEDIT D200", then 50, ENTER, AA, ENTER, do you hear any sound?: What SIO device are you using? Have Fun!
  5. Hi! Yes, you have to use the NE555 pin 7 (discharge) as output, connected to SIO pin 9 with the same 2k2 resistor to pin 8. To use the 555 as a comparator with hysteresis, you tie the NE555 pins 2 and 6, and adjust the hysteresis with a resistor from NE555 pin 5 to ground. And, the same as the other circuit, you adjust the comparator signal with a resistor divider at the input. This is the idea: The 4k7 resistor should be changed depending on the hysteresis needed. Have Fun!
  6. Hi! I suspect it should be much easier to simply use a LM393 and a transistor.... easy to buy in any electronics shop. Or, you can use a 555 chip as the comparator and output transistor with a few resistors to adjust the threshold voltaje. Have Fun!
  7. Hi! Perhaps, but as I don't have an 128k A8, I won't try 😛 Here is a new animation, running in reverse but also moving the floor with respect to the spheres - the original animation moved the floor in the oposite direction as the spheres, and the reflection did not move (as was in the original). You can press OPTION to change between 4 palletes, 2 are better in PAL, 2 are better in NTSC. Pressing START restarts the animation from the beginning. Have Fun! raytrace.atr
  8. Hi! You can use a REPEAT/UNTIL instead of FOR and use one less variable to do the loop, my result is in N, input in X: i=x/16+x&15*16:w=1:n=0:R.:n=n+i&w*w*3:w=w+w:U.w>255 But it is smaller still if you use the same variable to hold the input and the result. This is the same length as my other solution: n=x/16+x&15*16:I=128:R.:n=n*4+n&I/I*3:I=I+I:U.I<0 What kills this kind of loop is the need to invert the nibbles at the start (the "x/16=x&15*16"), without it it is much smaller. Have Fun!
  9. Hi! Which BASIC? For example, FastBasic does not have "READ", the data is defined as an array. You can have DATA statement span more than one line: DATA LongVar() BYTE = 0,1,2,3,4,5,6,7,8, DATA BYTE = 9,10,11,12,13,14,15,16,$C0,$80, DATA BYTE = $FF,7,8,9 ? LongVar(10) For other BASIC dialects in the Atari, you can use RESTORE to assign a line to read DATA from. Have Fun!
  10. Hi! Indeed! and you don't need the parenthesis, so it is now 2 chars less than the table based one: n=x/16+x&15*256:n=n!(n*4)&13107:n=n!(n*2)&21845*3 Have Fun!
  11. Hi! I don't understand, that is exactly how Altirra works if you set the image to "R/W", just there in the disk-drives window. And this is not the default because people tend to overwrite it's images in this mode 😛 Have Fun!
  12. Hi! Here is a version without a table - it is still 2 more characters than the table solution by Vitoco, but it does not use any special symbols: n=x/16+x&15*256:n=n!(n*4)&13107:n=n!(n*2)&21845:n=n*3 The way this works is, starting with the binary number ABCDEFGH: 00000000ABCDEFGH n=x/16+x&15*256 0000EFGH0000ABCD n=n!(n*4)&13107 00EF00GH00AB00CD n=n!(n*2)&21845 0E0F0G0H0A0B0C0D n=n*3 EEFFGGHHAABBCCDD Have Fun!
  13. Hi! Yes, parameters in procedures are not local, so you can't call a procedure recursively and expect them to retain the value. But of course, you can implement recursion if you save the values in an array, and the parameters are a good way to minimize your program in a tenliner 🙂. Do you have a recursive function that need to implement? This is an example of a recursive QuickSort, using an array as a stack to store the variables that need to be preserved between calls: proc QSort i0 i1 if i1 < i0 + 10 ' Use insertion sort for small arrays for i=i0 to i1-1 temp = p(i+1) for j=i to i0 step -1 if (p(j)) <= (temp) then exit p(j+1) = p(j) next p(j+1) = temp next else ' Set pivot to 'i1', do the partition temp = p(i1) j0 = i0 - 1 j1 = i1 do repeat : inc j0 : until (p(j0)) >= (temp) repeat : dec j1 : if j1 = i0 then exit : until (temp) >= (p(j1)) if j0 >= j1 then exit x = p(j0) : p(j0) = p(j1) : p(j1) = x loop p(i1) = p(j0) : p(j0) = temp ' Recurse over smaller sub-array first stack1(lvl) = j0 if i1 - j0 > j1 - i0 stack0(lvl) = i1 : inc lvl @QSort i0, j0 - 1 : dec lvl @QSort stack1(lvl) + 1, stack0(lvl) else stack0(lvl) = i0 : inc lvl @QSort j0 + 1, i1 : dec lvl @QSort stack0(lvl), stack1(lvl) - 1 endif endif endproc The above can be minimized to: pr.QS i j:ifj<=i t.ex.:t=p(j):k=i-1:m=j:do:r.:inck:u.p(k)>=t:r.:decm:u.m<>i a.t>=p(m):ifk>=m t.ex.:x=p(k):p(k)=p(m):p(m)=x:l.:p(j)=p(k):p(k)=t s1(l)=k:ifj-k>m-i:s0(l)=j:incl:@QS i,k-1:decl:@QS s1(l)+1,s0(l):el.:s0(l)=i:incl:@QS k+1,j:decl:@QS s0(l),s1(l)-1:e.:en. Have Fun!
  14. Hi! Not easily, you need a better compression and a decompressor in assembly language. This is a little prof of concept, using the RAM under the ROM on the XL computers, needs 64K and decompresses each frame using directly to screen. Then, all the frame data is compressed again to allow loading from disk. I used my ZX02 compressor for both the individual frames and the complete program. There are 83 frames in total. Have Fun! raytrace.atr
  15. Hi! I made a disk based animation, uncompressed from disk to screen. All 100 frames were rendered with my code above, in FastBasic, then saved to disk and compressed. Decompression code: Have Fun! video.atr
×
×
  • Create New...