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

TAQOZ - Tachyon Forth for the P2 BOOT ROM



  • roglohrogloh Posts: 5,106
    edited 2018-12-05 23:06
    Cool. I just wouldn't want to see something get into the next P2 ROM that is always off by one pixel, in case your VGA driver makes it in anyway.

    I guess you are just trying to fit 106 columns into 640 pixels, using your 5x7 font. Maybe 2+3 pixels is a good margin either side to centre it, though after the last character it needs some special treatment at the end of the line to clear the following pixels. I think you are just ending it right on the last character's last pixel, maybe for simplification. For a text mode 104 columns might be a good number too being divisible by 8, which works well for tabs. But maybe what you have was more for a graphics mode anyway given you can overlay coloured blocks onto it, in fact I'm not really sure what type of driver you have actually.
  • You're right, it is a bit rough and ready and I haven't done any work on it since I got it up and running. Seeing I have a real chance now of fitting this and the font table into ROM by storing TAQOZ as a compressed image, I should make sure it is working correctly and optimised.

    I just adapted the VGA code and allowed the palette and intensity to be updated on every frame as well as maintaining a frame count which can be used for synchronous and counted frame updates if needed.

    Here's the current VGA code and some other snippets:
    '*  VGA 640 x 480 x 8bpp-lut  *
    ' PBJ: 181022 Adapted for TAQOZ
    vsync		= 4
    intensity	= 120				'0..128
    bmpint		= $0				' 256 byte header - mostly free but top half may have bmp header written'
    hcnt		= $4
    vcnt		= $6
    bmppal		= $100
    bmppic		= $500
    fclk		= float(CPUHZ)
    fpix		= 25_000_000.0
    fset		= (fpix / fclk * 2.0) * float($4000_0000)
    DAT		org
    		call	#loadpal
    		rdfast	##640*480/64,##bmporg+bmppic 'set rdfast to wrap on bitmap
    		setxfrq ##round(fset)		'set transfer frequency to 25MHz
    		'  cmod   65_4_321_0'		' VGA
    		setcmod	#%01_0_000_0		'enable vga colorspace conversion
    		wrpin	dacmode,#0		'enable dac modes in pins 0..3
    		wrpin	dacmode,#1
    		wrpin	dacmode,#2
    		wrpin	dacmode,#3
    		dirh	#0			' silicon needs dir set to enable smartpin'
    		dirh	#1
    		dirh	#2
    		dirh	#3
    ' Field loop
    field		mov	x,#33			'top blanks
    		call	#blank
    		mov     x,#480			'set visible lines
    line		call	#hsync			'do horizontal sync
    		xcont	m_rf,#0			'visible line
    		djnz    x,#line           	'another line?
    		mov	x,#10			'bottom blanks
    		call	#blank
    		drvnot	#vsync			'sync on
    		mov	x,#2			'sync blanks
    		call	#blank
    		drvnot	#vsync			'sync off
    		call	#loadpal		' continually update palette in case it has changed'
                    jmp     #field                  'loop
    ' Subroutines
    blank		call	#hsync			'blank lines
    		xcont	m_vi,#0
    	_ret_	djnz	x,#blank
    hsync		xcont	m_bs,#0			'horizontal sync
    		xcont	m_sn,#1
    	_ret_	xcont	m_bv,#0
    ' Load palette from hub into lut '
    loadpal		mov	x,#0
    		rdfast	#0,##bmporg+bmppal 	'load .bmp palette into lut
    		rep	@.end,#$100		' 256 colors
    		rflong	y
    		shl	y,#8
    		wrlut	y,x
    		add	x,#1
    		rdbyte	x,##bmporg+bmpint	' update intensity'
    		shl	x,#8
    		setcq	x
    		shl	x,#8
    		setci	x
    		shl	x,#8
    		setcy	x
    		add	_vcnt,#1		' increment frame count'
    		wrword	_vcnt,##bmporg+vcnt
    ' Initialized data
    '			 1098_7654_321_0987654321098_76_54321_0
    dacmode		long	%0000_0000_000_1010000000000_01_00000_0+vgacog<<8
    ' $CF00 = output X3, X2, X1, X0 on all four DAC channels'
    m_bs		long	$CF000000+16		'before sync  %1100_dddd_eppp_xxxx <long> 32-bit immediate
    m_sn		long	$CF000000+96		'sync
    m_bv		long	$CF000000+48		'before visible
    m_vi		long	$CF000000+640		'visible
    m_rf		long	$7F000000+640		'visible rflong 8bpp lut
    x		res	1
    y		res	1
    _vcnt		res	1

    There is one TAQOZ support word in the cog that draws the 5x7 character:
    ' WRCH ( font screen pen.paper )'
    WRCH		mov	r0,tos
    		shr	r0,#8		' r0 = pen, tos = paper'
    		mov	ptrb,tos1
    		mov	r1,#7
    wrch1		rdbyte	fx,tos2		' read in next font char
    		mov	r2,#6
    		rep	@wrchx,#5
    wrch2		shr	fx,#1 wc
      	if_c	wrbyte	r0,ptrb++
    	if_nc	wrbyte	tos,ptrb++
    wrchx		wrbyte	tos,ptrb++
    		add	ptrb,##640-6
    		add	tos2,#1
    wrch3		djnz	r1,#wrch1
    		jmp	#DROP3

    These are the terminal routines in TAQOZ:
    96 7 * TABLE FONT5X7
    FONT5X7 $20 7 * -	:= FONT5X7A
    10 	:= lsp	--- line space constant'
    6	:= csp	--- character space constant 
    --- User commands to change line and character spacing 
    : LSP ( n -- )	' lsp :=! ;
    : CSP ( n -- )	' csp :=! ;
    long col
    long col1
    long row
    long row1
    byte vflg	--- 0= noscroll
    byte _scrolls
    '' bytes/line of text
    : b/l ( -- bytes )	cols lsp W* ;
    --- setup _scr to point to screen at current row and column
    pri @RC 		col @ row @ cols W* + SCR + scr' ! ;
    pub VXY    ( x y -- )	row ! col ! ;
    pub VXY>		col1 @ row1 @ VXY ;
    pub >VXY		col @ col1 ! row1 @ row1 ! ;
    --- Set how many rows the terminal will use where 0 = all 
    pub NS			0
    pub TERM ( lines -- )	rows lsp / MIN _scrolls C! 0 rows lsp - VXY csp ' lm :=! ;
    pri VHOME		0 TERM 0 0 VXY 480 lsp / _scrolls C! ;
    pri SCROLL
    	_scrolls C@ IF SCR SCRSZ + b/l _scrolls C@ W* - DUP b/l + SWAP b/l _scrolls C@ 1- W* 4/ LMOVE THEN
    	SCR SCRSZ + b/l - b/l PAPER@ FILL
    	lsp NEGATE row +!
    pri NEWLINE
        lm col !
        lsp row +!
        row @ lsp 1- + rows => IF SCROLL THEN
    --- draw a 5X7 font character
    pub VCH ( char -- ) --- 8.750us @300MHZ
    	7 W* FONT5X7A +
    	col @ rm => IF NEWLINE THEN
    	col @ row @ cols W* + SCR +
    	WRCH ( font' screen' pen.paper  -- )
    	csp col +!
    : BELL ;
    --- make the VGA display the current output device
    pub VGA
    pub VEMIT ( ch -- )
        DUP 32 <
          $00 CASE BREAK
          $01 CASE VHOME BREAK
          $07 CASE BELL BREAK
          $08 CASE col @ lm <> IF csp NEGATE col +! THEN BREAK
          $09 CASE  BEGIN 32 VCH col @ 7 AND 0= UNTIL BREAK
          $0D CASE lm col ! BREAK
          CASE@ ( unknown control - display as character )
  • octettaoctetta Posts: 123
    edited 2018-12-18 03:47
    Peter (or others in the know), do you know if Taqoz can work using the spinsim program?
    I'm ashamed to admit I don't know how to build Taqoz with the existing toolchains.
  • I've been trying to change clock from 20 MHz to 80 Mhz with no joy. I'm using the new eval board.


    80 M CLOCK



    Any guidance?


  • jmgjmg Posts: 15,140
    edited 2018-12-23 19:40
    ctwardell wrote: »
    I've been trying to change clock from 20 MHz to 80 Mhz with no joy. I'm using the new eval board.


    80 M CLOCK



    Any guidance?
    I think default SysCLK is RCFAST ~ 20MHz(min), and to go faster needs the PLL enabled.
    The PLL needs to know the Crystal settings, as well as the 3 divider options, so I think there is no simple 3 word SysCLK change, but Taqoz should be able to set PLL, given the params.

    A search finds this TAQOZ PLL example

  • RaymanRayman Posts: 13,699
    edited 2018-12-23 19:59
    See cluso’s 1080p example...
  • Thanks jmg and Rayman, I'll follow those leads.


  • Here is some code you can paste into TAQOZ that will allow you to select either the P2D2 or P2-ES boards. Just type either one in and then CRUISE to switch to 180MHz. The default baud rate has been set to 115200 baud to suit slow terminals but if you are using some other baud rate then just enter this on the same line before switching frequency like this:

    The P2-ES word will spec the XIN as 20MHz crystal and CRUISE simply says "180 P2MHZ". Other preset words you can clearly see in the source.

    This code works on the P2D2 so hopefully the P2-ES part works too. I set my terminal to a 3ms line delay.
    use this version to extend TAQOZ V1.0 in ROM
    P2-ES uses 20MHz crystal
    $1FA := DIRA
    $1FB := DIRB
    $1FC := OUTA
    $1FD := OUTB
    $1FE := INA
    $1FF := INB
    long _baud 115200 _baud !
    : CONBAUD	DUP _baud ! 63 PIN DUP RXD 62 PIN TXD ;
    ---	 1098_7654_321098_7654321098_7654_32_10
    long _clk
    : RCSLOW	1 HUBSET _clk ~ ;
    : RCFAST	0 HUBSET _clk ~ ;
    --- set the clock mode
    : CLKSET 	_clk @ HUBSET ;
    ( PLL should run between 100 to 200MHz )
    : CLK! ( data mask -- )	_clk @ SWAP ANDN OR _clk ! ;
    : PLLEN		24 |< _clk SET ;
    : PLLOFF	24 |< _clk CLR ;
    : XIDIV ( 1..64 -- ) 	1- $3F AND 18 << $00FC0000 CLK! ;
    ( ends up as multiply)
    : VCOMUL ( 1..1024 -- ) 1- $3FF AND 8 << $3FF00 CLK! ;
    --- Divide the PLL by 1 2 4 6 ... 30 for the system clock when SS = %11
    : PLLDIV ( 2..30 -- ) 	2/ 1- $0F AND 4 << $0F0 CLK! ;
    : USEPLL 	3 CLKSRC ;
    : CC		3 AND 2 << $0C CLK! ;
    : 15PF		2 CC ;
    : 30PF		3 CC ;
    : 0PF		1 CC ;
    : XPF		0 CC ;
    12,000,000	:= _xin		--- P2D2
    : XIN		' _xin 2+ ! ;
    --- Set P2 CLOCK to selected MHZ ( simple PLL settings only )
    : CLOCK ( HZ --- )
    	' CLKHZ 2+ !
    	_xin @ 20,000,000 =
    	IF ( P2-ES )
    	  15PF PLLEN 1 XIDIV
    	  30PF PLLEN _xin 1,000,000 U/ XIDIV CLKHZ
    	  1,000,000 U/ VCOMUL 1 PLLDIV USEPLL
    	_baud @ CONBAUD
    --- setup for P2-ES instead
    : P2-ES		20,000,000 XIN ;
    : P2D2		12,000,000 XIN ;
    : SLOW		40 P2MHZ ;
    : ECO		80 P2MHZ ;
    : CRUISE	180 P2MHZ ;
    : TURBO		240 P2MHZ ;
    : HYPER		320 P2MHZ ;
    \ ' 12-bit analog to digital to analog, 19.5k samples/second
    pub DAC ( bits -- )	%101000000000001000110 WRPIN |< WXPIN L ;
    pub ADC12
    	@PIN DUP 1+ PIN %100011000000000000000 WRPIN
      	PIN %10000000000000000000000011000 WRPIN 4096 WXPIN L
    : .CLK
    	CLKHZ 1 M // 0=
     	IF CLKHZ 1 M U/ . ." MHz" ELSE CLKHZ .DECL ." Hz" THEN
    : .LAP
    	LAP@ LAP LAP LAP@ -
    	( cycles/clkhz )
    	DUP .DECL ."  cycles = "
    	1,000,000 CLKHZ 1000 U/ */  ( scale cycles to nanoseconds )
    	.DECL ." ns @" .CLK
    \ fibonacci - iterative method - but skip test for n = 0
    : fibo ( n -- f )  	0 1 ROT FOR BOUNDS NEXT DROP ;
    : fibos  1 46 ADO CRLF ." fibo(" I . ." ) = " LAP I fibo  LAP .LAP ."  result =" . 5 +LOOP ;
    : .fibo  CRLF ." fibo(" DUP . ." ) = " LAP  fibo  LAP .LAP ."  result =" .  ;
  • ctwardellctwardell Posts: 1,716
    edited 2018-12-23 22:00
    I think there may be a bug in TAQOZ binary input when 8 nibbles are entered separated by . or _

    I can enter up to 7 nibbles with no issue, but 8 fails.


    TAQOZ# %1111_1111_1111_1111_1111_1111_1111 ok
    TAQOZ# %1111_1111_1111_1111_1111_1111_1111_1111 ok
    TAQOZ# %11111111111111111111111111111111 ok
    TAQOZ# .S
    DATA STACK (3)
    1 $FFFF_FFFF -1
    2 $C71C_71C7 -954437177
    3 $0FFF_FFFF 268435455 ok

    Easy enough to work around, but could be easy to trip on.


  • Yes, the word input buffer only takes up to 37 characters which is normally way more than enough except for full 32-bit binary with separators on every nibble. Of course that is easy enough to increase in the next ROM :)
    TAQOZ# %11111111.00000000_10101010_01010101 .l $FF00_AA55 ok
    TAQOZ# %1111.1111.0000.0000_1010_1010_0101_0101 .L $5CA2_9F92 ok

    Have a look at the code I posted as it is much easier to set the clock rate with that plus it also sets the baud rate to match.
  • ctwardellctwardell Posts: 1,716
    edited 2018-12-23 22:48
    Thanks Peter, I'll give it a go.


    - Edit -

    I get an "error in .LAP..." if I attempt to load the code above as-is. I tried in both Tera Term and Putty.
    If I remove the code from "\ ' 12-bit analog..." through END it compiles with no errors and the speed commands work as expected.
    Thanks for the help on this, I appreciate it!
  • jmgjmg Posts: 15,140
    edited 2018-12-24 01:10
    Here is some code you can paste into TAQOZ that will allow you to select either the P2D2 or P2-ES boards. ...

    Now there are P2-ES boards in the wile, can you start a new thread that covers TAQOZ ROM in P2-ES, with some simple bring-up tests users can do ?

    I guess the very first bring-up step, is apply power and see what LEDs illuminate

    Then what string to send to verify PC connection, eg - I think this is minimal echo
    ;  '> Prop_Chk 0 0 0 0 '
    ;                      ^-> P2 Loader: CR+LF+'Prop_Ver A'+CR+LF     
    ; Echo in HEX : 0D 0A 50 72 6F 70 5F 56 65 72 20 41 0D 0A
    ; 19 Chars out, 14 chars echo back
    ; LEDs TX & RX flash, as do P63 & P62

    Then, how to jump into and out of TAQOZ, and the simplest Pin-toggle commands supported by the ROM TAQOZ.

    eg I found this in a thread,
    TAQOZ# 59 PIN 40 MHZ ok
    but I think that one might not be in the ROM as shipped ?
  • You get a board jmg? Having traveled all this way with us and all.
  • JonnyMacJonnyMac Posts: 8,888
    edited 2018-12-25 07:58
    Tried a simple demo on the P2 Eval board
    It runs (P63 LED blinks), but I get no response from the console after. Tried ESC 4x; no luck. Tried ^C and ^Z -- no luck. Am I doing something wrong?
  • Normally P63 is serial RX, so there would be some contention in turning it into a transmitter, and certainly it wouldn't be listening to serial commands since the direction has changed

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-12-25 13:31
    P63 is serial receive and you wouldn't normally ask dedicated pins like these to blink. Once you do you have changed the pins smartpin mode from serial receive over to nco counter and of course you will be unable to talk to TAQOZ after that. I'm guessing that the P2 will be contending with the FT232 but the P2 probably has stronger drive to be able to pull the pin low. (Or maybe the Christmas punch is stronger? :)

    Not having a board yet I didn't even think about the pin numbers that were being used for LEDs but of course those pins are used by the serial port and Flash/SD. Great for monitoring those pins but not real great for exercising. Maybe we just need more punch! :)
  • JonnyMacJonnyMac Posts: 8,888
    edited 2018-12-26 00:15
    Okay -- makes sense. I saw 31 as RX, but that is P31 on OUTB (which is P63). I am going to tear into the docs and start learning this thing properly tomorrow.
    Not having a board yet I didn't even think about the pin numbers that were being used for LEDs but of course those pins are used by the serial port and Flash/SD. Great for monitoring those pins but not real great for exercising. Maybe we just need more punch! :)
    They're on the board and convenient -- so I put them to use. I didn't want to connect anything yet. I will probably layout a simple attachment board for the P2 Eval that will let me play with IO without disrupting the serial, SPI, or uSD pins. Merry Christmas!
  • JonnyMac wrote: »
    Okay -- makes sense. I saw 31 as RX, but that is P31 on OUTB (which is P63). I am going to tear into the docs and start learning this thing properly tomorrow.

    Merry Christmas!

    I'm still getting used to it too. You know when I did the TAQOZ version of your scanner I didn't even think about those pins being part of the boot and serial, doh!
  • @Peter,
    In the nubie thread you posted:
    "To blink P58 in software vs smart pin mode you can do this:
    BEGIN 58 HIGH 100 ms 58 LOW 100 ms AGAIN 
    It's just an endless loop which you could also assign another cog to run in the background"

    In the TAQOZ documentation I see coginit and the other P2 cog words listed, but no examples. (I realize that the documentation is a work in progress that needs to be fit into all the other work you are doing -- including answering questions.) But how do you use coginit to assign a cog to run specific code? Once that code is running, can parameters be passed from the cog that communicates with Teraterm to the other cog? If so how?

    Second topic: If I want to read the voltage from 2 potentiometers (a joystick) using the ADC Smartpin mode, how would I do that in TAQOZ?

    I appreciate your help
  • jmgjmg Posts: 15,140
    Another quick demo on P2 of P2 to generate a 10% PWM with a resolution of 1,000 counts with minimum clock division.
    TAQOZ# 2 PIN 100 1000 1 PWM  ok

    When I try
    '16 PIN 100 10000 1 PWM',$0D
    that works almost as expected, but the PWM frequency measure 1152~1153Hz, which seems half what the 23MHz RCFAST should be giving.
    Is there some inbuilt /2 in that mode somewhere ?

    RCFAST seems to have around 784ppm of jitter.
  • jmgjmg Posts: 15,140
    I also see the PWM command is not starting cleanly, see the scope capture here - eventually, it 'gets going' right, but apart from the off-by-2 on timing, it has a wide initial pulse & delay.
    1478 x 793 - 67K
  • @"Peter Jakacki" - If I use the 'CRUISE' word from the extended .FTH file in your signature, I am not able to MOUNT/DIR my SD card with the clock in the high speed mode. Is there some other word that needs to be used to reset the SPI speed with the higher clock speed?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-12-27 02:05
    Assuming you set the mode to P2-ES then CRUISE will only be 180MHz and the SD works fine even at over 300MHz. But i haven't tested this on the ES where the card is much further away. Can anyone else check this also? I use Sandisk Ultra.
  • I am on holiday travel so I only brought 1 random uSD card with me to play with with my ES board. I have a brand new SanDisk Ultra sitting on my desk along with a couple other brands and speed ratings that I can test on Friday.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-12-27 05:41
    Although TAQOZ in ROM is mostly fine and you can extend it easily enough, I have been working on the new version every since I had real chips. The new version assumes it will be decompressed into RAM at startup so not only can I pack a lot more into there, I also don't have to worry about the memory map. Well, not quite true as the ROM version is unsuitable for saving an image to the SD because of overwriting of the boot areas but this is all fixed in the current version. It also allows for easy custom configurations with different clock options and hardware options.

    Here I am just testing out the WIZnet W5500 part of my EASYNET servers and they run very nicely on silicon. Next I will add the modified server layer and test that out. This version is saved on SD card as a 128kB _BOOT_P2.BIX file. If anyone wants to try it out on their P2D2 they can and also hookup VGA and PS/2 keyboard since this is running in conjunction with the serial console. In fact the function keys are easily setup as shortcuts that execute a TAQOZ function like this:
    pub :FC		ls ; --- define F12 key
    pub :FB		DIR ; --- F11
    pub :F5		" SPIDEY" VIEW$ ;
    pub :F6		" MCQUEEN" VIEW$ ;

    _BOOT_P2.BIX for TAQOZ V1.1 with VGA, PS/2 and WIZnet etc.

    You can copy the attached file onto your uSD card and your P2D2 will boot up at 180MHz (stays cool) and is running VGA. To switch over to the PS/2 and VGA console while still running serial in parallel just type P2PC. I will include some more information soon about the config section that can be changed to suit the P2-ES etc.
    TAQOZ# ifconfig 
    LINK *UP*
    HARDWARE: P2D2 using WIZnet W5500 V4
    SRC IP
    MAC       02.FF.50.AD.00.21.
    TAQOZ#   ok
    .SDSL08G 6040_FA40 P2D2       4k 7,576M
      0: P2D2         $0000_9640   2018.   ................   0
      1: _BOOT_P2.BIN $0000_9758   2018.   ................   524,288
      2: _BOOT_P2.BIX $0000_9658   2018.   X...P2D2F   ....   131,072
      3: _BOOT_P2.BIB $0000_9B58   2018.   ................   262,144
      4: BEACH   .BMP $0000_9D58   2018.   BMZ.......Z...l.   308,314
      5: SPIDEY  .PNG $0000_9FB8   2018.   .PNG........IHDR   124,697
      6: SPIDEY  .GIF $0000_A0B0   2018.   GIF89a..........   145,609
      7: SPIDEY  .BMP $0000_A1D0   2018.   BMz.......z...l.   308,346
      8: MCQUEEN .BMP $0000_A430   2018.   BMz.......z...l.   308,346
      9: EYEGOD  .BMP $0000_A690   2018.   BMz.......z...l.   308,346
     10: SUNSET  .BMP $0000_A8F0   2018.   BMz.......z...l.   308,346
     11: FACE    .BMP $0000_AB50   2018.   BMz.......z...l.   308,346
     12: TIGER1  .BMP $0002_7EB0   2018.   P2D2       .....   77,946
     13: TIGER   .GIF $0000_AE50   2018.   P2D2       .....   1,251,197,815
     14: TIGER   .JPG $0000_B038   2018.   P2D2       .....   133,590
     15: TIGER   .PNG $0000_B140   2018.   P2D2       .....   1,251,197,815
     16: P2D2         $0000_9640   2018.   w..J8.2.......J.   1,251,197,815
     17: _BOOT_P2.BIN $0000_9758   2018.   P2D2       .....   1,251,197,815
     18: _BOOT_P2.BIX $0000_9658   2018.   w..J8.2.......J.   1,251,197,815
     19: _BOOT_P2.BIB $0000_9B58   2018.   w..J8.2.......J.   1,251,197,815
     20: BEACH   .BMP $0000_9D58   2018.   w..J8.2.......J.   308,314
     21: SPIDEY  .PNG $0000_9FB8   2018.   w..J8.2.......J.   1,251,197,815
     22: SPIDEY  .GIF $0000_A0B0   2018.   w..J8.2.......J.   1,251,197,815
     23: SPIDEY  .BMP $0000_A1D0   2018.   w..J8.2.......J.   1,251,197,815
     24: MCQUEEN .BMP $0000_A430   2018.   P2D2       .....   1,251,197,815
     25: EYEGOD  .BMP $0000_A690   2018.   w..J8.2.......J.   1,251,197,815
     26: SUNSET  .BMP $0000_A8F0   2018.   w..J8.2.......J.   1,251,197,815
     27: FACE    .BMP $0000_AB50   2018.   w..J8.2.......J.   308,346
     28: TIGER1  .BMP $0002_7EB0   2018.   w..J8.2.......J.   1,251,197,815
     29: TIGER   .GIF $0000_AE50   2018.   w..J8.2.......J.   1,251,197,815
     30: TIGER   .JPG $0000_B038   2018.   w..J8.2.......J.   1,251,197,815
      Parallax P2  .:.:--TAQOZ--:.:.  V1.1--RAM          181216-1800
    TAQOZ#   ok

    BTW, I have a just added a new bug in my DIR which I noticed so I will have to fix that up (not showing the file content header properly etc).

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-12-27 07:42
    Fired up my ES I just received and didn't have any problems switching to 360MHz. Tried a 10% PWM at 1.8MHz rate too!

    Here's my terminal dump where I load TAQOZ-EXTEND.FTH then backup to serial Flash (enabled), change to 360MHz but forgot to set the P2-ES, tried again, restored the extensions with a ^R and ran some tests. BTW, using SAW instead of PWM gets me a 3.6MHz waveform so I guess the default PWM mode should be sawtooth (oops).
    Cold start
      Parallax P2  .:.:--TAQOZ--:.:.  V1.0--142          180530-0135
    ----------------------------------------------------------------  ok
    ----------------------------------------------------------------  ok
    ----------------------------------------------------------------  ok
    TAQOZ#   ok                                                 
    TAQOZ#   ok                                                 
    TAQOZ# TAQOZ   Parallax P2  .:.:--TAQOZ--:.:.  V1.0--142          180530-0135
    94 lines and 726 bytes compiled,  with 0 errors in 399ms  ok
    TAQOZ#   ok                                                 
    TAQOZ# .SF $EF70_1800 $DB35_4829_$E468_5835 ok              
    TAQOZ# BACKUP  ok                                           
    TAQOZ#   ok                                                 
    TAQOZ# $F.0000 $20 SF DUMP                                 
    000F_0000: FF FF FF FF  54 41 51 4F  FF FF FF FF  A3 09 A3 09     '....TAQO........'
    000F_0010: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00     '................' ok
    xAQOZ# 360 P2MHZ 
      Cold start
      Parallax P2  .:.:--TAQOZ--:.:.  V1.0--142          180530-0135
      Parallax P2  .:.:--TAQOZ--:.:.  V1.0--142          180530-0135
    TAQOZ#   ok
    TAQOZ# P2-ES  ok
    TAQOZ#   ok
    TAQOZ# 360 P2MHZ  ok
    TAQOZ# fibos 
    fibo(1) = 458 cycles = 1,272ns @360MHz result =1
    fibo(6) = 778 cycles = 2,161ns @360MHz result =8
    fibo(11) = 1,098 cycles = 3,050ns @360MHz result =89
    fibo(16) = 1,418 cycles = 3,938ns @360MHz result =987
    fibo(21) = 1,738 cycles = 4,827ns @360MHz result =10946
    fibo(26) = 2,058 cycles = 5,716ns @360MHz result =121393
    fibo(31) = 2,378 cycles = 6,605ns @360MHz result =1346269
    fibo(36) = 2,698 cycles = 7,494ns @360MHz result =14930352
    fibo(41) = 3,018 cycles = 8,383ns @360MHz result =165580141
    fibo(46) = 3,338 cycles = 9,272ns @360MHz result =1836311903 ok
    TAQOZ# 32 PIN 16 256 1 PWM  ok
    TAQOZ# 128 256 1 PWM  ok
    TAQOZ# 10 100 1 PWM  ok
  • Cluso99Cluso99 Posts: 18,066
    Great to see the P2_EVAL finally arrived OK :smiley:

    Seems you have made some more great progress with TAQOZ.

    I haven't had time to check out VGA on my P2_EVAL yet :(
  • evanhevanh Posts: 15,040
    Chip has asked an excellent question in the beginner's topic about using Taqoz to test out assembly snippets:
    cgracey wrote: »
    Peter, I have a question about your Forth.

    I understand it can be augmented by new "words", but can these words be used to invoke PASM code? Or, can the words only invoke your Forth primitives?

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-12-29 15:04
    Yes, although wordcode is decoded so that certain memory areas are called as assembly and other areas are treated as threaded code. But all that threaded code needs is an entry point that tells it to now execute PASM where PTRA points to the next TAQOZ instruction but in this case we don't decode it, we just call it. But to the user we just create a word normally and simply say PASM which compiles this entry point and then invokes the inline assembler. Not only that but we could even execute one-liners as we do now without creating a named routine.

    I could finish off my P2 assembler and then we could type in something like this:
    pub MYSQRT ( d1 -- sqrt )
        qsqrt   tos+1,tos
        getqx   tos+1
        jmp     #DROP

    Then use it like this:
    First square a number to produce a 64-bit double result
    TAQOZ# 12345678 DUP UM*  ok

    Check the stack
    TAQOZ# .S 
     DATA STACK (2)
    1   $0000_8A9F   35487
    2   $0F8C_33C4   260846532 ok

    Now call our PASM routine the same as any other code
    TAQOZ# MYSQRT . 12345678 ok

    So threaded code pointed to by PTRA (as the IP instruction pointer) could be executed prior to this in the same definition if need be but on encountering the PASM instruction it performs a "CALL PTRA".

  • cgraceycgracey Posts: 14,106
    Thanks, Peter. Looks pretty neat.
Sign In or Register to comment.