diff --git a/compiler/res/prog8lib/c64utils.p8 b/compiler/res/prog8lib/c64utils.p8 index e29c2457c..a27d7bbd3 100644 --- a/compiler/res/prog8lib/c64utils.p8 +++ b/compiler/res/prog8lib/c64utils.p8 @@ -913,6 +913,39 @@ asmsub print_ubhex (ubyte prefix @ Pc, ubyte value @ A) -> clobbers(A,X,Y) -> } +asmsub print_ubbin (ubyte prefix @ Pc, ubyte value @ A) -> clobbers(A,X,Y) ->() { + ; ---- print the ubyte in A in binary form (if Carry is set, a radix prefix '%' is printed as well) + %asm {{ + sta c64.SCRATCH_ZPB1 + bcc + + lda #'%' + jsr c64.CHROUT ++ ldy #8 +- lda #'0' + asl c64.SCRATCH_ZPB1 + bcc + + lda #'1' ++ jsr c64.CHROUT + dey + bne - + rts + }} +} + + +asmsub print_uwbin (ubyte prefix @ Pc, uword value @ AY) -> clobbers(A,X,Y) ->() { + ; ---- print the uword in A/Y in binary form (if Carry is set, a radix prefix '%' is printed as well) + %asm {{ + pha + tya + jsr print_ubbin + pla + clc + jmp print_ubbin + }} +} + + asmsub print_uwhex (ubyte prefix @ Pc, uword value @ AY) -> clobbers(A,X,Y) -> () { ; ---- print the uword in A/Y in hexadecimal form (4 digits) ; (if Carry is set, a radix prefix '$' is printed as well) diff --git a/compiler/res/prog8lib/prog8lib.p8 b/compiler/res/prog8lib/prog8lib.p8 index 7739f6631..1489bd1bf 100644 --- a/compiler/res/prog8lib/prog8lib.p8 +++ b/compiler/res/prog8lib/prog8lib.p8 @@ -9,19 +9,6 @@ %asm {{ -; 16-bit rotate right (as opposed to the 6502's usual 17-bit rotate with carry) -; the word is placed in c64.SCRATCH_ZPWORD1 -ror2_word .proc - lsr c64.SCRATCH_ZPWORD1+1 - ror c64.SCRATCH_ZPWORD1 - bcc + - lda c64.SCRATCH_ZPWORD1+1 - ora #$80 - sta c64.SCRATCH_ZPWORD1+1 -+ rts - .pend - - add_a_to_zpword .proc ; -- add ubyte in A to the uword in c64.SCRATCH_ZPWORD1 clc diff --git a/compiler/src/prog8/ast/AST.kt b/compiler/src/prog8/ast/AST.kt index 0082f7bdf..ee5427215 100644 --- a/compiler/src/prog8/ast/AST.kt +++ b/compiler/src/prog8/ast/AST.kt @@ -382,8 +382,10 @@ interface INameScope { return null } - fun allLabelsAndVariables() = statements.asSequence().filter { it is Label || it is VarDecl } - .associate {((it as? Label)?.name ?: (it as? VarDecl)?.name)!! to it } + fun allLabelsAndVariables(): Map { + val labelsAndVars = statements.filterIsInstance