Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
3f54491
don't load v
jkotlinski Apr 20, 2023
9edf5fb
Merge branch 'master' into blocks
jkotlinski Apr 21, 2023
c6b2591
blocks
jkotlinski Apr 22, 2023
1953cf8
some progress on BLOCK
jkotlinski Apr 22, 2023
d8c8c1d
drop least recently used buffer
jkotlinski Apr 22, 2023
011528a
wipe block if file missing
jkotlinski Apr 22, 2023
944f867
refactoring: extract >path
jkotlinski Apr 22, 2023
8cee2b9
added BUFFER
jkotlinski Apr 22, 2023
f914a80
added list
jkotlinski Apr 22, 2023
acf7a61
add empty-buffers
jkotlinski Apr 22, 2023
0ecb0fe
added update
jkotlinski Apr 22, 2023
79de402
tidy up
jkotlinski Apr 22, 2023
e77a727
inline doload
jkotlinski Apr 22, 2023
29431e5
simplify buffer management (no lru)
jkotlinski Apr 22, 2023
505b7ee
tidy up
jkotlinski Apr 22, 2023
ece5ced
allow 3-digit blocks
jkotlinski Apr 22, 2023
aeb29a4
drop path storage
jkotlinski Apr 22, 2023
3ef92ee
add TODO comment
jkotlinski Apr 22, 2023
8f4efd9
scratch before save
jkotlinski Apr 22, 2023
15a528e
fix empty-buffers
jkotlinski Apr 27, 2023
ed6a588
added b-a to allocate blocks
jkotlinski Apr 28, 2023
78d6168
tidy up comment
jkotlinski Apr 28, 2023
eaacf39
add create-blocks
jkotlinski Apr 28, 2023
e2886ad
leaner map file format
jkotlinski Apr 28, 2023
6716c36
safer map loading
jkotlinski Apr 28, 2023
c8ccb88
factoring: extract word
jkotlinski Apr 28, 2023
9aa02b2
some work on sector loading
jkotlinski Apr 28, 2023
6f3ca2b
seemingly fixed block load
jkotlinski Apr 28, 2023
d954604
shorten error message
jkotlinski Apr 28, 2023
58a9162
Merge branch 'master' into blocks
jkotlinski Apr 28, 2023
b74e3b5
tidy up; fix load-map error
jkotlinski Apr 28, 2023
0c5d9e8
temporarily disable build
jkotlinski Apr 28, 2023
b80d8e1
print b-a drive output
jkotlinski Apr 29, 2023
429c8df
added TODO comment
jkotlinski Apr 29, 2023
c05f15a
Merge branch 'master' into blocks
jkotlinski Apr 29, 2023
adc2af6
Merge branch 'master' into blocks
jkotlinski Apr 29, 2023
6ade26a
speed up create-blocks
jkotlinski Apr 29, 2023
3ce7fae
simplify code
jkotlinski Apr 29, 2023
336636a
Merge branch 'master' into blocks
jkotlinski Apr 29, 2023
c29b7b7
simplify disk full check
jkotlinski Apr 29, 2023
2d39689
bugfix load-blk
jkotlinski Apr 29, 2023
5b43051
add decimal for number formatting, tidy up
jkotlinski Apr 29, 2023
7574d26
simplify code
jkotlinski Apr 29, 2023
5ded1ec
implement block save
jkotlinski Apr 29, 2023
00170ad
save a byte
jkotlinski Apr 29, 2023
e19160b
add BLK
jkotlinski Apr 30, 2023
0006ddf
made block numbers start at 1 again (standard)
jkotlinski Apr 30, 2023
789b915
Merge branch 'master' into blocks
jkotlinski Apr 30, 2023
138c162
push/pop BLK
jkotlinski Apr 30, 2023
77bd347
start work on LOAD
jkotlinski Apr 30, 2023
d4b32a0
start work on save/restore BLK
jkotlinski May 1, 2023
d6536e5
some work on testing
jkotlinski May 1, 2023
0c102bb
LOAD 100%
jkotlinski May 1, 2023
410f9af
made test-load pass
jkotlinski May 1, 2023
541dde9
allocate 11 block buffers
jkotlinski May 1, 2023
15a1775
hide private block words
jkotlinski May 1, 2023
1aecc81
fix create-blocks
jkotlinski May 1, 2023
1d28d0e
fix: load-map did not advance HERE
jkotlinski May 1, 2023
ae09ad5
Merge branch 'master' into blocks
jkotlinski May 1, 2023
c6c185a
Merge branch 'master' into blocks
jkotlinski May 20, 2023
7a3aee9
implement \ for blocks (not tested)
jkotlinski May 20, 2023
e06b63c
add REFILL EVALUATE for blocks (not tested)
jkotlinski May 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions forth/block.fs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
require io

