mirror of
https://github.com/irmen/prog8.git
synced 2025-11-03 19:16:13 +00:00
update examples to use typed pointers where appropriate
(found 2 regressions that still need to be handled)
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
c64 (and cx16 as well) fileselector has 2 issues when using ^^ubyte (code size and compiler error about return statement)
|
||||
cx16 life code size regression when using ^^ubyte
|
||||
|
||||
|
||||
pointer arithmetic precedence issue?:
|
||||
^^uword values
|
||||
cx16.r0 = values + (pos-1) ; different outcome as:
|
||||
@@ -9,7 +13,7 @@ pointer arithmetic precedence issue?:
|
||||
sorting.gnomesort_uw() : when converted to ^^uword, the resulting code is MUCH larger than before (peek/poke code gen problem?)
|
||||
(same with shellsort_uw and others)
|
||||
|
||||
this doesn't work:
|
||||
this doesn't work but probably should:
|
||||
^^uword xpositions_ptr
|
||||
repeat num_sprites {
|
||||
pokew(cx16.VERA_DATA0, xpositions_ptr^^) ; must set data0 and data1 at the same time
|
||||
@@ -21,7 +25,6 @@ STRUCTS and TYPED POINTERS (6502 codegen specific)
|
||||
--------------------------------------------------
|
||||
|
||||
- implement the TODO's in PointerAssignmentsGen.
|
||||
- scan through 6502 examples to change untyped uword pointers to typed pointers
|
||||
- fix code size regressions (if any left)
|
||||
- update structpointers.rst docs with 6502 specific things?
|
||||
- optimize deref() to not always add the field offset to the pointer value but using it in the Y register instead
|
||||
|
||||
@@ -158,7 +158,7 @@ widget {
|
||||
}
|
||||
}
|
||||
|
||||
sub icon(uword x, uword y, uword caption) {
|
||||
sub icon(uword x, uword y, str caption) {
|
||||
const ubyte width = 56
|
||||
const ubyte height = 28
|
||||
highlightedrect(x, y, width, height, false, false)
|
||||
@@ -170,7 +170,7 @@ widget {
|
||||
}
|
||||
|
||||
|
||||
sub window_titlebar(uword x, uword y, uword width, uword titlestr, bool active) {
|
||||
sub window_titlebar(uword x, uword y, uword width, str titlestr, bool active) {
|
||||
const ubyte height = 11
|
||||
widget.highlightedrect(x+widget.window_close_icon.width, y, width-64, height, true, active)
|
||||
gfx_hires.plot(x+widget.window_close_icon.width, y+height-1, 1) ; correct bottom left corner
|
||||
|
||||
@@ -55,7 +55,7 @@ main {
|
||||
for cx16.r9L in "Cellular Automaton #" {
|
||||
cx16.GRAPH_put_next_char(cx16.r9L)
|
||||
}
|
||||
uword num_str = conv.str_ub(number)
|
||||
^^ubyte num_str = conv.str_ub(number)
|
||||
do {
|
||||
cx16.GRAPH_put_next_char(@(num_str))
|
||||
num_str++
|
||||
|
||||
@@ -176,7 +176,7 @@ main {
|
||||
uword vmem = vmembase * 2048 ; mkword(vmembase,0) * 8
|
||||
ubyte bank = vmembase>=32 as ubyte
|
||||
vmem += 35
|
||||
uword number_str = conv.str_uw0(number)
|
||||
^^ubyte number_str = conv.str_uw0(number)
|
||||
uword pixelsptr = &numberpixels + (number_str[1] & 15)*7
|
||||
ubyte pix
|
||||
cx16.VERA_CTRL = 0
|
||||
|
||||
@@ -60,7 +60,7 @@ main {
|
||||
txt.nl()
|
||||
}
|
||||
|
||||
sub parse(uword stringptr) -> float {
|
||||
sub parse(str stringptr) -> float {
|
||||
if @(stringptr)==0
|
||||
return 0.0
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ market {
|
||||
}
|
||||
}
|
||||
|
||||
sub match(uword nameptr) -> ubyte {
|
||||
sub match(str nameptr) -> ubyte {
|
||||
ubyte ci
|
||||
for ci in 0 to len(names)-1 {
|
||||
if util.prefix_matches(nameptr, names[ci])
|
||||
@@ -429,7 +429,7 @@ galaxy {
|
||||
market.init(lsb(seed[0])+msb(seed[2]))
|
||||
}
|
||||
|
||||
sub search_closest_planet(uword nameptr) -> bool {
|
||||
sub search_closest_planet(str nameptr) -> bool {
|
||||
ubyte x = planet.x
|
||||
ubyte y = planet.y
|
||||
ubyte current_planet_num = planet.number
|
||||
@@ -911,7 +911,7 @@ planet {
|
||||
}
|
||||
}
|
||||
|
||||
sub concat_string(uword str_ptr) {
|
||||
sub concat_string(str str_ptr) {
|
||||
repeat {
|
||||
ubyte c = @(str_ptr)
|
||||
if c==0
|
||||
@@ -1005,7 +1005,7 @@ planet {
|
||||
}
|
||||
|
||||
util {
|
||||
sub prefix_matches(uword prefixptr, uword stringptr) -> bool {
|
||||
sub prefix_matches(str prefixptr, str stringptr) -> bool {
|
||||
repeat {
|
||||
ubyte pc = @(prefixptr)
|
||||
ubyte sc = @(stringptr)
|
||||
@@ -1019,7 +1019,7 @@ util {
|
||||
}
|
||||
}
|
||||
|
||||
sub print_right(ubyte width, uword s) {
|
||||
sub print_right(ubyte width, str s) {
|
||||
repeat width - strings.length(s) {
|
||||
txt.spc()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user