I think I found a bug in TAQOZ. When going through Starting Forth Quizzie 2-b I noticed the following problem. I would have expected zero (because of integer math) where fraction math would have put it at -1/3), but I got -3 instead. Is this a bug, or am I doing something wrong?
TAQOZ# : 2B5 SWAP - / ; --- ok
TAQOZ# 3 2 1 2B5 --- ok
TAQOZ# . --- -3 ok
TAQOZ#
@hinv
I'm not sure what you are doing with such a short operation and then naming it with what could be a hex number? Anyway it is so easy to debug in so many ways but it should be obvious that you are dividing 3 by -1 not -1 by 3.
TAQOZ# 3 2 1 SWAP - .S ---
DATA STACK (2)
1 $FFFF_FFFF -1
2 $0000_0003 3 ok
TAQOZ# / . --- -3 ok
Alternatively you can use the trace feature if running the RELOADED version, being careful to turn it back off again.
btw, you are working with integers, not floating point. You will need to scale your numbers if you want a fractional result.
TAQOZ# -1 3 / . --- 0 ok
TAQOZ# -1 1000 3 */ . --- -333 ok
Where -1 is scaled by 1000 with a 64-bit intermediate result and then divided by 3 back to a 32-bit result, in this case the result would be interpreted as having 3 decimal places or -0.333.
@hinv
I'm not sure what you are doing with such a short operation and then naming it with what could be a hex number? Anyway it is so easy to debug in so many ways but it should be obvious that you are dividing 3 by -1 not -1 by 3.
...
Where -1 is scaled by 1000 with a 64-bit intermediate result and then divided by 3 back to a 32-bit result, in this case the result would be interpreted as having 3 decimal places or -0.333.
Yep, you're right. I should have put another swap in my program. Thanks!
@dnalor - Most of these replies are simply from the sources, both taqoz.spin and TAQOZ.FTH
a) "DUPC@"
It says 'Push the internal fx register onto the datastack', but what is 'fx register' ?
' DUPC@ ( addr -- addr data )
013a0 fac01820 DUPCFT rdbyte X,a
013a4 fd800070 jmp #PUSHX ' Push the internal X register onto the datastack
b) "BIT!"
BIT! ( mask addr flg -- )
Will SET or CLR a bit mask in memmory. true will SET, false will CLR
c) "GOTO"
I know what "GOTO" means. But how would I use it?
'' compile a dummy NOP/GO to be replacd later with a goto (addr+ex)
This is only used internally by IF and ELSE etc where the forward address can't be known until later
It leave a $1E MARK + the current address on the stack which is used later.
d) "T"
H is for pin high, L for pin low, F before pin float, R for pin input, but T?
' T - toggle the pinreg PIN '
00b4c 164 0d60145f _T _ret_ drvnot pinreg
e) "NONE"
Maybe to disable terminal output? How to use it?
NONE PRINT" this is going nowhere"
f) "SEROUT"
Serial output? How, what, where?
pub SEROUT ( data pin -- ) pIN WAITPIN WYPIN ;
Transmit a character through the smartpin that is normally configured for asynch
g) ".AS"
What is the difference to '.AS"'?
The .AS" must compile a literal format string whereas .AS expects the pointer to the string on the stack.
1234 .AS" #.###ms"
1234 " #.###ms" .AS
h) ASM
It says 'Execute following code as hubexec assembly code'. Following? How to use?
Simply switches to the assembler input and vocabulary. This would only be used within
a Forth definition when you want to switch to inline assembly. I will see if I can paste in an example later on.
i) "[" and "]"
[ Stop permanent compiling (as in a new word) and switch back to temporary compilation (as in interactive)
] Resume permanent compiling.
These words are handy if you need to perform some operation at compile time inside of a new word.
j) "!SX"
k) "CMD"
l) "ACMD
m) "cid
All these are SD card routines that are exposed but not normally needed.
You can however check a card is responding with a 0 0 CMD for instance.
o) "AUTO"
With "BACKUP" I can save newly created words and restore them manually with "RESTORE" after restart. But how does "AUTO" work.
AUTO MAIN
Make MAIN the autostart routine (requires a backup)
At the top of your document there is the link to EXTEND.FTH is broken. What was in it?
EXTEND.FTH in Tachyon is simply called TAQOZ.FTH in TAQOZ with all the standard high-level stuff
I will check the links
I've made some changes to the boot report since the I2C bus activity seemed to be upsetting the RTC sometimes (but only at boot when it is interrogating the devices etc). All is stable now but I will enable the password lock on the RTC to prevent inadvertent corruption as it seems to be a bit sensitive to the volume of high-speed traffic with the UB3. The I2C driver enables strong pullups on the selected I2C pins so there is no need to have external pullups.
The binaries have been updated on Dropbox and SF accordingly and I have changed the names of the source files since I was getting confused with my own naming system
EXTEND.FTH - the main extensions added to the kernel by the kernel.
FILE.FTH - all the SD FAT32 file system add-ons etc and the backup utilities
Those two are the minimum that needs to be added for a bootable system.
The standard extras are:
P2ASM.FTH - the interactive assembler.
MEDIA.FTH - VGA text and graphics, WAV audio, BMP viewer and BMV video player etc.
A zip file containing the current TAQOZ and Tachyon binaries etc is attached.
The boot report for the current version (along with some updated UB3 firmware)
BOOTING.... CARD: SANDISK SD SC64G REV$80 #35190404 DATE:2018/10
KERNEL Parallax P2 *TAQOZ RELOADED sIDE* V2.7 'CHIP' Prop_Ver G 200MHz 201123-1000
MODULES:
1508 *TEXT* VGA BMP TEXT 190800-0000
1260 *BMV* BMV VIDEO PLAYER 190800-0000
766 *WAVE* WAVE AUDIO FILE PLAYER 190800-0000
430 *BMP* BMP FILE VIEWER 190800-0000
1938 *MEDIA* TAQOZ INTERACTIVE MEDIA - AUDIO, TEXT, IMAGE & VIDEO DRIVERS 200403-1200
4868 *P2ASM* TAQOZ INTERACTIVE ASSEMBLER for the PARALLAX P2 - 200713-1000
2562 *DISK* SD DISK REPORTING & FORMATTING TOOLS 190800-0000
4798 *FILE* TAQOZ FAT32 FILE SYSTEM for SD CARD plus VIRTUAL MEMORY 210115-1400
1502 *SPIRAM* LY68L6400 8MB SPI RAM ACCESS 191020-0000
1774 *DECOMPILER* A decompiler for TAQOZ 190825-0000
1324 *RTC* RV-3028 RTC DATE and TIME 190800-0000
828 *SMARTPINS* SMARTPIN FUNCTIONS and drive modes 190800-0000
400 *P2CLOCK* P2 CLOCK CONTROL 190800-0000
2258 *ANSI* ANSI TERMINAL SUPPORT 200410-0000
406 *EXTEND* Primary kernel extensions for TAQOZ 210115-0030
5754 *SPIFLASH*
MEMORY MAP
CODE: 09EDA 40,666 bytes
WORDS: 1C0EB 16,012 bytes
DATA: 00496 1,174 bytes
ROOM: 74,257 bytes
HARDWARE
PCB P2 (P2D2)
CLOCK IN 20.000000MHZ
DEVICES
SD CARD 63 GB SANDISK SD SC64G REV$80 #35190404 DATE:2018/10
SPI FLASH 16MB WINBOND $EF40_1800 #4837448895114529879
USB Silicon Labs EFM8UB3 uPORT SERIAL WATCHDOG UB3_2.5.8B 0005
I2C DEVICES
$36 P2D2 UB USB+SUPPORT UUID:669BAD5834DEE811A8D742B1A51F80DA
$A4 RV-3028 RTC 2021/01/16 SAT 12:01:54
$C4 Si5351A CLOCK GEN
STATS 18 RESETS Temp= 40.35'C Vdd=1.833V
-------------------------------------------------------------------------------
TAQOZ#
My minicom status line:
CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Online 1:6 | ttyUSB0
If debugging is the art of removing bugs from programs, then programming must be the art of putting them in.
I'm fixing a bug that affects _BOOT_P2.BIX that I modified last week, so don't be surprised if that version didn't boot. I will update it today. It was actually to do with the way the open file directory space is handled, but this ended up overwriting the first sector of the boot file !@$$@!
TAQOZ BYTES anyone?
I mentioned that I could do a version of Quick Bytes for TAQOZ, simply called TAQOZ BYTES. What would that look like. I've attached a tentative version of a PDF lesson on handling I2C. It's incomplete but I'm just getting a feel for the format, the material, and the layout. Even though I already have numerous online documents and also the wiki pages on my SourceForge account, this may complement it and would be suitable for compiling into a book form too. I just felt too that this should have its own logo to dress it up.
This is done with Google docs and I download it as a PDF but I also "publish" the document as a web document that doesn't require any sign-in etc and automatically refreshes from the original, although it loses some of its formatting in the process.
Anyone, ask yourself this: will the P2 give a boost to any flavor of C or Basic or Python of sorts or vice versa ? Maybe.
But I think P2 and TAQOZ are an excellent combo. Each one giving the other one a boost in popularity and usability. No need for an external tools like compilers/debuggers and interactive. Instant feedback and extendable. Perfect, and getting even better.
Taqoz Bytes - good idea. Each article takes a small amount of time to do, unlike a complete manual. We can all contribute them according to our knowledge and interests. If they're all stored in one place, then the knowledge to help the newcomer use the language is easily found.
Thanks for the link to the Taqoz Bytes folder. Is it a good idea to identify the version of Taqoz the Byte was written for?
Cheers, Bob
Yes, the latest! There's all that extra little stuff I still need to add to the document with the links and references and author etc. The folder will also be the repository for those files that are linked to, just to keep everything all together in one place.
@DaveJenson - Hey Dave! Where did you get that old old version from? Just click on "The LOT" in my sig then P2/TAQOZ/binaries and grab the _BOOT_P2.BIX file. Here's a quick link to it which I may add to my sig which has to be short these days.
@DaveJenson - Hey Dave! Where did you get that old old version from? Just click on "The LOT" in my sig then P2/TAQOZ/binaries and grab the _BOOT_P2.BIX file. Here's a quick link to it which I may add to my sig which has to be short these days.
About five times now, I downloaded that _BOOT_P2.BIX file and copied it to my SD card.
I have even reformatted the card each time with windows Disk Format.
It still comes up "V2.5" on my Terminal screen and no I2CPINS found.
@DaveJenson
VGA on P0..P4 is enabled by default, that's why it doesn't "like" P0 You can change or disable the VGA config registers in page 0 (first 256 bytes). Once you use I2CPINS it will setup the pins with internal pullups and bus speed of 400kHz and then issues a restart followed by a stop.
Maybe your card had a backup on the MBR which overrides the BIX version. To disable the MBR version just type BACKUP DISABLE
I still have to finish off the first TAQOZ BYTES document but most of it is there now. It will be good to see it hosted on Parallax then.
If you want your card formatted properly and with larger clusters then please format the card in TAQOZ like this, after which you can backup again.
Grant RW and system permissions (for safety), then format which can take a little while but the cursor spins while it is busy.
RWS FORMAT
Once it is done it will test and display a long .DISK report.
There's an update to the TAQOZ binary and includes support for time-stamping files automatically now plus lots of other little things under the hood. Besides the DIR command remember that there is the DIRW, ls, ls -l, and now DIR+ and DIR++ with stacks of useful info being report. Renaming files is now working too and you can even rename by index rather than name. Basically anything that had to do with directories has been brought up-to-date.
If you want to format your SD card then I'd recommend using the maximum cluster size that FAT32 supports of 64KB which is much better suited for embedded systems. Even if you had one thousand small files (really!?), that's still only 64MB which is barely noticed even in the smallest SD cards. I've made that the default now although you can specify the cluster size and also set permissions (for safety) before a FORMAT like this:
RWS FORMAT
After it's done it will spit out a long disk report covering the card's registers, the MBR, the FAT32, and also speed and latency reports.
If you do a BACKUP BIX and it doesn't exist, it will now correctly create the file etc before backing up.
I want to do a version now that backs up and boots from Flash so I can have it preinstalled when I ship the P2D2s.
In the meantime I hooked up a piezo transducer/speaker directly to 2 I/O pins set as left and right audio but complementary analog drive for mono audio. I then switched over to the WAV directory on my old test board and this is what I typed, and you can hear it here. The WAV player has been there since 2019 at least but I did add the complementary drive some time ago too.
TAQOZ# DIRW ---
P2 CARD
_BOOT_P2.BIX [BMP ] [BMV ] [FTH ] [HTM ] [PDF ] [PNG ] [TXT ]
[WAV ] _BOOT_P2.LZ4 FAVICON.ICO IMAGE IMAGE1 IMAGE2 IMAGE3 P8CPU.JPG
SPIDEY.GIF TIGER.GIF TIGER.JPG FISH2.VT ok
TAQOZ# CD WAV Opened @ $007B_8396 --- ok
TAQOZ# DIRW ---
P2 CARD
[. ] [.. ] LOVE.WAV POPCORN.WAV LOVE.MP3 POPCORN.MP3 MANICMON.WAV MOUTH.WAV
500MILES.WAV ABOTTLE.WAV ALABAMA.WAV AMORE.WAV AVATAR.WAV BABYLON.WAV BASS.WAV BELIEVER.WAV
BOOTS.WAV BROWNEYE.WAV CANON.WAV COMEAWAY.WAV COSMIC.WAV CRASHES.WAV CRUSH.WAV DANNY.WAV
DAYO.WAV DREAMIN.WAV DRIFT.WAV DRUM.WAV EATWORLD.WAV EYEJOE.WAV FALLLOVE.WAV FASTCAR.WAV
FLOWERS.WAV FOURWIND.WAV FRIENDS.WAV GAS.WAV GEORGIA.WAV GRASS.WAV GUANTAN.WAV GUNDI.WAV
HERDOOR.WAV HOMEWARD.WAV HORIZON.WAV INLOVE.WAV ISLAND.WAV ISTANBUL.WAV JANE.WAV KELLYST.WAV
LION.WAV LOVEISIN.WAV MOONLIGH.WAV MOONRIVR.WAV MORNING.WAV PERHAPS.WAV PODCAST.WAV REET.WAV
ROCKROLL.WAV SHARONA.WAV SHINE.WAV SOFTLY.WAV STANDBY.WAV SUMMER.WAV SUMMER69.WAV SUNSHINE.WAV
TEQUILA.WAV THISKISS.WAV TONIGHT.WAV TRULY.WAV TWIST.WAV WAYWARD.WAV WISHIN.WAV WONDER.WAV ok
TAQOZ# PLAY REET --- ok
TAQOZ# 20 PITCH --- ok
TAQOZ# 100 PITCH --- ok
TAQOZ# 120 PITCH --- ok
TAQOZ# 90 PITCH --- ok
TAQOZ# 100 PITCH --- ok
TAQOZ# PAUSE --- ok
TAQOZ# PAUSE --- ok
TAQOZ# PLAY ALABAMA --- ok
TAQOZ# 2 REW --- ok
TAQOZ# 2 REW --- ok
TAQOZ# 5 REW --- ok
TAQOZ# PLAY PODCAST --- ok
TAQOZ# 120 PITCH --- ok
TAQOZ# PLAY TWIST --- ok
TAQOZ# STOP --- ok
TAQOZ# --- ok
Here's one of the newer directory commands too, this one just lists out the maximum size allocated and a bit of the file header.
NAME ATR 1ST SECTOR MODIFIED FILE SIZE MAX SIZE HEADER
The P2ASM module allows standard syntax code files to be assembled interactively or mixed with source. If you want a word that works like any other Forth word but is defined purely in assembler then you can use the CODE word instead of pub or : and TAQOZ will switch to the assembler mode and create a CODE <name> in the dictionary as normal. But what happens when you start off as a normal pub Forth word, write some Forth code, but then you really need to insert some inline code. Well, here's one way to do it.
Use ASM: and if you want a listing then use ON LISTING or list. The assembler automatically indents to allow for labels and conditions so you ideally want to tab one more to allow for this since it is a single-pass assembler that can resolve forward references and symbols, but obviously not amend the single pass listing.
Here's an example that plots a point on a mono screen which is also used by the text font generator for 1080p.
--- Plot a point on a 1bpp screen (called from PLOT)
TAQOZ# pub PLOT1 ( c:pen b:x a:y ) ---
cols W* 3 >> SCR + --- dynamic row calculation in screen memory
ASM:
list
0A0C4 F600_1821 mov xx,b ' x '
0A0C8 F044_1803 shr xx,#3 ' x >>3'
0A0CC F100_400C add a,xx ' a = scrptr
0A0D0 FAC0_1820 rdbyte xx,a ' read byte'
0A0D4 F504_4207 and b,#7 ' bit position in byte '
0A0D8 F608_4422 mov c,c wz
0A0DC F4A0_1821 bitnz xx,b
0A0E0 FC40_1820 wrbyte xx,a
0A0E4 FD80_0EB4 3DROP; ' shortcut to return and drop the 3 parameters
--- ok end
The top 4 registers of the data stack are a b c d and in the TAQOZ cog there are internal working registers xx yy zz and r0 r1 r2 r3 and acc. The reason for xx yy zz instead of x y z is simply to avoid confusion with the graphics words x y w h which are used to set co-ordinates and width and height etc (i.e. 100 x 40 y 150 w 150 h PANEL)
@DaveJenson - EXPLANDER a typo? Maybe it's a new word
Testing the new forum for uploads. A 2MB file limit is a bit 2010'ish, isn't it?
I had a 37MB file that I passed through WinFF and ended up with 2.7MB. I had to crop the frame further to squeeze into the 2MB limit.
Here is TAQOZ booting up and checking to see if it has a VGA monitor connected and then setting the screen up for 640x360x8 (16:9) then searching the SD card for a splash screen and/or a startup sound. I will have to make a more appropriate sound TAQOZ, but it's a quick test and then TAQOZ prints up a short report.
Found a better splash screen and some music, and add a touch of image modulation. Much better!
I just changed the method for splash and startup to read a config file which points to the files to use etc rather than copying and renaming (which btw we can do in TAQOZ itself).
16 bytes configs
16 bytes splash
16 bytes startup
pub !MEDIA
8 BPP 360p VGA
--- READ CONFIGS and copy to configs splash screen startup sound + effects + match text
" BOOT.CFG" FOPEN$ IF 0 SDADR configs $30 CMOVE splash VIEW$ startup PLAY$ MODULATE black PEN 255 PAPER THEN
VHOME CRLF SYSINFO CON
;
--- patch this in to the INIT code that is run at boot
AT !MEDIA +INIT
I've updated Dropbox and cleaned up any clutter on Source Forge pages but here is a zip of those files to make this work and tested on a P2 EVAL with VGA hooked to P0 and sound on P6,7 and baud rate set to 921600.
On the way to adding stand-alone text editing to TAQOZ I decided that I could implement something similar to the old Forth block editor. I never really used these old block editors but something like that is all that I would need for config files etc. Normally these blocks are 64x16 or 1kB but I decided that I would just work with a 512 byte sector at a time and 64 wide or 128 wide if it detects a CR in that position. This would make it editable with trailing spaces on a PC editor but the fixed width is useful for config files etc.
This will work very nicely with my built-in VGA modes too and I will tie this in with the PS/2 keyboard functions. Once it is useful I can then start dressing it up to display and edit larger blocks although SED already pages to the next sector when it has too. Just keeping it simple for now. So SED is a Simple Editor (or sector editor) in 570 code bytes (at present).
NOTE: I've been able to use this not only for my files but also to edit headers in media files and even directly edit other sectors. For this reason I am adding a hex edit mode and a backup sector for a revert option even though I've made it only save if you type ^S anyway.
This SED looks to be super useful. I've given it a shot and it's fun. Need some more practice to use it effectively.
BTW, I've noticed the ^J and ^Z do the same thing or maybe I'm missing something (I know it's not polished yet so maybe this is intentional. A placeholder for something else perhaps ?)
A lot of these controls and escape commands are not final but I know that the only way to test it is to make it functional first. So I'm trying to make it easy to edit without requiring interpreting ANSI key sequences like $1B $5B $42 for the right arrow etc However $1B $5B could be a command to read another key so I could add this function easily. I'll do it right now!
I actually had changed ^J to an ignore but this editor is only a few hours old, there's still plenty to do but I'm even editing source code files with it too. The hex mode hasn't been implemented yet but I think I know how I want to display that now.
I've avoided writing any kind of editor before this simply because I wanted it to handle regular variable length line text files, but really, most of the time that is not required anyway. SED keeps it simple and surprisingly useful.
edit: yep, cursor keys work fine. Now to add some more sequence keys.
Reading time and date is combined into one quick 7 byte read from the RTC and so to read the time and/or date takes 290us over the I2C bus at 400kHz. That's good but sometimes we don't want to waste too much time doing this. Is there a faster way? Yes, if the time and date is read at boot time and latched along with the P2's 64-bit counter using GETMS, then whenever we want the current time we can do a GETMS for an elapsed time and then calculate the current time.
For this I have added QTIME@ and QDATE@ to quickly work this out and now it takes only 15us to get the current time. I might change the method later and store the boot time in seconds rather then hhmmss to speed it up a bit more, but still, 15us aint' bad.
Here is the quick&dirty test code - yet to be improved.
--- Calculate the current time quickly (15us) by using the latched boot time and ms plus the curent GETMS
pub QTIME@ ( --- hhmmss )
btime @ HMS ( s m h ) --- get time at booter and split into hours mins secs
GETMS bms @ - 1000 / 60 U// 60 U// ( s m h ) --- GETMS since booter and split into hours mins secs
ROT4 + -ROT ROT4 + -ROT ROT4 + ( m h s ) --- add the two sets of hours mins secs
60 U// ROT4 + ( h s m ) 60 U// ROT4 + ( s m h ) --- wrap and carry seconds and minutes into hours mins secs
100 * + 100 * + --- recombine into hhmmss ;
;
{ Test timing of methods and check output
TAQOZ# LAP TIME@ LAP .LAP TAB PRINT --- 58,057 cycles= 290,285ns @200MHz 234017 ok
TAQOZ# LAP QTIME@ LAP .LAP TAB PRINT --- 3,089 cycles= 15,445ns @200MHz 234024 ok
Here is the updated routine for Quick Time which relies on the P2's 64-bit systick counter and the associated GETMS function to calculate the time of day using the RTC time which was read and latched at boot. The SECS@ function is also useful for timestamps.
Software needn't be slowed down performing I2C routines just to get the current time, and this QTIME function takes only 10us. No doubt a hubexec function could be a bit faster.
--- return with seconds of the day
pub SECS@ ( -- seconds ) btime @ GETMS bms @ - 1000 / + ;
--- Quick TIME@ (10us) using the boot time plus the curent GETMS
pub QTIME@ ( --- hhmmss ) SECS@ 60 U// 60 U// ( s m h ) >HMS ;
In Australia we used to have stones, pounds and ounces, and also pounds, shillings and pence before we changed over to the metric system in the 60's and 70's. The US has dollars and sense but are still weighed down by imperial British weights! (as well as feet and inches)
Calculating in straight decimal is so much easier but it makes me think about how hours, minutes, and seconds are so "imperial" and awkward. I can't see any country changing to metric time though :) Sumerian time is deeply embedded in society and history.
BTW - the RV-3028 has UNIX time as well but that's a bit harder to convert to standard date and time notation.
Comments
Did you ever create a driver for the nrfl024+ in TAQOZ?
Jim
TAQOZ# : 2B5 SWAP - / ; --- ok
TAQOZ# 3 2 1 2B5 --- ok
TAQOZ# . --- -3 ok
TAQOZ#
I'm not sure what you are doing with such a short operation and then naming it with what could be a hex number? Anyway it is so easy to debug in so many ways but it should be obvious that you are dividing 3 by -1 not -1 by 3.
Alternatively you can use the trace feature if running the RELOADED version, being careful to turn it back off again.
btw, you are working with integers, not floating point. You will need to scale your numbers if you want a fractional result. Where -1 is scaled by 1000 with a 64-bit intermediate result and then divided by 3 back to a 32-bit result, in this case the result would be interpreted as having 3 decimal places or -0.333.
I miss in the documentation (https://docs.google.com/document/d/1TgkY8WBOzIlQca1pXsuInmEeOqT5w0pIJlaFY1qfvco/edit#) a (more detailed) description for the following keywords:
a) "DUPC@"
It says 'Push the internal fx register onto the datastack', but what is 'fx register' ?
b) "BIT!"
c) "GOTO"
I know what "GOTO" means. But how would I use it?
d) "T"
H is for pin high, L for pin low, F before pin float, R for pin input, but T?
e) "NONE"
Maybe to disable terminal output? How to use it?
f) "SEROUT"
Serial output? How, what, where?
g) ".AS"
What is the difference to '.AS"'?
h) ASM
It says 'Execute following code as hubexec assembly code'. Following? How to use?
i) "[" and "]"
j) "!SX"
k) "CMD"
l) "ACMD
m) "cid
o) "AUTO"
With "BACKUP" I can save newly created words and restore them manually with "RESTORE" after restart. But how does "AUTO" work.
At the top of your document there is the link to EXTEND.FTH is broken. What was in it?
Yep, you're right. I should have put another swap in my program. Thanks!
Will SET or CLR a bit mask in memmory. true will SET, false will CLR
'' compile a dummy NOP/GO to be replacd later with a goto (addr+ex)
This is only used internally by IF and ELSE etc where the forward address can't be known until later
It leave a $1E MARK + the current address on the stack which is used later.
NONE PRINT" this is going nowhere"
Transmit a character through the smartpin that is normally configured for asynch
The .AS" must compile a literal format string whereas .AS expects the pointer to the string on the stack. Simply switches to the assembler input and vocabulary. This would only be used within
a Forth definition when you want to switch to inline assembly. I will see if I can paste in an example later on.
[ Stop permanent compiling (as in a new word) and switch back to temporary compilation (as in interactive)
] Resume permanent compiling.
These words are handy if you need to perform some operation at compile time inside of a new word. All these are SD card routines that are exposed but not normally needed.
You can however check a card is responding with a 0 0 CMD for instance.
AUTO MAIN
Make MAIN the autostart routine (requires a backup)
EXTEND.FTH in Tachyon is simply called TAQOZ.FTH in TAQOZ with all the standard high-level stuff
I will check the links
The binaries have been updated on Dropbox and SF accordingly and I have changed the names of the source files since I was getting confused with my own naming system
EXTEND.FTH - the main extensions added to the kernel by the kernel.
FILE.FTH - all the SD FAT32 file system add-ons etc and the backup utilities
Those two are the minimum that needs to be added for a bootable system.
The standard extras are:
P2ASM.FTH - the interactive assembler.
MEDIA.FTH - VGA text and graphics, WAV audio, BMP viewer and BMV video player etc.
A zip file containing the current TAQOZ and Tachyon binaries etc is attached.
The boot report for the current version (along with some updated UB3 firmware)
My minicom status line:
I'm fixing a bug that affects _BOOT_P2.BIX that I modified last week, so don't be surprised if that version didn't boot. I will update it today. It was actually to do with the way the open file directory space is handled, but this ended up overwriting the first sector of the boot file !@$$@!
TAQOZ BYTES anyone?
I mentioned that I could do a version of Quick Bytes for TAQOZ, simply called TAQOZ BYTES. What would that look like. I've attached a tentative version of a PDF lesson on handling I2C. It's incomplete but I'm just getting a feel for the format, the material, and the layout. Even though I already have numerous online documents and also the wiki pages on my SourceForge account, this may complement it and would be suitable for compiling into a book form too. I just felt too that this should have its own logo to dress it up.
This is done with Google docs and I download it as a PDF but I also "publish" the document as a web document that doesn't require any sign-in etc and automatically refreshes from the original, although it loses some of its formatting in the process.
EDIT: revised PDF
BTW I don't like the logo. Need the ByTes changing to Bytes because I read it as TAQOZ By Tes - who's Tes
That part on programming is a killer !
And a huge YES to TAQOZ BYTES, or whatever it's eventually called.
But I think P2 and TAQOZ are an excellent combo. Each one giving the other one a boost in popularity and usability. No need for an external tools like compilers/debuggers and interactive. Instant feedback and extendable. Perfect, and getting even better.
I boot TAQOZ from SD Card and I cannot "SEE" I2CPINS.
I'm trying to set the pins for I2C to 0,1 and thought that instruction was just the thing.
It says I have ver 2.5. Is that the latest?
Thanks for the link to the Taqoz Bytes folder. Is it a good idea to identify the version of Taqoz the Byte was written for?
Cheers, Bob
Yes, the latest! There's all that extra little stuff I still need to add to the document with the links and references and author etc. The folder will also be the repository for those files that are linked to, just to keep everything all together in one place.
@DaveJenson - Hey Dave! Where did you get that old old version from? Just click on "The LOT" in my sig then P2/TAQOZ/binaries and grab the _BOOT_P2.BIX file. Here's a quick link to it which I may add to my sig which has to be short these days.
About five times now, I downloaded that _BOOT_P2.BIX file and copied it to my SD card.
I have even reformatted the card each time with windows Disk Format.
It still comes up "V2.5" on my Terminal screen and no I2CPINS found.
What am I doing wrong?
OK, I got it!
I formatted my sd card with SD Card Formatter and copied _BOOT_P2.BIX and it seems to be all there. V2.7.
And I2CPINS is there.
And apparently TAQOZ does not like using pins 0 and 1 for I2C bus.
It works when I use pins 10 and 11...
Thanks. I'm ready for MORE TAQOZ Bytes!!
VGA on P0..P4 is enabled by default, that's why it doesn't "like" P0 You can change or disable the VGA config registers in page 0 (first 256 bytes). Once you use I2CPINS it will setup the pins with internal pullups and bus speed of 400kHz and then issues a restart followed by a stop.
Maybe your card had a backup on the MBR which overrides the BIX version. To disable the MBR version just type BACKUP DISABLE
I still have to finish off the first TAQOZ BYTES document but most of it is there now. It will be good to see it hosted on Parallax then.
If you want your card formatted properly and with larger clusters then please format the card in TAQOZ like this, after which you can backup again.
Grant RW and system permissions (for safety), then format which can take a little while but the cursor spins while it is busy. Once it is done it will test and display a long .DISK report.
Then backup TAQOZ again.
If you want to format your SD card then I'd recommend using the maximum cluster size that FAT32 supports of 64KB which is much better suited for embedded systems. Even if you had one thousand small files (really!?), that's still only 64MB which is barely noticed even in the smallest SD cards. I've made that the default now although you can specify the cluster size and also set permissions (for safety) before a FORMAT like this:
After it's done it will spit out a long disk report covering the card's registers, the MBR, the FAT32, and also speed and latency reports.
If you do a BACKUP BIX and it doesn't exist, it will now correctly create the file etc before backing up.
I want to do a version now that backs up and boots from Flash so I can have it preinstalled when I ship the P2D2s.
In the meantime I hooked up a piezo transducer/speaker directly to 2 I/O pins set as left and right audio but complementary analog drive for mono audio. I then switched over to the WAV directory on my old test board and this is what I typed, and you can hear it here. The WAV player has been there since 2019 at least but I did add the complementary drive some time ago too.
Here's one of the newer directory commands too, this one just lists out the maximum size allocated and a bit of the file header.
Thanks for all your help and ALL your efforts for TAQOZ and everything!
I am currently running on @Cluso99's RetroBlade2, and having mostly success.
I found a typo (I think) in lsi2c.
It lists a device as "I/O EXPLANDER". Should that be "EXPANDER"?
The P2ASM module allows standard syntax code files to be assembled interactively or mixed with source. If you want a word that works like any other Forth word but is defined purely in assembler then you can use the CODE word instead of pub or : and TAQOZ will switch to the assembler mode and create a CODE <name> in the dictionary as normal. But what happens when you start off as a normal pub Forth word, write some Forth code, but then you really need to insert some inline code. Well, here's one way to do it.
Use ASM: and if you want a listing then use ON LISTING or list. The assembler automatically indents to allow for labels and conditions so you ideally want to tab one more to allow for this since it is a single-pass assembler that can resolve forward references and symbols, but obviously not amend the single pass listing.
Here's an example that plots a point on a mono screen which is also used by the text font generator for 1080p. The top 4 registers of the data stack are a b c d and in the TAQOZ cog there are internal working registers xx yy zz and r0 r1 r2 r3 and acc. The reason for xx yy zz instead of x y z is simply to avoid confusion with the graphics words x y w h which are used to set co-ordinates and width and height etc (i.e. 100 x 40 y 150 w 150 h PANEL)
@DaveJenson - EXPLANDER a typo? Maybe it's a new word
I had a 37MB file that I passed through WinFF and ended up with 2.7MB. I had to crop the frame further to squeeze into the 2MB limit.
Here is TAQOZ booting up and checking to see if it has a VGA monitor connected and then setting the screen up for 640x360x8 (16:9) then searching the SD card for a splash screen and/or a startup sound. I will have to make a more appropriate sound TAQOZ, but it's a quick test and then TAQOZ prints up a short report.
I just changed the method for splash and startup to read a config file which points to the files to use etc rather than copying and renaming (which btw we can do in TAQOZ itself).
and the config file itself:
I've updated Dropbox and cleaned up any clutter on Source Forge pages but here is a zip of those files to make this work and tested on a P2 EVAL with VGA hooked to P0 and sound on P6,7 and baud rate set to 921600.
On the way to adding stand-alone text editing to TAQOZ I decided that I could implement something similar to the old Forth block editor. I never really used these old block editors but something like that is all that I would need for config files etc. Normally these blocks are 64x16 or 1kB but I decided that I would just work with a 512 byte sector at a time and 64 wide or 128 wide if it detects a CR in that position. This would make it editable with trailing spaces on a PC editor but the fixed width is useful for config files etc.
This will work very nicely with my built-in VGA modes too and I will tie this in with the PS/2 keyboard functions. Once it is useful I can then start dressing it up to display and edit larger blocks although SED already pages to the next sector when it has too. Just keeping it simple for now. So SED is a Simple Editor (or sector editor) in 570 code bytes (at present).
NOTE: I've been able to use this not only for my files but also to edit headers in media files and even directly edit other sectors. For this reason I am adding a hex edit mode and a backup sector for a revert option even though I've made it only save if you type ^S anyway.
This SED looks to be super useful. I've given it a shot and it's fun. Need some more practice to use it effectively.
BTW, I've noticed the ^J and ^Z do the same thing or maybe I'm missing something (I know it's not polished yet so maybe this is intentional. A placeholder for something else perhaps ?)
A lot of these controls and escape commands are not final but I know that the only way to test it is to make it functional first. So I'm trying to make it easy to edit without requiring interpreting ANSI key sequences like $1B $5B $42 for the right arrow etc However $1B $5B could be a command to read another key so I could add this function easily. I'll do it right now!
I actually had changed ^J to an ignore but this editor is only a few hours old, there's still plenty to do but I'm even editing source code files with it too. The hex mode hasn't been implemented yet but I think I know how I want to display that now.
I've avoided writing any kind of editor before this simply because I wanted it to handle regular variable length line text files, but really, most of the time that is not required anyway. SED keeps it simple and surprisingly useful.
edit: yep, cursor keys work fine. Now to add some more sequence keys.
QUICK RTC FUNCTIONS
Reading time and date is combined into one quick 7 byte read from the RTC and so to read the time and/or date takes 290us over the I2C bus at 400kHz. That's good but sometimes we don't want to waste too much time doing this. Is there a faster way? Yes, if the time and date is read at boot time and latched along with the P2's 64-bit counter using GETMS, then whenever we want the current time we can do a GETMS for an elapsed time and then calculate the current time.
For this I have added QTIME@ and QDATE@ to quickly work this out and now it takes only 15us to get the current time. I might change the method later and store the boot time in seconds rather then hhmmss to speed it up a bit more, but still, 15us aint' bad.
Here is the quick&dirty test code - yet to be improved.
{ Test timing of methods and check output
TAQOZ# LAP TIME@ LAP .LAP TAB PRINT --- 58,057 cycles= 290,285ns @200MHz 234017 ok
TAQOZ# LAP QTIME@ LAP .LAP TAB PRINT --- 3,089 cycles= 15,445ns @200MHz 234024 ok
}
Here is the updated routine for Quick Time which relies on the P2's 64-bit systick counter and the associated GETMS function to calculate the time of day using the RTC time which was read and latched at boot. The SECS@ function is also useful for timestamps.
Software needn't be slowed down performing I2C routines just to get the current time, and this QTIME function takes only 10us. No doubt a hubexec function could be a bit faster.
In Australia we used to have stones, pounds and ounces, and also pounds, shillings and pence before we changed over to the metric system in the 60's and 70's. The US has dollars and sense but are still weighed down by imperial British weights! (as well as feet and inches)
Calculating in straight decimal is so much easier but it makes me think about how hours, minutes, and seconds are so "imperial" and awkward. I can't see any country changing to metric time though :) Sumerian time is deeply embedded in society and history.
BTW - the RV-3028 has UNIX time as well but that's a bit harder to convert to standard date and time notation.