Skip to content

Commit 47ab7cd

Browse files
committed
...
1 parent aca1e07 commit 47ab7cd

21 files changed

+6119
-6127
lines changed

doc/sizes.csv0

+757-758
Large diffs are not rendered by default.

doc/sizes.csv1

+757-758
Large diffs are not rendered by default.

doc/sizes.csv2

+757-758
Large diffs are not rendered by default.

doc/sizes.csv3

+757-758
Large diffs are not rendered by default.

doc/sizes.csv4

+757-758
Large diffs are not rendered by default.

doc/sizes.csv5

+757-758
Large diffs are not rendered by default.

doc/sizes.csv6

+757-758
Large diffs are not rendered by default.

doc/sizes.csv7

+757-758
Large diffs are not rendered by default.

pettil.d64

0 Bytes
Binary file not shown.

pettil0.d64

0 Bytes
Binary file not shown.

pettil1.d64

0 Bytes
Binary file not shown.

pettil2.d64

0 Bytes
Binary file not shown.

pettil3.d64

0 Bytes
Binary file not shown.

pettil4.d64

0 Bytes
Binary file not shown.

pettil5.d64

0 Bytes
Binary file not shown.

pettil6.d64

0 Bytes
Binary file not shown.

pettil7.d64

0 Bytes
Binary file not shown.

src/core/core-inner.a65

+15-7
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ docconst
104104
sta tos
105105
pla
106106
sta tos+1
107-
jsr inctos
108-
jmp fetch01
107+
ldy #1
108+
bne fetch01
109109

110110
;--------------------------------------------------------------
111111
#if 0
@@ -137,7 +137,6 @@ put0a
137137
name=M>R
138138
stack=( count addr -- )
139139
tags=primitive,extra,memory
140-
beginning at `addr`, push `count` bytes to return stack. `count` must be even.
141140

142141
mtor
143142
ldy #0
@@ -263,6 +262,7 @@ put
263262
sta tos
264263
puty
265264
sty tos+1
265+
put99
266266
jmp next
267267

268268
;--------------------------------------------------------------
@@ -319,7 +319,7 @@ tags=forth-79,nucleus,memory,forth-83
319319
#endif
320320
cfetch
321321
clc
322-
.byt $29
322+
.byt $29 ; AND #
323323
; fall through
324324
;--------------------------------------------------------------
325325
#if 0
@@ -334,8 +334,8 @@ Leave the 16 bit contents of address.
334334
fetch
335335
sec
336336
;
337-
fetch01
338337
ldy #0
338+
fetch01
339339
lda (tos),y
340340
bcc put
341341
pha
@@ -403,9 +403,11 @@ rfrom
403403
jsr slip
404404
rput
405405
pla
406-
sta tos
406+
tay
407407
pla
408+
putay
408409
sta tos+1
410+
sty tos
409411
rput99
410412
jmp next
411413

@@ -621,6 +623,9 @@ stack=( -- )
621623
tags=inner,nosymbol
622624
Displays an inline string
623625

