Jump to content

artrag

Members
  • Content Count

    1,591
  • Joined

  • Last visited

Community Reputation

750 Excellent

3 Followers

About artrag

  • Rank
    Stargunner

Profile Information

  • Gender
    Male

Recent Profile Visitors

25,771 profile views
  1. Ask on www.msx.org You can get a lot of help there
  2. Thanks for the suggestions. I've pre-computed part of the pointers in a separate frame and now frame tearing seems more acceptable. I've attached BAS, BIN, ASM and LST and sources for your curiosity cloudy montain reboot.rar
  3. Do you know if CPU is capable of moving 190 words in a frame ? I'm trying to optimize this code in order to stay within a frame, but it seems that the problem is the number of moved words itself... plotscreen: procedure xA = ((#wX/4) and 1) yA = ((#wY/4) and 1) tX = ((#wX/8) % 9) tY = ((#wY/8) % 9) mX = (#wX/8/9) % wMAP my = (#wY/8/9) % hMAP #j = (xA + yA*2)*(9*9) ' first line imap = 0+mX + (0+mY)*wMAP #i = map(imap) + #j SCREEN #xyrooms,#i + (tX + tY*9) , 0 ,9-tX,9-tY,9 imap = (1+mX)%wMAP + (0+mY)*wMAP #i = map(imap) + #j SCREEN #xyrooms,#i + tY*9 , 0 + 9-tX ,9 ,9-tY,9 imap = (2+mX)%wMAP + (0+mY)*wMAP #i = map(imap) + #j SCREEN #xyrooms,#i + tY*9 , 0 + 18-tX ,tX+1,9-tY,9 ' second line imap = 0+mX + ((1+mY)%hMAP)*wMAP #i = map(imap) + #j SCREEN #xyrooms,#i + tX , 0 + (9-tY)*20 ,9-tX,1+tY,9 imap = (1+mX)%wMAP + ((1+mY)%hMAP)*wMAP #i = map(imap) + #j SCREEN #xyrooms,#i , 9-tX+(9-tY)*20,9 ,1+tY,9 imap = (2+mX)%wMAP + ((1+mY)%hMAP)*wMAP #i = map(imap) + #j SCREEN #xyrooms,#i ,18-tX+(9-tY)*20,tX+1,1+tY,9 end For your fun, the snippets is used in the demo in attach... demo.cfg demo.bin
  4. thanks, I ended to use the first parameter as an offset SCREEN #room0_0,#j, 0,9,9,9 #j = #j + 9*9
  5. I was trying to code a 4 frame animation: I need to plot a small 9x9 square of tiles on the screen taken from different positions in a large ROM area ad change the place from the data come at each frame I was doing this for i=0 to 3 SCREEN VARPTR #room0_0(i*9*9),0,0,9,9,9 wait next BUT it seems that SCREEN does not support VARPTR.... Oscar can we add this feature if it is missing ? Or Is there a workaround I cannot see? Maybe playing on the origin_offset....
  6. You was executing data as they were instructions. The best way to get a crash...
  7. artrag

    SGM 5th run

    No the black one
  8. artrag

    SGM 5th run

    Mine has arrived! Thanks
  9. Just a note. This line Peek(VarPtr Pow2Table(Exp)) is equivalent to Pow2Table(Exp)
  10. How fast! It works great! Probably less detail on trees would help in getting less aliasing
  11. Provided that Pandora Project is on its own way, maybe the procedure ExtractField could be a very useful tool for everyone if developed in ASM Maybe using the ASM directive and the naming convention for variables in ASM the integration with intybasic could be easy. I would try myself but I a total noob with the CP1600
  12. Yes the bottleneck is ExtractField. Its multiplications and divisions make the bit extraction too slow to be practically usable.
  13. Hi DZ, I've been testing for a while your code for extracting bit files with variable length from a bit stream, but something wasn't working as I expected. So I have done my own version of the ExtractField in the way I was expecting to be used 🙂 I've also implemented the simple encoding that we discussed. It is a pure differential encoder without run length encoding. INCLUDE "constants.bas" MODE SCREEN_FB sound 5,0 ' Ensure ECS ROMs are mapped out. OPTION EXPLICIT ON DEF FN ExtractField(Bits) = FieldLen = Bits : Gosub ExtractField DIM FieldLen,#WordAdr,#MaxWordAdr,FieldOffset,NextFieldOffset,#Field #WordAdr = varptr #bitstream(0) #MaxWordAdr = varptr #bitstream_end(0) FieldOffset = 0 DIM Idx,#Output,Cmd #Output = 7 + 32*8 ' only for test, it should be 0 Idx = 0 Do Gosub ProcessNextCommand #BACKTAB(Idx) = #Output Idx = (Idx + 1) Loop While (Idx < 240) while (1):wend ' 3 bits for commands + variable lenght filed 'FBT ==Foreground,Backgrounf,Tile '000 = nothing has changed, repeat last backtab word '100 + 3 = 6 bits if foreground color changes '010 + 4 = 7 bits if background color changes '001 + 7 = 10 bits if tile number changes '110 + 7 = 10 bits if foreground and background change '101 + 10 = 13 bits if foreground and tile number change '011 + 11 = 14 bits if background and tile number change '111 + 14 = 17 bits if everything changes Const MSK_BTAB_FG_COL = &0000000000000111 Const MSK_BTAB_BG_COL = &0011011000000000 Const MSK_BTAB_PIC = &0000100111111000 Const MSK_GRAM_FLG = &0000100000000000 #BackGround: DATA $0000 ' BG_BLACK DATA $0200 ' BG_BLUE DATA $0400 ' BG_RED DATA $0600 ' BG_TAN DATA $2000 ' BG_DARKGREEN DATA $2200 ' BG_GREEN DATA $2400 ' BG_YELLOW DATA $2600 ' BG_WHITE DATA $1000 ' BG_GREY DATA $1200 ' BG_CYAN DATA $1400 ' BG_ORANGE DATA $1600 ' BG_BROWN DATA $3000 ' BG_PINK DATA $3200 ' BG_LIGHTBLUE DATA $3400 ' BG_YELLOWGREEN DATA $3600 ' BG_PURPLE ProcessNextCommand:procedure ExtractField(3) Cmd = #Field if Cmd and 1 then gosub foreground if Cmd and 2 then gosub background if Cmd and 4 then gosub tile end foreground: procedure ExtractField(3) #Output = (#Output and (not MSK_BTAB_FG_COL)) + #Field end background: procedure ExtractField(4) #Output = (#Output and (not MSK_BTAB_BG_COL)) + #BackGround(#Field) end tile: procedure ExtractField(7) #Output = (#Output and (not MSK_BTAB_PIC)) + (#Field and &111111)*8 + (MSK_GRAM_FLG and ((#Field and &1000000)>0)) end ExtractField: procedure ' input: FieldLen = number of bits to read (from 0 to 16) ' FieldOffset,#WordAdr,#MaxWordAdr = data start and data end pointers ' output: #Field value of the FieldLen bits extracted from the stream ' local variables: NextFieldOffset SIGNED NextFieldOffset if (#WordAdr < #MaxWordAdr) then NextFieldOffset = FieldLen+FieldOffset-16 ' bit offset in the next word #Field = peek(#WordAdr) / Pow2Table(FieldOffset) if (NextFieldOffset<=0) then ' all bits within the current word #Field = (Pow2Table(FieldLen)-1) and #Field else ' you need also bits from the next word #Field = #Field + ((Pow2Table(NextFieldOffset)-1) and peek(#WordAdr+1)) * Pow2Table(16-FieldOffset) end if FieldOffset = FieldOffset + FieldLen if (FieldOffset>15) then #WordAdr = #WordAdr + 1 FieldOffset = FieldOffset and 15 end if end if end ' Table of Powers of 2 (0..15) Pow2Table: DATA $0001, $0002, $0004, $0008, $0010, $0020, $0040, $0080 DATA $0100, $0200, $0400, $0800, $1000, $2000, $4000, $8000 DATA $0000 ' used for (2^16) - 1 ' Test sequences #bitstream: ' FEDCBA9876543210 DATA &0100001100000000 DATA &0100010100000000 DATA &1000110001110000 DATA &0000000000000000 DATA &0100001100000000 DATA &0100010100000000 DATA &1000110001110000 DATA &0000000000000000 #bitstream_end: Aside from the compression ratio, the main concern is the speed of the layer in charge of extracting bits... I think there is no practical application if the code of ExtractField stays in intybasic because of the speed of multiplications and divisions needed to shift bits inside the word stream. What do you think ? Can the code be made faster? I think only an ASM implementation, using shift instructions, could make it usable.
  14. I'm sorry I return on the topic but something strange is happening with varptr... This lines do not work, as intybasic keeps telling that the expression is not constant const #max_bit_index = (VARPTR #bitstream_end(0) - VARPTR #bitstream(0)) * 16 but it is very constant as the arrays are #bitstream: DATA &1001100110011001,&1001100110011001,&1001100110011001,&1001100110011001,&1001100110011001 #bitstream_end: Moreover, I spotted that randomly, if I use the minuscule varprt, sometimes it does not compile, telling that some brackets is odd #max_bit_index = (varprt #bitstream_end(0) - varprt #bitstream(0)) * 16 It is like varprt (in minuscule) sometimes is confused by a variable name....
×
×
  • Create New...