diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index b6708e86f..e394a1754 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -290,8 +290,9 @@ cx16 { &ubyte d2ier = via2+14 &ubyte d2ora = via2+15 - &ubyte ym2151adr = $9f40 - &ubyte ym2151dat = $9f41 +; YM-2151 sound chip + &ubyte YM_ADDRESS = $9f40 + &ubyte YM_DATA = $9f41 const uword extdev = $9f60 diff --git a/compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt index 05a1d1b79..9c0abd521 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt @@ -86,7 +86,7 @@ internal class AstIdentifiersChecker(private val errors: IErrorReporter, val existing = subroutine.lookup(listOf(subroutine.name)) if (existing != null && existing !== subroutine) { - if(existing.parent!==existing.parent) // TODO fix this check + if(existing.parent!==subroutine.parent && existing is Subroutine) nameShadowWarning(subroutine.name, existing.position, subroutine) else nameError(subroutine.name, existing.position, subroutine) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index c214b5136..56aff428f 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,7 +3,6 @@ TODO For next release ^^^^^^^^^^^^^^^^ -- AstIdentifiersChecker: fix the subroutine name shadow if-condition (see vardecl check) - 6502 codegen: make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as ``p8v_``? Or not worth it (most 3 letter opcodes as variables are nonsensical anyway) then we can get rid of the instruction lists in the machinedefinitions as well. This is already no problem at all in the IR codegen. - create BSS section in output program and put StStaticVariables in there with bss=true. Don't forget to add init code to zero out everything that was put in bss. If array in bss->only zero ONCE! So requires self-modifying code diff --git a/examples/test.p8 b/examples/test.p8 index 15260cf14..41236cb56 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,17 +1,35 @@ %import textio +%import psg %zeropage basicsafe main { - ubyte @shared qqq=123 - - &uword mapped = $ea31 sub start() { - ubyte bb = 99 - txt.print_ub(bb) - txt.print("Hello, world!") - uword ww = bb - txt.print_uw(bb) - txt.print_uw(ww) + ubyte @shared variable + + sub nested() { + ubyte @shared variable2 + + variable2 = 33 + nested() + + sub nested() { + ubyte @shared variable3 + + variable3 = 33 + } + } + + nested() + explosion() + } + + sub explosion() { + ; this subroutine is not used but it is an example of how to make a sound effect using the psg library! + psg.silent() + psg.voice(0, psg.LEFT, 63, psg.NOISE, 0) + psg.voice(1, psg.RIGHT, 63, psg.NOISE, 0) + psg.freq(0, 1000) + psg.freq(1, 2000) } }