626+
~todo: fix bug where a string followed by a 1-byte pad crashes `(.")`
627+
when target address is $xxFF then it needs to become $(xx+1)00
628+
624629
```
625630
: (.")
626631
r> count 2dup type >6502 ( `;code` instead? )
@@ -1288,8 +1293,11 @@ j
12881293
name=PADAY
12891294
tags=inner,subroutine,nosymbol
12901295
stack=( -- )
1291-
subroutine to add a (properly paged) value to offset IP, result returned in AY
1296+
add a page-adjusted offset to IP
12921297

1298+
```
1299+
AY new IP
1300+
```
12931301
#endif
12941302
paday
12951303
sec ;[2] ; A+1 = offset to be added to IP

src/core/core-nucleus.a65

+3-7
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,6 @@ neg2
525525
eor #$FF
526526
adc #0
527527
sta tos
528-
; .byt $29
529-
;eorff00
530-
; clc ; set upper byte of tos =$FF
531-
;
532528
lda tos+1
533529
eor #$FF
534530
adc #0
@@ -2237,6 +2233,7 @@ stack=( -- r )
22372233
tags=nucleus
22382234

22392235
return a random number in the range 0..65535
2236+
from the [[First Book of KIM-1|http://users.telenet.be/kim1-6502/6502/fbok.html]]
22402237

22412238
#endif
22422239
rnd
@@ -2255,7 +2252,7 @@ tags=nucleus
22552252
#endif
22562253
randuc
22572254
ldy #0
2258-
;
2255+
randu2
22592256
jsr randu
22602257
jmp pushya
22612258

@@ -2780,7 +2777,7 @@ e.g.
27802777

27812778

27822779
```
2783-
: >bit ( bit# base -- mask addr )
2780+
: >bit ( bit# base -- mask offset )
27842781
over 7 and power2 + c@ -rot
27852782
swap 2/ 2/ 2/ + ;
27862783

@@ -2893,7 +2890,6 @@ storeplus
28932890
sta (tos),y
28942891
jmp twoplus
28952892
;[21]
2896-
28972893
```
28982894
#endif
28992895
#include "align.i65"

src/core/core-vm.a65

+15-19
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ name=B/SCR
1919
stack=( -- 1000 )
2020
tags=const,vm
2121
!!!Constant
22-
bytes per screen. Not what it usually means in other Forths,
23-
24-
|model|b/scr|h
25-
|PET|1000|
26-
|PET 8032|2000|
27-
|VIC-20|512|
28-
|C=64|1000|
29-
|C128|1000|
30-
|Plus/4|1000|
31-
22+
bytes per screen. In other Forths, this word often has a different meaning of blocks per screen
23+
24+
|^model|^b/scr|h
25+
|^PET|^1000|
26+
|^PET 8032|^2000|
27+
|^VIC-20|^512|
28+
|^C=64|^1000|
29+
|^C128|^1000|
30+
|^Plus/4|^1000|
31+
|^Other Forths*|^1|
3232
#endif
3333
bperscr
3434
jsr doconst
@@ -40,11 +40,7 @@ name=CAS1BUF
4040
stack=( -- $027A )
4141
tags=const,vm
4242
!!!Constant
43-
Address of the first tape buffer (device #1)
44-
#endif
45-
cas1buf
46-
jsr doconst
47-
.word CAS1BUF
43+
bytes per screen. In other Forths, this word often has a different meaning of blocks per screen
4844

4945
;--------------------------------------------------------------
5046
#if 0
@@ -56,9 +52,9 @@ Address of the second tape buffer (device #2)
5652
base address of cassette buffer #2, used (for now) as a line buffer
5753
to unpack screens and blocks into lines
5854
#endif
59-
cas2buf
55+
cas2buf
6056
jsr doconst
61-
#ifdef IS_PET
57+
#ifdef IS_PET
6258
.word CAS2BUF
6359
#else
6460
.word CAS1BUF
@@ -97,9 +93,9 @@ blkbuf02
9793
sbc #4 ; -1K ~8032
9894
pusha0
9995
tay
96+
pushy0
10097
lda #0
10198
jmp pushya
102-
;[17] -1 20191019cah
10399

104100
;--------------------------------------------------------------
105101
#if 0
@@ -382,7 +378,7 @@ _pktsize
382378
#if 0
383379
name=PKT.THIS
384380
stack=( -- pkt size )
385-
tags=vm,ext
381+
tags=vm,ext,nosymbol
386382
Return header address and size for current packet in `n8`
387383

388384
```

src/core/pettil-core.a65

+30-30
Original file line numberDiff line numberDiff line change
@@ -271,49 +271,49 @@ Initialization and storage area for User Variables
271271
#endif
272272
userarea
273273
; ---- initialization values per each `cold`
274-
user0base .word 10 ; 8-bit
275-
user0filename .word currname+3 ;1 counted string, default "PETTILPACKETS" 16-bit
276-
user0sanum .word 0 ;2 default secondary address is 0, (PRG file) 8-bit
277-
user0drvnum .word 1 ;3 default drive (datasette #1), 8-bit
274+
user0base .word 10
275+
user0filename .word currname+3 ;1 counted string, default "PETTILPACKETS"
276+
user0sanum .word 0 ;2 default secondary address is 0, (PRG file)
277+
user0drvnum .word 1 ;3 default drive (datasette #1),
278278

279279
; ---- UP points to here, all live user variables
280280
uarea
281281
; ---- not re-initialized or initialized another way
282-
usersp0 .word bos+1 ; `abort` does `sp!` 8-bit
283-
userrp0 .word $01FE ; `quit` does `rp!` 8-bit
284-
userirq .word 0 ; see `=irq` 16-bit
285-
userbrk .word SW16 ; see `=brk` `!sw16` 16-bit
286-
usernmi .word 0 ; see `=nmi` 16-bit
282+
usersp0 .word bos+1 ; `abort` does `sp!`
283+
userrp0 .word $01FE ; `quit` does `rp!`
284+
userirq .word 0 ; see `=irq`
285+
userbrk .word SW16 ; see `=brk` `!sw16`
286+
usernmi .word 0 ; see `=nmi`
287287
useriooper .word 0 ; vector for external tape and disk I/O 16-bit
288-
userstartup .word fencepost ;`studio` begins here 16-bit
289-
userwarning .word _doterr ;1/ `studio` replaces `.err` with `error.msg` 16-bit
290-
userdp .word fencepost ; 16-bit
291-
userfence .word fencepost ; 16-bit
292-
usersymtab .word 0 ; 16-bit
288+
userstartup .word fencepost ;`studio` begins here
289+
userwarning .word _doterr ;1/ `studio` replaces `.err` with `error.msg`
290+
userdp .word fencepost
291+
userfence .word fencepost
292+
usersymtab .word 0
293293

294294
ucore
295295
.dsb uarea-userarea+80,$cc ; storage for user variables
296296

297297
; ---- re-initialized by `cold`
298-
userbase = ucore+0 ; 8-bit
299-
userfilename = ucore+2 ;-> `(save-buffers)` reads 8 consecutive bytes 16-bit
300-
usersanum = ucore+4 ;-> 8-bit
301-
userdrvnum = ucore+6 ;-> 8-bit
298+
userbase = ucore+0
299+
userfilename = ucore+2
300+
usersanum = ucore+4
301+
userdrvnum = ucore+6
302302

303303
ustart = ucore+8
304-
uservmbuf = ustart+0 ;-> There is code that relies on adjacency of 16-bit
305-
usernumblk = ustart+2 ;-> these sets of uservariables, so that bytes 8-bit
306-
userscr = ustart+4 ;-> and clocks may be saved 16-bit
307-
userprev = ustart+6 ;-> most recently referenced block 16-bit
308-
userblk = ustart+8 ;-> 16-bit
309-
userin = ustart+10 ;-> 8-bit
310-
userlin = userin+1 ; upper byte is physical line counter 8-bit
311-
userspan = ustart+12 ;-> 8-bit
312-
usernumline = ustart+14 ;-> 16-bit
313-
usernumout = ustart+16 ;-> 16-bit
314-
userediting = ustart+18 ;-> - `quit` erases 12 bytes at `blk` flag
304+
uservmbuf = ustart+0 ;1 There is code that relies on adjacency of
305+
usernumblk = ustart+2 ;2 1 these sets of uservariables, so that bytes
306+
userscr = ustart+4 ;3 2 and clocks may be saved
307+
userprev = ustart+6 ; 3 most recently referenced block
308+
userblk = ustart+8 ;1 4
309+
userin = ustart+10 ;2 8-bit
310+
userlin = userin+1 ; upper byte is physical line counter
311+
userspan = ustart+12 ;3 8-bit
312+
usernumline = ustart+14 ;4
313+
usernumout = ustart+16 ;5
314+
userediting = ustart+18 ;6 - `quit` erases 12 bytes at `blk`
315315
userdpl = ustart+20 ; 8-bit
316-
userhld = ustart+22 ; 8-bit
316+
userhld = ustart+22 ;
317317
usercursor = ustart+24 ; 6 bytes
318318

319319
uendcore = ustart+30 ; mark our place for piggyback app's uservar base

0 commit comments

Comments
 (0)