Shop OBEX P1 Docs P2 Docs Learn Events
TAQOZ - Tachyon Forth for the P2 BOOT ROM - Page 30 — Parallax Forums

TAQOZ - Tachyon Forth for the P2 BOOT ROM

1272830323338

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-28 09:14
    @MJB Well, fair enough, but I thought about trying it this way instead of starting a new line because I already had them laid out in tabular format more or less. Maybe it doesn't help readability but that's something I try and then let rest, and when I come back to it later I may get a distinct feeling about it then. I looked at creating a table of timing values and then having a routine to scan through it and match up to user resolution but that becomes inflexible. Having a named routine is far more flexible. But I'm concentrating on adding different color depths to this now as I would like to try out a logic analyzer and text editor in 1080p, and maybe a classic Mac like desktop!

    But I notice that everytime I knock on the forum door, I keep hear the sound of crickets. I know there are 100 P2 eval boards behind those doors, but I can't hear them. I left my TAQOZ box at the door, maybe somebody will stir and check the door.
  • MJBMJB Posts: 1,235
    edited 2019-07-28 12:42
    @"Peter Jakacki"
    would it be possible to have part of the screen in lower color mode than other?
    E.g. upper half 16 color - good enough for DSO / Signal displays
    lower half 4 color - enough for a text editor
    to get higher resolution but still enough colors for many applications
    (you will make it configurable anyhow ...)


    EDIT: example
    pub 768p	 1024 768 1 VRES =V65 ;                                            ---  786.4 kB, 393.2, 196.6, 98.3 kB
    
    so half screen 16 color = 196.6 kB
    plus half screen 4 color = 98.3 kB
    total = 294.9 kB leaves space for some program code ...


    moving towards TaqOS-P2PC ;-)

  • MJBMJB Posts: 1,235
    edited 2019-07-28 10:41
    RAM requirements added in listing in Bytes for 8, 4, 2, 1 bit color
    		*** VIDEO TIMING MODES ***
    ( 4:3 )
    pub 120p	 160 120 4 VRES : =VGA 25,175,000 VCLK 16 96 48 HSYN 10 2 31 VSYN ;   ---  19.2kB, 9.6, 4.8, 2.4kB
    pub 240p	 320 240 2 VRES =VGA ;                                         --- 76.8,  38.4, 19.2, 9.6 kB
    pub 480p	 640 480 1 VRES =VGA ;                                         --- 307.2 kB, 153.6,  76.8, 38.4 kB
    pub 600p	 800 600 1 VRES 40,000,000 VCLK 	   40 128 88 HSYN 1 4 23 VSYN ;  ---  480 kB, 240,  120,  60 kB
    pub 384p	 512 384 2 VRES : =V65 65,000,000 VCLK	24 136 160 HSYN 3 6 29 VSYN ;  --- 196.6 kB, 98.3, 49.2, 24.6 kB
    pub 768p	 1024 768 1 VRES =V65 ;                                            ---  786.4 kB, 393.2, 196.6, 98.3 kB
    
    ( 16:9 )
    pub 360p  640 360 2 VRES : =HD 74,250,000 VCLK 	72 80 216 HSYN 3 5 22 VSYN  ; --- 230.4 kB, 115.2,  57.6, 28.8 kB
    pub 720p  1280 720 1 VRES =HD ;   --- 921.6 kB,  460.8, 230.4, 115.2 kB
    pub 1080p  1920 1080 1 VRES 148,500,000 VCLK 	88 44 148 HSYN 4 5 36 VSYN ; --- 2073.6 kB, 1036.8, 518.4, 259.2 kB
    
    pub 1368x768p  1368 768 1 VRES 85,860,000 VCLK	72 144 216 HSYN 1 3 23 VSYN ; --- 1050.6 kB, 525.3, 262.7, 132.3 kB
    pub 1440x900p  1440 900 1 VRES 106,470,000 VCLK	80 152 232 HSYN 1 3 28 VSYN ; --- 1296kB, 648, 324, 162 kB
    
  • After I nail the resolution and color modes I was thinking of tiling for mono and also mixing compatible timings.

    The framework I have for setting modes and the locations etc are just mainly for testing as I'm sure that as I add things I can then organize it better. Still very early days because it's only been a few days :)
  • msrobotsmsrobots Posts: 3,701
    edited 2019-07-28 21:45
    Sorry for the crickets, I was busy with real work.

    I butchered some changes into Spin2Gui to create more buttons to click on, Now there is 'compile', 'load binary','compile & run' and I added 'compile with TAQOZVGA' and 'compile & run with TAQOZVGA'.

    I currently concentrate on with VGA, the without VGA version will follow soon.

    Hopefully I can spare some hours today to play, but real work is hitting hard, 7 days/week 12 hour shifts take their toll.

    Mike
  • Question, @"Peter Jakacki"

    I currently load TAQOZ.FTH DECOMP.FTH and AV.FTH

    In a post above you said TAQOZ.FTH and AV.FTH without DECOMP.FTH

    What is the right way to go?

    Mike
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-28 22:23
    msrobots wrote: »
    Question, @"Peter Jakacki"

    I currently load TAQOZ.FTH DECOMP.FTH and AV.FTH

    In a post above you said TAQOZ.FTH and AV.FTH without DECOMP.FTH

    What is the right way to go?

    Mike

    It's up to you but DECOMP is useful for debugging etc so it is really only useful when you are developing and testing code via a terminal. If you are using via the mailbox then there probably is no real need for it.

    However, there is so much room left, it "couldn't hoit". Maybe TAQOZ could be squeezed down to a 32k image if need be.
  • msrobotsmsrobots Posts: 3,701
    edited 2019-07-29 00:53
    msrobots wrote: »
    Question, @"Peter Jakacki"

    I currently load TAQOZ.FTH DECOMP.FTH and AV.FTH

    In a post above you said TAQOZ.FTH and AV.FTH without DECOMP.FTH

    What is the right way to go?

    Mike

    It's up to you but DECOMP is useful for debugging etc so it is really only useful when you are developing and testing code via a terminal. If you are using via the mailbox then there probably is no real need for it.

    However, there is so much room left, it "couldn't hoit". Maybe TAQOZ could be squeezed down to a 32k image if need be.

    what I was thinking off is to move the palette below $10000 so that the video memory starts a $10000 not $10400 just so a program loaded at $10000 just sits in the v-memory, but gets not overridden by palette changes.

    I still couldn't get mailbox+prog at $10000 running. $48800 works

    I have some time now and will do a run with your new version on my old monitors...

    results soon,

    and yeah I 'see' why I would like to keep DECOMP.FTH

    Mike
  • It's weird that you couldn't get the mailbox to work at that address since the palette doesn't change, it's only when you view a file or force a palette change. However I should be able to squeeze it up so that the screen buffer starts from $1.0000 since there is still a lot of room available and it is not at all difficult to move the dictionary to another area if we wanted to run a larger TAQOZ environment.
  • If I do not want to have VGA I set _VGACFG to 0, correct?

    Mike
  • That's correct just set it to zero and it will skip that step.
    		or	_VGACFG,#0 wz			' ignore VGA if no pins assigned (all zeros)
    	if_nz	coginit #vgacog,_VGAINIT
    
  • msrobotsmsrobots Posts: 3,701
    edited 2019-07-29 03:30
    OK started with fresh P2ES.spin2 and fresh copy of FORTH folder
    on line 2478 is a '}" to much, but then it compiles. 60224 bytes.
    I noticed you already moved bmporg to $FF00 so I could start at $48700? For now I stay at $48800 to be save.
    Boot TAQOZ from _BOOT_P2.BIX of SD
    TerraTerm - send file TAQOZ.FTH, DECOMP.FTH, AV.FTH
    TERRATEM - Paste
    $48.800 := incon
    $48.802 := outcon
    : GETCON ( -- char ) incon W@ DUP IF incon W~ THEN >B ;
    : SENDCON ( char -- ) BEGIN outcon W@ $101 = outcon W@ 0 = OR UNTIL outcon W@ 0 = IF $100 OR outcon W! ELSE DROP THEN ;
    : MBXCON ' GETCON ukey W! ' SENDCON uemit W! ;
    : EMBED flags C~ ' NOP uprompt W! ' NOP uaccept W! $CE REG W++ MBXCON ' MBXCON 1+ ' CON W! 63 PIN MUTE 62 PIN MUTE outcon 2 + 1 COGINIT ;
    AUTO EMBED BACKUP BIX
    copy _BOOT_P2.BIX back to PC as TQ_TAQOZVGA.BIN
    click 'compile & run with TAQOZVGA' in Spin2Gui'

    takes a while to load but runs. TV seems to sync, but no output yet.

    Now I send VGA -C64 CLS over the Mailbox and YES I do have some output on VGA, but non on console anymore.

    VGA seems to write command + result, but no linefeed, I guess I told it so with my embed command

    Tried CONVGA now output on VGA and Console, but ECHO back so command is displayed too.

    This is getting better and better, will try my old monitors if they sync too.

    attached binary - should run with 230_400 baud
    '
    ' TQ_Test.spin2
    ' compile with -H 0x10404 -E or -H 0x48804 -E depending on w or w/o VGA
    '
    CON
      oscmode = $010c3f04
      freq = 160_000_000
      baud = 230_400 
    OBJ
      ser: "FullDuplexSerial2.spin2"
      tqz: "TQ_DriverVGA.spin2"
    
    PUB demo | c
      clkset(oscmode, freq)
      ser.start(63, 62, 0, baud)
      'displayResponse
      ser.printf("\nrunning from $%x switched to_clkmode $%x _clkfreq %d - %dMhz\n", tqz#_MAILBOXIN+4, _clkmode, _clkfreq, _clkfreq/1000000)
      repeat
        ser.str(@menu)
        'ser.write(@menu, @entrynotvalid-@menu-1)
        c := ser.rx 
        case c
          49 : tqz.strCRflush("56 BLINK")
          50 : tqz.strCRflush("56 PIN MUTE")
          51 : tqz.strCRflush("57 BLINK")
          52 : tqz.strCRflush("57 PIN MUTE")
          53 : tqz.strCR("22 33 + .")
    	   displayResponse
          54 : ser.str(@prompt)
    	   ser.strin(@cmdline, 160)
    	   ser.printf("\nsending %s to TAQOZ\n", @cmdline) 
    	   tqz.strCR(@cmdline)
    	   displayResponse
          other : ser.str(@entrynotvalid)
    
    PRI displayResponse | c, w
      w := 30000
      repeat 
        if (c:=tqz.rxcheck)>-1
          w := 30000
          ser.tx(c)
          if c==13
            ser.tx(10)
        w--
      until w < 1 
    DAT
    menu	
    	byte	13,10
    	byte	"1 Test 1 - send 56 BLINK    - FLUSH RESPONSE",13,10
    	byte	"2 Test 2 - send 56 PIN MUTE - FLUSH RESPONSE",13,10
    	byte	"3 Test 3 - send 57 BLINK    - FLUSH RESPONSE",13,10
    	byte	"4 Test 4 - send 57 PIN MUTE - FLUSH RESPONSE",13,10
    	byte	"5 Test 5 - send 22 33 + .   - DISPLAY RESPONSE",13,10
    	byte	"6 Test 6 - send commandline - DISPLAY RESPONSE",13,10,0
    entrynotvalid	
    	byte	13,10
    	byte	"Entry not valid, try 1-6",13,10
    	byte	0
    prompt  byte	"enter cmd: " ,0
    cmdline byte	0[160],0
    

    Mike
  • cheezuscheezus Posts: 295
    edited 2019-07-29 11:07
    @"Peter Jakacki"

    TaqOZ has been a wonderful tool in my p2 toolkit. Although I still can't get my head around RPN it's been very helpful. I wish I was able to spend more time working for that eureka moment where things finally just make sense... I've been following your work and it's amazing. II just can't seem to understand how to leverage it at this time, other than for basic hardware testing. I DO use the ROM for testing, got a notepad document with some one-liners and stuff I can just copy-paste for basic sanity checking when I need to.

    Don't get discouraged, I've busy with my own things but I lurk this thread a lot in anticipation when I can leverage all this work a bit more.
  • OK @"Peter Jakacki",

    your change to the video driver did it, now all my monitors sync on your VGA, perfect.

    And starting at $10000 w/o VGA seems to work too, very nice.

    Now I need to dig into AV.FTH and try to understand what goodies you can offer for a BASIC/C/SPIN/PASM user. This is quite a challenge to me, but hopefully worth it.

    Same goes for SD access, that will work for both versions.

    I have basically solved the connection between TAQOZ and FastSpin, so If @ersmith agrees, we can welcome TAQOZ as new member in Eric's Compiler Collection called FastSpin.

    Enjoy!

    Mike
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-30 04:08
    Here's a couple of photos of the screen with one in the default mode of 640x480x8 and viewing a BMP file while I maintain a terminal on the bottom few lines, and then switching to 1920x1080x1 to test that the system adapts and that I can render text and line graphics etc. Obviously I can't view BMP files but I will play with some classic MAC like icons. This is where I need to start interfacing the mouse and mouse pointer.
    There's a small bug in my vertical scaling routine for the scaled resolutions now that I have 1080p working, so I will look at this next.

    Last photo is a closeup of the 1080p screen.BTW, this is a small monitor TV so it is not as crisp as my 4k monitor.
    3680 x 2137 - 613K
    4080 x 2176 - 1M
    3734 x 2023 - 1M
  • kwinnkwinn Posts: 8,697
    msrobots wrote: »
    OK @"Peter Jakacki",

    your change to the video driver did it, now all my monitors sync on your VGA, perfect.

    And starting at $10000 w/o VGA seems to work too, very nice.

    Now I need to dig into AV.FTH and try to understand what goodies you can offer for a BASIC/C/SPIN/PASM user. This is quite a challenge to me, but hopefully worth it.

    Same goes for SD access, that will work for both versions.

    I have basically solved the connection between TAQOZ and FastSpin, so If @ersmith agrees, we can welcome TAQOZ as new member in Eric's Compiler Collection called FastSpin.

    Enjoy!

    Mike

    FastSpin is becoming a bit of a multi-language ecosystem.
  • yes, cool, isn't it?

    Mike
  • kwinnkwinn Posts: 8,697
    msrobots wrote: »
    yes, cool, isn't it?

    Mike

    Yes, cool indeed.
  • OK @"Peter Jakacki" I need your help again, getting closer.

    The current image I use for with VGA has the pins defined in _VGACFG. For the non VGA version I just set this to 0. For the VGA version I leave your $03020100 working on the ES.

    This is not really nice, I would like to kill that and set _VGACFG to 0 while booting and loading and allow the user program to select the pins for VGA COG7 to do its job.

    Am I correct if I set _VGACFG to 0 in the image so that nothing gets started at boot-time, and then send what exactly to start VGA with given pins at HUB $10000 with the smallest HUB memory so I have the rest of memory at $48800 or $48700 since you moved bmporg to $FF00.

    This is working very nice right now an I would like to seriously finish the integration. But I need to set the used pins for VGA before starting COG7 somehow.

    Help needed

    Mike
  • Just set vgacfg from your code or via TAQOZ and run the VGA cog with 0 @VGA 7 COGINIT from TAQOZ. But if you want to start from outside of TAQOZ then you will also need to locate the address of the VGA driver but you can read this from location $28.
    00020 008 03020100 _VGACFG		long	$03020100		' VRGBH pins '
    00024 009 00000004 		long	4
    00028 00a 00000c48 _VGAINIT	long	@vgainit		' VGA code '
    0002c 00b 1423d700 _VGASET		long	round(fset)
    
  • msrobotsmsrobots Posts: 3,701
    edited 2019-07-31 11:07
    so it would be

    $03020100 _VGACFG W! 0 @VGA 7 COGINIT <CR>

    to send via Mail Box, am I near?

    Mike
  • Yes, but perhaps that can just be added to the dictionary as VGAUP or something short?
  • MJBMJB Posts: 1,235
    msrobots wrote: »
    so it would be

    $03020100 _VGACFG W! 0 @VGA 7 COGINIT <CR>

    to send via Mail Box, am I near?

    Mike

    near - but not exactly

    $03020100 is a LONG so you store with ! not W!

    if _VGACFG is in the dictionary
    otherwise you can probably reach it via @VGA if you know the offset
    which you can look up in the code

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-31 21:33
    My bad, the address is $20 for vgacfg and you need to store a long with ! not W!
    @VGA only returns the hub address of a long in the vga driver from an index. So an index of 0 is the start address but you can also find this by reading the config table at hub address $28.
  • so it will be

    $03020100 $20 ! 0 @VGA 7 COGINIT <CR>

    to set the existing vga at 3-0 yes/no/cancel?

    Mike
  • Yes
    The parameter at address $20 is read by the vga code.
  • the current P2ES.spin2 image I use does already start VGA at 3-0 and I need to send "VGA CON" <CR> once and then I can use "xxx VEMIT" <CR> to TX out to VGA.

    works nicely, but in AV.FTH I stumbled over PEN what looks like a word to change BG and FG color of the displayed text, how I would use this?

    next thing I am searching for is to set the current cursor position so that I could do something like

    tqz.pos(x,y)
    tqz.str("Hey Mike")

    the tqz.str() part is already working, I use erics include so I even have tqz.printf() working for VGA I just need some oneliner for tqz.pos(x,y) on VGA. And one for changing Color. That would sum up the TEXT part.

    The bitmap part needs more of the goodies TAQOZ offers, I have not really looked at it, yet. But I stumbled over video and audio and gosh there is a lot in AV.FTH what I do not understand at all.

    Step by step.

    Mike
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-07-31 23:42
    The high level VGA driver needs to initialize too but I like to do that automatically the first time that the VGA word is invoked, which is why the VGA CON thing is necessary when you are trying to access the VEMIT primitive directly.
    pub VGA     vcold W@ $A55A <> IF 100:100 vint W! -MONO VHOME CLRSCR $A55A vcold W! THEN
    

    If you can follow the code from VEMIT it drops down into VCH and then VCH8 for 8bpp text (just scrunched onto one line for posting)
    pub VCH8	col @ row @ cols W* + SCR +	PAPER@ WRCH ( font' screen' pen.paper  -- )	;
    

    So VEMIT ends up using col and row variables but you can set these directly with VXY. To set dead center of a VGA screen: 320 240 VXY
    pub VXY    ( x y -- )	row ! col ! ;
    

    For any line graphics or plotting just use the words x y w h to set the x and y origin as in top left-hand corner and w for width and h for height. To draw a rectangle from the center of the screen for 200 pixels wide by 100 pixels high:
    320 x 240 y 200 w 100 h RECT
    
    Note that text and graphics will use the current pen and paper, that's what the PEN and PAPER words are for, like this:
    blue PEN white PAPER
    
    PLOT requires 3 parameters, the color, x, and y. To plot a line manually here's a demo:
    480 FOR white I I PLOT NEXT
    
    Try it and you will see what it does but try substituting "white" with I, the current loop/next index.

    NOTE: perhaps now's the time for me to clean up this code and standardize things a bit better since I have some words that use the current pen, and others where you need to supply the pen color. So ideally PLOT would just have x and y and use the current pen. PEN and PAPER are much better than the long foreground and background words and better than the FG BG abbreviations. I am using a red pen rather than $E0 FG :)

  • msrobotsmsrobots Posts: 3,701
    edited 2019-08-01 00:44
    OK so my tqz.pos(x,y) will look like this in Spin
    PUB pos(x,y)
       tq_dec(x)
       tq_tx($20)
       tq_dec(y)
       tq_strCR(" VXY")
    

    looks good to me. I still use the image already running VGA but just to be sure a
    PUB startVGA(pins)
       tq_dec(pins)
       tg_strCR(" $20 ! 0 @VGA 7 COGINIT")
    
    would do it, right? If pins is a long defined as $03020100 or whatever, I do not need to give it as HEX to TAQOZ, right?

    and can I use "_VGACFG" instead of $20 to keep it more readable,?

    sorry to bother you with this stuff, but I need to do this right so it will not mess up later.

    Since strings are expensive in Spin I would like to use numbers for colors, not "BLUE" so this is different from " I am using a red pen rather than $E0 FG "

    So PEN and PAPER have arguments as numbers, how are they organized? Indexes into the Palette as 0-15 or what? I really try but have a hard time to understand the code you wrote. But I do understand more and more.

    And since I am bothering anyways how could I present SD access in a non FORTH style to users, the classic way would be something like OPEN, SEEK, READ, WRITE, CLOSE

    But FastSpin does support streams so I am not sure yet if this would be sufficient. Need Eric's advice here.

    I am just a CodeMonkey trying to connect those two worlds in a sensible manner.

    so setcolor would be
    PUB setColor(fg, bg)
       tq_dec(fg)
       tq_str(" PEN ")
       tq_dec(bg)
       tq_strCR(" PAPER")
    
    right? wrong?

    Mike
  • Hi Peter,
    I was always facinated by forth. But I seem to be too simple minded to read the source code easily. :-(
    Some time ago I dicovered, that there is the feature of local named variables in forth, which improve the readability very much. You could as well say, it makes documentation very much more easy.
    Yes, I know, a real forth crack does not need local variables.
    Is there support or will there be support for local variables in Tachyon?
    Regards, Christof
Sign In or Register to comment.