Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PicoMite/PicoMiteVGA/WebMite V5.07.07 release candidates
Page 8 of 13 | |||||
Author | Message | ||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Great, that works, and thanks for fixing the other niggles too. I'll see if I can find you some more later / in the morning. Have a good evening, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Here is a nice MEMORY COPY bug: Option Base 0 Option Default None Option Explicit On Const BASE% = 0 Dim counter% = 0 test_copy_given_overlap() Sub test_copy_given_overlap() Local buf%(array.new%(4)) ' 32-bytes Local pbuf% = Peek(VarAddr buf%()) buf%(BASE%) = &h0 buf%(BASE% + 1) = &hFF01020304050607 buf%(BASE% + 2) = &h08090A0B0C0D0E0F buf%(BASE% + 3) = &h0 assert_hex_equals(0, Peek(Integer pbuf%)) assert_hex_equals(&hFF01020304050607, Peek(Integer pbuf% + 8)) assert_hex_equals(&h08090A0B0C0D0E0F, Peek(Integer pbuf% + 16)) assert_hex_equals(0, Peek(Integer pbuf% + 24)) ' Copy onto itself. Memory Copy pbuf%, pbuf%, 32 assert_hex_equals(0, Peek(Integer pbuf%)) assert_hex_equals(&hFF01020304050607, Peek(Integer pbuf% + 8)) assert_hex_equals(&h08090A0B0C0D0E0F, Peek(Integer pbuf% + 16)) assert_hex_equals(0, Peek(Integer pbuf% + 24)) buf%(BASE%) = &h0 buf%(BASE% + 1) = &hFF01020304050607 buf%(BASE% + 2) = &h08090A0B0C0D0E0F buf%(BASE% + 3) = &h0 ' Copy where pdst < psrc. Memory Copy pbuf% + 8, pbuf% + 5, 16 assert_hex_equals(&h0506070000000000, Peek(Integer pbuf%)) assert_hex_equals(&h0D0E0FFF01020304, Peek(Integer pbuf% + 8)) assert_hex_equals(&h08090A08090A0B0C, Peek(Integer pbuf% + 16)) assert_hex_equals(&h0, Peek(Integer pbuf% + 24)) buf%(BASE%) = &h0 buf%(BASE% + 1) = &hFF01020304050607 buf%(BASE% + 2) = &h08090A0B0C0D0E0F buf%(BASE% + 3) = &h0 If Mm.Device$ = "MMB4L" Then ' Copy where pdst > psrc. ' Colour Maximite 2 doesn't handle this correctly. Memory Copy pbuf% + 8, pbuf% + 11, 16 assert_hex_equals(&h0, Peek(Integer pbuf%)) assert_hex_equals(&h0304050607050607, Peek(Integer pbuf% + 8)) assert_hex_equals(&h0B0C0D0E0FFF0102, Peek(Integer pbuf% + 16)) assert_hex_equals(&h000000000008090A, Peek(Integer pbuf% + 24)) EndIf End Sub Function array.new%(capacity%) array.new% = capacity% + Mm.Info(Option Base) - 1 End Function Sub assert_hex_equals(expected%, actual%, chars%) Inc counter% Print "[" + Str$(counter%) + "] "; If expected% <> actual% Then Local s$ Cat s$, "Assert equals failed, expected &h" Cat s$, Hex$(expected%, chars%) Cat s$, " but actually &h" Cat s$, Hex$(actual%, chars%) Print s$ Else Print "OK" EndIf End Sub Which currently outputs: [1] OK [2] OK [3] OK [4] OK [5] OK [6] OK [7] OK [8] OK [9] Assert equals failed, expected &h506070000000000 but actually &h90A080000000000 [10] Assert equals failed, expected &hD0E0FFF01020304 but actually &hA08090A08090A08 [11] Assert equals failed, expected &h8090A08090A0B0C but actually &h8090A08090A0809 [12] OK The problems is where pdst < psrc. The CMM2, MMB4W and MMB4L all get this correct. For *bonus points* get pdst > psrc working too, it doesn't on the CMM2 (not sure about MMB4W). I haven't looked at the C code but *may* be as simple as taking the slight performance hit and using memmove() instead of memcpy(). Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Fixed including tests 13-16. Will include in next RC |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
It looks like there is a fragment of debug code in Mm.Info(FileSize file$) for drive B: > drive "a:" > ? Mm.Info(FileSize "bootcount") 4 > drive "b:" > ? Mm.Info(FileSize "tst_inc.bas") /tst_inc.bas <===== *** This should not be here *** 605 Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
I *think/hope* this (on A: and B:) may be the last of it for the PicoMite: Option Base 0 Option Default None Option Explicit On ' Setup a test file. Dim f$ = "test_file.txt" Open f$ For Output As #1 Print #1, "Hello World"; Close #1 Open f$ For Append As #1 If Eof(#1) <> 1 Then ? "[1] FAIL" Else ? "[1] OK" ? Loc(#1) ' Should start with r/w pointer one past the end. If Loc(#1) <> 12 Then ? "[2] FAIL" Else ? "[2] OK" Close #1 Open f$ For Random As #1 If Eof(#1) <> 1 Then ? "[3] FAIL" Else ? "[3] OK" ' Should start with r/w pointer one past the end. If Loc(#1) <> 12 Then ? "[4] FAIL" Else ? "[4] OK" Close #1 Assuming you are happy to make these changes then I'd appreciate a new RC (8?) for a final smoke test on the PicoMite and what I assume will be a non-event of testing on the PicoMiteVGA. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Tom The problem is that this is what littlefs returns. If you actually write to the files when appended or random you will see that the new write goes on the end. i.e. the open command is correct |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Hi Peter, Given that nothing else can be manipulating these files other than the interpreter it should (for the sake of consistency) be possible to workaround littlefs' idiosyncrasies (assuming it is littlefs that is idiosyncratic and not the library used for the other 'mites and drive B:) So, if I were the one doing this, that is what I would do. HOWEVER they are edge conditions and I'm not the one doing this, so if you want to say "No" then I'll just special-case these assertions in my test-suite on the PicoMite. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
The problem is that littlefs doesn't set the file write pointer until after a write so on open it just points to the beginning of the file regardless of the opening mode. It also doesn't have a EOF function so I simulate EOF by comparing the write pointer with the filelength |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
You can try this but you need to check it doesn't b....r anything else PicoMite.zip |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Right, so no pressure then ;-) ... what happens if you automatically perform a seek(file_length + 1) as part of opening for RANDOM or APPEND ? Best wishes, Tom Edited 2023-04-26 22:02 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
that's what I have done + a flush |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
OK, I will give it a thrash, but it will have to be tomorrow. Thanks, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Slowly going potty: PicoMite MMBasic Version 5.07.07RC7 Copyright 2011-2023 Geoff Graham Copyright 2016-2023 Peter Mather > ? Mm.Info(Drive) A: > ? Mm.Info(Exists Dir "B:") 1 > ? Mm.Info(Drive) B: <==== WTF!!! Also: PicoMite MMBasic Version 5.07.07RC7 Copyright 2011-2023 Geoff Graham Copyright 2016-2023 Peter Mather > ? Mm.Info(Drive) A: > ? Mm.Info(Exists Dir ".") 1 > ? Mm.Info(Exists Dir "..") 1 > ? Mm.Info(Exists Dir "") 1 > ? Mm.Info(Exists File ".") 0 > ? Mm.Info(Exists File "..") 0 > ? Mm.Info(Exists File "") 0 > Drive "B:" > ? Mm.Info(Exists Dir ".") 0 <==== WRONG > ? Mm.Info(Exists Dir "..") 0 <==== WRONG > ? Mm.Info(Exists Dir "") 1 > ? Mm.Info(Exists File ".") 0 > ? Mm.Info(Exists File "..") 0 Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6814 |
Does "Drive" still work from the command line or was it taken out? What happens if you change to drive B using "B:"? Edited 2023-04-27 20:42 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Both work fine, that's not what either of these bug reports is about: 1. Mm.Info(Exists Dir "B:") actually changes the Drive to B !!! 2. On Drive B, Mm.Info(Exists Dir ".") and Mm.Info(Exists Dir "..") do not return 1 Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Amnesie Guru Joined: 30/06/2020 Location: GermanyPosts: 396 |
Hello Tom, I am following your bug reports quite a while and I'm impressed and curious how you can spott so many of them. Have you written some "test-sequence" or do you work on a program for basic, which involves this extensive testing? In any case this work is hugely apprechiated! Greetings Daniel |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
That's what happens when I implement special cases to get round differences between LittleFS and FatFS - forgot to restore the current filesystem. And the second report also needs yet more special cases |
||||
disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 899 |
I have seen this one some time ago, but for 'too many labels' On the PicoMite the labels are hashed with the SUBs and FUNCTIONS, but after them so I think there is still a path after RC8 to get into this hang situation if number of SUBs and FUNCTIONs are OK but the labels take it over the maximum of 224. Also is there any room to increase the number for the Picomite as it also includes the labels, but on PicomiteVGA and WebMite labels are not hashed. #define MAXSUBFUN 224 // each entry takes up 4 bytes Gerry Latest F4 Latest H7 |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Since a "proper" program doesn't have any labels then counting them makes no difference to the subroutine number. In any case I am not making changes to memory layout now. Just bug fixes before 5.07.07 goes live |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Hi Daniel, I'm not doing it manually if that's what you are wondering about. I have ~20,000 lines of MMBasic solely written to test actual behaviour (of both low-level MMBasic and the programs I write in it) against expected behaviour. All I need to do is type one command and it rattles off and some time later (quite a lot of time later on the PicoMite) it reports what is behaving as expected and what is not ... of course it is far from comprehensive and occasional manual intervention is required. See more (and ask any followup questions) here: https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=15846 Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Page 8 of 13 |
Print this page |