Search found 744 matches

by ketmar
Mon Mar 18, 2024 4:36 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

anyway, isn't it is the time to rewrite the compiler in Forth? ;-) it will be much, much faster, and it will be possible to mix target code and host Forth code (i.e. use host Forth to calculate some tables, for example). you can use intermediate bytecode (as i did in my SSA compiler). i.e. compile e...
by ketmar
Mon Mar 18, 2024 4:23 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

as for "DOES>", the new standard did it wrong (yet again). in fig-FORTH there was a special word to create "doers": "<BUILDS … DOES>". i.e. "CREATE"d words cannot have "DOES>" part, only "builded". : a create … does> … ; — WRONG! : b <build...
by ketmar
Mon Mar 18, 2024 4:11 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

What is SSA poc.? i meant my SSA-based proof-of-concept compiler. it is not ready to be published yet, but basically it works like this: 1. compiled code is represented by a special VM bytecode (primitives are encoded as one-byte VM instructions, calls to other high-level words are 2 bytes). this b...
by ketmar
Sun Mar 17, 2024 7:20 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth v1.2 (with 42 cols driver)
Replies: 1
Views: 509

Abersoft fig-Forth v1.2 (with 42 cols driver)

this is the modification of Abersoft fig-Forth system made on request of PeterJ . it is using 42-columns print driver, and extended line editor. (and some bugfixes to the original system). it is fully compatible with the original system. download: v1.2 RC2 (includes mod source code). brief documenta...
by ketmar
Sat Mar 16, 2024 12:31 am
Forum: Programming
Topic: With Machine Code how much memory to leave basic
Replies: 7
Views: 632

Re: With Machine Code how much memory to leave basic

yeah, please, $6000! ;-) this will make TR-DOS-lovers life slightly easier: TR-DOS needs buffer for disk sector, and for some other data. sure, you don't have to think about crappy DOS nobody in their sane mind would use, but… why not? ;-)
by ketmar
Sat Mar 09, 2024 4:48 pm
Forum: Programming
Topic: Measuring frames/VSYNC
Replies: 10
Views: 837

Re: Measuring frames/VSYNC

or you can let the ray go. ;-) if you'll start drawing after the ray is passed, you'll have the whole frame to draw everything. some games are using this tech, finishing everything when the ray is already drawing the start of the frame (which was already updated). the only problem is to make sure th...
by ketmar
Sat Mar 09, 2024 3:13 pm
Forum: Programming
Topic: Measuring frames/VSYNC
Replies: 10
Views: 837

Re: Measuring frames/VSYNC

or simply don't bother at all. add 20 moving sprites, a lot of tile animations — and nobody will complain about tearing, because "wow! with all those updates it's a miracle that it is not 1 FPS!" ;-)
by ketmar
Fri Mar 08, 2024 5:57 pm
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

heh. your compiler is better than mine SSA poc. test code: 8192 constant size create flags size allot \ create; : do-prime ( -- count ) flags size -1 fill 0 0 begin ( count index ) dup flags + c@ if dup 2* 3 + 2dup + begin dup size < while dup flags + 0 swap c! over + repeat 2drop swap 1+ swap then ...
by ketmar
Fri Feb 23, 2024 8:04 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

It's amazing how many problems can be caused by just a suggestion of how to design it. And not how to do it. Make a translator (another wrong translation = compiler) is like playing on a children's playground that has no back border. and that's also why you should have your own compiler, written in...
by ketmar
Fri Feb 23, 2024 7:49 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

Especially when I'm not entirely sure how gforth and the Linux terminal do it with utf8. i don't know too. my system locale is KOI8-U. ;-) If you come across the word "chains" read it as "strings". Google translator does not understand the context and in Czech it is simply an ov...
by ketmar
Thu Feb 22, 2024 6:08 pm
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

I incorporated your solution into the code and it stopped working. So I gradually converted my code to yours in small steps and ended up with an unbalanced stack. I tried again.. and again.. and I thought why am I doing this when the original code worked? .) I finally came up with a workable soluti...
by ketmar
Wed Feb 21, 2024 4:18 pm
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

The Forth terminology for strings is so confusing... that's mostly because everybody have their own code for string handling. ;-) remember that Forth came from computers with very small amount of RAM, so handling dynamic strings in RAM wasn't the high priority. most of the time people used BLOCKs t...
by ketmar
Sun Feb 18, 2024 11:08 am
Forum: Programming
Topic: Contention pattern for HALT
Replies: 26
Views: 1727

Re: Contention pattern for HALT

