diff --git a/compiler/res/prog8lib/cx16/diskio.p8 b/compiler/res/prog8lib/cx16/diskio.p8 index 18e37c9aa..66bcdceb4 100644 --- a/compiler/res/prog8lib/cx16/diskio.p8 +++ b/compiler/res/prog8lib/cx16/diskio.p8 @@ -935,15 +935,14 @@ io_error: return cx16.r0 = cx16.r1 = cx16.r2 = cx16.r3 = 0 - - sub read4hex() -> uword { - str hex = "0000" - hex[0] = cbm.CHRIN() - hex[1] = cbm.CHRIN() - hex[2] = cbm.CHRIN() - hex[3] = cbm.CHRIN() - return conv.hex2uword(hex) - } } + sub read4hex() -> uword { + ubyte[5] hex = 0 + hex[0] = cbm.CHRIN() + hex[1] = cbm.CHRIN() + hex[2] = cbm.CHRIN() + hex[3] = cbm.CHRIN() + return conv.hex2uword(hex) + } } diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 578e1b3b7..00ad4dd87 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -2,11 +2,36 @@ TODO ==== IR: add codegen for containmentcheck literal + test that it actually works (positive and negative) - -diskio.internal_f_tell gets included in the assembly even though f_tell is never called ??? (when using another routine from diskio...) - IR: Improve codegen for for loops downto 0. (BPL if <=127 etc like 6502 codegen?) +callgraph issue? : if a sub contains another sub and it calls that, the outer sub is never removed even if it doesn't get called? +callgraph issue? : there's an odd case that keeps unused subroutines marked as used , they don't get removed. Has to do with declaring string var. :: + + %import conv + %option no_sysinit + + main { + sub start() { + cx16.r0++ + } + } + + stuff { + asmsub shim() { + %asm {{ + jmp p8s_read4hex + }} + } + + sub read4hex() -> uword { + ;ubyte[5] hex = 0 + str hex = "0000" ; TODO causes everything to be included , if declared as a byte array, nothing is included + return conv.hex2uword(hex) + } + } + + + Improve register load order in subroutine call args assignments: in certain situations, the "wrong" order of evaluation of function call arguments is done which results in overwriting registers that already got their value, which requires a lot of stack juggling (especially on plain 6502 cpu!)