Talk:Canon Basic/Scripts/Dumper

Back to page

600pages on
this wiki
Add New Page

This code may contain a bug, and an opinon on how to improve code Edit

I do not know uBasic nor Lua, but I understand that GetStart() looks for a keyword in an address and initialize the startaddr os and romsize, variables according on it's finding.

I was looking for a regularity in this procedure, which is broken when the addresses  0xFF810004 and 0xFF820004 contain "gaoinisoy", both set startaddr  to 0xFF810000. Should not de second be 0xFF820000?  I do not know the structure, just guessing what this code does, but it may be a mistake.

private sub GetStart()
'tryaddress, token    -> startaddr  os    romsize
0xFFC00004,"gaonisoy" -> 0xFFC00000 "dry" 0x0000000
0xFFC00008,"Copyrigh" -> 0xFFC00000 "vx"  0x0000000
0xFF810004,"gaonisoy" -> 0xFF810000 "dry" 0x0000000
0xFF820004,"gaonisoy" -> 0xFF810000 "dry" 0x0000000
0xFF810008,"Copyrigh" -> 0xFF810000 "vx"  0x0000000
0xFF000004,"gaonisoy" -> 0xFF000000 "dry" 0x0000000
0xFF020004,"gaonisoy" -> 0xFF010000 "dry" 0x0000000
0xFC020004,"gaonisoy" -> 0xFC000000 "dry" 0x2000000

end sub

if there is a regularity like: the OS keywor (either gaonisoy or Copirigh) starts either 4 or 8 bytes after the startaddr, could not be a more general code to write an automaton searching such keywords from a convinient address, then setting the startaddr, os and romsize according to the finding?

The automaton option may not be viable nor optimal due to restrictions that I ignore. In that case the code may be more easy to mantain if a table can be defined and be tested by a loop, instead of an if then for each case.

I started to program in a very primitive Basic, in which structured data could not be returned from a function, forcing to use global variables to return the values, or as a trick a string containing the values which the caller program should read as the input of the variables in the record.

The uBasic dialect seems to be very advanced. Is it possible in this language to return structured data? if so, the code would be more save and easier to mantain, if the values cold be returned in a structure containing {startaddr,os,romsize}, i.e. avoiding the use of global variables, when it is possible.  The risk of ussing global variables is higher in a real time enviroment, like the DryOS.

It is very frustrating to me, to be "too out of shape", I am not updated on all those programming environments and languages. I would love to help in coding, but all I can do is to say some, maybe non-sense concerns from my readings of the code.

I hope that this may help to this project.

The code could be hugely improved if written in the "literate programming" style, a way to write programs proposed by Donald E. Knuth, which puts more emphasis in explaining what the program does, with long comments, like the explanation of an equation in a math book, and the code as the obtained equation.

search "literate programming" to find more information.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.