Why not check if it can be done or not? because my Z80 emulator is a standalone library. it cannot know what callback might want to do, and adding more API to check if any breakpoint is possible is both complex, and even the main code sometimes doesn't know (complex expression, scripting language, ...
by ketmar
Sun Feb 11, 2024 11:59 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

that's great! but why using "case" there? this is just a regular switch over the monotonous range, and it's easier and faster to implement it with array of pointers to color printers. like this: create cctable ' white , ' l_blue , ' red , ' purple , ' green , ' cyan , ' l_brown , ' black ,...
by ketmar
Sat Feb 10, 2024 11:17 pm
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

_dw wrote: Sat Feb 10, 2024 10:21 pm But you mean another Dutchman, Edsger W. Dijkstra (none of his books have ever been translated).
that's a shame. and that's why you need English, so you won't need a translation ;-)
by ketmar
Sat Feb 10, 2024 11:02 pm
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

at first glance it looks like your code won't work : type ( addr count ) for dup c@ emit 1+ next drop ; because FOR ends at ZERO INCLUDING and that was the reason why I rejected the FOR loop at the very beginning, because it would still have to treat the empty string and reduce the index by 1... bu...
by ketmar
Sat Feb 10, 2024 10:36 pm
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

Looks like I confused it with another book... yeah, two completely different things. ;-) Knuth is more like a cookbook: he covered many areas, and you can simply take what you need and use, ignoring everything else. if you need some algorithm — check Knuth books, chances are the algo you need is th...
by ketmar
Sat Feb 10, 2024 9:05 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

Redefining .\" to .\" with TYPE together is probably beyond me. just checked this in gforth: : type ( addr count ) 33 emit type 33 emit ; : ." postpone s" postpone type ; immediate : a ." hi" cr ; a bye it works. At https://forth-standard.org/standard/core/PARSE it say...
by ketmar
Sat Feb 10, 2024 8:50 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

I'm not a computer scientist, so I won't argue about the meaning of STRUCTURED CODE. i am not a scientist too. i am an engineer, doing practical things. most of the software i am using now written by myself, and it works. i am rarely shutting down my PC (half-year uptime is not that much ;-), and i...
by ketmar
Thu Feb 08, 2024 9:33 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

I try to make the output assembler code as close as possible to what a human would write. In this, the Forth language simply goes against me, when I could get into a situation where even for a single Z80 instruction such as "ex DE, HL" I will call a function, because that's what the word ...
by ketmar
Tue Feb 06, 2024 6:16 am
Forum: Programming
Topic: Forth compiler for ZX
Replies: 67
Views: 3521

Re: Forth compiler for ZX

When I typed the compiler like ", " it said "HERE !" and increments HERE by 2, where HERE is a virtual variable that only exists at compile time, so if someone uses it in a loop it will fail. If it is in some initialization or word/function, it will simply store it at some addre...
by ketmar
Sun Feb 04, 2024 10:48 pm
Forum: Programming
Topic: Contention pattern for HALT
Replies: 26
Views: 1727

Re: Contention pattern for HALT

I also consume all the remaining T-cycles in the HALT itself. sadly, this doesn't quite work if you need a sophisticated breakpoint system. Zymosis uses callbacks for each type of memory i/o, and one general breakpoint callback before each instruction. this way i can stop execution on arbitrarily c...
by ketmar
Tue Jan 23, 2024 8:19 pm
Forum: Programming
Topic: Contention pattern for HALT
Replies: 26
Views: 1727

Re: Contention pattern for HALT

thank you all for the info. fixed ZXEmuT so it will perform fetching at "haltpc+1". ;-)
by ketmar
Tue Jan 23, 2024 8:07 am
Forum: Programming
Topic: How much self modifying code was there and did it do anything?
Replies: 31
Views: 2074

Re: How much self modifying code was there and did it do anything?

that unlocked some old memory. back than, when we in xUSSR used pirated ZX software, many pirated copies had custom loaders, and layers upon layers upon layers of xor encryption. usually with all kind of tricks: code that overwrites itself, using R register as a key, sometimes even using interrupts ...
by ketmar
Sun Jan 21, 2024 6:24 am
Forum: Programming
Topic: Contention pattern for HALT
Replies: 26
Views: 1727

Re: Contention pattern for HALT

sure. but i meant that Z80 keep reading and decoding HALT opcode again and again. i don't know how CPUs are developed, but using "sheer conventional logic", the easiest way to implement HALT is to insert /INTR check before the final PC decrement. so when /INTR is not raised, PC will be dec...