Search found 232 matches

by chitselb
Sat Nov 01, 2025 4:26 pm
Forum: General Discussions
Topic: EOR #$FF - 6502 Ponderables and Befuddlements
Replies: 6
Views: 3460

Re: EOR #$FF - 6502 Ponderables and Befuddlements

$1E has this:

Code: Select all

 SED
 CMP #$0A
 ADC #$30
 CLD


I am pretty sure (on the PET anyway) that this needs to be performed in between SEI / CLI so that when the jiffy clock IRQ strikes, we don't have a problem with the processor being in decimal mode.
by chitselb
Wed Apr 15, 2020 2:26 am
Forum: Forth
Topic: Self Modifying Code
Replies: 37
Views: 26298

Re: Self Modifying Code

I recall QUAN structures in MMSForth, a syntactically cleaner albeit nonstandard replacement for VARIABLE. The way it worked in your code was: quan foo
42 is foo
foo .
at foo .
: compiledfoo ( -- )
37 is foo foo . at foo . ;
Under the hood, FOO has three different code field addresses, and the ...
by chitselb
Wed Oct 09, 2019 9:38 am
Forum: Forth
Topic: various PETTIL design considerations
Replies: 109
Views: 39654

Re: various PETTIL design considerations

I finally got the outer interpreter behaving correctly and could not be more thrilled! It does nested loading of screens and has so far withstood all the torture tests I've thrown at it. Here's the source, feedback appreciated lazy-loading outer interpreter

code skip ( -- offset )
$f0 # lda,
$2c ...
by chitselb
Fri Sep 13, 2019 8:02 pm
Forum: Forth
Topic: various PETTIL design considerations
Replies: 109
Views: 39654

Re: various PETTIL design considerations

This (relocating loader that looks at the file load addres before calculating the effective load address) seems like it could be the sort of problem that someone else has already solved. All ideas are welcome.
Mia Magnusson came up with this in Facebook group "FORTH PROGRAMMING / RETRO COMPUTING ...
by chitselb
Fri Sep 13, 2019 2:52 am
Forum: Forth
Topic: various PETTIL design considerations
Replies: 109
Views: 39654

Re: various PETTIL design considerations

my exit was "POP RS->IP; JMP NEXT"
now it is "POP RS->IP; JMP NEXTO"
next inc ip
inc ip
nexto jmp (ip)

Either are perfectly standard EXITs. There are processors that do one faster and processors that do the other faster, and on those processors, the model will follow suit. IIRC, the 68K has a ...
by chitselb
Sun Sep 01, 2019 6:15 am
Forum: Forth
Topic: various PETTIL design considerations
Replies: 109
Views: 39654

Re: various PETTIL design considerations


But it is not standard whether to increment the IP before or after stacking. When NEXT is a short macro, it's often after, just because that makes EXIT into "POP RS; NEXT". But in a processor where the two are symmetric, doing the one that is more convenient for words manipulating the inner ...
by chitselb
Sat Aug 31, 2019 1:01 am
Forum: Forth
Topic: various PETTIL design considerations
Replies: 109
Views: 39654

Re: various PETTIL design considerations

Original way, also FIG & Blazin' way, seems like how everybody does it way ENTER pushes the current IP to the return stack
EXIT adds 2
I'm changing it to this: ENTER pushes the +2 address where we will wind up, e.g. IP := IP+2 -(IP==$FF), with page crossing considered
EXIT simply pops the return ...
by chitselb
Sat Aug 24, 2019 4:38 am
Forum: Forth
Topic: 6502 Assembler in 96 lines of Forth (July 1980)
Replies: 21
Views: 26329

Re: 6502 Assembler in 96 lines of Forth (July 1980)


The assembler I wrote for my Forth for the Commodore 64 is also based on Ragsdale's assembler. I rewrote M/CPU and the index table is ten bytes smaller. I added range checking for the instructions that compile a branch. One change I'm thinking about is removing the comma's at the end of the opcode ...
by chitselb
Mon Aug 12, 2019 3:31 am
Forum: Programming
Topic: Woz FP revisited
Replies: 11
Views: 2196

Re: Woz FP revisited

I'm really glad to have spotted this here, as an alternative to the floating point package I was planning on PETTIL (a general purpose Commodore Forth).

4-byte values are a natural for Forth, and I wouldn't have to rely on the kludgy swappy approach I was going to go with, because BASIC's floating ...
by chitselb
Sat Jul 13, 2019 12:37 am
Forum: Emulation and Simulation
Topic: test automation with VICE
Replies: 6
Views: 2297

Re: test automation with VICE

behold! remote 8-bit test automation!

https://photos.app.goo.gl/BX42trUAy7Q3Ui4x9
by chitselb
Sat Apr 27, 2019 6:49 am
Forum: Emulation and Simulation
Topic: test automation with VICE
Replies: 6
Views: 2297

test automation with VICE

I'm working with VICE emulator on Linux, but this approach should work on other operating systems. What I want to do is build my 6502 code launch a PET (shell script) load the freshly built binary (KEYBUF) then execute it(also KEYBUF) Finally I'd like the emulated PET to exit, to disappear (BREAK ...
by chitselb
Fri Feb 22, 2019 12:25 am
Forum: Forth
Topic: various PETTIL design considerations
Replies: 109
Views: 39654

Re: various PETTIL design considerations

As I start work on the metacompiler, I'm thinking of adding three additional `number` punctuation prefixes: " & '

" quoted_character" e.g. "P" puts $0050 on the stack
# decimal_value \
$ hex_value \ these are working
% binary_value / already in `number`
& resolve_reference resolves reference ...
by chitselb
Thu Jan 03, 2019 6:04 am
Forum: Forth
Topic: Vorth (unexpanded VIC-20 Forth) design considerations
Replies: 6
Views: 3306

Re: Vorth (unexpanded VIC-20 Forth) design considerations

Stacks are pretty simple, 8-bits wide with the stack pointer stored in the byte above the stack. It is easy enough to treat two 8-bit cells as an address, since everything is in zero page. This seems like it might work well for a few processes, each with its own private stack, in a multitasking ...
by chitselb
Thu Jan 03, 2019 5:56 am
Forum: Forth
Topic: Vorth (unexpanded VIC-20 Forth) design considerations
Replies: 6
Views: 3306

Re: Vorth (unexpanded VIC-20 Forth) design considerations

In Vorth, most things are done to conserve space. Here is some working code like that which the Vorth metacompiler will generate. This one makes a little bird fly around on the VIC-20 display. The whole thing, including a BASIC bootstrap and the Vorth inner interpreter with a few primitives, takes ...