( three block buffers at $c000-$cbff )

create bbi 0 , 0 c, \ buf block id's
create dirty 0 , 0 c,
( 11 block buffers at $a000-$cbff.
this may be excessive, let's
shrink it once v is replaced with
a block-based editor. )

\ buf block id's
create bbi 0 , 0 , 0 , 0 , 0 , 0 c,
create dirty 0 , 0 , 0 , 0 , 0 , 0 c,

@ekipan ekipan May 1, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it stays an odd number, say 5, then any block editor that does shadow blocks will still be able to use all 5 buffers while you browse +2 and -2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops nvm I should have read more, I see you're doing #11 mod please ignore.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is really nice that you take a look at things. It is maybe getting closer to first release. Test and documentation are still missing.

@jkotlinski jkotlinski May 1, 2023

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also to be done: update EVALUATE, \ and REFILL to support blocks.

Edit: Done

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to support:

  • disk change
  • release/delete blocks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've avoided the problem by only using ( in my blocks. FWIW my vote is 40 to (1) make editors simpler to implement and because (2) horizontal scrolling is kinda gross UX. It's definitely unorthodox though. Perhaps a poll is in order?

@jkotlinski jkotlinski May 20, 2023

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a poll is needed, just need to work out the pros and cons. I agree 40-width makes a lot of sense for the reasons you mention.

The strongest argument for 64 is that long strings can be useful, for example, it allows defining a S" string that is 40 characters long or more. I am not sure if there is a clean way to do the same with 40-width.

@jkotlinski jkotlinski May 20, 2023

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually: I realize now, long lines is not a problem for blocks. When LOADing a block, S" will parse until the next ", even if it is on another line.

It is a problem if the code is later copied from block to file, but then it can be resolved by joining the string lines to a single long line.

I think altogether, that makes a strong case for 40-width.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike files, block LOAD is specified to use the entire block source as the input buffer, so words like s" and ( should be able to span across lines portably if I understand correctly (if I don't understand correctly please let me know).

Another strong argument for 64 is to make it more likely to be able to directly reuse any Forth source already in 16x64 screens out there that have \ comments. I'm personally ambivalent to that though.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the most part, I don't think porting from 16x64 to 25x40+24 would be a big problem. At least not compared to all the other problems when porting code from a Forth to another.

create curr-buf 0 c,

variable map 0 map !
Expand Down Expand Up @@ -41,7 +45,7 @@ here path here loadb
0= abort" no blocks" map ! ;

: >addr ( buf -- addr )
$400 * $c000 + ;
$400 * $a000 + ;

: write-sector ( t s src -- ) decimal
s" #" 5 5 open ioabort
Expand All @@ -62,7 +66,7 @@ swap >addr dup $400 + swap do
dup @ split i write-sector
2+ $100 +loop drop ;

: >buf ( blk -- buf ) 3 mod ;
: >buf ( blk -- buf ) #11 mod ;

: read-sector ( dst t s -- ) decimal
s" #" 5 5 open ioabort <# 0 #s bl hold
Expand Down Expand Up @@ -101,17 +105,17 @@ block dup $400 + swap do
i c@ emit loop ;

: empty-buffers ( -- )
bbi 3 erase dirty 3 erase ;
bbi #11 erase dirty #11 erase ;

: update ( -- )
1 dirty curr-buf c@ + c! ;

: save-buffers ( -- )
0 save-buf 1 save-buf 2 save-buf ;
11 0 do i save-buf loop ;

: flush save-buffers empty-buffers ;

\ --- testing
( --- testing

: test-load
4 create-blocks 0
Expand All @@ -127,4 +131,4 @@ s" 4" 4 block swap move update
3 <> abort" 3"
2 <> abort" 2"
1 <> abort" 1"
0 <> abort" 0" ;
0 <> abort" 0" ; )
2 changes: 1 addition & 1 deletion manual/memmap.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $35b - $3d9 :: `pad` Scratch pad memory, Cassette Buffer, untouched by DurexFort
$3da - $3fb :: `#>` buffer.
$801 - here :: Forth Kernel followed by code and data space.
latest - $9fff :: Dictionary. Grows downwards as needed.
$a000 - $cbff :: Editor text buffer.
$a000 - $cbff :: Editor text buffer / Block buffers.
$cc00 - $cfff :: Hi-res graphics colors.
$d000 - $dfff :: I/O area.
$e000 - $ffff :: Kernal / hi-res graphics bitmap.